Re: [PATCH] arm: l2c: unlock ways when in non-secure mode

2017-11-26 Thread Russell King - ARM Linux
On Sun, Nov 26, 2017 at 08:25:30PM +0800, Peng Fan wrote:
> To boot Linux in Non-secure mode with l2x0, the l2x0 controller
> is enabled in secure mode and ways locked to make it seems L2 cache
> disabled during linux boot process. So during l2x0 initialization,
> need to unlock the ways to make l2x0 could cache data/inst.

Why was this chosen instead of doing what everyone else does?

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up
According to speedtest.net: 8.21Mbps down 510kbps up


[RFC 2/2] drivers: dma-mapping: parse per device reserved mem at probe time

2017-11-26 Thread Peng Fan
Invoke of_reserved_mem_device_init at dma_configure, then
there is no need to call of_reserved_mem_device_init in device
specific probe function.

Signed-off-by: Peng Fan 
---
 drivers/base/dma-mapping.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/base/dma-mapping.c b/drivers/base/dma-mapping.c
index e584eddef0a7..55dca06a7b55 100644
--- a/drivers/base/dma-mapping.c
+++ b/drivers/base/dma-mapping.c
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -351,7 +352,9 @@ int dma_configure(struct device *dev)
}
 
if (dma_dev->of_node) {
-   ret = of_dma_configure(dev, dma_dev->of_node);
+   ret = of_reserved_mem_device_init(dev);
+   if (ret)
+   ret = of_dma_configure(dev, dma_dev->of_node);
} else if (has_acpi_companion(dma_dev)) {
attr = acpi_get_dma_attr(to_acpi_device_node(dma_dev->fwnode));
if (attr != DEV_DMA_NOT_SUPPORTED)
@@ -367,5 +370,6 @@ int dma_configure(struct device *dev)
 void dma_deconfigure(struct device *dev)
 {
of_dma_deconfigure(dev);
+   of_reserved_mem_device_release(dev);
acpi_dma_deconfigure(dev);
 }
-- 
2.14.1



[RFC 1/2] of: reserved_mem: check return value of_dma_configure

2017-11-26 Thread Peng Fan
In commit <7b07cbefb6>("iommu: of: Handle IOMMU lookup failure
with deferred probing or error"), there is possibility that
of_dma_configure may fail. So in of_reserved_mem_device_init_by_idx,
also need to propagate the return value of_dma_configure to caller,
when need to use reserved memory for a device which needs iommu.

Signed-off-by: Peng Fan 
---
 drivers/of/of_reserved_mem.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c
index 22b75c82e377..61523819b50e 100644
--- a/drivers/of/of_reserved_mem.c
+++ b/drivers/of/of_reserved_mem.c
@@ -357,9 +357,12 @@ int of_reserved_mem_device_init_by_idx(struct device *dev,
/* ensure that dma_ops is set for virtual devices
 * using reserved memory
 */
-   of_dma_configure(dev, np);
-
-   dev_info(dev, "assigned reserved memory node %s\n", rmem->name);
+   ret = of_dma_configure(dev, np);
+   if (ret)
+   of_reserved_mem_device_release(dev);
+   else
+   dev_info(dev, "assigned reserved memory node %s\n",
+rmem->name);
} else {
kfree(rd);
}
-- 
2.14.1



[PATCH] [RFC] um: Convert ubd driver to blk-mq

2017-11-26 Thread Richard Weinberger
This is the first attempt to convert the UserModeLinux block driver
(UBD) to blk-mq.
While the conversion itself is rather trivial, a few questions
popped up in my head. Maybe you can help me with them.

MAX_SG is 64, used for blk_queue_max_segments(). This comes from
a0044bdf60c2 ("uml: batch I/O requests"). Is this still a good/sane
value for blk-mq?

The driver does IO batching, for each request it issues many UML struct
io_thread_req request to the IO thread on the host side.
One io_thread_req per SG page.
Before the conversion the driver used blk_end_request() to indicate that
a part of the request is done.
blk_mq_end_request() does not take a length parameter, therefore we can
only mark the whole request as done. See the new is_last property on the
driver.
Maybe there is a way to partially end requests too in blk-mq?

Another obstacle with IO batching is that UML IO thread requests can
fail. Not only due to OOM, also because the pipe between the UML kernel
process and the host IO thread can return EAGAIN.
In this case the driver puts the request into a list and retried later
again when the pipe turns writable.
I’m not sure whether this restart logic makes sense with blk-mq, maybe
there is a way in blk-mq to put back a (partial) request?

Signed-off-by: Richard Weinberger 
---
 arch/um/drivers/ubd_kern.c | 188 ++---
 1 file changed, 107 insertions(+), 81 deletions(-)

diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index 90034acace2a..abbfe0c97418 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -57,6 +58,7 @@ struct io_thread_req {
unsigned long long cow_offset;
unsigned long bitmap_words[2];
int error;
+   bool is_last;
 };
 
 
@@ -142,7 +144,6 @@ struct cow {
 #define MAX_SG 64
 
 struct ubd {
-   struct list_head restart;
/* name (and fd, below) of the file opened for writing, either the
 * backing or the cow file. */
char *file;
@@ -156,9 +157,12 @@ struct ubd {
struct cow cow;
struct platform_device pdev;
struct request_queue *queue;
+   struct blk_mq_tag_set tag_set;
spinlock_t lock;
+};
+
+struct ubd_pdu {
struct scatterlist sg[MAX_SG];
-   struct request *request;
int start_sg, end_sg;
sector_t rq_pos;
 };
@@ -182,10 +186,6 @@ struct ubd {
.shared =   0, \
.cow =  DEFAULT_COW, \
.lock = __SPIN_LOCK_UNLOCKED(ubd_devs.lock), \
-   .request =  NULL, \
-   .start_sg = 0, \
-   .end_sg =   0, \
-   .rq_pos =   0, \
 }
 
 /* Protected by ubd_lock */
@@ -196,6 +196,12 @@ static int fake_ide = 0;
 static struct proc_dir_entry *proc_ide_root = NULL;
 static struct proc_dir_entry *proc_ide = NULL;
 
+static blk_status_t ubd_queue_rq(struct blk_mq_hw_ctx *hctx,
+const struct blk_mq_queue_data *bd);
+static int ubd_init_request(struct blk_mq_tag_set *set,
+   struct request *req, unsigned int hctx_idx,
+   unsigned int numa_node);
+
 static void make_proc_ide(void)
 {
proc_ide_root = proc_mkdir("ide", NULL);
@@ -448,11 +454,8 @@ __uml_help(udb_setup,
 "in the boot output.\n\n"
 );
 
-static void do_ubd_request(struct request_queue * q);
-
 /* Only changed by ubd_init, which is an initcall. */
 static int thread_fd = -1;
-static LIST_HEAD(restart);
 
 /* Function to read several request pointers at a time
 * handling fractional reads if (and as) needed
@@ -510,9 +513,6 @@ static int bulk_req_safe_read(
 /* Called without dev->lock held, and only in interrupt context. */
 static void ubd_handler(void)
 {
-   struct ubd *ubd;
-   struct list_head *list, *next_ele;
-   unsigned long flags;
int n;
int count;
 
@@ -532,23 +532,22 @@ static void ubd_handler(void)
return;
}
for (count = 0; count < n/sizeof(struct io_thread_req *); 
count++) {
-   blk_end_request(
-   (*irq_req_buffer)[count]->req,
-   BLK_STS_OK,
-   (*irq_req_buffer)[count]->length
-   );
-   kfree((*irq_req_buffer)[count]);
+   struct io_thread_req *io_req = (*irq_req_buffer)[count];
+
+   /*
+* UBD is batching IO, only end the blk mq request
+* if this is the last one.
+*/
+   if (io_req->is_last)
+   blk_mq_end_request(io_req->req,
+  io_req->error ?
+  

[PATCH] video: sh_mobile_lcdcfb: Delete an error message for a failed memory allocation in two functions

2017-11-26 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sun, 26 Nov 2017 13:48:55 +0100

Omit an extra message for a memory allocation failure in these functions.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring 
---
 drivers/video/fbdev/sh_mobile_lcdcfb.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/video/fbdev/sh_mobile_lcdcfb.c 
b/drivers/video/fbdev/sh_mobile_lcdcfb.c
index c3a46506e47e..0f9b37034eaf 100644
--- a/drivers/video/fbdev/sh_mobile_lcdcfb.c
+++ b/drivers/video/fbdev/sh_mobile_lcdcfb.c
@@ -2149,10 +2149,8 @@ sh_mobile_lcdc_channel_fb_register(struct 
sh_mobile_lcdc_chan *ch)
if (info->fbdefio) {
ch->sglist = vmalloc(sizeof(struct scatterlist) *
 ch->fb_size >> PAGE_SHIFT);
-   if (!ch->sglist) {
-   dev_err(ch->lcdc->dev, "cannot allocate sglist\n");
+   if (!ch->sglist)
return -ENOMEM;
-   }
}
 
info->bl_dev = ch->bl;
@@ -2718,10 +2716,8 @@ static int sh_mobile_lcdc_probe(struct platform_device 
*pdev)
}
 
priv = kzalloc(sizeof(*priv), GFP_KERNEL);
-   if (!priv) {
-   dev_err(&pdev->dev, "cannot allocate device data\n");
+   if (!priv)
return -ENOMEM;
-   }
 
priv->dev = &pdev->dev;
priv->meram_dev = pdata->meram_dev;
-- 
2.15.0



Re: [RFC][PATCH] drm: adv7511/33: Fix adv7511_cec_init() failure handling

2017-11-26 Thread Archit Taneja

Hi,

On 11/17/2017 04:29 AM, John Stultz wrote:

From: Arnd Bergmann 

An otherwise correct cleanup patch from Dan Carpenter turned a broken
failure handling from a feature patch by Hans Verkuil into a kernel
Oops, so bisection points to commit 7af35b0addbc ("drm/kirin: Checking
for IS_ERR() instead of NULL") rather than 3b1b975003e4 ("drm:
adv7511/33: add HDMI CEC support").

I've managed to piece together several partial problems, though
I'm still struggling with the bigger picture:

adv7511_probe() registers a drm_bridge structure that was allocated
with devm_kzalloc(). It calls adv7511_cec_init(), which fails for an
unknown reason, which in turn triggers the registered structure to be
removed.

Elsewhere, kirin_drm_platform_probe() gets called, which calls
of_graph_get_remote_node(), and that returns NULL. Before Dan's
patch we would go on with a NULL pointer here and register that,
now kirin_drm_platform_probe() fails with -ENODEV.

In a third driver, dsi_parse_dt() calls drm_of_find_panel_or_bridge(),
which after not finding a panel goes on to call of_drm_find_bridge(),
and that crashes due to the earlier list corruption.

This addresses the first issue by making sure that adv7511_probe()
does not completely fail when the adv7511_cec_init() function fails,
and instead we just disable the CEC feature. This avoids having the
driver entirely fail to load if just the CEC initialization fails.

Reported-by: Naresh Kamboju 
Cc: Xinliang Liu 
Cc: Dan Carpenter 
Cc: Sean Paul 
Cc: Hans Verkuil 
Cc: Archit Taneja 
Link: https://bugs.linaro.org/show_bug.cgi?id=3345
Link: https://lkft.validation.linaro.org/scheduler/job/48017#L3551
Fixes: 7af35b0addbc ("drm/kirin: Checking for IS_ERR() instead of NULL")
Fixes: 3b1b975003e4 ("drm: adv7511/33: add HDMI CEC support")
Signed-off-by: Arnd Bergmann 
[jstultz: Reworked so when adv7511_cec_init() fails, we disable the feature 
instead
of disabling the entire driver, which causes graphics to not funciton]
Signed-off-by: John Stultz 
---
Just wanted to send out my rework of Arnd's patch here.
Feedback would be welcome.

thanks
-john

  drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 8 
  1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c 
b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
index 0e14f15..939c3b9 100644
--- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
+++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
@@ -1203,12 +1203,12 @@ static int adv7511_probe(struct i2c_client *i2c, const 
struct i2c_device_id *id)
  
  #ifdef CONFIG_DRM_I2C_ADV7511_CEC

ret = adv7511_cec_init(dev, adv7511, offset);
-   if (ret)
-   goto err_unregister_cec;
  #else
-   regmap_write(adv7511->regmap, ADV7511_REG_CEC_CTRL + offset,
-ADV7511_CEC_CTRL_POWER_DOWN);
+   ret = 1;
  #endif
+   if (ret)
+   regmap_write(adv7511->regmap, ADV7511_REG_CEC_CTRL + offset,
+ADV7511_CEC_CTRL_POWER_DOWN);


This would force CEC to be powered off even if adv7511_cec_init() returned 0, 
right?
We wouldn't want that if we want to use CEC on a platform that supports it.

Do we know why the call to adv7511_cec_init() is failing on the Hikey board? If 
it's
because there isn't a "cec" clock specified in DT, it's not really a fatal 
error, it
just means that the platform hasn't been set up to support CEC. In that case, we
should just power down the CEC block. So, if adv7511_cec_init() would return a
-ENOENT, which we could use as a hint to power down CEC. So, maybe something 
like this?:

#ifdef CONFIG_DRM_I2C_ADV7511_CEC
ret = adv7511_cec_init(dev, adv7511, offset);
if (ret && ret != -ENOENT)  
goto err_unregister_cec;
#endif
if (ret)
regmap_write(adv7511->regmap, ADV7511_REG_CEC_CTRL + offset,
ADV7511_CEC_CTRL_POWER_DOWN);

Apart from this, we should also move adv7511_cec_init() up in the probe so that
it's called before the drm_bridge is registered.

Thanks,
Archit

  
  	return 0;
  



--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project


Re: [PATCH] lib: memmove: Use optimised memcpy if possible

2017-11-26 Thread PrasannaKumar Muralidharan
Hi Dan,

On 26 November 2017 at 02:10, Dan Carpenter  wrote:
> Paul's original patch should have been separated into two patches to
> begin with.  The patch does two different things and one part goes
> through the MIPS tree and one part goes through Andrew, probably.

Okay. I will split his patch into two and send with my modifications.

> On Sat, Nov 25, 2017 at 10:52:04PM +0530, PrasannaKumar Muralidharan wrote:
>> Hi,
>>
>> On 4 October 2017 at 22:26, PrasannaKumar Muralidharan
>>  wrote:
>> > When there is no overlap between src and dst use optimised memcpy if it
>> > is available.
>> >
>> > Signed-off-by: Paul Burton 
>> > Signed-off-by: PrasannaKumar Muralidharan 
>> > ---
>> > This change is a small part of a patch [1] from Paul Burton. I have
>> > added his Signed-off by. I do not know whether it is correct. Please let
>> > me know if it has to be changed, I will send a v2.
>
>
> Sign-off is like signing a legal document.  Read
> Documentation/process/submitting-patches.rst the section about
> "11) Sign your work - the Developer's Certificate of Origin" for an
> explanation.
>
> So, yeah, Paul provided his s-o-b and it needs to be here as well.  But
> also he maybe should get authorship credit.  Just put the first line in
> the email as:
>
> From: Paul Burton 
>
> But that's sort of a trickier thing, so maybe put some explanation that
> you chopped out a bit from Pauls patch in the changelog:
>
> This is part of a patch that Paul Burton wrote
> https://patchwork.linux-mips.org/patch/14517/
>
> I know you put that here, but since it's under the --- cut off it won't
> be saved in the final git log.

Sure. Will do.

>> >
>> > This patch is boot tested with qemu for MIPS architecture by removing
>> > mips's memmove routine. This patch does not contain MIPS changes. I
>> > will try to find out why [1] was not taken already and figure out what
>> > to do.
>> >
>
> Instead of boot testing, it would be better if we had a benchmark to
> show it helped speed things up.

I will try to come up with some reasonable benchmark and post its results.

>> > 1. https://patchwork.linux-mips.org/patch/14517/
>> >
>> >  lib/string.c | 11 +++
>> >  1 file changed, 11 insertions(+)
>> >
>> > diff --git a/lib/string.c b/lib/string.c
>> > index 9921dc2..462ab7b 100644
>> > --- a/lib/string.c
>> > +++ b/lib/string.c
>> > @@ -825,6 +825,17 @@ void *memmove(void *dest, const void *src, size_t 
>> > count)
>> > char *tmp;
>> > const char *s;
>> >
>> > +#ifdef __HAVE_ARCH_MEMCPY
>> > +   /* Use optimised memcpy when there is no overlap */
>> > +   const char *s_end = src + count;
>> > +   const char *d = dest;
>> > +   char *d_end = dest + count;
>> > +
>> > +   s = src;
>> > +   if ((d_end <= s) || (s_end <= d))
>> > +   return memcpy(dest, src, count);
>> > +#endif /* __HAVE_ARCH_MEMCPY */
>> > +
>> > if (dest <= src) {
>> > tmp = dest;
>> > s = src;
>> > --
>> > 2.10.0
>> >
>>
>> Is there anything more that I have to do for this patch?
>>
>
> Probably a patch like this needs to go through Andrew.  Send it again
> and CC Andrew Morton .  It would be nice if
> we could CC a better list than LKML but I don't know which one...  Few
> people read LKML.

I will add Andrew. Get maintainer script gave me a small list of email
id for this. I don't know if there is a better way than using
get_maintainer.pl.

> regards,
> dan carpenter

Thanks a lot for your time Dan.

Thanks,
PrasannaKumar


[GIT pull] irq updates for 4.15

2017-11-26 Thread Thomas Gleixner
Linus,

please pull the latest irq-urgent-for-linus git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 
irq-urgent-for-linus

The last set of updates for 4.15-rc1:

 - Unbreak the irq trigger type check for legacy platforms

 - A handful fixes for ARM GIC v3/4 interrupt controllers

 - A few trivial fixes all over the place. 

Thanks,

tglx

-->
Arvind Yadav (2):
  irqchip/s3c24xx: pr_err() strings should end with newlines
  irqchip/gic-v3: pr_err() strings should end with newlines

Colin Ian King (1):
  irqchip/qcom: Fix u32 comparison with value less than zero

Johan Hovold (1):
  irqchip/gic-v3: Fix ppi-partitions lookup

Kees Cook (1):
  genirq/matrix: Make - vs ?: Precedence explicit

Marc Zyngier (4):
  genirq: Track whether the trigger type has been set
  irqchip/gic-v4: Clear IRQ_DISABLE_UNLAZY again if mapping fails
  irqchip/gic-v4: Add forward definition of struct irq_domain_ops
  irqchip/gic-v3-its: Remove artificial dependency on PCI

Vasyl Gomonovych (1):
  irqchip/imgpdc: Use resource_size function on resource object

Wei Yongjun (1):
  irqchip/exiu: Fix return value check in exiu_init()


 drivers/irqchip/Kconfig |  7 +++
 drivers/irqchip/Makefile|  3 ++-
 drivers/irqchip/irq-gic-v3.c| 11 +++
 drivers/irqchip/irq-gic-v4.c|  7 ++-
 drivers/irqchip/irq-imgpdc.c|  2 +-
 drivers/irqchip/irq-s3c24xx.c   |  4 ++--
 drivers/irqchip/irq-sni-exiu.c  |  4 ++--
 drivers/irqchip/qcom-irq-combiner.c |  2 +-
 include/linux/irq.h | 11 ++-
 include/linux/irqchip/arm-gic-v4.h  |  1 +
 kernel/irq/manage.c | 13 -
 kernel/irq/matrix.c |  2 +-
 12 files changed, 52 insertions(+), 15 deletions(-)

diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
index 53380bd72ea4..c70476b34a53 100644
--- a/drivers/irqchip/Kconfig
+++ b/drivers/irqchip/Kconfig
@@ -41,8 +41,15 @@ config ARM_GIC_V3
 
 config ARM_GIC_V3_ITS
bool
+   select GENERIC_MSI_IRQ_DOMAIN
+   default ARM_GIC_V3
+
+config ARM_GIC_V3_ITS_PCI
+   bool
+   depends on ARM_GIC_V3_ITS
depends on PCI
depends on PCI_MSI
+   default ARM_GIC_V3_ITS
 
 config ARM_NVIC
bool
diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile
index dae7282bfdef..d2df34a54d38 100644
--- a/drivers/irqchip/Makefile
+++ b/drivers/irqchip/Makefile
@@ -30,7 +30,8 @@ obj-$(CONFIG_ARM_GIC_PM)  += irq-gic-pm.o
 obj-$(CONFIG_ARCH_REALVIEW)+= irq-gic-realview.o
 obj-$(CONFIG_ARM_GIC_V2M)  += irq-gic-v2m.o
 obj-$(CONFIG_ARM_GIC_V3)   += irq-gic-v3.o irq-gic-common.o
-obj-$(CONFIG_ARM_GIC_V3_ITS)   += irq-gic-v3-its.o 
irq-gic-v3-its-pci-msi.o irq-gic-v3-its-platform-msi.o irq-gic-v4.o
+obj-$(CONFIG_ARM_GIC_V3_ITS)   += irq-gic-v3-its.o 
irq-gic-v3-its-platform-msi.o irq-gic-v4.o
+obj-$(CONFIG_ARM_GIC_V3_ITS_PCI)   += irq-gic-v3-its-pci-msi.o
 obj-$(CONFIG_PARTITION_PERCPU) += irq-partition-percpu.o
 obj-$(CONFIG_HISILICON_IRQ_MBIGEN) += irq-mbigen.o
 obj-$(CONFIG_ARM_NVIC) += irq-nvic.o
diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c
index b54b55597ffb..16fddff38f22 100644
--- a/drivers/irqchip/irq-gic-v3.c
+++ b/drivers/irqchip/irq-gic-v3.c
@@ -1103,18 +1103,18 @@ static void __init gic_populate_ppi_partitions(struct 
device_node *gic_node)
int nr_parts;
struct partition_affinity *parts;
 
-   parts_node = of_find_node_by_name(gic_node, "ppi-partitions");
+   parts_node = of_get_child_by_name(gic_node, "ppi-partitions");
if (!parts_node)
return;
 
nr_parts = of_get_child_count(parts_node);
 
if (!nr_parts)
-   return;
+   goto out_put_node;
 
parts = kzalloc(sizeof(*parts) * nr_parts, GFP_KERNEL);
if (WARN_ON(!parts))
-   return;
+   goto out_put_node;
 
for_each_child_of_node(parts_node, child_part) {
struct partition_affinity *part;
@@ -1181,6 +1181,9 @@ static void __init gic_populate_ppi_partitions(struct 
device_node *gic_node)
 
gic_data.ppi_descs[i] = desc;
}
+
+out_put_node:
+   of_node_put(parts_node);
 }
 
 static void __init gic_of_setup_kvm_info(struct device_node *node)
@@ -1521,7 +1524,7 @@ gic_acpi_init(struct acpi_subtable_header *header, const 
unsigned long end)
 
err = gic_validate_dist_version(acpi_data.dist_base);
if (err) {
-   pr_err("No distributor detected at @%p, giving up",
+   pr_err("No distributor detected at @%p, giving up\n",
   acpi_data.dist_base);
goto out_dist_unmap;
}
diff --git a/drivers/irqchip/irq-gic-v4.c b/drivers/irqchip/irq-gic-v4.c
index cd0bcc3b7e33..dba9d67cb9c1 100644

[GIT PULL] x86 fixes

2017-11-26 Thread Ingo Molnar
Linus,

Please pull the latest x86-urgent-for-linus git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 
x86-urgent-for-linus

   # HEAD: 12a78d43de767eaf8fb272facb7a7b6f2dc6a9df x86/decoder: Add new TEST 
instruction pattern

Misc fixes:

 - topology enumeration fixes
 - KASAN fix
 - two entry fixes (not yet the big series related to KASLR)
 - remove obsolete code
 - instruction decoder fix
 - better /dev/mem sanity checks, hopefully working better this time
 - pkeys fixes
 - two ACPI fixes
 - 5-level paging related fixes
 - UMIP fixes that should make application visible faults more debuggable
 - boot fix for weird virtualization environment

  out-of-topic modifications in x86-urgent-for-linus:
  -
  drivers/pci/Kconfig# fd2fa6c18b72: x86/PCI: Remove unused 
Hyper
  drivers/pci/Makefile   # fd2fa6c18b72: x86/PCI: Remove unused 
Hyper
  drivers/pci/htirq.c# fd2fa6c18b72: x86/PCI: Remove unused 
Hyper
  include/linux/htirq.h  # fd2fa6c18b72: x86/PCI: Remove unused 
Hyper
  include/linux/pci.h# fd2fa6c18b72: x86/PCI: Remove unused 
Hyper
  tools/testing/selftests/x86/5lvl.c # 97f404ad3e53: x86/selftests: Add test 
for 
  tools/testing/selftests/x86/Makefile# 97f404ad3e53: x86/selftests: Add test 
for 
  tools/testing/selftests/x86/mpx-hw.h# a6400120d042: x86/mpx/selftests: Fix up 
we
  tools/testing/selftests/x86/pkey-helpers.h# 7b659ee3e1fe: 
x86/pkeys/selftests: Fix pro
  tools/testing/selftests/x86/protection_keys.c# 91c49c2deb96: 
x86/pkeys/selftests: Rename 

 Thanks,

Ingo

-->
Andi Kleen (2):
  perf/x86/intel/uncore: Cache logical pkg id in uncore driver
  x86/topology: Avoid wasting 128k for package id array

Andrey Ryabinin (1):
  x86/mm/kasan: Don't use vmemmap_populate() to initialize shadow

Andy Lutomirski (2):
  x86/entry/64: Fix entry_SYSCALL_64_after_hwframe() IRQ tracing
  x86/entry/64: Add missing irqflags tracing to native_load_gs_index()

Bjorn Helgaas (1):
  x86/PCI: Remove unused HyperTransport interrupt support

Borislav Petkov (1):
  x86/umip: Fix insn_get_code_seg_params()'s return value

Chao Fan (1):
  x86/boot/KASLR: Remove unused variable

Craig Bergstrom (1):
  x86/mm: Limit mmap() of /dev/mem to valid physical addresses

Dave Hansen (4):
  x86/pkeys: Update documentation about availability
  x86/mpx/selftests: Fix up weird arrays
  x86/pkeys/selftests: Rename 'si_pkey' to 'siginfo_pkey'
  x86/pkeys/selftests: Fix protection keys write() warning

Kirill A. Shutemov (2):
  x86/mm: Prevent non-MAP_FIXED mapping across DEFAULT_MAP_WINDOW border
  x86/selftests: Add test for mapping placement for 5-level paging

Masami Hiramatsu (1):
  x86/decoder: Add new TEST instruction pattern

Prarit Bhargava (1):
  x86/smpboot: Fix __max_logical_packages estimate

Ricardo Neri (4):
  x86/umip: Select X86_INTEL_UMIP by default
  x86/umip: Print a line in the boot log that UMIP has been enabled
  x86/umip: Identify the STR and SLDT instructions
  x86/umip: Print a warning into the syslog if UMIP-protected instructions 
are used

Tom Lendacky (1):
  x86/boot: Fix boot failure when SMP MP-table is based at 0

Vikas C Sajjan (2):
  x86/acpi: Handle SCI interrupts above legacy space gracefully
  x86/acpi: Reduce code duplication in mp_override_legacy_irq()


 Documentation/x86/protection-keys.txt |   9 +-
 arch/x86/Kconfig  |  14 +-
 arch/x86/boot/compressed/kaslr.c  |   5 +-
 arch/x86/entry/entry_64.S |  14 +-
 arch/x86/events/intel/uncore.c|   4 +-
 arch/x86/events/intel/uncore.h|   2 +-
 arch/x86/events/intel/uncore_snbep.c  |   2 +-
 arch/x86/include/asm/elf.h|   1 +
 arch/x86/include/asm/hw_irq.h |   8 --
 arch/x86/include/asm/hypertransport.h |  46 --
 arch/x86/include/asm/insn-eval.h  |   2 +-
 arch/x86/include/asm/io.h |   4 +
 arch/x86/include/asm/irqdomain.h  |   6 -
 arch/x86/include/asm/processor.h  |   1 +
 arch/x86/kernel/acpi/boot.c   |  61 +---
 arch/x86/kernel/apic/Makefile |   1 -
 arch/x86/kernel/apic/htirq.c  | 198 --
 arch/x86/kernel/apic/vector.c |   5 +-
 arch/x86/kernel/cpu/common.c  |   2 +
 arch/x86/kernel/mpparse.c |   6 +-
 arch/x86/kernel/smpboot.c | 128 +
 arch/x86/kernel/sys_x86_64.c  |  10 +-
 arch/x86/kernel/umip.c|  88 ++--
 arch/x86/lib/insn-eval.c  |   4 +-
 arch/x86/lib/x86-opcode-map.txt   |   2 +-
 arch/x86/mm/hugetlbpage.c |  1

Re: [PATCH v4] drm: bridge: synopsys/dw-hdmi: Enable cec clock

2017-11-26 Thread Archit Taneja



On 11/26/2017 01:48 AM, Pierre-Hugues Husson wrote:

Support the "cec" optional clock. The documentation already mentions "cec"
optional clock and it is used by several boards, but currently the driver
doesn't enable it, thus preventing cec from working on those boards.

And even worse: a /dev/cecX device will appear for those boards, but it
won't be functioning without configuring this clock.


Thanks for the updating the commit message. I will queue this to drm-misc-fixes 
once
it's updated with the 4.15-rc1 tag.

Thanks,
Archit



Changes:
v4:
- Change commit message to stress the importance of this patch

v3:
- Drop useless braces

v2:
- Separate ENOENT errors from others
- Propagate other errors (especially -EPROBE_DEFER)

Signed-off-by: Pierre-Hugues Husson 
---
  drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 25 +
  1 file changed, 25 insertions(+)

diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c 
b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
index bf14214fa464..d82b9747a979 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
@@ -138,6 +138,7 @@ struct dw_hdmi {
struct device *dev;
struct clk *isfr_clk;
struct clk *iahb_clk;
+   struct clk *cec_clk;
struct dw_hdmi_i2c *i2c;
  
  	struct hdmi_data_info hdmi_data;

@@ -2382,6 +2383,26 @@ __dw_hdmi_probe(struct platform_device *pdev,
goto err_isfr;
}
  
+	hdmi->cec_clk = devm_clk_get(hdmi->dev, "cec");

+   if (PTR_ERR(hdmi->cec_clk) == -ENOENT) {
+   hdmi->cec_clk = NULL;
+   } else if (IS_ERR(hdmi->cec_clk)) {
+   ret = PTR_ERR(hdmi->cec_clk);
+   if (ret != -EPROBE_DEFER)
+   dev_err(hdmi->dev, "Cannot get HDMI cec clock: %d\n",
+   ret);
+
+   hdmi->cec_clk = NULL;
+   goto err_iahb;
+   } else {
+   ret = clk_prepare_enable(hdmi->cec_clk);
+   if (ret) {
+   dev_err(hdmi->dev, "Cannot enable HDMI cec clock: %d\n",
+   ret);
+   goto err_iahb;
+   }
+   }
+
/* Product and revision IDs */
hdmi->version = (hdmi_readb(hdmi, HDMI_DESIGN_ID) << 8)
  | (hdmi_readb(hdmi, HDMI_REVISION_ID) << 0);
@@ -2518,6 +2539,8 @@ __dw_hdmi_probe(struct platform_device *pdev,
cec_notifier_put(hdmi->cec_notifier);
  
  	clk_disable_unprepare(hdmi->iahb_clk);

+   if (hdmi->cec_clk)
+   clk_disable_unprepare(hdmi->cec_clk);
  err_isfr:
clk_disable_unprepare(hdmi->isfr_clk);
  err_res:
@@ -2541,6 +2564,8 @@ static void __dw_hdmi_remove(struct dw_hdmi *hdmi)
  
  	clk_disable_unprepare(hdmi->iahb_clk);

clk_disable_unprepare(hdmi->isfr_clk);
+   if (hdmi->cec_clk)
+   clk_disable_unprepare(hdmi->cec_clk);
  
  	if (hdmi->i2c)

i2c_del_adapter(&hdmi->i2c->adap);



--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project


[GIT PULL] scheduler fixes

2017-11-26 Thread Ingo Molnar
Linus,

Please pull the latest sched-urgent-for-linus git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 
sched-urgent-for-linus

   # HEAD: 3f5fe9fef5b2da06b6319fab8123056da5217c3f sched/debug: Fix task state 
recording/printout

Misc fixes: a documentation fix, a Sparse warning fix and a debugging fix.

 Thanks,

Ingo

-->
Claudio Scordino (1):
  sched/deadline: Fix the description of runtime accounting in the 
documentation

Dan Carpenter (1):
  sched/deadline: Don't use dubious signed bitfields

Thomas Gleixner (1):
  sched/debug: Fix task state recording/printout


 Documentation/scheduler/sched-deadline.txt | 13 ++---
 include/linux/sched.h  |  8 
 include/trace/events/sched.h   |  6 +++---
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/Documentation/scheduler/sched-deadline.txt 
b/Documentation/scheduler/sched-deadline.txt
index e89e36ec15a5..8ce78f82ae23 100644
--- a/Documentation/scheduler/sched-deadline.txt
+++ b/Documentation/scheduler/sched-deadline.txt
@@ -204,10 +204,17 @@ CONTENTS
  It does so by decrementing the runtime of the executing task Ti at a pace 
equal
  to
 
-   dq = -max{ Ui, (1 - Uinact) } dt
+   dq = -max{ Ui / Umax, (1 - Uinact - Uextra) } dt
 
- where Uinact is the inactive utilization, computed as (this_bq - running_bw),
- and Ui is the bandwidth of task Ti.
+ where:
+
+  - Ui is the bandwidth of task Ti;
+  - Umax is the maximum reclaimable utilization (subjected to RT throttling
+limits);
+  - Uinact is the (per runqueue) inactive utilization, computed as
+(this_bq - running_bw);
+  - Uextra is the (per runqueue) extra reclaimable utilization
+(subjected to RT throttling limits).
 
 
  Let's now see a trivial example of two deadline tasks with runtime equal
diff --git a/include/linux/sched.h b/include/linux/sched.h
index a5dc7c98b0a2..21991d668d35 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -473,10 +473,10 @@ struct sched_dl_entity {
 * conditions between the inactive timer handler and the wakeup
 * code.
 */
-   int dl_throttled  : 1;
-   int dl_boosted: 1;
-   int dl_yielded: 1;
-   int dl_non_contending : 1;
+   unsigned intdl_throttled  : 1;
+   unsigned intdl_boosted: 1;
+   unsigned intdl_yielded: 1;
+   unsigned intdl_non_contending : 1;
 
/*
 * Bandwidth enforcement timer. Each -deadline task has its
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index 306b31de5194..bc01e06bc716 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -116,9 +116,9 @@ static inline long __trace_sched_switch_state(bool preempt, 
struct task_struct *
 * RUNNING (we will not have dequeued if state != RUNNING).
 */
if (preempt)
-   return TASK_STATE_MAX;
+   return TASK_REPORT_MAX;
 
-   return task_state_index(p);
+   return 1 << task_state_index(p);
 }
 #endif /* CREATE_TRACE_POINTS */
 
@@ -164,7 +164,7 @@ TRACE_EVENT(sched_switch,
{ 0x40, "P" }, { 0x80, "I" }) :
  "R",
 
-   __entry->prev_state & TASK_STATE_MAX ? "+" : "",
+   __entry->prev_state & TASK_REPORT_MAX ? "+" : "",
__entry->next_comm, __entry->next_pid, __entry->next_prio)
 );
 


[GIT PULL] perf fixes

2017-11-26 Thread Ingo Molnar
Linus,

Please pull the latest perf-urgent-for-linus git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 
perf-urgent-for-linus

   # HEAD: 4a31b424ac0656d1bb17520ee861144fe7a19664 perf/core: Fix memory leak 
triggered by perf --namespace

Misc fixes: two PMU driver fixes and a memory leak fix.

 Thanks,

Ingo

-->
Andi Kleen (1):
  perf/x86/intel: Hide TSX events when RTM is not supported

Kan Liang (1):
  perf/x86/intel/uncore: Add event constraint for BDX PCU

Vasily Averin (1):
  perf/core: Fix memory leak triggered by perf --namespace


 arch/x86/events/intel/core.c | 35 +++
 arch/x86/events/intel/uncore_snbep.c |  8 
 kernel/events/core.c |  1 +
 3 files changed, 32 insertions(+), 12 deletions(-)

diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
index 9fb9a1f1e47b..f94855000d4e 100644
--- a/arch/x86/events/intel/core.c
+++ b/arch/x86/events/intel/core.c
@@ -3730,6 +3730,19 @@ EVENT_ATTR_STR(cycles-t, cycles_t,   
"event=0x3c,in_tx=1");
 EVENT_ATTR_STR(cycles-ct,  cycles_ct,  
"event=0x3c,in_tx=1,in_tx_cp=1");
 
 static struct attribute *hsw_events_attrs[] = {
+   EVENT_PTR(mem_ld_hsw),
+   EVENT_PTR(mem_st_hsw),
+   EVENT_PTR(td_slots_issued),
+   EVENT_PTR(td_slots_retired),
+   EVENT_PTR(td_fetch_bubbles),
+   EVENT_PTR(td_total_slots),
+   EVENT_PTR(td_total_slots_scale),
+   EVENT_PTR(td_recovery_bubbles),
+   EVENT_PTR(td_recovery_bubbles_scale),
+   NULL
+};
+
+static struct attribute *hsw_tsx_events_attrs[] = {
EVENT_PTR(tx_start),
EVENT_PTR(tx_commit),
EVENT_PTR(tx_abort),
@@ -3742,18 +3755,16 @@ static struct attribute *hsw_events_attrs[] = {
EVENT_PTR(el_conflict),
EVENT_PTR(cycles_t),
EVENT_PTR(cycles_ct),
-   EVENT_PTR(mem_ld_hsw),
-   EVENT_PTR(mem_st_hsw),
-   EVENT_PTR(td_slots_issued),
-   EVENT_PTR(td_slots_retired),
-   EVENT_PTR(td_fetch_bubbles),
-   EVENT_PTR(td_total_slots),
-   EVENT_PTR(td_total_slots_scale),
-   EVENT_PTR(td_recovery_bubbles),
-   EVENT_PTR(td_recovery_bubbles_scale),
NULL
 };
 
+static __init struct attribute **get_hsw_events_attrs(void)
+{
+   return boot_cpu_has(X86_FEATURE_RTM) ?
+   merge_attr(hsw_events_attrs, hsw_tsx_events_attrs) :
+   hsw_events_attrs;
+}
+
 static ssize_t freeze_on_smi_show(struct device *cdev,
  struct device_attribute *attr,
  char *buf)
@@ -4182,7 +4193,7 @@ __init int intel_pmu_init(void)
 
x86_pmu.hw_config = hsw_hw_config;
x86_pmu.get_event_constraints = hsw_get_event_constraints;
-   x86_pmu.cpu_events = hsw_events_attrs;
+   x86_pmu.cpu_events = get_hsw_events_attrs();
x86_pmu.lbr_double_abort = true;
extra_attr = boot_cpu_has(X86_FEATURE_RTM) ?
hsw_format_attr : nhm_format_attr;
@@ -4221,7 +4232,7 @@ __init int intel_pmu_init(void)
 
x86_pmu.hw_config = hsw_hw_config;
x86_pmu.get_event_constraints = hsw_get_event_constraints;
-   x86_pmu.cpu_events = hsw_events_attrs;
+   x86_pmu.cpu_events = get_hsw_events_attrs();
x86_pmu.limit_period = bdw_limit_period;
extra_attr = boot_cpu_has(X86_FEATURE_RTM) ?
hsw_format_attr : nhm_format_attr;
@@ -4279,7 +4290,7 @@ __init int intel_pmu_init(void)
extra_attr = boot_cpu_has(X86_FEATURE_RTM) ?
hsw_format_attr : nhm_format_attr;
extra_attr = merge_attr(extra_attr, skl_format_attr);
-   x86_pmu.cpu_events = hsw_events_attrs;
+   x86_pmu.cpu_events = get_hsw_events_attrs();
intel_pmu_pebs_data_source_skl(
boot_cpu_data.x86_model == INTEL_FAM6_SKYLAKE_X);
pr_cont("Skylake events, ");
diff --git a/arch/x86/events/intel/uncore_snbep.c 
b/arch/x86/events/intel/uncore_snbep.c
index 95cb19f4e06f..f4e4168455a8 100644
--- a/arch/x86/events/intel/uncore_snbep.c
+++ b/arch/x86/events/intel/uncore_snbep.c
@@ -3035,11 +3035,19 @@ static struct intel_uncore_type *bdx_msr_uncores[] = {
NULL,
 };
 
+/* Bit 7 'Use Occupancy' is not available for counter 0 on BDX */
+static struct event_constraint bdx_uncore_pcu_constraints[] = {
+   EVENT_CONSTRAINT(0x80, 0xe, 0x80),
+   EVENT_CONSTRAINT_END
+};
+
 void bdx_uncore_cpu_init(void)
 {
if (bdx_uncore_cbox.num_boxes > boot_cpu_data.x86_max_cores)
bdx_uncore_cbox.num_boxes = boot_cpu_data.x86_max_cores;
uncore_msr_uncores = bdx_msr_uncores;
+
+   hswep_uncore_pcu.constraints = bdx_uncore_pcu_constraints;
 }
 
 static struct intel_uncore_type bdx_uncore_ha = {
diff --git a/kernel

[GIT PULL] static keys fix

2017-11-26 Thread Ingo Molnar
Linus,

Please pull the latest locking-urgent-for-linus git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 
locking-urgent-for-linus

   # HEAD: 92ee46efeb505ead3ab06d3c5ce695637ed5f152 jump_label: Invoke 
jump_label_test() via early_initcall()

Fix a boot warning related to bad init ordering of the static keys self-test.

 Thanks,

Ingo

-->
Jason Baron (1):
  jump_label: Invoke jump_label_test() via early_initcall()


 kernel/jump_label.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/jump_label.c b/kernel/jump_label.c
index 8ff4ca4665ff..8594d24e4adc 100644
--- a/kernel/jump_label.c
+++ b/kernel/jump_label.c
@@ -769,7 +769,7 @@ static __init int jump_label_test(void)
 
return 0;
 }
-late_initcall(jump_label_test);
+early_initcall(jump_label_test);
 #endif /* STATIC_KEYS_SELFTEST */
 
 #endif /* HAVE_JUMP_LABEL */


[GIT PULL] objtool fixes

2017-11-26 Thread Ingo Molnar
Linus,

Please pull the latest core-urgent-for-linus git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 
core-urgent-for-linus

   # HEAD: a356d2ae50790f49858ebed35da9e206336fafee tools/headers: Sync objtool 
UAPI header

A handful of objtool fixes, most of them related to making the UAPI 
header-syncing 
warnings easier to read and easier to act upon.

 Thanks,

Ingo

-->
Ingo Molnar (1):
  tools/headers: Sync objtool UAPI header

Josh Poimboeuf (5):
  objtool: Add a comment for the unreachable annotation macros
  objtool: Make unreachable annotation inline asms explicitly volatile
  objtool: Move synced files to their original relative locations
  objtool: Move kernel headers/code sync check to a script
  objtool: Fix cross-build


 include/linux/compiler.h   | 21 ++--
 tools/objtool/.gitignore   |  2 +-
 tools/objtool/Makefile | 22 
 tools/objtool/arch/x86/Build   | 10 
 tools/objtool/arch/x86/decode.c|  6 ++---
 .../objtool/arch/x86/{insn => include/asm}/inat.h  | 12 -
 .../arch/x86/{insn => include/asm}/inat_types.h|  0
 .../objtool/arch/x86/{insn => include/asm}/insn.h  |  2 +-
 .../objtool/{ => arch/x86/include/asm}/orc_types.h |  0
 tools/objtool/arch/x86/{insn => lib}/inat.c|  2 +-
 tools/objtool/arch/x86/{insn => lib}/insn.c|  4 +--
 .../arch/x86/{insn => lib}/x86-opcode-map.txt  |  0
 .../arch/x86/{insn => tools}/gen-insn-attr-x86.awk |  0
 tools/objtool/orc.h|  2 +-
 tools/objtool/sync-check.sh| 29 ++
 15 files changed, 72 insertions(+), 40 deletions(-)
 rename tools/objtool/arch/x86/{insn => include/asm}/inat.h (95%)
 rename tools/objtool/arch/x86/{insn => include/asm}/inat_types.h (100%)
 rename tools/objtool/arch/x86/{insn => include/asm}/insn.h (99%)
 rename tools/objtool/{ => arch/x86/include/asm}/orc_types.h (100%)
 rename tools/objtool/arch/x86/{insn => lib}/inat.c (99%)
 rename tools/objtool/arch/x86/{insn => lib}/insn.c (99%)
 rename tools/objtool/arch/x86/{insn => lib}/x86-opcode-map.txt (100%)
 rename tools/objtool/arch/x86/{insn => tools}/gen-insn-attr-x86.awk (100%)
 create mode 100755 tools/objtool/sync-check.sh

diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 3672353a0acd..188ed9f65517 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -88,17 +88,22 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int 
val,
 
 /* Unreachable code */
 #ifdef CONFIG_STACK_VALIDATION
+/*
+ * These macros help objtool understand GCC code flow for unreachable code.
+ * The __COUNTER__ based labels are a hack to make each instance of the macros
+ * unique, to convince GCC not to merge duplicate inline asm statements.
+ */
 #define annotate_reachable() ({
\
-   asm("%c0:\n\t"  \
-   ".pushsection .discard.reachable\n\t"   \
-   ".long %c0b - .\n\t"\
-   ".popsection\n\t" : : "i" (__COUNTER__));   \
+   asm volatile("%c0:\n\t" \
+".pushsection .discard.reachable\n\t"  \
+".long %c0b - .\n\t"   \
+".popsection\n\t" : : "i" (__COUNTER__));  \
 })
 #define annotate_unreachable() ({  \
-   asm("%c0:\n\t"  \
-   ".pushsection .discard.unreachable\n\t" \
-   ".long %c0b - .\n\t"\
-   ".popsection\n\t" : : "i" (__COUNTER__));   \
+   asm volatile("%c0:\n\t" \
+".pushsection .discard.unreachable\n\t"\
+".long %c0b - .\n\t"   \
+".popsection\n\t" : : "i" (__COUNTER__));  \
 })
 #define ASM_UNREACHABLE
\
"999:\n\t"  \
diff --git a/tools/objtool/.gitignore b/tools/objtool/.gitignore
index d3102c865a95..914cff12899b 100644
--- a/tools/objtool/.gitignore
+++ b/tools/objtool/.gitignore
@@ -1,3 +1,3 @@
-arch/x86/insn/inat-tables.c
+arch/x86/lib/inat-tables.c
 objtool
 fixdep
diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile
index 424b1965d06f..0f94af3ccaaa 100644
--- a/tools/objtool/Makefile
+++ b/tools/objtool/Makefile
@@ -25,7 +25,9 @@ OBJTOOL_IN := $(OBJTOOL)-in.o
 
 all: $(OBJTOOL)
 
-INCLUDES := -I$(srctree)/tools/include 
-I$(src

[PATCH] arm: l2c: unlock ways when in non-secure mode

2017-11-26 Thread Peng Fan
To boot Linux in Non-secure mode with l2x0, the l2x0 controller
is enabled in secure mode and ways locked to make it seems L2 cache
disabled during linux boot process. So during l2x0 initialization,
need to unlock the ways to make l2x0 could cache data/inst.

Signed-off-by: Peng Fan 
Cc: Russell King 
Cc: Mark Rutland 
Cc: Thomas Gleixner 
Cc: Chris Brandt 
Cc: Will Deacon 
---
 arch/arm/mm/cache-l2x0.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
index 808efbb89b88..de8eed0871ec 100644
--- a/arch/arm/mm/cache-l2x0.c
+++ b/arch/arm/mm/cache-l2x0.c
@@ -879,6 +879,10 @@ static int __init __l2c_init(const struct l2c_init_data 
*data,
l2x0_saved_regs.aux_ctrl = aux;
 
data->enable(l2x0_base, data->num_lock);
+   } else {
+   pr_info("%s: unlock cache controller\n", data->type);
+
+   data->unlock(l2x0_base, data->num_lock);
}
 
outer_cache = fns;
-- 
2.14.1



[PATCH] video: sh_mobile_meram: Delete an error message for a failed memory allocation in sh_mobile_meram_probe()

2017-11-26 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sun, 26 Nov 2017 13:08:43 +0100

Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring 
---
 drivers/video/fbdev/sh_mobile_meram.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/video/fbdev/sh_mobile_meram.c 
b/drivers/video/fbdev/sh_mobile_meram.c
index baadfb207b2e..b5a6735aeb87 100644
--- a/drivers/video/fbdev/sh_mobile_meram.c
+++ b/drivers/video/fbdev/sh_mobile_meram.c
@@ -644,10 +644,8 @@ static int sh_mobile_meram_probe(struct platform_device 
*pdev)
}
 
priv = kzalloc(sizeof(*priv), GFP_KERNEL);
-   if (!priv) {
-   dev_err(&pdev->dev, "cannot allocate device data\n");
+   if (!priv)
return -ENOMEM;
-   }
 
/* Initialize private data. */
mutex_init(&priv->lock);
-- 
2.15.0



Re: [PATCH v6 14/17] ASoC: madera: Add common support for Cirrus Logic Madera codecs

2017-11-26 Thread kbuild test robot
Hi Richard,

I love your patch! Yet something to improve:

[auto build test ERROR on linus/master]
[cannot apply to ljones-mfd/for-mfd-next asoc/for-next v4.14]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Richard-Fitzgerald/Add-support-for-Cirrus-Logic-CS47L35-L85-L90-L91-codecs/20171126-145824
config: arm64-allmodconfig (attached as .config)
compiler: aarch64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=arm64 

All errors (new ones prefixed by >>):

   drivers/mfd/madera-i2c.o: In function `madera_i2c_probe':
>> madera-i2c.c:(.text+0x208): undefined reference to `__devm_regmap_init_i2c'
   madera-i2c.c:(.text+0x24c): undefined reference to `__devm_regmap_init_i2c'
   drivers/mfd/madera-i2c.o: In function `madera_i2c_driver_init':
>> madera-i2c.c:(.init.text+0x20): undefined reference to `i2c_register_driver'
   drivers/mfd/madera-i2c.o: In function `madera_i2c_driver_exit':
>> madera-i2c.c:(.exit.text+0x14): undefined reference to `i2c_del_driver'

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


Re: [PATCH 22/43] x86/mm/kaiser: Prepare assembly for entry/exit CR3 switching

2017-11-26 Thread Borislav Petkov
On Fri, Nov 24, 2017 at 06:23:50PM +0100, Ingo Molnar wrote:
> diff --git a/arch/x86/entry/calling.h b/arch/x86/entry/calling.h
> index 3fd8bc560fae..e1650da01323 100644
> --- a/arch/x86/entry/calling.h
> +++ b/arch/x86/entry/calling.h
> @@ -1,6 +1,7 @@
>  /* SPDX-License-Identifier: GPL-2.0 */
>  #include 
>  #include 
> +#include 
>  
>  /*
>  
> @@ -187,6 +188,70 @@ For 32-bit we have the following conventions - kernel is 
> built with
>  #endif
>  .endm
>  
> +#ifdef CONFIG_KAISER
> +
> +/* KAISER PGDs are 8k.  Flip bit 12 to switch between the two halves: */
> +#define KAISER_SWITCH_MASK (1< +.macro SAVE_AND_SWITCH_TO_KERNEL_CR3 scratch_reg:req save_reg:req
> + movq%cr3, %r\scratch_reg
> + movq%r\scratch_reg, \save_reg

What happened to making it uniform so that that macro can be invoked
like this:

SAVE_AND_SWITCH_TO_KERNEL_CR3 scratch_reg=%rax ...

instead of "splitting" the arg?

IOW, hunk below builds here, and asm looks correct:

14bf:   31 db   xor%ebx,%ebx
14c1:   0f 20 d8mov%cr3,%rax
14c4:   49 89 c6mov%rax,%r14
14c7:   48 a9 00 10 00 00   test   $0x1000,%rax
14cd:   74 09   je 14d8 
14cf:   48 25 ff ef ff ff   and$0xefff,%rax
14d5:   0f 22 d8mov%rax,%cr3

---
diff --git a/arch/x86/entry/calling.h b/arch/x86/entry/calling.h
index e1650da01323..d528f7060774 100644
--- a/arch/x86/entry/calling.h
+++ b/arch/x86/entry/calling.h
@@ -188,10 +188,12 @@ For 32-bit we have the following conventions - kernel is 
built with
 #endif
 .endm
 
+#define CONFIG_KAISER
+
 #ifdef CONFIG_KAISER
 
 /* KAISER PGDs are 8k.  Flip bit 12 to switch between the two halves: */
-#define KAISER_SWITCH_MASK (1< diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
> index 34e3110b0876..4ac952080869 100644
> --- a/arch/x86/entry/entry_64.S
> +++ b/arch/x86/entry/entry_64.S
> @@ -168,6 +168,9 @@ ENTRY(entry_SYSCALL_64_trampoline)
>   /* Stash the user RSP. */
>   movq%rsp, RSP_SCRATCH
>  
> + /* Note: using %rsp as a scratch reg. */

Haha, yap, it just got freed :)

> + SWITCH_TO_KERNEL_CR3 scratch_reg=%rsp
> +
>   /* Load the top of the task stack into RSP */
>   movqCPU_ENTRY_AREA_tss + TSS_sp1 + CPU_ENTRY_AREA, %rsp
>  
> @@ -198,6 +201,13 @@ ENTRY(entry_SYSCALL_64)
>  
>   swapgs
>   movq%rsp, PER_CPU_VAR(rsp_scratch)

< newline here.

> + /*
> +  * The kernel CR3 is needed to map the process stack, but we
> +  * need a scratch register to be able to load CR3.  %rsp is
> +  * clobberable right now, so use it as a scratch register.
> +  * %rsp will be look crazy here for a couple instructions.

s/be // or "will be looking crazy" :-)

> +  */
> + SWITCH_TO_KERNEL_CR3 scratch_reg=%rsp

Now, this is questionable: we did enter through the trampoline
entry_SYSCALL_64_trampoline so theoretically, we wouldn't need to switch
to CR3 here again because, well, we did already.

I.e., entry_SYSCALL_64 is not going to be called anymore. Unless we will
jump to it when we decide to jump over the trampolines in the kaiser
disabled case. Just pointing it out here so that we don't forget to deal
with this...

> @@ -1239,7 +1254,11 @@ ENTRY(paranoid_entry)
>   js  1f  /* negative -> in kernel */
>   SWAPGS
>   xorl%ebx, %ebx
> -1:   ret
> +
> +1:
> + SAVE_AND_SWITCH_TO_KERNEL_CR3 scratch_reg=ax save_reg=%r14
> +
> + ret
>  END(paranoid_entry)
>  
>  /*
> @@ -1261,6 +1280,7 @@ ENTRY(paranoid_exit)
>   testl   %ebx, %ebx  /* swapgs needed? */
>   jnz .Lparanoid_exit_no_swapgs
>   TRACE_IRQS_IRETQ
> + RESTORE_CR3 %r14

RESTORE_CR3 save_reg=%r14

like the other invocation below.

But if the runtime disable gets changed to a boottime one, you don't
need that macro anymore.

>   SWAPGS_UNSAFE_STACK
>   jmp .Lparanoid_exit_restore
>  .Lparanoid_exit_no_swapgs:

-- 
Regards/Gruss,
Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.


Re: [PATCH v3 2/2] Protected O_CREAT open in sticky directories

2017-11-26 Thread Salvatore Mesoraca
2017-11-24 12:53 GMT+01:00 David Laight :
> From: Salvatore Mesoraca [mailto:s.mesorac...@gmail.com]
>> Sent: 24 November 2017 11:44
>>
>> 2017-11-24 11:53 GMT+01:00 David Laight :
>> > From: Alan Cox
>> >> Sent: 22 November 2017 16:52
>> >>
>> >> On Wed, 22 Nov 2017 09:01:46 +0100
>> >> Salvatore Mesoraca  wrote:
>> >>
>> >> > Disallows O_CREAT open missing the O_EXCL flag, in world or
>> >> > group writable directories, even if the file doesn't exist yet.
>> >> > With few exceptions (e.g. shared lock files based on flock())
>> >>
>> >> Enough exceptions to make it a bad idea.
>> >>
>> >> Firstly if you care this much *stop* having shared writable directories.
>> >> We have namespaces, you don't need them. You can give every user their
>> >> own /tmp etc.
>> >
>> > Looks like a very bad idea to me as well.
>> >
>> > Doesn't this stop all shell redirects into a shared /tmp ?
>> > I'm pretty sure most programs use O_CREAT | O_TRUNC for output
>> > files - they'll all stop working.
>>
>> If some program does such a thing, that's a potential vulnerability.
>> With "protected_hardlinks" you are, in most cases, safe.
>> But, still, that program has a bug and having this feature enabled will
>> help you notice it soon.
>> For that matter, I'm using this patch on my system and I don't have any
>> program behaving like this.
>
> Hmmm a quick strace shows cp and vi doing stat("/tmp/foo") and then
> open(O_WRONLY|O_TRUNC) if it exists and O_CREATE|O_EXCL if it doesn't.
> I can't help feeling that is just hiding a race.

Yes, unfortunately, doing something like "cp somefile /tmp/" is a bad
practice that
in most cases will go unnoticed by this feature. Nevertheless there
are many other
real world vulnerability that it would have been able to detect.
Thank you very much for taking the time to do some experiments.

Salvatore


Re: [PATCH] input: pegasus_notetaker: add license information

2017-11-26 Thread Philippe Ombredanne
Greg, Martin:

On Sun, Nov 26, 2017 at 9:59 AM, Greg Kroah-Hartman
 wrote:
> On Sat, Nov 25, 2017 at 04:42:59PM -0800, Dmitry Torokhov wrote:
>> Hi Martin,
>>
>> On Sat, Nov 18, 2017 at 09:45:18AM +0100, Martin Kepplinger wrote:
>> > This adds an SPDX license identifier to this driver I wrote some time back.
>> >
>> > Signed-off-by: Martin Kepplinger 
>> > ---
>> >  drivers/input/tablet/pegasus_notetaker.c | 1 +
>> >  1 file changed, 1 insertion(+)
>> >
>> > diff --git a/drivers/input/tablet/pegasus_notetaker.c 
>> > b/drivers/input/tablet/pegasus_notetaker.c
>> > index 47de5a81172f..cdf75c989469 100644
>> > --- a/drivers/input/tablet/pegasus_notetaker.c
>> > +++ b/drivers/input/tablet/pegasus_notetaker.c
>> > @@ -1,3 +1,4 @@
>> > +// SPDX-License-Identifier: GPL-2.0
>>
>> Should this be GPL-2.0+? The MODULE_LICENSE specifies that the module is
>> "GPL" which in kernel land means GPLv2+. Or we should change the module
>> license to strict "GPLv2"?
>
> That is up to Martin, given that he is the author, as to what he wants
> to mark this as.  Odd that it missed the big "fix up all files with no
> license information" sweep.
>
> Philippe, how did we miss this one?

It was not missed but instead was set aside by design.
drivers/input/tablet/pegasus_notetaker.c does not have (or rather did
not have until now) any licensing information beside a
MODULE_LICENSE("GPL") and these were left aside as requiring some
extra review and the eventual need of a clarification by the author,
just as Martin is rightfully doing so just now.

>> Doing this would prevent mismatches between license notices, SPDX tags
>> and MODULE_LCENSE() strings, which happen very often.
>
> I agree, but now that we are getting SPDX tags, we can fix up all of the
> mismatches in MODULE_LICENSE() strings, of which there are a lot.

I said that I would take a stab at it... but I did not attack this yet:
Let me get over the ThanksGiving hangover and provide a list this
week. I guess there could be three lists in fact:

- modules with only a MODULE_LICENSE and no other license info: these
could be candidates for adding an SPDX id matching the MODULE_LICENSE

- modules updated to use an SPDX id and with a conflicting
MODULE_LICENSE: the MODULE_LICENSE should be aligned to match the SPDX
id

- modules not yet updated to use an SPDX id and with a license notice
conflicting with the MODULE_LICENSE: the MODULE_LICENSE should be
aligned to match the licensing

I'll run a scancode-toolkit scan on the tip of Linus' tree and create
a CSV from that to surface these oddities.
Unless you prefer me to use another tree like on the USB side for a start.

-- 
Cordially
Philippe Ombredanne, the wild licenses tamer


Re: About GPL license compliance of Tesla Model S, Linux kernel 4.4

2017-11-26 Thread Geunsik Lim
Here is my next activity.

After reading http://gpl-violations.org/helping/,
I have reported this issue to solve a potential GPL misuse about the
Linux kernel open source code
that is used to deploy Tesla Model S (Linux kernel based commercial product).




BRs,
Geunsik Lim.


On Sat, Nov 25, 2017 at 4:48 PM, Geunsik Lim  wrote:
> Hi All,
>
> I want to talk about a potential GPL misuse of the Linux open source
> that is used by Tesla Model S. Some months ago, I have read that a
> version information of Linux kernel that is deployed into the
> commercial self-driving car such as Tesla Model S via (1) the twitter
> web page of Tesla CEO Elon Musk  and (2) the presentation material of
> the Blackhat 2017  presenter Sen Nie as follows.
>
> Oct-05-2016, Twitter, "When we upgrade the core Linux OS to 4.4, which
> is probably December"
> https://twitter.com/elonmusk/status/783759011724210176
>
> Jul-22-2017, Blackhat 2017, "FREE-FALL: HACKING TESLA FROM WIRELESS TO CAN 
> BUS"
> https://www.blackhat.com/us-17/briefings.html#free-fall-hacking-tesla-from-wireless-to-can-bus
>
>
> In case of the embedded device vendors, it seems that the most of the
> global vendors have being uploaded related open source software that
> are used by commercial products via their open source release center
> to keep the GPL compliance as following:
>
> https://opensource.google.com/
> https://opensource.microsoft.com/
> https://opensource.apple.com
> https://opensource.samsung.com
> https://opensource.lge.com
> https://opensource.dell.com/
> http://opensource.alibaba.com/
> https://developer.sonymobile.com/knowledge-base/open-source/
> http://consumer.huawei.com/en/opensource/
> http://xiaomi.github.io/
> https://software.intel.com/en-us/open-source
>
>
> Also, we can download related open sources such as Linux kernel, GCC,
> and so on from their official homepage in case of BMW, GM, Ford, and
> Toyota cars.
>
> BMW - http://www.bmw-carit.de/open-source/
> GM - http://oss.bosch-cm.com/gm.html
> Ford - http://corporate.ford.com/ford-open-source.html
> Toyota - http://www.globaldenso.com/en/opensource/ivi/toyota/
>
>
> BTW, in case of Tesla, where can we find an official open source
> release center to download their Linux kernel source that is deployed
> into a commercial self-driving car? I could not find an official web
> page of Tesla to download Linux Kernel 4.4 (GPLv2) and other open
> sources that are used by Tesla company. And, I can not find the
> related Linux kernel source code from https://github.com/teslamotors.
> Unfortunately, even though I asked a person in charging on this issue,
> they do not reply me any e-mail for 2 weeks. Anyone that already tried
> to get their Linux kernel source of Tesla Model S?
>
> As we all know, Linus Torvalds has released his Linux Kernel under
> GPLv2 license via https://www.kernel.org/.
> For more details, please visit the below web-pages.
>
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/COPYING?h=v4.4
> http://www.gnu.org/licenses/gpl-faq.en.html#GPLRequireSourcePostedPublic
>
> I wonder if they correctly keep the GPL compliance because I am not a lawyer.
>
>
> Thanks for reading.
>
>
>
> BRs,
> Geunsik Lim.
>
>
>
> 
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 



-- 

Best regards,
Geunsik Lim, Samsung Electronics
http://leemgs.fedorapeople.org

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Sparse warnings from sched.h

2017-11-26 Thread luca abeni
On Sat, 25 Nov 2017 21:46:11 -0800
Jakub Kicinski  wrote:

> Hi!
> 
> Did these:
> 
> ./include/linux/sched.h:476:62: error: dubious one-bit signed bitfield
> ./include/linux/sched.h:477:62: error: dubious one-bit signed bitfield
> ./include/linux/sched.h:478:62: error: dubious one-bit signed bitfield
> ./include/linux/sched.h:479:62: error: dubious one-bit signed bitfield
> 
> got fixed?  I saw there were patches posted, but nothing have reached
> Linus's tree, yet.

I think a fix is in the tip tree:
https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?id=aa5222e92f8000ed3c1c38dddf11c83222aadfb3



Luca


Re: Sparse warnings from sched.h

2017-11-26 Thread Matthew Wilcox
On Sat, Nov 25, 2017 at 09:46:11PM -0800, Jakub Kicinski wrote:
> Hi!
> 
> Did these:
> 
> ./include/linux/sched.h:476:62: error: dubious one-bit signed bitfield
> ./include/linux/sched.h:477:62: error: dubious one-bit signed bitfield
> ./include/linux/sched.h:478:62: error: dubious one-bit signed bitfield
> ./include/linux/sched.h:479:62: error: dubious one-bit signed bitfield
> 
> got fixed?  I saw there were patches posted, but nothing have reached
> Linus's tree, yet.

I got an email from tipbot indicating that Ingo merged it to sched/urgent.

Commit-ID:  aa5222e92f8000ed3c1c38dddf11c83222aadfb3
Gitweb: https://git.kernel.org/tip/aa5222e92f8000ed3c1c38dddf11c83222aadfb3
Author: Dan Carpenter 
AuthorDate: Fri, 13 Oct 2017 10:01:22 +0300
Committer:  Ingo Molnar 
CommitDate: Tue, 21 Nov 2017 09:25:01 +0100



Re: [PATCH v6 01/11] intel_sgx: updated MAINTAINERS

2017-11-26 Thread Bjørn Mork
Joe Perches  writes:
> On Sat, 2017-11-25 at 21:29 +0200, Jarkko Sakkinen wrote:
>> diff --git a/MAINTAINERS b/MAINTAINERS
> []
>> @@ -14932,6 +14932,11 @@ L:  linux...@kvack.org
>>  S:  Maintained
>>  F:  mm/zswap.c
>>  
>> +INTEL SGX
>> +M:  Jarkko Sakkinen 
>> +L:  intel-sgx-kernel-...@lists.01.org
>> +Q:  https://patchwork.kernel.org/project/intel-sgx/list/
>
> Alphabetical order please and this should
> have at least an "F:" pattern like:
>
> F:drivers/platform/x86/intel_sgx/

FYI: Darren already requested that when reviewing v5:
https://www.spinics.net/lists/kernel/msg2651743.html



Bjørn


[PATCH 4/4] video: sm501fb: Adjust 15 checks for null pointers

2017-11-26 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sun, 26 Nov 2017 10:56:46 +0100
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The script “checkpatch.pl” pointed information out like the following.

Comparison to NULL could be written !…

Thus fix the affected source code places.

Signed-off-by: Markus Elfring 
---
 drivers/video/fbdev/sm501fb.c | 31 ++-
 1 file changed, 14 insertions(+), 17 deletions(-)

diff --git a/drivers/video/fbdev/sm501fb.c b/drivers/video/fbdev/sm501fb.c
index f38e3773ccc0..313acc83bb71 100644
--- a/drivers/video/fbdev/sm501fb.c
+++ b/drivers/video/fbdev/sm501fb.c
@@ -1484,7 +1484,7 @@ static int sm501_init_cursor(struct fb_info *fbi, 
unsigned int reg_base)
struct sm501fb_info *info;
int ret;
 
-   if (fbi == NULL)
+   if (!fbi)
return 0;
 
par = fbi->par;
@@ -1532,7 +1532,7 @@ static int sm501fb_start(struct sm501fb_info *info,
/* allocate, reserve and remap resources for display
 * controller registers */
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   if (res == NULL) {
+   if (!res) {
dev_err(dev, "no resource definition for registers\n");
ret = -ENOENT;
goto err_release;
@@ -1541,15 +1541,14 @@ static int sm501fb_start(struct sm501fb_info *info,
info->regs_res = request_mem_region(res->start,
resource_size(res),
pdev->name);
-
-   if (info->regs_res == NULL) {
+   if (!info->regs_res) {
dev_err(dev, "cannot claim registers\n");
ret = -ENXIO;
goto err_release;
}
 
info->regs = ioremap(res->start, resource_size(res));
-   if (info->regs == NULL) {
+   if (!info->regs) {
dev_err(dev, "cannot remap registers\n");
ret = -ENXIO;
goto err_regs_res;
@@ -1558,7 +1557,7 @@ static int sm501fb_start(struct sm501fb_info *info,
/* allocate, reserve and remap resources for 2d
 * controller registers */
res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-   if (res == NULL) {
+   if (!res) {
dev_err(dev, "no resource definition for 2d registers\n");
ret = -ENOENT;
goto err_regs_map;
@@ -1567,15 +1566,14 @@ static int sm501fb_start(struct sm501fb_info *info,
info->regs2d_res = request_mem_region(res->start,
  resource_size(res),
  pdev->name);
-
-   if (info->regs2d_res == NULL) {
+   if (!info->regs2d_res) {
dev_err(dev, "cannot claim registers\n");
ret = -ENXIO;
goto err_regs_map;
}
 
info->regs2d = ioremap(res->start, resource_size(res));
-   if (info->regs2d == NULL) {
+   if (!info->regs2d) {
dev_err(dev, "cannot remap registers\n");
ret = -ENXIO;
goto err_regs2d_res;
@@ -1583,7 +1581,7 @@ static int sm501fb_start(struct sm501fb_info *info,
 
/* allocate, reserve resources for framebuffer */
res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
-   if (res == NULL) {
+   if (!res) {
dev_err(dev, "no memory resource defined\n");
ret = -ENXIO;
goto err_regs2d_map;
@@ -1592,14 +1590,14 @@ static int sm501fb_start(struct sm501fb_info *info,
info->fbmem_res = request_mem_region(res->start,
 resource_size(res),
 pdev->name);
-   if (info->fbmem_res == NULL) {
+   if (!info->fbmem_res) {
dev_err(dev, "cannot claim framebuffer\n");
ret = -ENXIO;
goto err_regs2d_map;
}
 
info->fbmem = ioremap(res->start, resource_size(res));
-   if (info->fbmem == NULL) {
+   if (!info->fbmem) {
dev_err(dev, "cannot remap framebuffer\n");
ret = -ENXIO;
goto err_mem_res;
@@ -1862,13 +1860,13 @@ static int sm501fb_probe_one(struct sm501fb_info *info,
pd = (head == HEAD_CRT) ? info->pdata->fb_crt : info->pdata->fb_pnl;
 
/* Do not initialise if we've not been given any platform data */
-   if (pd == NULL) {
+   if (!pd) {
dev_info(info->dev, "no data for fb %s (disabled)\n", name);
return 0;
}
 
fbi = framebuffer_alloc(sizeof(struct sm501fb_par), info->dev);
-   if (fbi == NULL) {
+   if (!fbi) {
dev_err(info->dev, "cannot allocate %s framebuffer\n", name);
return -ENOMEM;
}
@@ -1944,7 +1942,7 @@ static int sm501fb_probe(struct platform_device *pdev)
info->pdata = pd->fb;
}
 
-

[PATCH 3/4] video: sm501fb: Combine substrings for four messages

2017-11-26 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sun, 26 Nov 2017 10:43:36 +0100

The script "checkpatch.pl" pointed information out like the following.

WARNING: quoted string split across lines

Thus fix four source code places.

Signed-off-by: Markus Elfring 
---
 drivers/video/fbdev/sm501fb.c | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/video/fbdev/sm501fb.c b/drivers/video/fbdev/sm501fb.c
index 80bda5a655c0..f38e3773ccc0 100644
--- a/drivers/video/fbdev/sm501fb.c
+++ b/drivers/video/fbdev/sm501fb.c
@@ -510,10 +510,10 @@ static int sm501fb_set_par_common(struct fb_info *info,
/* update fb layer with actual clock used */
var->pixclock = sm501fb_hz_to_ps(sm501pixclock);
 
-   dev_dbg(fbi->dev, "%s: pixclock(ps) = %u, pixclock(Hz)  = %lu, "
-  "sm501pixclock = %lu,  error = %ld%%\n",
-  __func__, var->pixclock, pixclock, sm501pixclock,
-  ((pixclock - sm501pixclock)*100)/pixclock);
+   dev_dbg(fbi->dev,
+   "%s: pixclock(ps) = %u, pixclock(Hz)  = %lu, sm501pixclock = 
%lu,  error = %ld%%\n",
+   __func__, var->pixclock, pixclock, sm501pixclock,
+   ((pixclock - sm501pixclock) * 100) / pixclock);
 
return 0;
 }
@@ -1789,16 +1789,16 @@ static int sm501fb_init_fb(struct fb_info *fb, enum 
sm501_controller head,
 
switch (ret) {
case 1:
-   dev_info(info->dev, "using mode specified in "
-   "@mode\n");
+   dev_info(info->dev,
+"using mode specified in @mode\n");
break;
case 2:
-   dev_info(info->dev, "using mode specified in "
-   "@mode with ignored refresh rate\n");
+   dev_info(info->dev,
+"using mode specified in @mode with 
ignored refresh rate\n");
break;
case 3:
-   dev_info(info->dev, "using mode default "
-   "mode\n");
+   dev_info(info->dev,
+"using mode default mode\n");
break;
case 4:
dev_info(info->dev, "using mode from list\n");
-- 
2.15.0



[PATCH 2/4] video: sm501fb: Improve a size determination in sm501fb_probe()

2017-11-26 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sun, 26 Nov 2017 10:22:37 +0100

Replace the specification of a data structure by a pointer dereference
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring 
---
 drivers/video/fbdev/sm501fb.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/video/fbdev/sm501fb.c b/drivers/video/fbdev/sm501fb.c
index e8301c4e7d44..80bda5a655c0 100644
--- a/drivers/video/fbdev/sm501fb.c
+++ b/drivers/video/fbdev/sm501fb.c
@@ -1932,8 +1932,7 @@ static int sm501fb_probe(struct platform_device *pdev)
int ret;
 
/* allocate our framebuffers */
-
-   info = kzalloc(sizeof(struct sm501fb_info), GFP_KERNEL);
+   info = kzalloc(sizeof(*info), GFP_KERNEL);
if (!info)
return -ENOMEM;
 
-- 
2.15.0



[PATCH 1/4] video: sm501fb: Delete error messages for a failed memory allocation in two functions

2017-11-26 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sun, 26 Nov 2017 10:10:31 +0100

Omit extra messages for a memory allocation failure in these functions.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring 
---
 drivers/video/fbdev/sm501fb.c | 12 +++-
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/video/fbdev/sm501fb.c b/drivers/video/fbdev/sm501fb.c
index 6f0a19501c6a..e8301c4e7d44 100644
--- a/drivers/video/fbdev/sm501fb.c
+++ b/drivers/video/fbdev/sm501fb.c
@@ -1934,10 +1934,8 @@ static int sm501fb_probe(struct platform_device *pdev)
/* allocate our framebuffers */
 
info = kzalloc(sizeof(struct sm501fb_info), GFP_KERNEL);
-   if (!info) {
-   dev_err(dev, "failed to allocate state\n");
+   if (!info)
return -ENOMEM;
-   }
 
info->dev = dev = &pdev->dev;
platform_set_drvdata(pdev, info);
@@ -2121,16 +2119,12 @@ static int sm501fb_suspend_fb(struct sm501fb_info *info,
/* backup copies in case chip is powered down over suspend */
 
par->store_fb = vmalloc(par->screen.size);
-   if (par->store_fb == NULL) {
-   dev_err(info->dev, "no memory to store screen\n");
+   if (!par->store_fb)
return -ENOMEM;
-   }
 
par->store_cursor = vmalloc(par->cursor.size);
-   if (par->store_cursor == NULL) {
-   dev_err(info->dev, "no memory to store cursor\n");
+   if (!par->store_cursor)
goto err_nocursor;
-   }
 
dev_dbg(info->dev, "suspending screen to %p\n", par->store_fb);
dev_dbg(info->dev, "suspending cursor to %p\n", par->store_cursor);
-- 
2.15.0



[PATCH 0/4] video: sm501fb: Adjustments for seven function implementations

2017-11-26 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sun, 26 Nov 2017 11:10:01 +0100

A few update suggestions were taken into account
from static source code analysis.

Markus Elfring (4):
  Delete error messages for a failed memory allocation in two functions
  Improve a size determination in sm501fb_probe()
  Combine substrings for four messages
  Adjust 15 checks for null pointers

 drivers/video/fbdev/sm501fb.c | 66 ++-
 1 file changed, 28 insertions(+), 38 deletions(-)

-- 
2.15.0



Re: [PATCH] x86/orc: Don't bail on stack overflow

2017-11-26 Thread Thomas Gleixner
On Sat, 25 Nov 2017, Josh Poimboeuf wrote:

> It looks a *lot* better with mine and your patches applied.  It probably
> would have helped Ingo and Thomas figure the problem out a lot sooner:

> [1.159583] CS:  0010 DS:  ES:  CR0: 80050033
> [1.159583] CR2: ff083fb8 CR3: 000136f78002 CR4: 
> 001606e0
> [1.159583] Call Trace:
> [1.159583]  
> [1.159583]  __do_page_fault+0x4b0/0x4b0
> [1.159583]  page_fault+0x2c/0x60
> [1.159583] RIP: 0010:do_page_fault+0x0/0x100
> [1.159583] RSP: :ff084120 EFLAGS: 00010012
> [1.159583] RAX: 819d0a87 RBX: 0001 RCX: 
> 819d0a87
> [1.159583] RDX: 1000 RSI: 0010 RDI: 
> ff084128
> [1.159583] RBP: 0d68 R08: 7f6d6bb24278 R09: 
> 0023
> [1.159583] R10: 558e0feca600 R11: 0246 R12: 
> 7f6d6bb203c0
> [1.159583] R13: 7f6d6bb1f880 R14: 7793bebc R15: 
> 0100
> [1.159583]  ? native_iret+0x7/0x7
> [1.159583]  page_fault+0x2c/0x60
> [1.159583] RIP: 0010:apic_timer_interrupt+0x0/0xb0

Yes. That would have pointed immediately to the right place. It'd been
obvious that apic_timer_interrupt is not mapped.

Thanks,

tglx


Re: [PATCH v2 1/2] ALSA: pcm: add SNDRV_PCM_FORMAT_{S, U}20

2017-11-26 Thread Takashi Sakamoto

Hi,

On Nov 24 2017 08:31, Maciej S. Szmigiero wrote:

This format is similar to existing SNDRV_PCM_FORMAT_{S,U}20_3 that keep
20-bit PCM samples in 3 bytes, however i.MX6 platform SSI FIFO does not
allow 3-byte accesses (including DMA) so a 4-byte (more conventional)
format is needed for it.

Signed-off-by: Maciej S. Szmigiero 
---
Changes from v1: Drop "_4" suffix from these formats since they aren't
non-standard ones, use empty format slots starting from format number 25
for them, add information that they are LSB justified formats.

Corresponding alsa-lib changes will be posted as soon as this patch is
merged on the kernel side, to keep alsa-lib and kernel synchronized.

  include/sound/pcm.h |  8 
  include/sound/soc-dai.h |  2 ++
  include/uapi/sound/asound.h |  9 +
  sound/core/pcm_misc.c   | 16 
  4 files changed, 35 insertions(+)
...
diff --git a/sound/core/pcm_misc.c b/sound/core/pcm_misc.c
index 9be81025372f..c62bfe27106f 100644
--- a/sound/core/pcm_misc.c
+++ b/sound/core/pcm_misc.c
@@ -170,6 +170,22 @@ static struct pcm_format_data 
pcm_formats[(INT)SNDRV_PCM_FORMAT_LAST+1] = {
[SNDRV_PCM_FORMAT_GSM] = {
.le = -1, .signd = -1,
},
+   [SNDRV_PCM_FORMAT_S20_LE] = {
+   .width = 20, .phys = 32, .le = 1, .signd = 1,
+   .silence = {},
+   },
+   [SNDRV_PCM_FORMAT_S20_BE] = {
+   .width = 20, .phys = 32, .le = 0, .signd = 1,
+   .silence = {},
+   },
+   [SNDRV_PCM_FORMAT_U20_LE] = {
+   .width = 20, .phys = 32, .le = 1, .signd = 0,
+   .silence = { 0x00, 0x00, 0x08, 0x00 },
+   },
+   [SNDRV_PCM_FORMAT_U20_BE] = {
+   .width = 20, .phys = 32, .le = 0, .signd = 0,
+   .silence = { 0x00, 0x08, 0x00, 0x00 },
+   },
[SNDRV_PCM_FORMAT_SPECIAL] = {
.le = -1, .signd = -1,
},


Before applying this patch:
166 /* FIXME: the following three formats are not defined 
properly yet */

167 [SNDRV_PCM_FORMAT_MPEG] = {
168 .le = -1, .signd = -1,
169 },
170 [SNDRV_PCM_FORMAT_GSM] = {
171 .le = -1, .signd = -1,
172 },
173 [SNDRV_PCM_FORMAT_SPECIAL] = {
174 .le = -1, .signd = -1,
175 },

After applying this patch:

166 /* FIXME: the following three formats are not defined 
properly yet */

167 [SNDRV_PCM_FORMAT_MPEG] = {
168 .le = -1, .signd = -1,
169 },
170 [SNDRV_PCM_FORMAT_GSM] = {
171 .le = -1, .signd = -1,
172 },
173 [SNDRV_PCM_FORMAT_S20_LE] = {
174 .width = 20, .phys = 32, .le = 1, .signd = 1,
175 .silence = {},
176 },
177 [SNDRV_PCM_FORMAT_S20_BE] = {
178 .width = 20, .phys = 32, .le = 0, .signd = 1,
179 .silence = {},
180 },
181 [SNDRV_PCM_FORMAT_U20_LE] = {
182 .width = 20, .phys = 32, .le = 1, .signd = 0,
183 .silence = { 0x00, 0x00, 0x08, 0x00 },
184 },
185 [SNDRV_PCM_FORMAT_U20_BE] = {
186 .width = 20, .phys = 32, .le = 0, .signd = 0,
187 .silence = { 0x00, 0x08, 0x00, 0x00 },
188 },
189 [SNDRV_PCM_FORMAT_SPECIAL] = {
190 .le = -1, .signd = -1,
191 },

I think it good to add an alternative comment for each of entry which is 
not defined yet, like:


-> 166 /* FIXME: this format is not defined properly yet */
167 [SNDRV_PCM_FORMAT_MPEG] = {
168 .le = -1, .signd = -1,
169 },
-> 170 /* FIXME: this format is not defined properly yet */
171 [SNDRV_PCM_FORMAT_GSM] = {
172 .le = -1, .signd = -1,
173 },
174 [SNDRV_PCM_FORMAT_S20_LE] = {
175 .width = 20, .phys = 32, .le = 1, .signd = 1,
176 .silence = {},
177 },
178 [SNDRV_PCM_FORMAT_S20_BE] = {
179 .width = 20, .phys = 32, .le = 0, .signd = 1,
180 .silence = {},
181 },
182 [SNDRV_PCM_FORMAT_U20_LE] = {
183 .width = 20, .phys = 32, .le = 1, .signd = 0,
184 .silence = { 0x00, 0x00, 0x08, 0x00 },
185 },
186 [SNDRV_PCM_FORMAT_U20_BE] = {
187 .width = 20, .phys = 32, .le = 0, .signd = 0,
188 .silence = { 0x00, 0x08, 0x00, 0x00 },
189 },
-> 190 /* FIXME: this format is not defined properly yet */
191 [SNDRV_PCM_FORMAT_SPECIAL] = {
192 .le = -1, .signd = -1,
193 },


Regards

Takashi Sakamoto


Re: [PATCH v2 02/22] mmc: renesas_sdhi: remove wrong depends on to enable compile test

2017-11-26 Thread Geert Uytterhoeven
On Fri, Nov 24, 2017 at 5:24 PM, Masahiro Yamada
 wrote:
> ARCH_RENESAS is a stronger condition than (ARM || ARM64).
> If ARCH_RENESAS is enabled, (ARM || ARM64) is met as well.
>
> What is worse, the first depends on line prevents COMPILE_TEST from
> enabling this driver.  It should be removed.
>
> Signed-off-by: Masahiro Yamada 
> Acked-by: Wolfram Sang 

Reviewed-by: Geert Uytterhoeven 

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


Re: [PATCH] input: pegasus_notetaker: add license information

2017-11-26 Thread Greg Kroah-Hartman
On Sat, Nov 25, 2017 at 04:42:59PM -0800, Dmitry Torokhov wrote:
> Hi Martin,
> 
> On Sat, Nov 18, 2017 at 09:45:18AM +0100, Martin Kepplinger wrote:
> > This adds an SPDX license identifier to this driver I wrote some time back.
> > 
> > Signed-off-by: Martin Kepplinger 
> > ---
> >  drivers/input/tablet/pegasus_notetaker.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/drivers/input/tablet/pegasus_notetaker.c 
> > b/drivers/input/tablet/pegasus_notetaker.c
> > index 47de5a81172f..cdf75c989469 100644
> > --- a/drivers/input/tablet/pegasus_notetaker.c
> > +++ b/drivers/input/tablet/pegasus_notetaker.c
> > @@ -1,3 +1,4 @@
> > +// SPDX-License-Identifier: GPL-2.0
> 
> Should this be GPL-2.0+? The MODULE_LICENSE specifies that the module is
> "GPL" which in kernel land means GPLv2+. Or we should change the module
> license to strict "GPLv2"?

That is up to Martin, given that he is the author, as to what he wants
to mark this as.  Odd that it missed the big "fix up all files with no
license information" sweep.

Philippe, how did we miss this one?

> Also, why do we use C++ -style comments for this?

That is what Linus wants, see the thread on lkml in the past few hours
for his reasoning here.

> Greg, do you have any plans on dropping MODULE_LICENSE() altogether and
> generating the appropriate string from SPDX markings in the source?

At this time, no, it's not a simple solution as it gets messy quickly
(multiple c files make up modulues, what about .h files, etc...)

> Doing this would prevent mismatches between license notices, SPDX tags
> and MODULE_LCENSE() strings, which happen very often.

I agree, but now that we are getting SPDX tags, we can fix up all of the
mismatches in MODULE_LICENSE() strings, of which there are a lot.

thanks,

greg k-h


Re: [PATCH 42/43] x86/mm/kaiser: Allow KAISER to be enabled/disabled at runtime

2017-11-26 Thread Thomas Gleixner
On Sat, 25 Nov 2017, Andy Lutomirski wrote:
> On Sat, Nov 25, 2017 at 2:48 PM, Thomas Gleixner  wrote:
> > On Sat, 25 Nov 2017, Andy Lutomirski wrote:
> >> > On Nov 25, 2017, at 1:05 PM, Thomas Gleixner  wrote:
> >> > On Sat, 25 Nov 2017, Andy Lutomirski wrote:
> >> >> Keep in mind that, for a static_branch, actually setting the thing needs
> >> >> to be deferred, but that's straightforward.
> >> >
> >> > That's not an issue during boot. That would be an issue for a run time
> >> > switch.
> >>
> >> What I mean is: if you modify a static_branch too early, it blows up 
> >> terribly.
> >
> > I'm aware of that. We can't switch it in the early boot stage. But that
> > does not matter as we can switch way before we reach user space.
> >
> > The early kaiser mappings are fine whether we use them later or not. At the
> > point in boot where we actually make the decision, there is nothing more
> > than the extra 4k shadow which got initialized.
> >
> > If we ever want to do runtime switching, then the full shadow mapping needs
> > to be maintained even while kaiser is disabled, just the NX poisoning of
> > the user space mappings is what makes the difference.
> 
> One unfortunate thing is that, if we boot with kaiser off and don't
> intend to ever switch it on at runtime, we could avoid the 8k pgd
> allocations.  But if we want to be able to enable kaiser, we need the
> 8k mappings.  My inclination is to not try for runtime control until
> some distro asks for it.

I completely agree. boot time is good enough. We should start with the 8k
allocations for simplicity reasons and when that works have a patch on top
which switches is back to 4k.

> In general, I think that trying to runtime switch without stop_machine
> is a bit nuts, and getting it to be reliable even with stop_machine is
> gross.  Not to mention that stop_machine is currently incompatible
> with writing to static branches, although that's fixable.

Yes, it's doable, but surely not trivial and I'd like to avoid the mess it
creates.

Thanks,

tglx


<    1   2   3   4