Re: [PATCH 06/11] powerpc/kvm: Allow KVM_PPC_ALLOCATE_HTAB ioctl() to change HPT size

2016-12-18 Thread Thomas Huth
On 19.12.2016 01:48, David Gibson wrote:
> On Fri, Dec 16, 2016 at 01:44:57PM +0100, Thomas Huth wrote:
>> On 15.12.2016 06:53, David Gibson wrote:
>>> The KVM_PPC_ALLOCATE_HTAB ioctl() is used to set the size of hashed page
>>> table (HPT) that userspace expects a guest VM to have, and is also used to
>>> clear that HPT when necessary (e.g. guest reboot).
>>>
>>> At present, once the ioctl() is called for the first time, the HPT size can
>>> never be changed thereafter - it will be cleared but always sized as from
>>> the first call.
>>>
>>> With upcoming HPT resize implementation, we're going to need to allow
>>> userspace to resize the HPT at reset (to change it back to the default size
>>> if the guest changed it).
>>>
>>> So, we need to allow this ioctl() to change the HPT size.
>>>
>>> Signed-off-by: David Gibson 
>>> ---
[...]
>>> diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c 
>>> b/arch/powerpc/kvm/book3s_64_mmu_hv.c
>>> index 68bb228..8e5ac2f 100644
>>> --- a/arch/powerpc/kvm/book3s_64_mmu_hv.c
>>> +++ b/arch/powerpc/kvm/book3s_64_mmu_hv.c
>>> @@ -104,10 +104,22 @@ void kvmppc_set_hpt(struct kvm *kvm, struct 
>>> kvm_hpt_info *info)
>>> info->virt, (long)info->order, kvm->arch.lpid);
>>>  }
>>>  
>>> -long kvmppc_alloc_reset_hpt(struct kvm *kvm, u32 *htab_orderp)
>>> +void kvmppc_free_hpt(struct kvm_hpt_info *info)
>>> +{
>>> +   vfree(info->rev);
>>> +   if (info->cma)
>>> +   kvm_free_hpt_cma(virt_to_page(info->virt),
>>> +1 << (info->order - PAGE_SHIFT));
>>> +   else
>>> +   free_pages(info->virt, info->order - PAGE_SHIFT);
>>> +   info->virt = 0;
>>> +   info->order = 0;
>>> +}
>>
>> Why do you need to move kvmppc_free_hpt() around? Seems like unecessary
>> code churn to me?
> 
> Previously, kvmppc_free_hpt() wasn't needed in
> kvmppc_alloc_reset_hpt(), now it is.  So we need to move it above that
> function.  I could move it in the previous patch, but that would
> obscure what the actual changes are to it, so it seemed better to do
> it here.

kvmppc_free_hpt() is not a static function, there is a prototype in a
header for this somewhere, so as far as I can see, it should also work
without moving this function?

[...]
>>> diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
>>> index 71c5adb..957e473 100644
>>> --- a/arch/powerpc/kvm/book3s_hv.c
>>> +++ b/arch/powerpc/kvm/book3s_hv.c
>>> @@ -3600,12 +3600,9 @@ static long kvm_arch_vm_ioctl_hv(struct file *filp,
>>> r = -EFAULT;
>>> if (get_user(htab_order, (u32 __user *)argp))
>>> break;
>>> -   r = kvmppc_alloc_reset_hpt(kvm, _order);
>>> +   r = kvmppc_alloc_reset_hpt(kvm, htab_order);
>>> if (r)
>>> break;
>>> -   r = -EFAULT;
>>> -   if (put_user(htab_order, (u32 __user *)argp))
>>> -   break;
>>
>> Now that htab_order is not changed anymore by the kernel, I'm pretty
>> sure you need some checks on the value here before calling
>> kvmppc_alloc_reset_hpt(), e.g. return an error code if htab_order <
>> PPC_MIN_HPT_ORDER.
> 
> Right.  I've done that by putting the checks into
> kvmppc_allocate_hpt() in the earlier patch.
> 
>> And, I'm not sure if I got that right, but in former times, the
>> htab_order from the userspace application was just a suggestion, and now
>> it's mandatory, right? So if an old userspace used a very high value
>> here (or even something smaller than PPC_MIN_HPT_ORDER like 0), the
>> kernel fixed this up and the userspace could run happily with the fixed
>> value afterwards. But since this value from userspace if mandatory now,
>> such an userspace application is broken now. So maybe it's better to
>> introduce a new ioctl for this new behavior instead, to avoid breaking
>> old userspace applications?
> 
> A long time ago it was just a hint.  However, that behaviour was
> already changed in 572abd5 "KVM: PPC: Book3S HV: Don't fall back to
> smaller HPT size in allocation ioctl".  This is important: without
> that we could get a different HPT size on the two ends of a migration,
> which broke things nastily.

OK, makes sense, especially if the userspace provided an order. But if I
get that patch right, it was still possible to call with order == 0 to
get the automatic sizing? Do we need to preserve that behavior for some
very old userspace applications?

 Thomas




signature.asc
Description: OpenPGP digital signature


Re: [PATCH 06/11] powerpc/kvm: Allow KVM_PPC_ALLOCATE_HTAB ioctl() to change HPT size

2016-12-18 Thread Thomas Huth
On 19.12.2016 01:48, David Gibson wrote:
> On Fri, Dec 16, 2016 at 01:44:57PM +0100, Thomas Huth wrote:
>> On 15.12.2016 06:53, David Gibson wrote:
>>> The KVM_PPC_ALLOCATE_HTAB ioctl() is used to set the size of hashed page
>>> table (HPT) that userspace expects a guest VM to have, and is also used to
>>> clear that HPT when necessary (e.g. guest reboot).
>>>
>>> At present, once the ioctl() is called for the first time, the HPT size can
>>> never be changed thereafter - it will be cleared but always sized as from
>>> the first call.
>>>
>>> With upcoming HPT resize implementation, we're going to need to allow
>>> userspace to resize the HPT at reset (to change it back to the default size
>>> if the guest changed it).
>>>
>>> So, we need to allow this ioctl() to change the HPT size.
>>>
>>> Signed-off-by: David Gibson 
>>> ---
[...]
>>> diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c 
>>> b/arch/powerpc/kvm/book3s_64_mmu_hv.c
>>> index 68bb228..8e5ac2f 100644
>>> --- a/arch/powerpc/kvm/book3s_64_mmu_hv.c
>>> +++ b/arch/powerpc/kvm/book3s_64_mmu_hv.c
>>> @@ -104,10 +104,22 @@ void kvmppc_set_hpt(struct kvm *kvm, struct 
>>> kvm_hpt_info *info)
>>> info->virt, (long)info->order, kvm->arch.lpid);
>>>  }
>>>  
>>> -long kvmppc_alloc_reset_hpt(struct kvm *kvm, u32 *htab_orderp)
>>> +void kvmppc_free_hpt(struct kvm_hpt_info *info)
>>> +{
>>> +   vfree(info->rev);
>>> +   if (info->cma)
>>> +   kvm_free_hpt_cma(virt_to_page(info->virt),
>>> +1 << (info->order - PAGE_SHIFT));
>>> +   else
>>> +   free_pages(info->virt, info->order - PAGE_SHIFT);
>>> +   info->virt = 0;
>>> +   info->order = 0;
>>> +}
>>
>> Why do you need to move kvmppc_free_hpt() around? Seems like unecessary
>> code churn to me?
> 
> Previously, kvmppc_free_hpt() wasn't needed in
> kvmppc_alloc_reset_hpt(), now it is.  So we need to move it above that
> function.  I could move it in the previous patch, but that would
> obscure what the actual changes are to it, so it seemed better to do
> it here.

kvmppc_free_hpt() is not a static function, there is a prototype in a
header for this somewhere, so as far as I can see, it should also work
without moving this function?

[...]
>>> diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
>>> index 71c5adb..957e473 100644
>>> --- a/arch/powerpc/kvm/book3s_hv.c
>>> +++ b/arch/powerpc/kvm/book3s_hv.c
>>> @@ -3600,12 +3600,9 @@ static long kvm_arch_vm_ioctl_hv(struct file *filp,
>>> r = -EFAULT;
>>> if (get_user(htab_order, (u32 __user *)argp))
>>> break;
>>> -   r = kvmppc_alloc_reset_hpt(kvm, _order);
>>> +   r = kvmppc_alloc_reset_hpt(kvm, htab_order);
>>> if (r)
>>> break;
>>> -   r = -EFAULT;
>>> -   if (put_user(htab_order, (u32 __user *)argp))
>>> -   break;
>>
>> Now that htab_order is not changed anymore by the kernel, I'm pretty
>> sure you need some checks on the value here before calling
>> kvmppc_alloc_reset_hpt(), e.g. return an error code if htab_order <
>> PPC_MIN_HPT_ORDER.
> 
> Right.  I've done that by putting the checks into
> kvmppc_allocate_hpt() in the earlier patch.
> 
>> And, I'm not sure if I got that right, but in former times, the
>> htab_order from the userspace application was just a suggestion, and now
>> it's mandatory, right? So if an old userspace used a very high value
>> here (or even something smaller than PPC_MIN_HPT_ORDER like 0), the
>> kernel fixed this up and the userspace could run happily with the fixed
>> value afterwards. But since this value from userspace if mandatory now,
>> such an userspace application is broken now. So maybe it's better to
>> introduce a new ioctl for this new behavior instead, to avoid breaking
>> old userspace applications?
> 
> A long time ago it was just a hint.  However, that behaviour was
> already changed in 572abd5 "KVM: PPC: Book3S HV: Don't fall back to
> smaller HPT size in allocation ioctl".  This is important: without
> that we could get a different HPT size on the two ends of a migration,
> which broke things nastily.

OK, makes sense, especially if the userspace provided an order. But if I
get that patch right, it was still possible to call with order == 0 to
get the automatic sizing? Do we need to preserve that behavior for some
very old userspace applications?

 Thomas




signature.asc
Description: OpenPGP digital signature


Re: [PATCH] mm: simplify node/zone name printing

2016-12-18 Thread Sergey Senozhatsky
Hello,

On (12/19/16 08:00), Vlastimil Babka wrote:
[..]
> > @@ -4421,7 +4421,6 @@ void show_free_areas(unsigned int filter)
> > printk("lowmem_reserve[]:");
> > for (i = 0; i < MAX_NR_ZONES; i++)
> > printk(KERN_CONT " %ld", zone->lowmem_reserve[i]);
> > -   printk(KERN_CONT "\n");
> 
> So there's really no functional difference between terminating line
> explicitly with "\n", and doing a followup printk() without KERN_CONT?
> I agree that a KERN_CONT line just to print "\n" is ugly, just want to
> be sure we are really safe without it, considering how KERN_CONT has
> been recently changed etc.

depending on what will follow. if another KERN_CONT printk then
without this explicit '\n' printk may assume that we are still
in cont printing; if something else -- printk should flush.

kernel/printk/printk.c

/*
 * If an earlier line was buffered, and we're a continuation
 * write from the same process, try to add it to the buffer.
 */
if (cont.len) {
if (cont.owner == current && (lflags & LOG_CONT)) {
if (cont_add(facility, level, lflags, text, text_len))
return text_len;
}
/* Otherwise, make sure it's flushed */
cont_flush();
}


as far as I can tell, now for_each_populated_zone() iterations are
split by non-CONT printk() from show_zone_node(), which previously
has been   printk(KERN_CONT "%s: ", zone->name), so pr_cont(\n)
between iterations was important, but now that non-CONT printk()
should do the trick. it's _a bit_ hacky, though.

-ss

> > }
> >  
> > for_each_populated_zone(zone) {
> > @@ -4431,8 +4430,7 @@ void show_free_areas(unsigned int filter)
> >  
> > if (skip_free_areas_node(filter, zone_to_nid(zone)))
> > continue;
> > -   show_node(zone);
> > -   printk(KERN_CONT "%s: ", zone->name);
> > +   show_zone_node(zone);
> >  
> > spin_lock_irqsave(>lock, flags);


Re: [PATCH] mm: simplify node/zone name printing

2016-12-18 Thread Sergey Senozhatsky
Hello,

On (12/19/16 08:00), Vlastimil Babka wrote:
[..]
> > @@ -4421,7 +4421,6 @@ void show_free_areas(unsigned int filter)
> > printk("lowmem_reserve[]:");
> > for (i = 0; i < MAX_NR_ZONES; i++)
> > printk(KERN_CONT " %ld", zone->lowmem_reserve[i]);
> > -   printk(KERN_CONT "\n");
> 
> So there's really no functional difference between terminating line
> explicitly with "\n", and doing a followup printk() without KERN_CONT?
> I agree that a KERN_CONT line just to print "\n" is ugly, just want to
> be sure we are really safe without it, considering how KERN_CONT has
> been recently changed etc.

depending on what will follow. if another KERN_CONT printk then
without this explicit '\n' printk may assume that we are still
in cont printing; if something else -- printk should flush.

kernel/printk/printk.c

/*
 * If an earlier line was buffered, and we're a continuation
 * write from the same process, try to add it to the buffer.
 */
if (cont.len) {
if (cont.owner == current && (lflags & LOG_CONT)) {
if (cont_add(facility, level, lflags, text, text_len))
return text_len;
}
/* Otherwise, make sure it's flushed */
cont_flush();
}


as far as I can tell, now for_each_populated_zone() iterations are
split by non-CONT printk() from show_zone_node(), which previously
has been   printk(KERN_CONT "%s: ", zone->name), so pr_cont(\n)
between iterations was important, but now that non-CONT printk()
should do the trick. it's _a bit_ hacky, though.

-ss

> > }
> >  
> > for_each_populated_zone(zone) {
> > @@ -4431,8 +4430,7 @@ void show_free_areas(unsigned int filter)
> >  
> > if (skip_free_areas_node(filter, zone_to_nid(zone)))
> > continue;
> > -   show_node(zone);
> > -   printk(KERN_CONT "%s: ", zone->name);
> > +   show_zone_node(zone);
> >  
> > spin_lock_irqsave(>lock, flags);


Re: [PATCH v6 4/5] fpga manager: Add cyclone-ps-spi driver for Altera FPGAs

2016-12-18 Thread Uwe Kleine-König
On Fri, Dec 16, 2016 at 03:17:53PM -0800, Joshua Clayton wrote:
> cyclone-ps-spi loads FPGA firmware over spi, using the "passive serial"
> interface on Altera Cyclone FPGAS.
> 
> This is one of the simpler ways to set up an FPGA at runtime.
> The signal interface is close to unidirectional spi with lsb first.
> 
> Signed-off-by: Joshua Clayton 
> ---
>  drivers/fpga/Kconfig  |   7 ++
>  drivers/fpga/Makefile |   1 +
>  drivers/fpga/cyclone-ps-spi.c | 186 
> ++
>  3 files changed, 194 insertions(+)
>  create mode 100644 drivers/fpga/cyclone-ps-spi.c
> 
> diff --git a/drivers/fpga/Kconfig b/drivers/fpga/Kconfig
> index ce861a2..e6c032d 100644
> --- a/drivers/fpga/Kconfig
> +++ b/drivers/fpga/Kconfig
> @@ -20,6 +20,13 @@ config FPGA_REGION
> FPGA Regions allow loading FPGA images under control of
> the Device Tree.
>  
> +config FPGA_MGR_CYCLONE_PS_SPI
> + tristate "Altera Cyclone FPGA Passive Serial over SPI"
> + depends on SPI
> + help
> +   FPGA manager driver support for Altera Cyclone using the
> +   passive serial interface over SPI
> +
>  config FPGA_MGR_SOCFPGA
>   tristate "Altera SOCFPGA FPGA Manager"
>   depends on ARCH_SOCFPGA || COMPILE_TEST
> diff --git a/drivers/fpga/Makefile b/drivers/fpga/Makefile
> index 8df07bc..a112bef 100644
> --- a/drivers/fpga/Makefile
> +++ b/drivers/fpga/Makefile
> @@ -6,6 +6,7 @@
>  obj-$(CONFIG_FPGA)   += fpga-mgr.o
>  
>  # FPGA Manager Drivers
> +obj-$(CONFIG_FPGA_MGR_CYCLONE_PS_SPI)+= cyclone-ps-spi.o
>  obj-$(CONFIG_FPGA_MGR_SOCFPGA)   += socfpga.o
>  obj-$(CONFIG_FPGA_MGR_SOCFPGA_A10)   += socfpga-a10.o
>  obj-$(CONFIG_FPGA_MGR_ZYNQ_FPGA) += zynq-fpga.o
> diff --git a/drivers/fpga/cyclone-ps-spi.c b/drivers/fpga/cyclone-ps-spi.c
> new file mode 100644
> index 000..f9126f9
> --- /dev/null
> +++ b/drivers/fpga/cyclone-ps-spi.c
> @@ -0,0 +1,186 @@
> +/**
> + * Altera Cyclone Passive Serial SPI Driver
> + *
> + *  Copyright (c) 2017 United Western Technologies, Corporation

In which timezone it's already 2017? s/  / /

> + *
> + *  Joshua Clayton 
> + *
> + * Manage Altera FPGA firmware that is loaded over spi using the passive
> + * serial configuration method.
> + * Firmware must be in binary "rbf" format.
> + * Works on Cyclone V. Should work on cyclone series.
> + * May work on other Altera FPGAs.

I can test this later on an Arria 10. I'm not sure what the connection
between "Cyclone" and "Arria" is, but the protocol looks similar.

> + *
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#define FPGA_RESET_TIME  50   /* time in usecs to trigger FPGA 
> config */
> +#define FPGA_MIN_DELAY   50   /* min usecs to wait for config 
> status */
> +#define FPGA_MAX_DELAY   1000 /* max usecs to wait for config 
> status */
> +
> +struct cyclonespi_conf {
> + struct gpio_desc *config;
> + struct gpio_desc *status;
> + struct spi_device *spi;
> +};
> +
> +static const struct of_device_id of_ef_match[] = {
> + { .compatible = "altr,cyclone-ps-spi-fpga-mgr", },
> + {}
> +};
> +MODULE_DEVICE_TABLE(of, of_ef_match);

barebox already has such a driver, the binding is available at


https://git.pengutronix.de/cgit/barebox/tree/Documentation/devicetree/bindings/firmware/altr,passive-serial.txt

(This isn't completely accurate because nstat is optional in the driver.)

> +static enum fpga_mgr_states cyclonespi_state(struct fpga_manager *mgr)
> +{
> + struct cyclonespi_conf *conf = (struct cyclonespi_conf *)mgr->priv;
> +
> + if (gpiod_get_value(conf->status))
> + return FPGA_MGR_STATE_RESET;
> +
> + return FPGA_MGR_STATE_UNKNOWN;
> +}
> +
> +static int cyclonespi_write_init(struct fpga_manager *mgr,
> +  struct fpga_image_info *info,
> +  const char *buf, size_t count)
> +{
> + struct cyclonespi_conf *conf = (struct cyclonespi_conf *)mgr->priv;
> + int i;
> +
> + if (info->flags & FPGA_MGR_PARTIAL_RECONFIG) {
> + dev_err(>dev, "Partial reconfiguration not supported.\n");
> + return -EINVAL;
> + }
> +
> + gpiod_set_value(conf->config, 1);
> + usleep_range(FPGA_RESET_TIME, FPGA_RESET_TIME + 20);
> + if (!gpiod_get_value(conf->status)) {
> + dev_err(>dev, "Status pin should be low.\n");

You write this when get_value returns 0. There is something fishy.

> + return -EIO;
> + }
> +
> + gpiod_set_value(conf->config, 0);
> + for (i = 0; i < (FPGA_MAX_DELAY / FPGA_MIN_DELAY); i++) {
> + usleep_range(FPGA_MIN_DELAY, FPGA_MIN_DELAY + 20);
> + if (!gpiod_get_value(conf->status))
> + return 0;
> + }
> +
> + dev_err(>dev, "Status pin not 

Re: [PATCH v6 4/5] fpga manager: Add cyclone-ps-spi driver for Altera FPGAs

2016-12-18 Thread Uwe Kleine-König
On Fri, Dec 16, 2016 at 03:17:53PM -0800, Joshua Clayton wrote:
> cyclone-ps-spi loads FPGA firmware over spi, using the "passive serial"
> interface on Altera Cyclone FPGAS.
> 
> This is one of the simpler ways to set up an FPGA at runtime.
> The signal interface is close to unidirectional spi with lsb first.
> 
> Signed-off-by: Joshua Clayton 
> ---
>  drivers/fpga/Kconfig  |   7 ++
>  drivers/fpga/Makefile |   1 +
>  drivers/fpga/cyclone-ps-spi.c | 186 
> ++
>  3 files changed, 194 insertions(+)
>  create mode 100644 drivers/fpga/cyclone-ps-spi.c
> 
> diff --git a/drivers/fpga/Kconfig b/drivers/fpga/Kconfig
> index ce861a2..e6c032d 100644
> --- a/drivers/fpga/Kconfig
> +++ b/drivers/fpga/Kconfig
> @@ -20,6 +20,13 @@ config FPGA_REGION
> FPGA Regions allow loading FPGA images under control of
> the Device Tree.
>  
> +config FPGA_MGR_CYCLONE_PS_SPI
> + tristate "Altera Cyclone FPGA Passive Serial over SPI"
> + depends on SPI
> + help
> +   FPGA manager driver support for Altera Cyclone using the
> +   passive serial interface over SPI
> +
>  config FPGA_MGR_SOCFPGA
>   tristate "Altera SOCFPGA FPGA Manager"
>   depends on ARCH_SOCFPGA || COMPILE_TEST
> diff --git a/drivers/fpga/Makefile b/drivers/fpga/Makefile
> index 8df07bc..a112bef 100644
> --- a/drivers/fpga/Makefile
> +++ b/drivers/fpga/Makefile
> @@ -6,6 +6,7 @@
>  obj-$(CONFIG_FPGA)   += fpga-mgr.o
>  
>  # FPGA Manager Drivers
> +obj-$(CONFIG_FPGA_MGR_CYCLONE_PS_SPI)+= cyclone-ps-spi.o
>  obj-$(CONFIG_FPGA_MGR_SOCFPGA)   += socfpga.o
>  obj-$(CONFIG_FPGA_MGR_SOCFPGA_A10)   += socfpga-a10.o
>  obj-$(CONFIG_FPGA_MGR_ZYNQ_FPGA) += zynq-fpga.o
> diff --git a/drivers/fpga/cyclone-ps-spi.c b/drivers/fpga/cyclone-ps-spi.c
> new file mode 100644
> index 000..f9126f9
> --- /dev/null
> +++ b/drivers/fpga/cyclone-ps-spi.c
> @@ -0,0 +1,186 @@
> +/**
> + * Altera Cyclone Passive Serial SPI Driver
> + *
> + *  Copyright (c) 2017 United Western Technologies, Corporation

In which timezone it's already 2017? s/  / /

> + *
> + *  Joshua Clayton 
> + *
> + * Manage Altera FPGA firmware that is loaded over spi using the passive
> + * serial configuration method.
> + * Firmware must be in binary "rbf" format.
> + * Works on Cyclone V. Should work on cyclone series.
> + * May work on other Altera FPGAs.

I can test this later on an Arria 10. I'm not sure what the connection
between "Cyclone" and "Arria" is, but the protocol looks similar.

> + *
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#define FPGA_RESET_TIME  50   /* time in usecs to trigger FPGA 
> config */
> +#define FPGA_MIN_DELAY   50   /* min usecs to wait for config 
> status */
> +#define FPGA_MAX_DELAY   1000 /* max usecs to wait for config 
> status */
> +
> +struct cyclonespi_conf {
> + struct gpio_desc *config;
> + struct gpio_desc *status;
> + struct spi_device *spi;
> +};
> +
> +static const struct of_device_id of_ef_match[] = {
> + { .compatible = "altr,cyclone-ps-spi-fpga-mgr", },
> + {}
> +};
> +MODULE_DEVICE_TABLE(of, of_ef_match);

barebox already has such a driver, the binding is available at


https://git.pengutronix.de/cgit/barebox/tree/Documentation/devicetree/bindings/firmware/altr,passive-serial.txt

(This isn't completely accurate because nstat is optional in the driver.)

> +static enum fpga_mgr_states cyclonespi_state(struct fpga_manager *mgr)
> +{
> + struct cyclonespi_conf *conf = (struct cyclonespi_conf *)mgr->priv;
> +
> + if (gpiod_get_value(conf->status))
> + return FPGA_MGR_STATE_RESET;
> +
> + return FPGA_MGR_STATE_UNKNOWN;
> +}
> +
> +static int cyclonespi_write_init(struct fpga_manager *mgr,
> +  struct fpga_image_info *info,
> +  const char *buf, size_t count)
> +{
> + struct cyclonespi_conf *conf = (struct cyclonespi_conf *)mgr->priv;
> + int i;
> +
> + if (info->flags & FPGA_MGR_PARTIAL_RECONFIG) {
> + dev_err(>dev, "Partial reconfiguration not supported.\n");
> + return -EINVAL;
> + }
> +
> + gpiod_set_value(conf->config, 1);
> + usleep_range(FPGA_RESET_TIME, FPGA_RESET_TIME + 20);
> + if (!gpiod_get_value(conf->status)) {
> + dev_err(>dev, "Status pin should be low.\n");

You write this when get_value returns 0. There is something fishy.

> + return -EIO;
> + }
> +
> + gpiod_set_value(conf->config, 0);
> + for (i = 0; i < (FPGA_MAX_DELAY / FPGA_MIN_DELAY); i++) {
> + usleep_range(FPGA_MIN_DELAY, FPGA_MIN_DELAY + 20);
> + if (!gpiod_get_value(conf->status))
> + return 0;
> + }
> +
> + dev_err(>dev, "Status pin not ready.\n");
> + return -EIO;

For Arria 10 the 

[PATCH] genwqe: drop .link_reset()

2016-12-18 Thread Cao jin
In AER recovery, pci_error_handlers.link_reset() is never called,
drop it now.

Signed-off-by: Cao jin 
---
 drivers/misc/genwqe/card_base.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/misc/genwqe/card_base.c b/drivers/misc/genwqe/card_base.c
index 6c1f49a85023..4fd21e86ad56 100644
--- a/drivers/misc/genwqe/card_base.c
+++ b/drivers/misc/genwqe/card_base.c
@@ -1336,7 +1336,6 @@ static int genwqe_sriov_configure(struct pci_dev *dev, 
int numvfs)
 static struct pci_error_handlers genwqe_err_handler = {
.error_detected = genwqe_err_error_detected,
.mmio_enabled   = genwqe_err_result_none,
-   .link_reset = genwqe_err_result_none,
.slot_reset = genwqe_err_slot_reset,
.resume = genwqe_err_resume,
 };
-- 
2.1.0





[PATCH] genwqe: drop .link_reset()

2016-12-18 Thread Cao jin
In AER recovery, pci_error_handlers.link_reset() is never called,
drop it now.

Signed-off-by: Cao jin 
---
 drivers/misc/genwqe/card_base.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/misc/genwqe/card_base.c b/drivers/misc/genwqe/card_base.c
index 6c1f49a85023..4fd21e86ad56 100644
--- a/drivers/misc/genwqe/card_base.c
+++ b/drivers/misc/genwqe/card_base.c
@@ -1336,7 +1336,6 @@ static int genwqe_sriov_configure(struct pci_dev *dev, 
int numvfs)
 static struct pci_error_handlers genwqe_err_handler = {
.error_detected = genwqe_err_error_detected,
.mmio_enabled   = genwqe_err_result_none,
-   .link_reset = genwqe_err_result_none,
.slot_reset = genwqe_err_slot_reset,
.resume = genwqe_err_resume,
 };
-- 
2.1.0





[PATCH v4 3/3] ARM: dts: vf610-zii-dev-rev-b: Remove 'fixed-link' from DSA ports

2016-12-18 Thread Andrey Smirnov
Remove 'fixed-link' nodes from DSA ports since they are not needed (they
are not limiting link's speed and the ports will be configured to their
maximux speed as a default)

Suggested-by: Andrew Lunn 
Signed-off-by: Andrey Smirnov 
---

Changes since v3:

- None

 arch/arm/boot/dts/vf610-zii-dev-rev-b.dts | 8 
 1 file changed, 8 deletions(-)

diff --git a/arch/arm/boot/dts/vf610-zii-dev-rev-b.dts 
b/arch/arm/boot/dts/vf610-zii-dev-rev-b.dts
index c0fc3f2..646c90c 100644
--- a/arch/arm/boot/dts/vf610-zii-dev-rev-b.dts
+++ b/arch/arm/boot/dts/vf610-zii-dev-rev-b.dts
@@ -97,10 +97,6 @@
phy-mode = "rgmii-txid";
link = <
>;
-   fixed-link {
-   speed = <1000>;
-   full-duplex;
-   };
};
 
port@6 {
@@ -165,10 +161,6 @@
label = "dsa";
phy-mode = "rgmii-txid";
link = <>;
-   fixed-link {
-   speed = <1000>;
-   full-duplex;
-   };
};
};
mdio {
-- 
2.5.5



[PATCH v4 3/3] ARM: dts: vf610-zii-dev-rev-b: Remove 'fixed-link' from DSA ports

2016-12-18 Thread Andrey Smirnov
Remove 'fixed-link' nodes from DSA ports since they are not needed (they
are not limiting link's speed and the ports will be configured to their
maximux speed as a default)

Suggested-by: Andrew Lunn 
Signed-off-by: Andrey Smirnov 
---

Changes since v3:

- None

 arch/arm/boot/dts/vf610-zii-dev-rev-b.dts | 8 
 1 file changed, 8 deletions(-)

diff --git a/arch/arm/boot/dts/vf610-zii-dev-rev-b.dts 
b/arch/arm/boot/dts/vf610-zii-dev-rev-b.dts
index c0fc3f2..646c90c 100644
--- a/arch/arm/boot/dts/vf610-zii-dev-rev-b.dts
+++ b/arch/arm/boot/dts/vf610-zii-dev-rev-b.dts
@@ -97,10 +97,6 @@
phy-mode = "rgmii-txid";
link = <
>;
-   fixed-link {
-   speed = <1000>;
-   full-duplex;
-   };
};
 
port@6 {
@@ -165,10 +161,6 @@
label = "dsa";
phy-mode = "rgmii-txid";
link = <>;
-   fixed-link {
-   speed = <1000>;
-   full-duplex;
-   };
};
};
mdio {
-- 
2.5.5



[PATCH v4 2/3] ARM: dts: vf610-zii-dev: Add .dts file for rev. C

2016-12-18 Thread Andrey Smirnov
Add .dts file for rev. C of the board by factoring out commonalities
into a shared include file (vf610-zii-dev-rev-b-c.dtsi) and deriving
revision specific file from it (vf610-zii-dev-rev-b.dts and
vf610-zii-dev-reb-c.dts).

Signed-off-by: Andrey Smirnov 
---

Changes since v3:

- Added node for AT86RF233 chip on SPI0

 arch/arm/boot/dts/Makefile|   3 +-
 arch/arm/boot/dts/vf610-zii-dev-rev-b.dts | 300 +-
 arch/arm/boot/dts/vf610-zii-dev-rev-c.dts | 413 ++
 arch/arm/boot/dts/vf610-zii-dev.dtsi  | 383 +++
 4 files changed, 799 insertions(+), 300 deletions(-)
 create mode 100644 arch/arm/boot/dts/vf610-zii-dev-rev-c.dts
 create mode 100644 arch/arm/boot/dts/vf610-zii-dev.dtsi

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index befcd26..9f0d2a1 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -442,7 +442,8 @@ dtb-$(CONFIG_SOC_VF610) += \
vf610-cosmic.dtb \
vf610m4-cosmic.dtb \
vf610-twr.dtb \
-   vf610-zii-dev-rev-b.dtb
+   vf610-zii-dev-rev-b.dtb \
+   vf610-zii-dev-rev-c.dtb
 dtb-$(CONFIG_ARCH_MXS) += \
imx23-evk.dtb \
imx23-olinuxino.dtb \
diff --git a/arch/arm/boot/dts/vf610-zii-dev-rev-b.dts 
b/arch/arm/boot/dts/vf610-zii-dev-rev-b.dts
index 2210811..c0fc3f2 100644
--- a/arch/arm/boot/dts/vf610-zii-dev-rev-b.dts
+++ b/arch/arm/boot/dts/vf610-zii-dev-rev-b.dts
@@ -43,32 +43,12 @@
  */
 
 /dts-v1/;
-#include "vf610.dtsi"
+#include "vf610-zii-dev.dtsi"
 
 / {
model = "ZII VF610 Development Board, Rev B";
compatible = "zii,vf610dev-b", "zii,vf610dev", "fsl,vf610";
 
-   chosen {
-   stdout-path = "serial0:115200n8";
-   };
-
-   memory {
-   reg = <0x8000 0x2000>;
-   };
-
-   gpio-leds {
-   compatible = "gpio-leds";
-   pinctrl-0 = <_leds_debug>;
-   pinctrl-names = "default";
-
-   debug {
-   label = "zii:green:debug1";
-   gpios = < 10 GPIO_ACTIVE_HIGH>;
-   linux,default-trigger = "heartbeat";
-   };
-   };
-
mdio-mux {
compatible = "mdio-mux-gpio";
pinctrl-0 = <_mdio_mux>;
@@ -281,25 +261,6 @@
};
};
 
-   reg_vcc_3v3_mcu: regulator-vcc-3v3-mcu {
-   compatible = "regulator-fixed";
-   regulator-name = "vcc_3v3_mcu";
-   regulator-min-microvolt = <330>;
-   regulator-max-microvolt = <330>;
-   };
-
-   usb0_vbus: regulator-usb0-vbus {
-   compatible = "regulator-fixed";
-   pinctrl-0 = <_usb_vbus>;
-   regulator-name = "usb_vbus";
-   regulator-min-microvolt = <500>;
-   regulator-max-microvolt = <500>;
-   enable-active-high;
-   regulator-always-on;
-   regulator-boot-on;
-   gpio = < 6 0>;
-   };
-
spi0 {
compatible = "spi-gpio";
pinctrl-0 = <_gpio_spi0>;
@@ -336,49 +297,6 @@
};
 };
 
- {
-   pinctrl-names = "default";
-   pinctrl-0 = <_adc0_ad5>;
-   vref-supply = <_vcc_3v3_mcu>;
-   status = "okay";
-};
-
- {
-   status = "okay";
-};
-
- {
-   pinctrl-names = "default";
-   pinctrl-0 = <_esdhc1>;
-   bus-width = <4>;
-   status = "okay";
-};
-
- {
-   phy-mode = "rmii";
-   pinctrl-names = "default";
-   pinctrl-0 = <_fec0>;
-   status = "okay";
-};
-
- {
-   phy-mode = "rmii";
-   pinctrl-names = "default";
-   pinctrl-0 = <_fec1>;
-   status = "okay";
-
-   fixed-link {
-  speed = <100>;
-  full-duplex;
-   };
-
-   mdio1: mdio {
-   #address-cells = <1>;
-   #size-cells = <0>;
-   status = "okay";
-   };
-};
-
  {
clock-frequency = <10>;
pinctrl-names = "default";
@@ -403,33 +321,6 @@
interrupt-parent = <>;
interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
};
-
-   lm75@48 {
-   compatible = "national,lm75";
-   reg = <0x48>;
-   };
-
-   at24c04@50 {
-   compatible = "atmel,24c04";
-   reg = <0x50>;
-   };
-
-   at24c04@52 {
-   compatible = "atmel,24c04";
-   reg = <0x52>;
-   };
-
-   ds1682@6b {
-   compatible = "dallas,ds1682";
-   reg = <0x6b>;
-   };
-};
-
- {
-   clock-frequency = <10>;
-   pinctrl-names = "default";
-   pinctrl-0 = <_i2c1>;
-   status = "okay";
 };
 
  {
@@ -499,120 +390,8 @@
};
 };
 
- {
-   pinctrl-names = "default";
-   pinctrl-0 = <_uart0>;
-   status = "okay";
-};
-
- {
-   pinctrl-names = 

[PATCH v4 1/3] ARM: dts: vf610-zii-dev-rev-b: Remove leftover PWM pingroup

2016-12-18 Thread Andrey Smirnov
Remove pwm0grp since it is:

a) Not referenced anywhere in the DTS file (unlike Tower board it
is based on, this board does not use/expose FTM0)

b) Configures PTB2 and PTB3 in a way that contradicts
pinctrl-mdio-mux

Signed-off-by: Andrey Smirnov 
---

Changes since v3:

- None

 arch/arm/boot/dts/vf610-zii-dev-rev-b.dts | 9 -
 1 file changed, 9 deletions(-)

diff --git a/arch/arm/boot/dts/vf610-zii-dev-rev-b.dts 
b/arch/arm/boot/dts/vf610-zii-dev-rev-b.dts
index fa19cfd..2210811 100644
--- a/arch/arm/boot/dts/vf610-zii-dev-rev-b.dts
+++ b/arch/arm/boot/dts/vf610-zii-dev-rev-b.dts
@@ -677,15 +677,6 @@
>;
};
 
-   pinctrl_pwm0: pwm0grp {
-   fsl,pins = <
-   VF610_PAD_PTB0__FTM0_CH00x1582
-   VF610_PAD_PTB1__FTM0_CH10x1582
-   VF610_PAD_PTB2__FTM0_CH20x1582
-   VF610_PAD_PTB3__FTM0_CH30x1582
-   >;
-   };
-
pinctrl_qspi0: qspi0grp {
fsl,pins = <
VF610_PAD_PTD7__QSPI0_B_QSCK0x31c3
-- 
2.5.5



[PATCH v4 2/3] ARM: dts: vf610-zii-dev: Add .dts file for rev. C

2016-12-18 Thread Andrey Smirnov
Add .dts file for rev. C of the board by factoring out commonalities
into a shared include file (vf610-zii-dev-rev-b-c.dtsi) and deriving
revision specific file from it (vf610-zii-dev-rev-b.dts and
vf610-zii-dev-reb-c.dts).

Signed-off-by: Andrey Smirnov 
---

Changes since v3:

- Added node for AT86RF233 chip on SPI0

 arch/arm/boot/dts/Makefile|   3 +-
 arch/arm/boot/dts/vf610-zii-dev-rev-b.dts | 300 +-
 arch/arm/boot/dts/vf610-zii-dev-rev-c.dts | 413 ++
 arch/arm/boot/dts/vf610-zii-dev.dtsi  | 383 +++
 4 files changed, 799 insertions(+), 300 deletions(-)
 create mode 100644 arch/arm/boot/dts/vf610-zii-dev-rev-c.dts
 create mode 100644 arch/arm/boot/dts/vf610-zii-dev.dtsi

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index befcd26..9f0d2a1 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -442,7 +442,8 @@ dtb-$(CONFIG_SOC_VF610) += \
vf610-cosmic.dtb \
vf610m4-cosmic.dtb \
vf610-twr.dtb \
-   vf610-zii-dev-rev-b.dtb
+   vf610-zii-dev-rev-b.dtb \
+   vf610-zii-dev-rev-c.dtb
 dtb-$(CONFIG_ARCH_MXS) += \
imx23-evk.dtb \
imx23-olinuxino.dtb \
diff --git a/arch/arm/boot/dts/vf610-zii-dev-rev-b.dts 
b/arch/arm/boot/dts/vf610-zii-dev-rev-b.dts
index 2210811..c0fc3f2 100644
--- a/arch/arm/boot/dts/vf610-zii-dev-rev-b.dts
+++ b/arch/arm/boot/dts/vf610-zii-dev-rev-b.dts
@@ -43,32 +43,12 @@
  */
 
 /dts-v1/;
-#include "vf610.dtsi"
+#include "vf610-zii-dev.dtsi"
 
 / {
model = "ZII VF610 Development Board, Rev B";
compatible = "zii,vf610dev-b", "zii,vf610dev", "fsl,vf610";
 
-   chosen {
-   stdout-path = "serial0:115200n8";
-   };
-
-   memory {
-   reg = <0x8000 0x2000>;
-   };
-
-   gpio-leds {
-   compatible = "gpio-leds";
-   pinctrl-0 = <_leds_debug>;
-   pinctrl-names = "default";
-
-   debug {
-   label = "zii:green:debug1";
-   gpios = < 10 GPIO_ACTIVE_HIGH>;
-   linux,default-trigger = "heartbeat";
-   };
-   };
-
mdio-mux {
compatible = "mdio-mux-gpio";
pinctrl-0 = <_mdio_mux>;
@@ -281,25 +261,6 @@
};
};
 
-   reg_vcc_3v3_mcu: regulator-vcc-3v3-mcu {
-   compatible = "regulator-fixed";
-   regulator-name = "vcc_3v3_mcu";
-   regulator-min-microvolt = <330>;
-   regulator-max-microvolt = <330>;
-   };
-
-   usb0_vbus: regulator-usb0-vbus {
-   compatible = "regulator-fixed";
-   pinctrl-0 = <_usb_vbus>;
-   regulator-name = "usb_vbus";
-   regulator-min-microvolt = <500>;
-   regulator-max-microvolt = <500>;
-   enable-active-high;
-   regulator-always-on;
-   regulator-boot-on;
-   gpio = < 6 0>;
-   };
-
spi0 {
compatible = "spi-gpio";
pinctrl-0 = <_gpio_spi0>;
@@ -336,49 +297,6 @@
};
 };
 
- {
-   pinctrl-names = "default";
-   pinctrl-0 = <_adc0_ad5>;
-   vref-supply = <_vcc_3v3_mcu>;
-   status = "okay";
-};
-
- {
-   status = "okay";
-};
-
- {
-   pinctrl-names = "default";
-   pinctrl-0 = <_esdhc1>;
-   bus-width = <4>;
-   status = "okay";
-};
-
- {
-   phy-mode = "rmii";
-   pinctrl-names = "default";
-   pinctrl-0 = <_fec0>;
-   status = "okay";
-};
-
- {
-   phy-mode = "rmii";
-   pinctrl-names = "default";
-   pinctrl-0 = <_fec1>;
-   status = "okay";
-
-   fixed-link {
-  speed = <100>;
-  full-duplex;
-   };
-
-   mdio1: mdio {
-   #address-cells = <1>;
-   #size-cells = <0>;
-   status = "okay";
-   };
-};
-
  {
clock-frequency = <10>;
pinctrl-names = "default";
@@ -403,33 +321,6 @@
interrupt-parent = <>;
interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
};
-
-   lm75@48 {
-   compatible = "national,lm75";
-   reg = <0x48>;
-   };
-
-   at24c04@50 {
-   compatible = "atmel,24c04";
-   reg = <0x50>;
-   };
-
-   at24c04@52 {
-   compatible = "atmel,24c04";
-   reg = <0x52>;
-   };
-
-   ds1682@6b {
-   compatible = "dallas,ds1682";
-   reg = <0x6b>;
-   };
-};
-
- {
-   clock-frequency = <10>;
-   pinctrl-names = "default";
-   pinctrl-0 = <_i2c1>;
-   status = "okay";
 };
 
  {
@@ -499,120 +390,8 @@
};
 };
 
- {
-   pinctrl-names = "default";
-   pinctrl-0 = <_uart0>;
-   status = "okay";
-};
-
- {
-   pinctrl-names = "default";
-   pinctrl-0 

[PATCH v4 1/3] ARM: dts: vf610-zii-dev-rev-b: Remove leftover PWM pingroup

2016-12-18 Thread Andrey Smirnov
Remove pwm0grp since it is:

a) Not referenced anywhere in the DTS file (unlike Tower board it
is based on, this board does not use/expose FTM0)

b) Configures PTB2 and PTB3 in a way that contradicts
pinctrl-mdio-mux

Signed-off-by: Andrey Smirnov 
---

Changes since v3:

- None

 arch/arm/boot/dts/vf610-zii-dev-rev-b.dts | 9 -
 1 file changed, 9 deletions(-)

diff --git a/arch/arm/boot/dts/vf610-zii-dev-rev-b.dts 
b/arch/arm/boot/dts/vf610-zii-dev-rev-b.dts
index fa19cfd..2210811 100644
--- a/arch/arm/boot/dts/vf610-zii-dev-rev-b.dts
+++ b/arch/arm/boot/dts/vf610-zii-dev-rev-b.dts
@@ -677,15 +677,6 @@
>;
};
 
-   pinctrl_pwm0: pwm0grp {
-   fsl,pins = <
-   VF610_PAD_PTB0__FTM0_CH00x1582
-   VF610_PAD_PTB1__FTM0_CH10x1582
-   VF610_PAD_PTB2__FTM0_CH20x1582
-   VF610_PAD_PTB3__FTM0_CH30x1582
-   >;
-   };
-
pinctrl_qspi0: qspi0grp {
fsl,pins = <
VF610_PAD_PTD7__QSPI0_B_QSCK0x31c3
-- 
2.5.5



KREDITANGEBOTE

2016-12-18 Thread Timothy Connor
-- 
Darlehen für alle möglichen Zwecke
Wir bieten Ihnen zwischen € 5000 und € 20 Millionen, können Sie Ihre
Anfrage direkt per E-Mail: mkfinancial.onl...@gmail.com


KREDITANGEBOTE

2016-12-18 Thread Timothy Connor
-- 
Darlehen für alle möglichen Zwecke
Wir bieten Ihnen zwischen € 5000 und € 20 Millionen, können Sie Ihre
Anfrage direkt per E-Mail: mkfinancial.onl...@gmail.com


Re: [PATCH v2] clk: imx: pllv3: support fractional multiplier on vf610 PLL1/PLL2

2016-12-18 Thread Andrey Smirnov
On Wed, Dec 14, 2016 at 12:14 AM, Nikita Yushchenko
 wrote:
> On vf610, PLL1 and PLL2 have registers to configure fractional part of
> frequency multiplier.
>
> This patch adds support for these registers.
>
> This fixes "fast system clock" issue on boards where bootloader sets
> fractional multiplier for PLL1.
>
> Suggested-by: Andrey Smirnov 
> CC: Chris Healy 
> Signed-off-by: Nikita Yushchenko 
> ---
> This version restructures the patch:
> - introduce explicit structure to store mf (multiply factor) consisting of
>   integer part, numenator and denumenator;

Spelling. See my comments in the actual code below.

> - provides routines that:
>   - calculate rate based on parent rate and mf,
>   - read mf from hw,
>   - write mf to hw,
>   - calculate best mf for wanted rate;

I do see the benefit of having calculation routines since those get to
be reused in multiple places, read/write subroutines, OTOH, are used
only once, so I'd encourage you to drop them and move that code back
to where it was in v1.

If you are going to make changes to this patch, I also would like to
urge you to consider naming you calculation routines in a more
consistent fashion. Right now what you have is
clk_pllv3_vf610_mf_for_rate and clk_pllv3_vf610_calc_rate, those two
functions are symmetric in what they do, but, IMHO, that symmetricity
is not very obvious in their names. I'd suggest converting it as such
(and yes, the second one does return struct clk_pllv3_vf610_mf by
value):

static unsigned long clk_pllv3_vf610_mf_to_rate(unsigned long
parent_rate, const struct clk_pllv3_vf610_mf *mf)

and

struct clk_pllv3_vf610_mf clk_pllv3_vf610_rate_to_mf(unsigned long
parent_rate, unsigned long rate)


That all being said, those all are just my personal preferences, so
take them with a grain of salt.


> - implement recalc_rate() / round_rate() / set_rate() based on these.
>
>  drivers/clk/imx/clk-pllv3.c | 110 
> 
>  drivers/clk/imx/clk-vf610.c |   4 +-
>  drivers/clk/imx/clk.h   |   1 +
>  3 files changed, 113 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/clk/imx/clk-pllv3.c b/drivers/clk/imx/clk-pllv3.c
> index 7a6acc3e4a92..89ab42e7d6c0 100644
> --- a/drivers/clk/imx/clk-pllv3.c
> +++ b/drivers/clk/imx/clk-pllv3.c
> @@ -21,6 +21,9 @@
>  #define PLL_NUM_OFFSET 0x10
>  #define PLL_DENOM_OFFSET   0x20
>
> +#define PLL_VF610_NUM_OFFSET   0x20
> +#define PLL_VF610_DENOM_OFFSET 0x30
> +
>  #define BM_PLL_POWER   (0x1 << 12)
>  #define BM_PLL_LOCK(0x1 << 31)
>  #define IMX7_ENET_PLL_POWER(0x1 << 5)
> @@ -292,6 +295,110 @@ static const struct clk_ops clk_pllv3_av_ops = {
> .set_rate   = clk_pllv3_av_set_rate,
>  };
>
> +struct clk_pllv3_vf610_mf {
> +   u32 mfi;/* integer part, can be 20 or 22 */
> +   u32 mfn;/* numinator, 30-bit value */

s/numinator/numerator/

> +   u32 mfd;/* denomenator, 30-bit value, must be less than mfn */

s/denomenator/denominator/

Anyway, regardless of my comments above:

Teseted-by: Andrey Smirnov 

Regards,
Andrey Smirnov


Re: [PATCH v2] clk: imx: pllv3: support fractional multiplier on vf610 PLL1/PLL2

2016-12-18 Thread Andrey Smirnov
On Wed, Dec 14, 2016 at 12:14 AM, Nikita Yushchenko
 wrote:
> On vf610, PLL1 and PLL2 have registers to configure fractional part of
> frequency multiplier.
>
> This patch adds support for these registers.
>
> This fixes "fast system clock" issue on boards where bootloader sets
> fractional multiplier for PLL1.
>
> Suggested-by: Andrey Smirnov 
> CC: Chris Healy 
> Signed-off-by: Nikita Yushchenko 
> ---
> This version restructures the patch:
> - introduce explicit structure to store mf (multiply factor) consisting of
>   integer part, numenator and denumenator;

Spelling. See my comments in the actual code below.

> - provides routines that:
>   - calculate rate based on parent rate and mf,
>   - read mf from hw,
>   - write mf to hw,
>   - calculate best mf for wanted rate;

I do see the benefit of having calculation routines since those get to
be reused in multiple places, read/write subroutines, OTOH, are used
only once, so I'd encourage you to drop them and move that code back
to where it was in v1.

If you are going to make changes to this patch, I also would like to
urge you to consider naming you calculation routines in a more
consistent fashion. Right now what you have is
clk_pllv3_vf610_mf_for_rate and clk_pllv3_vf610_calc_rate, those two
functions are symmetric in what they do, but, IMHO, that symmetricity
is not very obvious in their names. I'd suggest converting it as such
(and yes, the second one does return struct clk_pllv3_vf610_mf by
value):

static unsigned long clk_pllv3_vf610_mf_to_rate(unsigned long
parent_rate, const struct clk_pllv3_vf610_mf *mf)

and

struct clk_pllv3_vf610_mf clk_pllv3_vf610_rate_to_mf(unsigned long
parent_rate, unsigned long rate)


That all being said, those all are just my personal preferences, so
take them with a grain of salt.


> - implement recalc_rate() / round_rate() / set_rate() based on these.
>
>  drivers/clk/imx/clk-pllv3.c | 110 
> 
>  drivers/clk/imx/clk-vf610.c |   4 +-
>  drivers/clk/imx/clk.h   |   1 +
>  3 files changed, 113 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/clk/imx/clk-pllv3.c b/drivers/clk/imx/clk-pllv3.c
> index 7a6acc3e4a92..89ab42e7d6c0 100644
> --- a/drivers/clk/imx/clk-pllv3.c
> +++ b/drivers/clk/imx/clk-pllv3.c
> @@ -21,6 +21,9 @@
>  #define PLL_NUM_OFFSET 0x10
>  #define PLL_DENOM_OFFSET   0x20
>
> +#define PLL_VF610_NUM_OFFSET   0x20
> +#define PLL_VF610_DENOM_OFFSET 0x30
> +
>  #define BM_PLL_POWER   (0x1 << 12)
>  #define BM_PLL_LOCK(0x1 << 31)
>  #define IMX7_ENET_PLL_POWER(0x1 << 5)
> @@ -292,6 +295,110 @@ static const struct clk_ops clk_pllv3_av_ops = {
> .set_rate   = clk_pllv3_av_set_rate,
>  };
>
> +struct clk_pllv3_vf610_mf {
> +   u32 mfi;/* integer part, can be 20 or 22 */
> +   u32 mfn;/* numinator, 30-bit value */

s/numinator/numerator/

> +   u32 mfd;/* denomenator, 30-bit value, must be less than mfn */

s/denomenator/denominator/

Anyway, regardless of my comments above:

Teseted-by: Andrey Smirnov 

Regards,
Andrey Smirnov


Re: [PATCH] mm: simplify node/zone name printing

2016-12-18 Thread Vlastimil Babka
On 12/16/2016 01:32 PM, Michal Hocko wrote:
> From: Michal Hocko 
> 
> show_node currently only prints Node id while it is always followed by
> printing zone->name. As the node information is conditional to
> CONFIG_NUMA we have to be careful to always terminate the previous
> continuation line before printing the zone name. This is quite ugly
> and easy to mess up. Let's rename show_node to show_zone_node and
> make sure that it will always start at a new line. We can drop the ugly
> printk(KERN_CONT "\n") from show_free_areas.
> 
> Signed-off-by: Michal Hocko 

Acked-by: Vlastimil Babka 

Just a question below... (CC printk experts)

> ---
> Hi,
> this has been sitting in my tree since oct and I completely forgot about
> it. Does this look like a reasonable clean up to you?

Yeah, even besides the removed line, which my question is about

>  mm/page_alloc.c | 14 ++
>  1 file changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 3f2c9e535f7f..5324efa8b9d0 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -4120,10 +4120,12 @@ unsigned long nr_free_pagecache_pages(void)
>   return nr_free_zone_pages(gfp_zone(GFP_HIGHUSER_MOVABLE));
>  }
>  
> -static inline void show_node(struct zone *zone)
> +static inline void show_zone_node(struct zone *zone)
>  {
>   if (IS_ENABLED(CONFIG_NUMA))
> - printk("Node %d ", zone_to_nid(zone));
> + printk("Node %d %s", zone_to_nid(zone), zone->name);
> + else
> + printk("%s: ", zone->name);
>  }
>  
>  long si_mem_available(void)
> @@ -4371,9 +4373,8 @@ void show_free_areas(unsigned int filter)
>   for_each_online_cpu(cpu)
>   free_pcp += per_cpu_ptr(zone->pageset, cpu)->pcp.count;
>  
> - show_node(zone);
> + show_zone_node(zone);
>   printk(KERN_CONT
> - "%s"
>   " free:%lukB"
>   " min:%lukB"
>   " low:%lukB"
> @@ -4396,7 +4397,6 @@ void show_free_areas(unsigned int filter)
>   " local_pcp:%ukB"
>   " free_cma:%lukB"
>   "\n",
> - zone->name,
>   K(zone_page_state(zone, NR_FREE_PAGES)),
>   K(min_wmark_pages(zone)),
>   K(low_wmark_pages(zone)),
> @@ -4421,7 +4421,6 @@ void show_free_areas(unsigned int filter)
>   printk("lowmem_reserve[]:");
>   for (i = 0; i < MAX_NR_ZONES; i++)
>   printk(KERN_CONT " %ld", zone->lowmem_reserve[i]);
> - printk(KERN_CONT "\n");

So there's really no functional difference between terminating line
explicitly with "\n", and doing a followup printk() without KERN_CONT?
I agree that a KERN_CONT line just to print "\n" is ugly, just want to
be sure we are really safe without it, considering how KERN_CONT has
been recently changed etc.

>   }
>  
>   for_each_populated_zone(zone) {
> @@ -4431,8 +4430,7 @@ void show_free_areas(unsigned int filter)
>  
>   if (skip_free_areas_node(filter, zone_to_nid(zone)))
>   continue;
> - show_node(zone);
> - printk(KERN_CONT "%s: ", zone->name);
> + show_zone_node(zone);
>  
>   spin_lock_irqsave(>lock, flags);
>   for (order = 0; order < MAX_ORDER; order++) {
> 



Re: [PATCH] mm: simplify node/zone name printing

2016-12-18 Thread Vlastimil Babka
On 12/16/2016 01:32 PM, Michal Hocko wrote:
> From: Michal Hocko 
> 
> show_node currently only prints Node id while it is always followed by
> printing zone->name. As the node information is conditional to
> CONFIG_NUMA we have to be careful to always terminate the previous
> continuation line before printing the zone name. This is quite ugly
> and easy to mess up. Let's rename show_node to show_zone_node and
> make sure that it will always start at a new line. We can drop the ugly
> printk(KERN_CONT "\n") from show_free_areas.
> 
> Signed-off-by: Michal Hocko 

Acked-by: Vlastimil Babka 

Just a question below... (CC printk experts)

> ---
> Hi,
> this has been sitting in my tree since oct and I completely forgot about
> it. Does this look like a reasonable clean up to you?

Yeah, even besides the removed line, which my question is about

>  mm/page_alloc.c | 14 ++
>  1 file changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 3f2c9e535f7f..5324efa8b9d0 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -4120,10 +4120,12 @@ unsigned long nr_free_pagecache_pages(void)
>   return nr_free_zone_pages(gfp_zone(GFP_HIGHUSER_MOVABLE));
>  }
>  
> -static inline void show_node(struct zone *zone)
> +static inline void show_zone_node(struct zone *zone)
>  {
>   if (IS_ENABLED(CONFIG_NUMA))
> - printk("Node %d ", zone_to_nid(zone));
> + printk("Node %d %s", zone_to_nid(zone), zone->name);
> + else
> + printk("%s: ", zone->name);
>  }
>  
>  long si_mem_available(void)
> @@ -4371,9 +4373,8 @@ void show_free_areas(unsigned int filter)
>   for_each_online_cpu(cpu)
>   free_pcp += per_cpu_ptr(zone->pageset, cpu)->pcp.count;
>  
> - show_node(zone);
> + show_zone_node(zone);
>   printk(KERN_CONT
> - "%s"
>   " free:%lukB"
>   " min:%lukB"
>   " low:%lukB"
> @@ -4396,7 +4397,6 @@ void show_free_areas(unsigned int filter)
>   " local_pcp:%ukB"
>   " free_cma:%lukB"
>   "\n",
> - zone->name,
>   K(zone_page_state(zone, NR_FREE_PAGES)),
>   K(min_wmark_pages(zone)),
>   K(low_wmark_pages(zone)),
> @@ -4421,7 +4421,6 @@ void show_free_areas(unsigned int filter)
>   printk("lowmem_reserve[]:");
>   for (i = 0; i < MAX_NR_ZONES; i++)
>   printk(KERN_CONT " %ld", zone->lowmem_reserve[i]);
> - printk(KERN_CONT "\n");

So there's really no functional difference between terminating line
explicitly with "\n", and doing a followup printk() without KERN_CONT?
I agree that a KERN_CONT line just to print "\n" is ugly, just want to
be sure we are really safe without it, considering how KERN_CONT has
been recently changed etc.

>   }
>  
>   for_each_populated_zone(zone) {
> @@ -4431,8 +4430,7 @@ void show_free_areas(unsigned int filter)
>  
>   if (skip_free_areas_node(filter, zone_to_nid(zone)))
>   continue;
> - show_node(zone);
> - printk(KERN_CONT "%s: ", zone->name);
> + show_zone_node(zone);
>  
>   spin_lock_irqsave(>lock, flags);
>   for (order = 0; order < MAX_ORDER; order++) {
> 



Re: [PATCH 1/8] extcon: axp288: Remove dependency on non-existing platform_data

2016-12-18 Thread Chanwoo Choi
Hi Hans,

This series look good to me. I added the comment
for patch4/5. If you agree following two comment, I'll merge these series for 
4.11.

- patch4 uses the EXTCON_NONE when setting the previous_cable in probe()
- patch5, I don't want to use the dev_info on the fly. So, I want to drop the 
patch5.

Regards,
Chanwoo Choi

On 2016년 12월 19일 15:10, Chanwoo Choi wrote:
> Hi Hans,
> 
> On 2016년 12월 19일 09:13, Hans de Goede wrote:
>> When the extcon_axp288 driver was originally merged, it was merged with
>> a dependency on some other driver providing platform data for it.
>>
>> However such another driver was never merged, so the extcon_axp288 as
>> merged upstream has never worked, its probe method simply always returns
>> -ENODEV.
>>
>> This commit drops the dependency on the pdata always being there, instead
>> it treats not having pdata as the pdata having a NULL gpio_mux_control,
>> something which the code was already prepared to handle.
>>
>> Note that the code for controlling the mux_control gpio is left in place,
>> as this may be necessary to allow the axp288 pmic to properly detect the
>> charger type (instead of assuming 500mA max charge current) on some
>> tablets. This will make it easier for future patches to add support for
>> this gpio by getting the gpio info from somewhere.
>>
>> Signed-off-by: Hans de Goede 
>> ---
>>  drivers/extcon/extcon-axp288.c | 25 ++---
>>  1 file changed, 10 insertions(+), 15 deletions(-)
> 
> Looks good to me.
> Acked-by: Chanwoo Choi 
> 



Re: [PATCH 1/8] extcon: axp288: Remove dependency on non-existing platform_data

2016-12-18 Thread Chanwoo Choi
Hi Hans,

This series look good to me. I added the comment
for patch4/5. If you agree following two comment, I'll merge these series for 
4.11.

- patch4 uses the EXTCON_NONE when setting the previous_cable in probe()
- patch5, I don't want to use the dev_info on the fly. So, I want to drop the 
patch5.

Regards,
Chanwoo Choi

On 2016년 12월 19일 15:10, Chanwoo Choi wrote:
> Hi Hans,
> 
> On 2016년 12월 19일 09:13, Hans de Goede wrote:
>> When the extcon_axp288 driver was originally merged, it was merged with
>> a dependency on some other driver providing platform data for it.
>>
>> However such another driver was never merged, so the extcon_axp288 as
>> merged upstream has never worked, its probe method simply always returns
>> -ENODEV.
>>
>> This commit drops the dependency on the pdata always being there, instead
>> it treats not having pdata as the pdata having a NULL gpio_mux_control,
>> something which the code was already prepared to handle.
>>
>> Note that the code for controlling the mux_control gpio is left in place,
>> as this may be necessary to allow the axp288 pmic to properly detect the
>> charger type (instead of assuming 500mA max charge current) on some
>> tablets. This will make it easier for future patches to add support for
>> this gpio by getting the gpio info from somewhere.
>>
>> Signed-off-by: Hans de Goede 
>> ---
>>  drivers/extcon/extcon-axp288.c | 25 ++---
>>  1 file changed, 10 insertions(+), 15 deletions(-)
> 
> Looks good to me.
> Acked-by: Chanwoo Choi 
> 



Re: [PATCH 2/8] extcon: axp288: Remove usb_phy notification code

2016-12-18 Thread Chanwoo Choi
Hi Hans,

On 2016년 12월 19일 09:13, Hans de Goede wrote:
> The usb_phy based intel-usb-phy code never got merged into the
> mainline kernel, so the devm_usb_get_phy() call will always fail,
> blocking the driver from loading.
> 
> Since new drivers should use the generic-phy framework, not the
> old-style usb_phy stuff, keeping this around is not useful.
> 
> Therefor this patch removes the usb_phy notification bits, which together
> with the patch to remove the platform_data dependency, makes this driver
> actually successfully probe on systems with an axp288 pmic.
> 
> Signed-off-by: Hans de Goede 
> ---
>  drivers/extcon/extcon-axp288.c | 12 
>  1 file changed, 12 deletions(-)
> 
> diff --git a/drivers/extcon/extcon-axp288.c b/drivers/extcon/extcon-axp288.c
> index a84fab8..3d5e84e 100644
> --- a/drivers/extcon/extcon-axp288.c
> +++ b/drivers/extcon/extcon-axp288.c
> @@ -21,7 +21,6 @@
>  #include 
>  #include 
>  #include 
> -#include 
>  #include 
>  #include 
>  #include 
> @@ -116,7 +115,6 @@ struct axp288_extcon_info {
>   int irq[EXTCON_IRQ_END];
>   struct extcon_dev *edev;
>   struct notifier_block extcon_nb;
> - struct usb_phy *otg;
>  };
>  
>  /* Power up/down reason string array */
> @@ -220,9 +218,6 @@ static int axp288_handle_chrg_det_event(struct 
> axp288_extcon_info *info)
>   gpiod_set_value(info->gpio_mux_cntl,
>   vbus_attach ? EXTCON_GPIO_MUX_SEL_SOC
>   : EXTCON_GPIO_MUX_SEL_PMIC);
> -
> - atomic_notifier_call_chain(>otg->notifier,
> - vbus_attach ? USB_EVENT_VBUS : USB_EVENT_NONE, NULL);
>   }
>  
>   if (notify_charger)
> @@ -303,13 +298,6 @@ static int axp288_extcon_probe(struct platform_device 
> *pdev)
>   return ret;
>   }
>  
> - /* Get otg transceiver phy */
> - info->otg = devm_usb_get_phy(>dev, USB_PHY_TYPE_USB2);
> - if (IS_ERR(info->otg)) {
> - dev_err(>dev, "failed to get otg transceiver\n");
> - return PTR_ERR(info->otg);
> - }
> -
>   /* Set up gpio control for USB Mux */
>   if (info->gpio_mux_cntl) {
>   gpio = desc_to_gpio(info->gpio_mux_cntl);
> 

Looks good to me.
Acked-by: Chanwoo Choi 

-- 
Regards,
Chanwoo Choi


Re: [PATCH 2/8] extcon: axp288: Remove usb_phy notification code

2016-12-18 Thread Chanwoo Choi
Hi Hans,

On 2016년 12월 19일 09:13, Hans de Goede wrote:
> The usb_phy based intel-usb-phy code never got merged into the
> mainline kernel, so the devm_usb_get_phy() call will always fail,
> blocking the driver from loading.
> 
> Since new drivers should use the generic-phy framework, not the
> old-style usb_phy stuff, keeping this around is not useful.
> 
> Therefor this patch removes the usb_phy notification bits, which together
> with the patch to remove the platform_data dependency, makes this driver
> actually successfully probe on systems with an axp288 pmic.
> 
> Signed-off-by: Hans de Goede 
> ---
>  drivers/extcon/extcon-axp288.c | 12 
>  1 file changed, 12 deletions(-)
> 
> diff --git a/drivers/extcon/extcon-axp288.c b/drivers/extcon/extcon-axp288.c
> index a84fab8..3d5e84e 100644
> --- a/drivers/extcon/extcon-axp288.c
> +++ b/drivers/extcon/extcon-axp288.c
> @@ -21,7 +21,6 @@
>  #include 
>  #include 
>  #include 
> -#include 
>  #include 
>  #include 
>  #include 
> @@ -116,7 +115,6 @@ struct axp288_extcon_info {
>   int irq[EXTCON_IRQ_END];
>   struct extcon_dev *edev;
>   struct notifier_block extcon_nb;
> - struct usb_phy *otg;
>  };
>  
>  /* Power up/down reason string array */
> @@ -220,9 +218,6 @@ static int axp288_handle_chrg_det_event(struct 
> axp288_extcon_info *info)
>   gpiod_set_value(info->gpio_mux_cntl,
>   vbus_attach ? EXTCON_GPIO_MUX_SEL_SOC
>   : EXTCON_GPIO_MUX_SEL_PMIC);
> -
> - atomic_notifier_call_chain(>otg->notifier,
> - vbus_attach ? USB_EVENT_VBUS : USB_EVENT_NONE, NULL);
>   }
>  
>   if (notify_charger)
> @@ -303,13 +298,6 @@ static int axp288_extcon_probe(struct platform_device 
> *pdev)
>   return ret;
>   }
>  
> - /* Get otg transceiver phy */
> - info->otg = devm_usb_get_phy(>dev, USB_PHY_TYPE_USB2);
> - if (IS_ERR(info->otg)) {
> - dev_err(>dev, "failed to get otg transceiver\n");
> - return PTR_ERR(info->otg);
> - }
> -
>   /* Set up gpio control for USB Mux */
>   if (info->gpio_mux_cntl) {
>   gpio = desc_to_gpio(info->gpio_mux_cntl);
> 

Looks good to me.
Acked-by: Chanwoo Choi 

-- 
Regards,
Chanwoo Choi


warning: (UBIFS_FS_ENCRYPTION) selects FS_ENCRYPTION which has unmet direct dependencies (BLOCK)

2016-12-18 Thread kbuild test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   b0b3a37b908b5906524c11f3ca12cd7c9d4adc1c
commit: d475a507457b5cafa428871a473d0dcc828c5f68 ubifs: Add skeleton for 
fscrypto
date:   6 days ago
config: x86_64-randconfig-x016-12191306 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
git checkout d475a507457b5cafa428871a473d0dcc828c5f68
# save the attached .config to linux build tree
make ARCH=x86_64 

All error/warnings (new ones prefixed by >>):

warning: (UBIFS_FS_ENCRYPTION) selects FS_ENCRYPTION which has unmet direct 
dependencies (BLOCK)
   fs/crypto/crypto.c: In function 'fscrypt_zeroout_range':
>> fs/crypto/crypto.c:355:9: error: implicit declaration of function 
>> 'bio_alloc' [-Werror=implicit-function-declaration]
  bio = bio_alloc(GFP_NOWAIT, 1);
^
>> fs/crypto/crypto.c:355:7: warning: assignment makes pointer from integer 
>> without a cast [-Wint-conversion]
  bio = bio_alloc(GFP_NOWAIT, 1);
  ^
>> fs/crypto/crypto.c:360:6: error: dereferencing pointer to incomplete type 
>> 'struct bio'
  bio->bi_bdev = inode->i_sb->s_bdev;
 ^~
>> fs/crypto/crypto.c:363:3: error: implicit declaration of function 
>> 'bio_set_op_attrs' [-Werror=implicit-function-declaration]
  bio_set_op_attrs(bio, REQ_OP_WRITE, 0);
  ^~~~
>> fs/crypto/crypto.c:364:9: error: implicit declaration of function 
>> 'bio_add_page' [-Werror=implicit-function-declaration]
  ret = bio_add_page(bio, ciphertext_page,
^~~~
>> fs/crypto/crypto.c:369:4: error: implicit declaration of function 'bio_put' 
>> [-Werror=implicit-function-declaration]
   bio_put(bio);
   ^~~
>> fs/crypto/crypto.c:373:9: error: implicit declaration of function 
>> 'submit_bio_wait' [-Werror=implicit-function-declaration]
  err = submit_bio_wait(bio);
^~~
   fs/crypto/crypto.c: In function 'fscrypt_d_revalidate':
>> fs/crypto/crypto.c:411:25: error: dereferencing pointer to incomplete type 
>> 'struct key'
 (ci->ci_keyring_key->flags & ((1 << KEY_FLAG_INVALIDATED) |
^~
>> fs/crypto/crypto.c:411:42: error: 'KEY_FLAG_INVALIDATED' undeclared (first 
>> use in this function)
 (ci->ci_keyring_key->flags & ((1 << KEY_FLAG_INVALIDATED) |
 ^~~~
   fs/crypto/crypto.c:411:42: note: each undeclared identifier is reported only 
once for each function it appears in
>> fs/crypto/crypto.c:412:14: error: 'KEY_FLAG_REVOKED' undeclared (first use 
>> in this function)
   (1 << KEY_FLAG_REVOKED) |
 ^~~~
>> fs/crypto/crypto.c:413:14: error: 'KEY_FLAG_DEAD' undeclared (first use in 
>> this function)
   (1 << KEY_FLAG_DEAD
 ^
   fs/crypto/crypto.c: In function 'completion_pages':
>> fs/crypto/crypto.c:457:2: error: implicit declaration of function 
>> 'bio_for_each_segment_all' [-Werror=implicit-function-declaration]
 bio_for_each_segment_all(bv, bio, i) {
 ^~~~
>> fs/crypto/crypto.c:457:39: error: expected ';' before '{' token
 bio_for_each_segment_all(bv, bio, i) {
  ^
   cc1: some warnings being treated as errors
--
   fs/crypto/keyinfo.c: In function 'validate_user_key':
>> fs/crypto/keyinfo.c:98:16: error: implicit declaration of function 
>> 'request_key' [-Werror=implicit-function-declaration]
 keyring_key = request_key(_type_logon, full_key_descriptor, NULL);
   ^~~
>> fs/crypto/keyinfo.c:98:29: error: 'key_type_logon' undeclared (first use in 
>> this function)
 keyring_key = request_key(_type_logon, full_key_descriptor, NULL);
^~
   fs/crypto/keyinfo.c:98:29: note: each undeclared identifier is reported only 
once for each function it appears in
>> fs/crypto/keyinfo.c:103:17: error: dereferencing pointer to incomplete type 
>> 'struct key'
 if (keyring_key->type != _type_logon) {
^~
>> fs/crypto/keyinfo.c:110:8: error: implicit declaration of function 
>> 'user_key_payload' [-Werror=implicit-function-declaration]
 ukp = user_key_payload(keyring_key);
   ^~~~
>> fs/crypto/keyinfo.c:110:6: warning: assignment makes pointer from integer 
>> without a cast [-Wint-conversion]
 ukp = user_key_payload(keyring_key);
 ^
>> fs/crypto/keyinfo.c:111:9: error: dereferencing pointer to incomplete type 
>> 'const struct user_key_payload'
 if (ukp->datalen != sizeof(struct fscrypt_key)) {
^~
   fs/crypto/keyinfo.c: In function 'fscrypt_get_encryption_info':
>> fs/crypto/keyinfo.c:327:40: error: 'KEY_FLAG_INVALIDATED' undeclared (first 
>> use in this function)
   (ci->ci_keyring_key->flags & ((1 << KEY_FLAG_INVALIDATED) |
   

[PATCH] nvmem: core: Allow ignoring length when reading a cell

2016-12-18 Thread Vivek Gautam
nvmem_cell_read() API fills in the argument 'len' with
the number of bytes read from the cell. Many users don't
care about this length value. So allow users to pass a
NULL pointer to this len field.

Signed-off-by: Vivek Gautam 
---

Based on torvalds's master branch.
 - Tested against 'next-20161219' tag on db410c (apq8016) target
   for thermal sensors.

 drivers/nvmem/core.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index 965911d..4c38842 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -970,7 +970,8 @@ static int __nvmem_cell_read(struct nvmem_device *nvmem,
if (cell->bit_offset || cell->nbits)
nvmem_shift_read_buffer_in_place(cell, buf);
 
-   *len = cell->bytes;
+   if (len)
+   *len = cell->bytes;
 
return 0;
 }
@@ -979,7 +980,8 @@ static int __nvmem_cell_read(struct nvmem_device *nvmem,
  * nvmem_cell_read() - Read a given nvmem cell
  *
  * @cell: nvmem cell to be read.
- * @len: pointer to length of cell which will be populated on successful read.
+ * @len: pointer to length of cell which will be populated on successful read;
+ *  can be NULL.
  *
  * Return: ERR_PTR() on error or a valid pointer to a char * buffer on success.
  * The buffer should be freed by the consumer with a kfree().
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project



warning: (UBIFS_FS_ENCRYPTION) selects FS_ENCRYPTION which has unmet direct dependencies (BLOCK)

2016-12-18 Thread kbuild test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   b0b3a37b908b5906524c11f3ca12cd7c9d4adc1c
commit: d475a507457b5cafa428871a473d0dcc828c5f68 ubifs: Add skeleton for 
fscrypto
date:   6 days ago
config: x86_64-randconfig-x016-12191306 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
git checkout d475a507457b5cafa428871a473d0dcc828c5f68
# save the attached .config to linux build tree
make ARCH=x86_64 

All error/warnings (new ones prefixed by >>):

warning: (UBIFS_FS_ENCRYPTION) selects FS_ENCRYPTION which has unmet direct 
dependencies (BLOCK)
   fs/crypto/crypto.c: In function 'fscrypt_zeroout_range':
>> fs/crypto/crypto.c:355:9: error: implicit declaration of function 
>> 'bio_alloc' [-Werror=implicit-function-declaration]
  bio = bio_alloc(GFP_NOWAIT, 1);
^
>> fs/crypto/crypto.c:355:7: warning: assignment makes pointer from integer 
>> without a cast [-Wint-conversion]
  bio = bio_alloc(GFP_NOWAIT, 1);
  ^
>> fs/crypto/crypto.c:360:6: error: dereferencing pointer to incomplete type 
>> 'struct bio'
  bio->bi_bdev = inode->i_sb->s_bdev;
 ^~
>> fs/crypto/crypto.c:363:3: error: implicit declaration of function 
>> 'bio_set_op_attrs' [-Werror=implicit-function-declaration]
  bio_set_op_attrs(bio, REQ_OP_WRITE, 0);
  ^~~~
>> fs/crypto/crypto.c:364:9: error: implicit declaration of function 
>> 'bio_add_page' [-Werror=implicit-function-declaration]
  ret = bio_add_page(bio, ciphertext_page,
^~~~
>> fs/crypto/crypto.c:369:4: error: implicit declaration of function 'bio_put' 
>> [-Werror=implicit-function-declaration]
   bio_put(bio);
   ^~~
>> fs/crypto/crypto.c:373:9: error: implicit declaration of function 
>> 'submit_bio_wait' [-Werror=implicit-function-declaration]
  err = submit_bio_wait(bio);
^~~
   fs/crypto/crypto.c: In function 'fscrypt_d_revalidate':
>> fs/crypto/crypto.c:411:25: error: dereferencing pointer to incomplete type 
>> 'struct key'
 (ci->ci_keyring_key->flags & ((1 << KEY_FLAG_INVALIDATED) |
^~
>> fs/crypto/crypto.c:411:42: error: 'KEY_FLAG_INVALIDATED' undeclared (first 
>> use in this function)
 (ci->ci_keyring_key->flags & ((1 << KEY_FLAG_INVALIDATED) |
 ^~~~
   fs/crypto/crypto.c:411:42: note: each undeclared identifier is reported only 
once for each function it appears in
>> fs/crypto/crypto.c:412:14: error: 'KEY_FLAG_REVOKED' undeclared (first use 
>> in this function)
   (1 << KEY_FLAG_REVOKED) |
 ^~~~
>> fs/crypto/crypto.c:413:14: error: 'KEY_FLAG_DEAD' undeclared (first use in 
>> this function)
   (1 << KEY_FLAG_DEAD
 ^
   fs/crypto/crypto.c: In function 'completion_pages':
>> fs/crypto/crypto.c:457:2: error: implicit declaration of function 
>> 'bio_for_each_segment_all' [-Werror=implicit-function-declaration]
 bio_for_each_segment_all(bv, bio, i) {
 ^~~~
>> fs/crypto/crypto.c:457:39: error: expected ';' before '{' token
 bio_for_each_segment_all(bv, bio, i) {
  ^
   cc1: some warnings being treated as errors
--
   fs/crypto/keyinfo.c: In function 'validate_user_key':
>> fs/crypto/keyinfo.c:98:16: error: implicit declaration of function 
>> 'request_key' [-Werror=implicit-function-declaration]
 keyring_key = request_key(_type_logon, full_key_descriptor, NULL);
   ^~~
>> fs/crypto/keyinfo.c:98:29: error: 'key_type_logon' undeclared (first use in 
>> this function)
 keyring_key = request_key(_type_logon, full_key_descriptor, NULL);
^~
   fs/crypto/keyinfo.c:98:29: note: each undeclared identifier is reported only 
once for each function it appears in
>> fs/crypto/keyinfo.c:103:17: error: dereferencing pointer to incomplete type 
>> 'struct key'
 if (keyring_key->type != _type_logon) {
^~
>> fs/crypto/keyinfo.c:110:8: error: implicit declaration of function 
>> 'user_key_payload' [-Werror=implicit-function-declaration]
 ukp = user_key_payload(keyring_key);
   ^~~~
>> fs/crypto/keyinfo.c:110:6: warning: assignment makes pointer from integer 
>> without a cast [-Wint-conversion]
 ukp = user_key_payload(keyring_key);
 ^
>> fs/crypto/keyinfo.c:111:9: error: dereferencing pointer to incomplete type 
>> 'const struct user_key_payload'
 if (ukp->datalen != sizeof(struct fscrypt_key)) {
^~
   fs/crypto/keyinfo.c: In function 'fscrypt_get_encryption_info':
>> fs/crypto/keyinfo.c:327:40: error: 'KEY_FLAG_INVALIDATED' undeclared (first 
>> use in this function)
   (ci->ci_keyring_key->flags & ((1 << KEY_FLAG_INVALIDATED) |
   

[PATCH] nvmem: core: Allow ignoring length when reading a cell

2016-12-18 Thread Vivek Gautam
nvmem_cell_read() API fills in the argument 'len' with
the number of bytes read from the cell. Many users don't
care about this length value. So allow users to pass a
NULL pointer to this len field.

Signed-off-by: Vivek Gautam 
---

Based on torvalds's master branch.
 - Tested against 'next-20161219' tag on db410c (apq8016) target
   for thermal sensors.

 drivers/nvmem/core.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index 965911d..4c38842 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -970,7 +970,8 @@ static int __nvmem_cell_read(struct nvmem_device *nvmem,
if (cell->bit_offset || cell->nbits)
nvmem_shift_read_buffer_in_place(cell, buf);
 
-   *len = cell->bytes;
+   if (len)
+   *len = cell->bytes;
 
return 0;
 }
@@ -979,7 +980,8 @@ static int __nvmem_cell_read(struct nvmem_device *nvmem,
  * nvmem_cell_read() - Read a given nvmem cell
  *
  * @cell: nvmem cell to be read.
- * @len: pointer to length of cell which will be populated on successful read.
+ * @len: pointer to length of cell which will be populated on successful read;
+ *  can be NULL.
  *
  * Return: ERR_PTR() on error or a valid pointer to a char * buffer on success.
  * The buffer should be freed by the consumer with a kfree().
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project



Re: [PATCH 8/8] extcon: axp288: Fix the module not auto-loading

2016-12-18 Thread Chanwoo Choi
Hi Hans,

On 2016년 12월 19일 09:13, Hans de Goede wrote:
> Add a MODULE_DEVICE_TABLE to fix the module not auto-loading.
> 
> Signed-off-by: Hans de Goede 
> ---
>  drivers/extcon/extcon-axp288.c | 7 +++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/extcon/extcon-axp288.c b/drivers/extcon/extcon-axp288.c
> index a27ee68..509a5f9 100644
> --- a/drivers/extcon/extcon-axp288.c
> +++ b/drivers/extcon/extcon-axp288.c
> @@ -320,8 +320,15 @@ static int axp288_extcon_probe(struct platform_device 
> *pdev)
>   return 0;
>  }
>  
> +static const struct platform_device_id axp288_extcon_table[] = {
> + { .name = "axp288_extcon" },
> + {},
> +};
> +MODULE_DEVICE_TABLE(platform, axp288_extcon_table);
> +
>  static struct platform_driver axp288_extcon_driver = {
>   .probe = axp288_extcon_probe,
> + .id_table = axp288_extcon_table,
>   .driver = {
>   .name = "axp288_extcon",
>   },
> 

Looks good to me.
Acked-by: Chanwoo Choi 

-- 
Regards,
Chanwoo Choi


Re: [PATCH 7/8] extcon: axp288: Remove unnecessary irq?_en register writes

2016-12-18 Thread Chanwoo Choi
Hi Hans,

On 2016년 12월 19일 09:13, Hans de Goede wrote:
> Setting the irq_enable bits is taken care of by the irq chip when we
> request the irqs and the driver should not be meddling with the
> irq?_en registers itself.
> 
> Signed-off-by: Hans de Goede 
> ---
>  drivers/extcon/extcon-axp288.c | 19 +++
>  1 file changed, 3 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/extcon/extcon-axp288.c b/drivers/extcon/extcon-axp288.c
> index 7aec413..a27ee68 100644
> --- a/drivers/extcon/extcon-axp288.c
> +++ b/drivers/extcon/extcon-axp288.c
> @@ -70,12 +70,6 @@
>  #define DET_STAT_CDP 2
>  #define DET_STAT_DCP 3
>  
> -/* IRQ enable-1 register */
> -#define PWRSRC_IRQ_CFG_MASK  (BIT(4)|BIT(3)|BIT(2))
> -
> -/* IRQ enable-6 register */
> -#define BC12_IRQ_CFG_MASKBIT(1)
> -
>  enum axp288_extcon_reg {
>   AXP288_PS_STAT_REG  = 0x00,
>   AXP288_PS_BOOT_REASON_REG   = 0x02,
> @@ -83,8 +77,6 @@ enum axp288_extcon_reg {
>   AXP288_BC_VBUS_CNTL_REG = 0x2d,
>   AXP288_BC_USB_STAT_REG  = 0x2e,
>   AXP288_BC_DET_STAT_REG  = 0x2f,
> - AXP288_PWRSRC_IRQ_CFG_REG   = 0x40,
> - AXP288_BC12_IRQ_CFG_REG = 0x45,
>  };
>  
>  enum axp288_mux_select {
> @@ -242,15 +234,10 @@ static irqreturn_t axp288_extcon_isr(int irq, void 
> *data)
>   return IRQ_HANDLED;
>  }
>  
> -static void axp288_extcon_enable_irq(struct axp288_extcon_info *info)
> +static void axp288_extcon_enable(struct axp288_extcon_info *info)
>  {
> - /* Unmask VBUS interrupt */
> - regmap_write(info->regmap, AXP288_PWRSRC_IRQ_CFG_REG,
> - PWRSRC_IRQ_CFG_MASK);
>   regmap_update_bits(info->regmap, AXP288_BC_GLOBAL_REG,
>   BC_GLOBAL_RUN, 0);
> - /* Unmask the BC1.2 complete interrupts */
> - regmap_write(info->regmap, AXP288_BC12_IRQ_CFG_REG, BC12_IRQ_CFG_MASK);
>   /* Enable the charger detection logic */
>   regmap_update_bits(info->regmap, AXP288_BC_GLOBAL_REG,
>   BC_GLOBAL_RUN, BC_GLOBAL_RUN);
> @@ -327,8 +314,8 @@ static int axp288_extcon_probe(struct platform_device 
> *pdev)
>   }
>   }
>  
> - /* Enable interrupts */
> - axp288_extcon_enable_irq(info);
> + /* Start charger cable type detection */
> + axp288_extcon_enable(info);
>  
>   return 0;
>  }
> 

Looks good to me.
Acked-by: Chanwoo Choi 

-- 
Regards,
Chanwoo Choi


Re: [PATCH 7/8] extcon: axp288: Remove unnecessary irq?_en register writes

2016-12-18 Thread Chanwoo Choi
Hi Hans,

On 2016년 12월 19일 09:13, Hans de Goede wrote:
> Setting the irq_enable bits is taken care of by the irq chip when we
> request the irqs and the driver should not be meddling with the
> irq?_en registers itself.
> 
> Signed-off-by: Hans de Goede 
> ---
>  drivers/extcon/extcon-axp288.c | 19 +++
>  1 file changed, 3 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/extcon/extcon-axp288.c b/drivers/extcon/extcon-axp288.c
> index 7aec413..a27ee68 100644
> --- a/drivers/extcon/extcon-axp288.c
> +++ b/drivers/extcon/extcon-axp288.c
> @@ -70,12 +70,6 @@
>  #define DET_STAT_CDP 2
>  #define DET_STAT_DCP 3
>  
> -/* IRQ enable-1 register */
> -#define PWRSRC_IRQ_CFG_MASK  (BIT(4)|BIT(3)|BIT(2))
> -
> -/* IRQ enable-6 register */
> -#define BC12_IRQ_CFG_MASKBIT(1)
> -
>  enum axp288_extcon_reg {
>   AXP288_PS_STAT_REG  = 0x00,
>   AXP288_PS_BOOT_REASON_REG   = 0x02,
> @@ -83,8 +77,6 @@ enum axp288_extcon_reg {
>   AXP288_BC_VBUS_CNTL_REG = 0x2d,
>   AXP288_BC_USB_STAT_REG  = 0x2e,
>   AXP288_BC_DET_STAT_REG  = 0x2f,
> - AXP288_PWRSRC_IRQ_CFG_REG   = 0x40,
> - AXP288_BC12_IRQ_CFG_REG = 0x45,
>  };
>  
>  enum axp288_mux_select {
> @@ -242,15 +234,10 @@ static irqreturn_t axp288_extcon_isr(int irq, void 
> *data)
>   return IRQ_HANDLED;
>  }
>  
> -static void axp288_extcon_enable_irq(struct axp288_extcon_info *info)
> +static void axp288_extcon_enable(struct axp288_extcon_info *info)
>  {
> - /* Unmask VBUS interrupt */
> - regmap_write(info->regmap, AXP288_PWRSRC_IRQ_CFG_REG,
> - PWRSRC_IRQ_CFG_MASK);
>   regmap_update_bits(info->regmap, AXP288_BC_GLOBAL_REG,
>   BC_GLOBAL_RUN, 0);
> - /* Unmask the BC1.2 complete interrupts */
> - regmap_write(info->regmap, AXP288_BC12_IRQ_CFG_REG, BC12_IRQ_CFG_MASK);
>   /* Enable the charger detection logic */
>   regmap_update_bits(info->regmap, AXP288_BC_GLOBAL_REG,
>   BC_GLOBAL_RUN, BC_GLOBAL_RUN);
> @@ -327,8 +314,8 @@ static int axp288_extcon_probe(struct platform_device 
> *pdev)
>   }
>   }
>  
> - /* Enable interrupts */
> - axp288_extcon_enable_irq(info);
> + /* Start charger cable type detection */
> + axp288_extcon_enable(info);
>  
>   return 0;
>  }
> 

Looks good to me.
Acked-by: Chanwoo Choi 

-- 
Regards,
Chanwoo Choi


Re: [PATCH 8/8] extcon: axp288: Fix the module not auto-loading

2016-12-18 Thread Chanwoo Choi
Hi Hans,

On 2016년 12월 19일 09:13, Hans de Goede wrote:
> Add a MODULE_DEVICE_TABLE to fix the module not auto-loading.
> 
> Signed-off-by: Hans de Goede 
> ---
>  drivers/extcon/extcon-axp288.c | 7 +++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/extcon/extcon-axp288.c b/drivers/extcon/extcon-axp288.c
> index a27ee68..509a5f9 100644
> --- a/drivers/extcon/extcon-axp288.c
> +++ b/drivers/extcon/extcon-axp288.c
> @@ -320,8 +320,15 @@ static int axp288_extcon_probe(struct platform_device 
> *pdev)
>   return 0;
>  }
>  
> +static const struct platform_device_id axp288_extcon_table[] = {
> + { .name = "axp288_extcon" },
> + {},
> +};
> +MODULE_DEVICE_TABLE(platform, axp288_extcon_table);
> +
>  static struct platform_driver axp288_extcon_driver = {
>   .probe = axp288_extcon_probe,
> + .id_table = axp288_extcon_table,
>   .driver = {
>   .name = "axp288_extcon",
>   },
> 

Looks good to me.
Acked-by: Chanwoo Choi 

-- 
Regards,
Chanwoo Choi


[PATCH] timerfd: export defines to userspace

2016-12-18 Thread Mike Frysinger
Since userspace is expected to call timerfd syscalls directly with these
flags/ioctls, make sure we export them so they don't have to duplicate
the values themselves.

Acked-by: Thomas Gleixner 
Signed-off-by: Mike Frysinger 
---
ping -- this was sent about two years ago now

 include/linux/timerfd.h  | 20 +---
 include/uapi/linux/Kbuild|  1 +
 include/uapi/linux/timerfd.h | 36 
 3 files changed, 38 insertions(+), 19 deletions(-)
 create mode 100644 include/uapi/linux/timerfd.h

diff --git a/include/linux/timerfd.h b/include/linux/timerfd.h
index bd36ce431e32..bab0b1ad0613 100644
--- a/include/linux/timerfd.h
+++ b/include/linux/timerfd.h
@@ -8,23 +8,7 @@
 #ifndef _LINUX_TIMERFD_H
 #define _LINUX_TIMERFD_H
 
-/* For O_CLOEXEC and O_NONBLOCK */
-#include 
-
-/* For _IO helpers */
-#include 
-
-/*
- * CAREFUL: Check include/asm-generic/fcntl.h when defining
- * new flags, since they might collide with O_* ones. We want
- * to re-use O_* flags that couldn't possibly have a meaning
- * from eventfd, in order to leave a free define-space for
- * shared O_* flags.
- */
-#define TFD_TIMER_ABSTIME (1 << 0)
-#define TFD_TIMER_CANCEL_ON_SET (1 << 1)
-#define TFD_CLOEXEC O_CLOEXEC
-#define TFD_NONBLOCK O_NONBLOCK
+#include 
 
 #define TFD_SHARED_FCNTL_FLAGS (TFD_CLOEXEC | TFD_NONBLOCK)
 /* Flags for timerfd_create.  */
@@ -32,6 +16,4 @@
 /* Flags for timerfd_settime.  */
 #define TFD_SETTIME_FLAGS (TFD_TIMER_ABSTIME | TFD_TIMER_CANCEL_ON_SET)
 
-#define TFD_IOC_SET_TICKS  _IOW('T', 0, u64)
-
 #endif /* _LINUX_TIMERFD_H */
diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild
index cd2be1c8e9fb..9c4d25ed8e1e 100644
--- a/include/uapi/linux/Kbuild
+++ b/include/uapi/linux/Kbuild
@@ -411,6 +411,7 @@ header-y += telephony.h
 header-y += termios.h
 header-y += thermal.h
 header-y += time.h
+header-y += timerfd.h
 header-y += times.h
 header-y += timex.h
 header-y += tiocl.h
diff --git a/include/uapi/linux/timerfd.h b/include/uapi/linux/timerfd.h
new file mode 100644
index ..6fcfaa8da173
--- /dev/null
+++ b/include/uapi/linux/timerfd.h
@@ -0,0 +1,36 @@
+/*
+ *  include/linux/timerfd.h
+ *
+ *  Copyright (C) 2007  Davide Libenzi 
+ *
+ */
+
+#ifndef _UAPI_LINUX_TIMERFD_H
+#define _UAPI_LINUX_TIMERFD_H
+
+#include 
+
+/* For O_CLOEXEC and O_NONBLOCK */
+#include 
+
+/* For _IO helpers */
+#include 
+
+/*
+ * CAREFUL: Check include/asm-generic/fcntl.h when defining
+ * new flags, since they might collide with O_* ones. We want
+ * to re-use O_* flags that couldn't possibly have a meaning
+ * from eventfd, in order to leave a free define-space for
+ * shared O_* flags.
+ *
+ * Also make sure to update the masks in include/linux/timerfd.h
+ * when adding new flags.
+ */
+#define TFD_TIMER_ABSTIME (1 << 0)
+#define TFD_TIMER_CANCEL_ON_SET (1 << 1)
+#define TFD_CLOEXEC O_CLOEXEC
+#define TFD_NONBLOCK O_NONBLOCK
+
+#define TFD_IOC_SET_TICKS  _IOW('T', 0, __u64)
+
+#endif /* _UAPI_LINUX_TIMERFD_H */
-- 
2.11.0.rc2



[PATCH] timerfd: export defines to userspace

2016-12-18 Thread Mike Frysinger
Since userspace is expected to call timerfd syscalls directly with these
flags/ioctls, make sure we export them so they don't have to duplicate
the values themselves.

Acked-by: Thomas Gleixner 
Signed-off-by: Mike Frysinger 
---
ping -- this was sent about two years ago now

 include/linux/timerfd.h  | 20 +---
 include/uapi/linux/Kbuild|  1 +
 include/uapi/linux/timerfd.h | 36 
 3 files changed, 38 insertions(+), 19 deletions(-)
 create mode 100644 include/uapi/linux/timerfd.h

diff --git a/include/linux/timerfd.h b/include/linux/timerfd.h
index bd36ce431e32..bab0b1ad0613 100644
--- a/include/linux/timerfd.h
+++ b/include/linux/timerfd.h
@@ -8,23 +8,7 @@
 #ifndef _LINUX_TIMERFD_H
 #define _LINUX_TIMERFD_H
 
-/* For O_CLOEXEC and O_NONBLOCK */
-#include 
-
-/* For _IO helpers */
-#include 
-
-/*
- * CAREFUL: Check include/asm-generic/fcntl.h when defining
- * new flags, since they might collide with O_* ones. We want
- * to re-use O_* flags that couldn't possibly have a meaning
- * from eventfd, in order to leave a free define-space for
- * shared O_* flags.
- */
-#define TFD_TIMER_ABSTIME (1 << 0)
-#define TFD_TIMER_CANCEL_ON_SET (1 << 1)
-#define TFD_CLOEXEC O_CLOEXEC
-#define TFD_NONBLOCK O_NONBLOCK
+#include 
 
 #define TFD_SHARED_FCNTL_FLAGS (TFD_CLOEXEC | TFD_NONBLOCK)
 /* Flags for timerfd_create.  */
@@ -32,6 +16,4 @@
 /* Flags for timerfd_settime.  */
 #define TFD_SETTIME_FLAGS (TFD_TIMER_ABSTIME | TFD_TIMER_CANCEL_ON_SET)
 
-#define TFD_IOC_SET_TICKS  _IOW('T', 0, u64)
-
 #endif /* _LINUX_TIMERFD_H */
diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild
index cd2be1c8e9fb..9c4d25ed8e1e 100644
--- a/include/uapi/linux/Kbuild
+++ b/include/uapi/linux/Kbuild
@@ -411,6 +411,7 @@ header-y += telephony.h
 header-y += termios.h
 header-y += thermal.h
 header-y += time.h
+header-y += timerfd.h
 header-y += times.h
 header-y += timex.h
 header-y += tiocl.h
diff --git a/include/uapi/linux/timerfd.h b/include/uapi/linux/timerfd.h
new file mode 100644
index ..6fcfaa8da173
--- /dev/null
+++ b/include/uapi/linux/timerfd.h
@@ -0,0 +1,36 @@
+/*
+ *  include/linux/timerfd.h
+ *
+ *  Copyright (C) 2007  Davide Libenzi 
+ *
+ */
+
+#ifndef _UAPI_LINUX_TIMERFD_H
+#define _UAPI_LINUX_TIMERFD_H
+
+#include 
+
+/* For O_CLOEXEC and O_NONBLOCK */
+#include 
+
+/* For _IO helpers */
+#include 
+
+/*
+ * CAREFUL: Check include/asm-generic/fcntl.h when defining
+ * new flags, since they might collide with O_* ones. We want
+ * to re-use O_* flags that couldn't possibly have a meaning
+ * from eventfd, in order to leave a free define-space for
+ * shared O_* flags.
+ *
+ * Also make sure to update the masks in include/linux/timerfd.h
+ * when adding new flags.
+ */
+#define TFD_TIMER_ABSTIME (1 << 0)
+#define TFD_TIMER_CANCEL_ON_SET (1 << 1)
+#define TFD_CLOEXEC O_CLOEXEC
+#define TFD_NONBLOCK O_NONBLOCK
+
+#define TFD_IOC_SET_TICKS  _IOW('T', 0, __u64)
+
+#endif /* _UAPI_LINUX_TIMERFD_H */
-- 
2.11.0.rc2



Re: [PATCH 6/8] extcon: axp288: Use vbus-valid instead of -present to determine cable presence

2016-12-18 Thread Chanwoo Choi
Hi Hans,

On 2016년 12월 19일 09:13, Hans de Goede wrote:
> The vbus-present bit in the power status register also gets set to 1
> when a usb-host cable (id-pin shorted to ground) is plugged in and a 5v
> boost converter is supplying 5v to the otg usb bus.
> 
> This causes a "disconnect or unknown or ID event" warning in dmesg as
> well as the extcon device to report the last detected charger cable
> type as being connected even though none is connected.
> 
> This commit switches to checking the vbus-valid bit instead, which is
> only 1 when both vbus is present and the vbus-path is enabled in the
> vbus-path control register (the vbus-path gets disabled when a usb-host
> cable is detected, to avoid the pmic drawing power from the 5v boost
> converter).
> 
> Signed-off-by: Hans de Goede 
> ---
>  drivers/extcon/extcon-axp288.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/extcon/extcon-axp288.c b/drivers/extcon/extcon-axp288.c
> index fc636f6..7aec413 100644
> --- a/drivers/extcon/extcon-axp288.c
> +++ b/drivers/extcon/extcon-axp288.c
> @@ -166,7 +166,7 @@ static int axp288_handle_chrg_det_event(struct 
> axp288_extcon_info *info)
>   return ret;
>   }
>  
> - vbus_attach = (pwr_stat & PS_STAT_VBUS_PRESENT);
> + vbus_attach = (pwr_stat & PS_STAT_VBUS_VALID);
>   if (!vbus_attach) {
>   dev_info(info->dev, "vbus/cable disconnected\n");
>   goto no_vbus;
> 

Acked-by: Chanwoo Choi 

-- 
Regards,
Chanwoo Choi


Re: [PATCH 6/8] extcon: axp288: Use vbus-valid instead of -present to determine cable presence

2016-12-18 Thread Chanwoo Choi
Hi Hans,

On 2016년 12월 19일 09:13, Hans de Goede wrote:
> The vbus-present bit in the power status register also gets set to 1
> when a usb-host cable (id-pin shorted to ground) is plugged in and a 5v
> boost converter is supplying 5v to the otg usb bus.
> 
> This causes a "disconnect or unknown or ID event" warning in dmesg as
> well as the extcon device to report the last detected charger cable
> type as being connected even though none is connected.
> 
> This commit switches to checking the vbus-valid bit instead, which is
> only 1 when both vbus is present and the vbus-path is enabled in the
> vbus-path control register (the vbus-path gets disabled when a usb-host
> cable is detected, to avoid the pmic drawing power from the 5v boost
> converter).
> 
> Signed-off-by: Hans de Goede 
> ---
>  drivers/extcon/extcon-axp288.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/extcon/extcon-axp288.c b/drivers/extcon/extcon-axp288.c
> index fc636f6..7aec413 100644
> --- a/drivers/extcon/extcon-axp288.c
> +++ b/drivers/extcon/extcon-axp288.c
> @@ -166,7 +166,7 @@ static int axp288_handle_chrg_det_event(struct 
> axp288_extcon_info *info)
>   return ret;
>   }
>  
> - vbus_attach = (pwr_stat & PS_STAT_VBUS_PRESENT);
> + vbus_attach = (pwr_stat & PS_STAT_VBUS_VALID);
>   if (!vbus_attach) {
>   dev_info(info->dev, "vbus/cable disconnected\n");
>   goto no_vbus;
> 

Acked-by: Chanwoo Choi 

-- 
Regards,
Chanwoo Choi


Re: [PATCH v2] fix code alignment with open parenthesis

2016-12-18 Thread Greg KH
On Sun, Dec 18, 2016 at 11:47:30AM -0600, Scott Matheina wrote:
> These changes where identified by checkpatch.pl as needed changes to
> align the code with the linux development coding style. The several
> lines of text where aligned with the precending parenthesis.
> 
> Signed-off-by: Scott Matheina 
> 
>  Changes to be committed:
>   modified:   drivers/staging/fbtft/fb_agm1264k-fl.c

Why are these lines in the changelog text?


Re: [PATCH v2] fix code alignment with open parenthesis

2016-12-18 Thread Greg KH
On Sun, Dec 18, 2016 at 11:47:30AM -0600, Scott Matheina wrote:
> These changes where identified by checkpatch.pl as needed changes to
> align the code with the linux development coding style. The several
> lines of text where aligned with the precending parenthesis.
> 
> Signed-off-by: Scott Matheina 
> 
>  Changes to be committed:
>   modified:   drivers/staging/fbtft/fb_agm1264k-fl.c

Why are these lines in the changelog text?


Re: [RFC 1/1] MicroSemi Switchtec management interface driver

2016-12-18 Thread Greg Kroah-Hartman
On Sun, Dec 18, 2016 at 10:20:47AM -0700, Logan Gunthorpe wrote:
> Hi Greg,
> 
> Thanks for the quick review!
> 
> On 18/12/16 12:51 AM, Greg Kroah-Hartman wrote:
> > On Sat, Dec 17, 2016 at 10:09:22AM -0700, Logan Gunthorpe wrote:
> > > +struct switchtec_dev {
> > > + struct pci_dev *pdev;
> > > + struct msix_entry *msix;
> > > + struct device *dev;
> > > + struct kref kref;
> > 
> > Why do you have a pointer to a device, yet a kref as well?  Just have
> > this structure embed a 'struct device' in itself, like you did for a
> > kref, and you will be fine.  Otherwise you are dealing with two
> > different sets of reference counting here, for no good reason.
> 
> Ok, understood. I had referenced the device dax driver which did it this way
> in 4.8 but looks like it was changed to the way you suggest in 4.9.
> 
> > > +#define stdev_pdev(stdev) ((stdev)->pdev)
> > > +#define stdev_pdev_dev(stdev) (_pdev(stdev)->dev)
> > > +#define stdev_name(stdev) pci_name(stdev_pdev(stdev))
> > > +#define stdev_dev(stdev) ((stdev)->dev)
> > 
> > Ick, just open code these please.  That's a huge hint your use of the
> > driver model is not correct :)
> 
> Ok, will do. For reference, I was copying
> 
> drivers/ntb/hw/intel/ntb_hw_intel.h
> 
> which does a similar thing.

No need to copy bad code, I suggest fixing that up as well :)

thanks,

greg k-h


Re: [RFC 1/1] MicroSemi Switchtec management interface driver

2016-12-18 Thread Greg Kroah-Hartman
On Sun, Dec 18, 2016 at 10:20:47AM -0700, Logan Gunthorpe wrote:
> Hi Greg,
> 
> Thanks for the quick review!
> 
> On 18/12/16 12:51 AM, Greg Kroah-Hartman wrote:
> > On Sat, Dec 17, 2016 at 10:09:22AM -0700, Logan Gunthorpe wrote:
> > > +struct switchtec_dev {
> > > + struct pci_dev *pdev;
> > > + struct msix_entry *msix;
> > > + struct device *dev;
> > > + struct kref kref;
> > 
> > Why do you have a pointer to a device, yet a kref as well?  Just have
> > this structure embed a 'struct device' in itself, like you did for a
> > kref, and you will be fine.  Otherwise you are dealing with two
> > different sets of reference counting here, for no good reason.
> 
> Ok, understood. I had referenced the device dax driver which did it this way
> in 4.8 but looks like it was changed to the way you suggest in 4.9.
> 
> > > +#define stdev_pdev(stdev) ((stdev)->pdev)
> > > +#define stdev_pdev_dev(stdev) (_pdev(stdev)->dev)
> > > +#define stdev_name(stdev) pci_name(stdev_pdev(stdev))
> > > +#define stdev_dev(stdev) ((stdev)->dev)
> > 
> > Ick, just open code these please.  That's a huge hint your use of the
> > driver model is not correct :)
> 
> Ok, will do. For reference, I was copying
> 
> drivers/ntb/hw/intel/ntb_hw_intel.h
> 
> which does a similar thing.

No need to copy bad code, I suggest fixing that up as well :)

thanks,

greg k-h


Re: [PATCH 5/8] extcon: axp288: Make a couple of messages dev_info instead of dev_dbg

2016-12-18 Thread Chanwoo Choi
Hi Hans,

I prefer to use the dev_dbg on the fly instead of dev_info.
If you want to check the change state, you can use the udev monitor tool
because extcon send the uevent when changing the state of connector.

Regards,
Chanwoo Choi

On 2016년 12월 19일 09:13, Hans de Goede wrote:
> These messages are helpful for the user to check if their charger is
> correctly detected, so make them dev_dbg instead of dev_info.
> 
> Also add a new message to indicate when the vbus is disconnected /
> no cable is detected.
> 
> Signed-off-by: Hans de Goede 
> ---
>  drivers/extcon/extcon-axp288.c | 10 ++
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/extcon/extcon-axp288.c b/drivers/extcon/extcon-axp288.c
> index ded0bd9..fc636f6 100644
> --- a/drivers/extcon/extcon-axp288.c
> +++ b/drivers/extcon/extcon-axp288.c
> @@ -167,8 +167,10 @@ static int axp288_handle_chrg_det_event(struct 
> axp288_extcon_info *info)
>   }
>  
>   vbus_attach = (pwr_stat & PS_STAT_VBUS_PRESENT);
> - if (!vbus_attach)
> + if (!vbus_attach) {
> + dev_info(info->dev, "vbus/cable disconnected\n");
>   goto no_vbus;
> + }
>  
>   /* Check charger detection completion status */
>   ret = regmap_read(info->regmap, AXP288_BC_GLOBAL_REG, );
> @@ -187,15 +189,15 @@ static int axp288_handle_chrg_det_event(struct 
> axp288_extcon_info *info)
>  
>   switch (chrg_type) {
>   case DET_STAT_SDP:
> - dev_dbg(info->dev, "sdp cable is connected\n");
> + dev_info(info->dev, "sdp cable is connected\n");
>   cable = EXTCON_CHG_USB_SDP;
>   break;
>   case DET_STAT_CDP:
> - dev_dbg(info->dev, "cdp cable is connected\n");
> + dev_info(info->dev, "cdp cable is connected\n");
>   cable = EXTCON_CHG_USB_CDP;
>   break;
>   case DET_STAT_DCP:
> - dev_dbg(info->dev, "dcp cable is connected\n");
> + dev_info(info->dev, "dcp cable is connected\n");
>   cable = EXTCON_CHG_USB_DCP;
>   break;
>   default:
> 



Re: [PATCH 5/8] extcon: axp288: Make a couple of messages dev_info instead of dev_dbg

2016-12-18 Thread Chanwoo Choi
Hi Hans,

I prefer to use the dev_dbg on the fly instead of dev_info.
If you want to check the change state, you can use the udev monitor tool
because extcon send the uevent when changing the state of connector.

Regards,
Chanwoo Choi

On 2016년 12월 19일 09:13, Hans de Goede wrote:
> These messages are helpful for the user to check if their charger is
> correctly detected, so make them dev_dbg instead of dev_info.
> 
> Also add a new message to indicate when the vbus is disconnected /
> no cable is detected.
> 
> Signed-off-by: Hans de Goede 
> ---
>  drivers/extcon/extcon-axp288.c | 10 ++
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/extcon/extcon-axp288.c b/drivers/extcon/extcon-axp288.c
> index ded0bd9..fc636f6 100644
> --- a/drivers/extcon/extcon-axp288.c
> +++ b/drivers/extcon/extcon-axp288.c
> @@ -167,8 +167,10 @@ static int axp288_handle_chrg_det_event(struct 
> axp288_extcon_info *info)
>   }
>  
>   vbus_attach = (pwr_stat & PS_STAT_VBUS_PRESENT);
> - if (!vbus_attach)
> + if (!vbus_attach) {
> + dev_info(info->dev, "vbus/cable disconnected\n");
>   goto no_vbus;
> + }
>  
>   /* Check charger detection completion status */
>   ret = regmap_read(info->regmap, AXP288_BC_GLOBAL_REG, );
> @@ -187,15 +189,15 @@ static int axp288_handle_chrg_det_event(struct 
> axp288_extcon_info *info)
>  
>   switch (chrg_type) {
>   case DET_STAT_SDP:
> - dev_dbg(info->dev, "sdp cable is connected\n");
> + dev_info(info->dev, "sdp cable is connected\n");
>   cable = EXTCON_CHG_USB_SDP;
>   break;
>   case DET_STAT_CDP:
> - dev_dbg(info->dev, "cdp cable is connected\n");
> + dev_info(info->dev, "cdp cable is connected\n");
>   cable = EXTCON_CHG_USB_CDP;
>   break;
>   case DET_STAT_DCP:
> - dev_dbg(info->dev, "dcp cable is connected\n");
> + dev_info(info->dev, "dcp cable is connected\n");
>   cable = EXTCON_CHG_USB_DCP;
>   break;
>   default:
> 



Re: [PATCH 4/8] extcon: axp288: Fix possibly reporting 2 cables in state true

2016-12-18 Thread Chanwoo Choi
Hi Hans,

This patch looks good to me. But I have one comment
when setting the previous_cable in probe().

On 2016년 12월 19일 09:13, Hans de Goede wrote:
> When the charger type changes from e.g. SDP to CDP, without Vbus being
> seen as low in between axp288_handle_chrg_det_event would set the state
> for the new cable type to true, without clearing the state of the
> previous cable type to false.
> 
> This commit fixes this and also gets rid of the function local static
> cable variable, properly storing all drv state in the axp288_extcon_info
> struct.
> 
> Signed-off-by: Hans de Goede 
> ---
>  drivers/extcon/extcon-axp288.c | 10 --
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/extcon/extcon-axp288.c b/drivers/extcon/extcon-axp288.c
> index 43b3637..ded0bd9 100644
> --- a/drivers/extcon/extcon-axp288.c
> +++ b/drivers/extcon/extcon-axp288.c
> @@ -115,6 +115,7 @@ struct axp288_extcon_info {
>   int irq[EXTCON_IRQ_END];
>   struct extcon_dev *edev;
>   struct notifier_block extcon_nb;
> + unsigned int previous_cable;
>  };
>  
>  /* Power up/down reason string array */
> @@ -154,9 +155,9 @@ static void axp288_extcon_log_rsi(struct 
> axp288_extcon_info *info)
>  
>  static int axp288_handle_chrg_det_event(struct axp288_extcon_info *info)
>  {
> - static unsigned int cable;
>   int ret, stat, cfg, pwr_stat;
>   u8 chrg_type;
> + unsigned int cable = info->previous_cable;
>   bool vbus_attach = false;
>  
>   ret = regmap_read(info->regmap, AXP288_PS_STAT_REG, _stat);
> @@ -212,7 +213,11 @@ static int axp288_handle_chrg_det_event(struct 
> axp288_extcon_info *info)
>   vbus_attach ? EXTCON_GPIO_MUX_SEL_SOC
>   : EXTCON_GPIO_MUX_SEL_PMIC);
>  
> - extcon_set_state_sync(info->edev, cable, vbus_attach);
> + extcon_set_state_sync(info->edev, info->previous_cable, false);
> + if (vbus_attach) {
> + extcon_set_state_sync(info->edev, cable, vbus_attach);
> + info->previous_cable = cable;
> + }
>  
>   return 0;
>  
> @@ -263,6 +268,7 @@ static int axp288_extcon_probe(struct platform_device 
> *pdev)
>   info->dev = >dev;
>   info->regmap = axp20x->regmap;
>   info->regmap_irqc = axp20x->regmap_irqc;
> + info->previous_cable = axp288_extcon_cables[0];

I think that you better to use "EXTCON_NONE" instead of
"axp288_extcon_cables[0]" as following:
info->previous_cable = EXTCON_NONE;


>   if (pdata)
>   info->gpio_mux_cntl = pdata->gpio_mux_cntl;
>  
> 

-- 
Regards,
Chanwoo Choi


Re: [PATCH 4/8] extcon: axp288: Fix possibly reporting 2 cables in state true

2016-12-18 Thread Chanwoo Choi
Hi Hans,

This patch looks good to me. But I have one comment
when setting the previous_cable in probe().

On 2016년 12월 19일 09:13, Hans de Goede wrote:
> When the charger type changes from e.g. SDP to CDP, without Vbus being
> seen as low in between axp288_handle_chrg_det_event would set the state
> for the new cable type to true, without clearing the state of the
> previous cable type to false.
> 
> This commit fixes this and also gets rid of the function local static
> cable variable, properly storing all drv state in the axp288_extcon_info
> struct.
> 
> Signed-off-by: Hans de Goede 
> ---
>  drivers/extcon/extcon-axp288.c | 10 --
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/extcon/extcon-axp288.c b/drivers/extcon/extcon-axp288.c
> index 43b3637..ded0bd9 100644
> --- a/drivers/extcon/extcon-axp288.c
> +++ b/drivers/extcon/extcon-axp288.c
> @@ -115,6 +115,7 @@ struct axp288_extcon_info {
>   int irq[EXTCON_IRQ_END];
>   struct extcon_dev *edev;
>   struct notifier_block extcon_nb;
> + unsigned int previous_cable;
>  };
>  
>  /* Power up/down reason string array */
> @@ -154,9 +155,9 @@ static void axp288_extcon_log_rsi(struct 
> axp288_extcon_info *info)
>  
>  static int axp288_handle_chrg_det_event(struct axp288_extcon_info *info)
>  {
> - static unsigned int cable;
>   int ret, stat, cfg, pwr_stat;
>   u8 chrg_type;
> + unsigned int cable = info->previous_cable;
>   bool vbus_attach = false;
>  
>   ret = regmap_read(info->regmap, AXP288_PS_STAT_REG, _stat);
> @@ -212,7 +213,11 @@ static int axp288_handle_chrg_det_event(struct 
> axp288_extcon_info *info)
>   vbus_attach ? EXTCON_GPIO_MUX_SEL_SOC
>   : EXTCON_GPIO_MUX_SEL_PMIC);
>  
> - extcon_set_state_sync(info->edev, cable, vbus_attach);
> + extcon_set_state_sync(info->edev, info->previous_cable, false);
> + if (vbus_attach) {
> + extcon_set_state_sync(info->edev, cable, vbus_attach);
> + info->previous_cable = cable;
> + }
>  
>   return 0;
>  
> @@ -263,6 +268,7 @@ static int axp288_extcon_probe(struct platform_device 
> *pdev)
>   info->dev = >dev;
>   info->regmap = axp20x->regmap;
>   info->regmap_irqc = axp20x->regmap_irqc;
> + info->previous_cable = axp288_extcon_cables[0];

I think that you better to use "EXTCON_NONE" instead of
"axp288_extcon_cables[0]" as following:
info->previous_cable = EXTCON_NONE;


>   if (pdata)
>   info->gpio_mux_cntl = pdata->gpio_mux_cntl;
>  
> 

-- 
Regards,
Chanwoo Choi


[RFC] Question about freeing of resource in 'atlas7_pinmux_probe()', in file 'drivers/pinctrl/sirf/pinctrl-atlas7.c'

2016-12-18 Thread Marion & Christophe JAILLET

Hi,

while playing with coccinelle, a missing 'of_node_put()' triggered in 
'atlas7_pinmux_probe()', in file 'drivers/pinctrl/sirf/pinctrl-atlas7.c'.


/* The sd3 and sd9 shared all pins, and the function select by
 * SYS2PCI_SDIO9SEL register
 */
sys2pci_np = of_find_node_by_name(NULL, "sys2pci");
if (!sys2pci_np)
return -EINVAL;
ret = of_address_to_resource(sys2pci_np, 0, );
if (ret) <-missing of_node_put(sys2pci_np);
return ret;
pmx->sys2pci_base = devm_ioremap_resource(>dev, );
if (IS_ERR(pmx->sys2pci_base)) {
of_node_put(sys2pci_np); <-added by commit 
151b8c5ba1eb

return -ENOMEM;
}

Looking at the history of this file, I found a recent commit that added 
another missing of_node_put (see above).



Adding missing 'of_node_put()' in error handling paths is fine, but in 
this particular case, I was wondering if one was not also missing in the 
normal path?



In such a case, I would revert 151b8c5ba1eb and propose something like:
/* The sd3 and sd9 shared all pins, and the function select by
 * SYS2PCI_SDIO9SEL register
 */
sys2pci_np = of_find_node_by_name(NULL, "sys2pci");
if (!sys2pci_np)
return -EINVAL;
ret = of_address_to_resource(sys2pci_np, 0, );
if (ret) {
of_node_put(sys2pci_np);
return ret;
}
of_node_put(sys2pci_np);

pmx->sys2pci_base = devm_ioremap_resource(>dev, );
if (IS_ERR(pmx->sys2pci_base))
return -ENOMEM;

Thanks for your comment,

best regards,

CJ



[RFC] Question about freeing of resource in 'atlas7_pinmux_probe()', in file 'drivers/pinctrl/sirf/pinctrl-atlas7.c'

2016-12-18 Thread Marion & Christophe JAILLET

Hi,

while playing with coccinelle, a missing 'of_node_put()' triggered in 
'atlas7_pinmux_probe()', in file 'drivers/pinctrl/sirf/pinctrl-atlas7.c'.


/* The sd3 and sd9 shared all pins, and the function select by
 * SYS2PCI_SDIO9SEL register
 */
sys2pci_np = of_find_node_by_name(NULL, "sys2pci");
if (!sys2pci_np)
return -EINVAL;
ret = of_address_to_resource(sys2pci_np, 0, );
if (ret) <-missing of_node_put(sys2pci_np);
return ret;
pmx->sys2pci_base = devm_ioremap_resource(>dev, );
if (IS_ERR(pmx->sys2pci_base)) {
of_node_put(sys2pci_np); <-added by commit 
151b8c5ba1eb

return -ENOMEM;
}

Looking at the history of this file, I found a recent commit that added 
another missing of_node_put (see above).



Adding missing 'of_node_put()' in error handling paths is fine, but in 
this particular case, I was wondering if one was not also missing in the 
normal path?



In such a case, I would revert 151b8c5ba1eb and propose something like:
/* The sd3 and sd9 shared all pins, and the function select by
 * SYS2PCI_SDIO9SEL register
 */
sys2pci_np = of_find_node_by_name(NULL, "sys2pci");
if (!sys2pci_np)
return -EINVAL;
ret = of_address_to_resource(sys2pci_np, 0, );
if (ret) {
of_node_put(sys2pci_np);
return ret;
}
of_node_put(sys2pci_np);

pmx->sys2pci_base = devm_ioremap_resource(>dev, );
if (IS_ERR(pmx->sys2pci_base))
return -ENOMEM;

Thanks for your comment,

best regards,

CJ



Re: [PATCH 3/8] extcon: axp288: Simplify axp288_handle_chrg_det_event

2016-12-18 Thread Chanwoo Choi
Hi Hans,

On 2016년 12월 19일 09:13, Hans de Goede wrote:
> axp288_handle_chrg_det_event only gets called on change interrupts
> (so not that often), extcon_set_state_sync() checks itself if there are
> any actual changes before notifying listeners, and gpiod_set_value is
> not really expensive either.
> 
> So we can simply always do both on each interrupt removing a bunch of
> somewhat magic looking code from axp288_handle_chrg_det_event.
> 
> Signed-off-by: Hans de Goede 
> ---
>  drivers/extcon/extcon-axp288.c | 37 -
>  1 file changed, 12 insertions(+), 25 deletions(-)

Looks good to me.
Acked-by: Chanwoo Choi 

-- 
Regards,
Chanwoo Choi


Re: [PATCH 3/8] extcon: axp288: Simplify axp288_handle_chrg_det_event

2016-12-18 Thread Chanwoo Choi
Hi Hans,

On 2016년 12월 19일 09:13, Hans de Goede wrote:
> axp288_handle_chrg_det_event only gets called on change interrupts
> (so not that often), extcon_set_state_sync() checks itself if there are
> any actual changes before notifying listeners, and gpiod_set_value is
> not really expensive either.
> 
> So we can simply always do both on each interrupt removing a bunch of
> somewhat magic looking code from axp288_handle_chrg_det_event.
> 
> Signed-off-by: Hans de Goede 
> ---
>  drivers/extcon/extcon-axp288.c | 37 -
>  1 file changed, 12 insertions(+), 25 deletions(-)

Looks good to me.
Acked-by: Chanwoo Choi 

-- 
Regards,
Chanwoo Choi


Re: [PATCH 1/8] extcon: axp288: Remove dependency on non-existing platform_data

2016-12-18 Thread Chanwoo Choi
Hi Hans,

On 2016년 12월 19일 09:13, Hans de Goede wrote:
> When the extcon_axp288 driver was originally merged, it was merged with
> a dependency on some other driver providing platform data for it.
> 
> However such another driver was never merged, so the extcon_axp288 as
> merged upstream has never worked, its probe method simply always returns
> -ENODEV.
> 
> This commit drops the dependency on the pdata always being there, instead
> it treats not having pdata as the pdata having a NULL gpio_mux_control,
> something which the code was already prepared to handle.
> 
> Note that the code for controlling the mux_control gpio is left in place,
> as this may be necessary to allow the axp288 pmic to properly detect the
> charger type (instead of assuming 500mA max charge current) on some
> tablets. This will make it easier for future patches to add support for
> this gpio by getting the gpio info from somewhere.
> 
> Signed-off-by: Hans de Goede 
> ---
>  drivers/extcon/extcon-axp288.c | 25 ++---
>  1 file changed, 10 insertions(+), 15 deletions(-)

Looks good to me.
Acked-by: Chanwoo Choi 

-- 
Regards,
Chanwoo Choi


Re: [PATCH 1/8] extcon: axp288: Remove dependency on non-existing platform_data

2016-12-18 Thread Chanwoo Choi
Hi Hans,

On 2016년 12월 19일 09:13, Hans de Goede wrote:
> When the extcon_axp288 driver was originally merged, it was merged with
> a dependency on some other driver providing platform data for it.
> 
> However such another driver was never merged, so the extcon_axp288 as
> merged upstream has never worked, its probe method simply always returns
> -ENODEV.
> 
> This commit drops the dependency on the pdata always being there, instead
> it treats not having pdata as the pdata having a NULL gpio_mux_control,
> something which the code was already prepared to handle.
> 
> Note that the code for controlling the mux_control gpio is left in place,
> as this may be necessary to allow the axp288 pmic to properly detect the
> charger type (instead of assuming 500mA max charge current) on some
> tablets. This will make it easier for future patches to add support for
> this gpio by getting the gpio info from somewhere.
> 
> Signed-off-by: Hans de Goede 
> ---
>  drivers/extcon/extcon-axp288.c | 25 ++---
>  1 file changed, 10 insertions(+), 15 deletions(-)

Looks good to me.
Acked-by: Chanwoo Choi 

-- 
Regards,
Chanwoo Choi


RE: [PATCH] ACPICA: use designated initializers

2016-12-18 Thread Zheng, Lv
Hi,

> From: Kees Cook [mailto:keesc...@chromium.org]
> Subject: [PATCH] ACPICA: use designated initializers
> 
> Prepare to mark sensitive kernel structures for randomization by making
> sure they're using designated initializers. These were identified during
> allyesconfig builds of x86, arm, and arm64, with most initializer fixes
> extracted from grsecurity.

This commit is not suitable for ACPICA upstream.
It's not portable. Please drop.

Thanks
Lv

> 
> Signed-off-by: Kees Cook 
> ---
>  drivers/acpi/acpica/hwxfsleep.c | 11 ++-
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/acpi/acpica/hwxfsleep.c b/drivers/acpi/acpica/hwxfsleep.c
> index f76e0eab32b8..25cd5c66e102 100644
> --- a/drivers/acpi/acpica/hwxfsleep.c
> +++ b/drivers/acpi/acpica/hwxfsleep.c
> @@ -70,11 +70,12 @@ static acpi_status acpi_hw_sleep_dispatch(u8 sleep_state, 
> u32 function_id);
>  /* Legacy functions are optional, based upon ACPI_REDUCED_HARDWARE */
> 
>  static struct acpi_sleep_functions acpi_sleep_dispatch[] = {
> - {ACPI_HW_OPTIONAL_FUNCTION(acpi_hw_legacy_sleep),
> -  acpi_hw_extended_sleep},
> - {ACPI_HW_OPTIONAL_FUNCTION(acpi_hw_legacy_wake_prep),
> -  acpi_hw_extended_wake_prep},
> - {ACPI_HW_OPTIONAL_FUNCTION(acpi_hw_legacy_wake), acpi_hw_extended_wake}
> + { .legacy_function = ACPI_HW_OPTIONAL_FUNCTION(acpi_hw_legacy_sleep),
> +   .extended_function = acpi_hw_extended_sleep },
> + { .legacy_function = 
> ACPI_HW_OPTIONAL_FUNCTION(acpi_hw_legacy_wake_prep),
> +   .extended_function = acpi_hw_extended_wake_prep },
> + { .legacy_function = ACPI_HW_OPTIONAL_FUNCTION(acpi_hw_legacy_wake),
> +   .extended_function = acpi_hw_extended_wake }
>  };
> 
>  /*
> --
> 2.7.4
> 
> 
> --
> Kees Cook
> Nexus Security


RE: [PATCH] ACPICA: use designated initializers

2016-12-18 Thread Zheng, Lv
Hi,

> From: Kees Cook [mailto:keesc...@chromium.org]
> Subject: [PATCH] ACPICA: use designated initializers
> 
> Prepare to mark sensitive kernel structures for randomization by making
> sure they're using designated initializers. These were identified during
> allyesconfig builds of x86, arm, and arm64, with most initializer fixes
> extracted from grsecurity.

This commit is not suitable for ACPICA upstream.
It's not portable. Please drop.

Thanks
Lv

> 
> Signed-off-by: Kees Cook 
> ---
>  drivers/acpi/acpica/hwxfsleep.c | 11 ++-
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/acpi/acpica/hwxfsleep.c b/drivers/acpi/acpica/hwxfsleep.c
> index f76e0eab32b8..25cd5c66e102 100644
> --- a/drivers/acpi/acpica/hwxfsleep.c
> +++ b/drivers/acpi/acpica/hwxfsleep.c
> @@ -70,11 +70,12 @@ static acpi_status acpi_hw_sleep_dispatch(u8 sleep_state, 
> u32 function_id);
>  /* Legacy functions are optional, based upon ACPI_REDUCED_HARDWARE */
> 
>  static struct acpi_sleep_functions acpi_sleep_dispatch[] = {
> - {ACPI_HW_OPTIONAL_FUNCTION(acpi_hw_legacy_sleep),
> -  acpi_hw_extended_sleep},
> - {ACPI_HW_OPTIONAL_FUNCTION(acpi_hw_legacy_wake_prep),
> -  acpi_hw_extended_wake_prep},
> - {ACPI_HW_OPTIONAL_FUNCTION(acpi_hw_legacy_wake), acpi_hw_extended_wake}
> + { .legacy_function = ACPI_HW_OPTIONAL_FUNCTION(acpi_hw_legacy_sleep),
> +   .extended_function = acpi_hw_extended_sleep },
> + { .legacy_function = 
> ACPI_HW_OPTIONAL_FUNCTION(acpi_hw_legacy_wake_prep),
> +   .extended_function = acpi_hw_extended_wake_prep },
> + { .legacy_function = ACPI_HW_OPTIONAL_FUNCTION(acpi_hw_legacy_wake),
> +   .extended_function = acpi_hw_extended_wake }
>  };
> 
>  /*
> --
> 2.7.4
> 
> 
> --
> Kees Cook
> Nexus Security


RE: [PATCH] acpi: Fix format string type mistakes

2016-12-18 Thread Zheng, Lv
Hi,

> From: Kees Cook [mailto:keesc...@chromium.org]
> Subject: [PATCH] acpi: Fix format string type mistakes
> 
> From: Emese Revfy 
> 
> This adds the missing __printf attribute which allows compile time
> format string checking (and will be used by the coming initify gcc
> plugin). Additionally, this fixes the warnings exposed by the attribute.
> 
> Signed-off-by: Emese Revfy 
> [kees: split scsi/acpi, merged attr and fix, new commit messages]
> Signed-off-by: Kees Cook 
> ---
>  drivers/acpi/acpica/dbhistry.c |  2 +-
>  drivers/acpi/acpica/dbinput.c  | 10 ++---
>  drivers/acpi/acpica/dbstats.c  | 88 
> +-
>  drivers/acpi/acpica/utdebug.c  |  2 +-
>  include/acpi/acpiosxf.h|  3 +-
>  5 files changed, 53 insertions(+), 52 deletions(-)
> 
> diff --git a/drivers/acpi/acpica/dbhistry.c b/drivers/acpi/acpica/dbhistry.c
> index 46bd65d38df9..ec9da4830f6a 100644
> --- a/drivers/acpi/acpica/dbhistry.c
> +++ b/drivers/acpi/acpica/dbhistry.c
> @@ -155,7 +155,7 @@ void acpi_db_display_history(void)
> 
>   for (i = 0; i < acpi_gbl_num_history; i++) {
>   if (acpi_gbl_history_buffer[history_index].command) {
> - acpi_os_printf("%3ld %s\n",
> + acpi_os_printf("%3u %s\n",
>  acpi_gbl_history_buffer[history_index].
>  cmd_num,
>  acpi_gbl_history_buffer[history_index].
> diff --git a/drivers/acpi/acpica/dbinput.c b/drivers/acpi/acpica/dbinput.c
> index 068214f9cc9d..43be06bdb790 100644
> --- a/drivers/acpi/acpica/dbinput.c
> +++ b/drivers/acpi/acpica/dbinput.c
> @@ -608,7 +608,7 @@ static u32 acpi_db_get_line(char *input_buffer)
>   (acpi_gbl_db_parsed_buf, sizeof(acpi_gbl_db_parsed_buf),
>input_buffer)) {
>   acpi_os_printf
> - ("Buffer overflow while parsing input line (max %u 
> characters)\n",
> + ("Buffer overflow while parsing input line (max %lu 
> characters)\n",
>sizeof(acpi_gbl_db_parsed_buf));
>   return (0);
>   }
> @@ -864,24 +864,24 @@ acpi_db_command_dispatch(char *input_buffer,
> 
>   if (param_count == 0) {
>   acpi_os_printf
> - ("Current debug level for file output is:
> %8.8lX\n",
> + ("Current debug level for file output is:
> %8.8X\n",
>acpi_gbl_db_debug_level);
>   acpi_os_printf
> - ("Current debug level for console output is: 
> %8.8lX\n",
> + ("Current debug level for console output is: 
> %8.8X\n",
>acpi_gbl_db_console_debug_level);
>   } else if (param_count == 2) {
>   temp = acpi_gbl_db_console_debug_level;
>   acpi_gbl_db_console_debug_level =
>   strtoul(acpi_gbl_db_args[1], NULL, 16);
>   acpi_os_printf
> - ("Debug Level for console output was %8.8lX, now 
> %8.8lX\n",
> + ("Debug Level for console output was %8.8X, now 
> %8.8X\n",
>temp, acpi_gbl_db_console_debug_level);
>   } else {
>   temp = acpi_gbl_db_debug_level;
>   acpi_gbl_db_debug_level =
>   strtoul(acpi_gbl_db_args[1], NULL, 16);
>   acpi_os_printf
> - ("Debug Level for file output was %8.8lX, now 
> %8.8lX\n",
> + ("Debug Level for file output was %8.8X, now 
> %8.8X\n",
>temp, acpi_gbl_db_debug_level);
>   }
>   break;
> diff --git a/drivers/acpi/acpica/dbstats.c b/drivers/acpi/acpica/dbstats.c
> index a414e1fa6f9d..de7023024b12 100644
> --- a/drivers/acpi/acpica/dbstats.c
> +++ b/drivers/acpi/acpica/dbstats.c
> @@ -377,17 +377,17 @@ acpi_status acpi_db_display_statistics(char *type_arg)
>  "ACPI_TYPE", "NODES", "OBJECTS");
> 
>   for (i = 0; i < ACPI_TYPE_NS_NODE_MAX; i++) {
> - acpi_os_printf("%16.16s % 10ld% 10ld\n",
> + acpi_os_printf("%16.16s % 10d% 10d\n",
>  acpi_ut_get_type_name(i),
>  acpi_gbl_node_type_count[i],
>  acpi_gbl_obj_type_count[i]);
>   }
> 
> - acpi_os_printf("%16.16s % 10ld% 10ld\n", "Misc/Unknown",
> + acpi_os_printf("%16.16s % 10d% 10d\n", "Misc/Unknown",
>  acpi_gbl_node_type_count_misc,
>  acpi_gbl_obj_type_count_misc);
> 
> - acpi_os_printf("%16.16s % 10ld% 10ld\n", 

RE: [PATCH] acpi: Fix format string type mistakes

2016-12-18 Thread Zheng, Lv
Hi,

> From: Kees Cook [mailto:keesc...@chromium.org]
> Subject: [PATCH] acpi: Fix format string type mistakes
> 
> From: Emese Revfy 
> 
> This adds the missing __printf attribute which allows compile time
> format string checking (and will be used by the coming initify gcc
> plugin). Additionally, this fixes the warnings exposed by the attribute.
> 
> Signed-off-by: Emese Revfy 
> [kees: split scsi/acpi, merged attr and fix, new commit messages]
> Signed-off-by: Kees Cook 
> ---
>  drivers/acpi/acpica/dbhistry.c |  2 +-
>  drivers/acpi/acpica/dbinput.c  | 10 ++---
>  drivers/acpi/acpica/dbstats.c  | 88 
> +-
>  drivers/acpi/acpica/utdebug.c  |  2 +-
>  include/acpi/acpiosxf.h|  3 +-
>  5 files changed, 53 insertions(+), 52 deletions(-)
> 
> diff --git a/drivers/acpi/acpica/dbhistry.c b/drivers/acpi/acpica/dbhistry.c
> index 46bd65d38df9..ec9da4830f6a 100644
> --- a/drivers/acpi/acpica/dbhistry.c
> +++ b/drivers/acpi/acpica/dbhistry.c
> @@ -155,7 +155,7 @@ void acpi_db_display_history(void)
> 
>   for (i = 0; i < acpi_gbl_num_history; i++) {
>   if (acpi_gbl_history_buffer[history_index].command) {
> - acpi_os_printf("%3ld %s\n",
> + acpi_os_printf("%3u %s\n",
>  acpi_gbl_history_buffer[history_index].
>  cmd_num,
>  acpi_gbl_history_buffer[history_index].
> diff --git a/drivers/acpi/acpica/dbinput.c b/drivers/acpi/acpica/dbinput.c
> index 068214f9cc9d..43be06bdb790 100644
> --- a/drivers/acpi/acpica/dbinput.c
> +++ b/drivers/acpi/acpica/dbinput.c
> @@ -608,7 +608,7 @@ static u32 acpi_db_get_line(char *input_buffer)
>   (acpi_gbl_db_parsed_buf, sizeof(acpi_gbl_db_parsed_buf),
>input_buffer)) {
>   acpi_os_printf
> - ("Buffer overflow while parsing input line (max %u 
> characters)\n",
> + ("Buffer overflow while parsing input line (max %lu 
> characters)\n",
>sizeof(acpi_gbl_db_parsed_buf));
>   return (0);
>   }
> @@ -864,24 +864,24 @@ acpi_db_command_dispatch(char *input_buffer,
> 
>   if (param_count == 0) {
>   acpi_os_printf
> - ("Current debug level for file output is:
> %8.8lX\n",
> + ("Current debug level for file output is:
> %8.8X\n",
>acpi_gbl_db_debug_level);
>   acpi_os_printf
> - ("Current debug level for console output is: 
> %8.8lX\n",
> + ("Current debug level for console output is: 
> %8.8X\n",
>acpi_gbl_db_console_debug_level);
>   } else if (param_count == 2) {
>   temp = acpi_gbl_db_console_debug_level;
>   acpi_gbl_db_console_debug_level =
>   strtoul(acpi_gbl_db_args[1], NULL, 16);
>   acpi_os_printf
> - ("Debug Level for console output was %8.8lX, now 
> %8.8lX\n",
> + ("Debug Level for console output was %8.8X, now 
> %8.8X\n",
>temp, acpi_gbl_db_console_debug_level);
>   } else {
>   temp = acpi_gbl_db_debug_level;
>   acpi_gbl_db_debug_level =
>   strtoul(acpi_gbl_db_args[1], NULL, 16);
>   acpi_os_printf
> - ("Debug Level for file output was %8.8lX, now 
> %8.8lX\n",
> + ("Debug Level for file output was %8.8X, now 
> %8.8X\n",
>temp, acpi_gbl_db_debug_level);
>   }
>   break;
> diff --git a/drivers/acpi/acpica/dbstats.c b/drivers/acpi/acpica/dbstats.c
> index a414e1fa6f9d..de7023024b12 100644
> --- a/drivers/acpi/acpica/dbstats.c
> +++ b/drivers/acpi/acpica/dbstats.c
> @@ -377,17 +377,17 @@ acpi_status acpi_db_display_statistics(char *type_arg)
>  "ACPI_TYPE", "NODES", "OBJECTS");
> 
>   for (i = 0; i < ACPI_TYPE_NS_NODE_MAX; i++) {
> - acpi_os_printf("%16.16s % 10ld% 10ld\n",
> + acpi_os_printf("%16.16s % 10d% 10d\n",
>  acpi_ut_get_type_name(i),
>  acpi_gbl_node_type_count[i],
>  acpi_gbl_obj_type_count[i]);
>   }
> 
> - acpi_os_printf("%16.16s % 10ld% 10ld\n", "Misc/Unknown",
> + acpi_os_printf("%16.16s % 10d% 10d\n", "Misc/Unknown",
>  acpi_gbl_node_type_count_misc,
>  acpi_gbl_obj_type_count_misc);
> 
> - acpi_os_printf("%16.16s % 10ld% 10ld\n", "TOTALS:",
> + acpi_os_printf("%16.16s % 10d% 10d\n", 

[PATCH] NTB: Fix 'request_irq()' and 'free_irq()' inconsistancy

2016-12-18 Thread Christophe JAILLET
'request_irq()' and 'free_irq()' should have the same 'dev_id'.

Signed-off-by: Christophe JAILLET 
---
 drivers/ntb/hw/amd/ntb_hw_amd.c | 2 +-
 drivers/ntb/hw/intel/ntb_hw_intel.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/ntb/hw/amd/ntb_hw_amd.c b/drivers/ntb/hw/amd/ntb_hw_amd.c
index 6ccba0d862df..a48c3e085eab 100644
--- a/drivers/ntb/hw/amd/ntb_hw_amd.c
+++ b/drivers/ntb/hw/amd/ntb_hw_amd.c
@@ -598,7 +598,7 @@ static int ndev_init_isr(struct amd_ntb_dev *ndev,
 
 err_msix_request:
while (i-- > 0)
-   free_irq(ndev->msix[i].vector, ndev);
+   free_irq(ndev->msix[i].vector, >vec[i]);
pci_disable_msix(pdev);
 err_msix_enable:
kfree(ndev->msix);
diff --git a/drivers/ntb/hw/intel/ntb_hw_intel.c 
b/drivers/ntb/hw/intel/ntb_hw_intel.c
index 7310a261c858..2413600aae30 100644
--- a/drivers/ntb/hw/intel/ntb_hw_intel.c
+++ b/drivers/ntb/hw/intel/ntb_hw_intel.c
@@ -472,7 +472,7 @@ static int ndev_init_isr(struct intel_ntb_dev *ndev,
 
 err_msix_request:
while (i-- > 0)
-   free_irq(ndev->msix[i].vector, ndev);
+   free_irq(ndev->msix[i].vector, >vec[i]);
pci_disable_msix(pdev);
 err_msix_enable:
kfree(ndev->msix);
-- 
2.9.3



[PATCH] NTB: Fix 'request_irq()' and 'free_irq()' inconsistancy

2016-12-18 Thread Christophe JAILLET
'request_irq()' and 'free_irq()' should have the same 'dev_id'.

Signed-off-by: Christophe JAILLET 
---
 drivers/ntb/hw/amd/ntb_hw_amd.c | 2 +-
 drivers/ntb/hw/intel/ntb_hw_intel.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/ntb/hw/amd/ntb_hw_amd.c b/drivers/ntb/hw/amd/ntb_hw_amd.c
index 6ccba0d862df..a48c3e085eab 100644
--- a/drivers/ntb/hw/amd/ntb_hw_amd.c
+++ b/drivers/ntb/hw/amd/ntb_hw_amd.c
@@ -598,7 +598,7 @@ static int ndev_init_isr(struct amd_ntb_dev *ndev,
 
 err_msix_request:
while (i-- > 0)
-   free_irq(ndev->msix[i].vector, ndev);
+   free_irq(ndev->msix[i].vector, >vec[i]);
pci_disable_msix(pdev);
 err_msix_enable:
kfree(ndev->msix);
diff --git a/drivers/ntb/hw/intel/ntb_hw_intel.c 
b/drivers/ntb/hw/intel/ntb_hw_intel.c
index 7310a261c858..2413600aae30 100644
--- a/drivers/ntb/hw/intel/ntb_hw_intel.c
+++ b/drivers/ntb/hw/intel/ntb_hw_intel.c
@@ -472,7 +472,7 @@ static int ndev_init_isr(struct intel_ntb_dev *ndev,
 
 err_msix_request:
while (i-- > 0)
-   free_irq(ndev->msix[i].vector, ndev);
+   free_irq(ndev->msix[i].vector, >vec[i]);
pci_disable_msix(pdev);
 err_msix_enable:
kfree(ndev->msix);
-- 
2.9.3



[PATCH] dmaengine: ti-dma-crossbar: Add some 'of_node_put()' in error path.

2016-12-18 Thread Christophe JAILLET
Add some missing 'of_node_put()' in early exit error path.

Signed-off-by: Christophe JAILLET 
---
 drivers/dma/ti-dma-crossbar.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/dma/ti-dma-crossbar.c b/drivers/dma/ti-dma-crossbar.c
index 3f24aeb48c0e..2403475a37cf 100644
--- a/drivers/dma/ti-dma-crossbar.c
+++ b/drivers/dma/ti-dma-crossbar.c
@@ -149,6 +149,7 @@ static int ti_am335x_xbar_probe(struct platform_device 
*pdev)
match = of_match_node(ti_am335x_master_match, dma_node);
if (!match) {
dev_err(>dev, "DMA master is not supported\n");
+   of_node_put(dma_node);
return -EINVAL;
}
 
@@ -339,6 +340,7 @@ static int ti_dra7_xbar_probe(struct platform_device *pdev)
match = of_match_node(ti_dra7_master_match, dma_node);
if (!match) {
dev_err(>dev, "DMA master is not supported\n");
+   of_node_put(dma_node);
return -EINVAL;
}
 
-- 
2.9.3



[PATCH] dmaengine: ti-dma-crossbar: Add some 'of_node_put()' in error path.

2016-12-18 Thread Christophe JAILLET
Add some missing 'of_node_put()' in early exit error path.

Signed-off-by: Christophe JAILLET 
---
 drivers/dma/ti-dma-crossbar.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/dma/ti-dma-crossbar.c b/drivers/dma/ti-dma-crossbar.c
index 3f24aeb48c0e..2403475a37cf 100644
--- a/drivers/dma/ti-dma-crossbar.c
+++ b/drivers/dma/ti-dma-crossbar.c
@@ -149,6 +149,7 @@ static int ti_am335x_xbar_probe(struct platform_device 
*pdev)
match = of_match_node(ti_am335x_master_match, dma_node);
if (!match) {
dev_err(>dev, "DMA master is not supported\n");
+   of_node_put(dma_node);
return -EINVAL;
}
 
@@ -339,6 +340,7 @@ static int ti_dra7_xbar_probe(struct platform_device *pdev)
match = of_match_node(ti_dra7_master_match, dma_node);
if (!match) {
dev_err(>dev, "DMA master is not supported\n");
+   of_node_put(dma_node);
return -EINVAL;
}
 
-- 
2.9.3



Re: [PATCH 05/21] MIPS memblock: Alter initrd memory reservation method

2016-12-18 Thread kbuild test robot
Hi Serge,

[auto build test ERROR on linus/master]
[also build test ERROR on v4.9 next-20161216]
[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/Serge-Semin/MIPS-memblock-Remove-bootmem-code-and-switch-to-NO_BOOTMEM/20161219-105045
config: mips-jazz_defconfig (attached as .config)
compiler: mipsel-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=mips 

All errors (new ones prefixed by >>):

>> arch/mips/kernel/setup.c:273:20: error: 'is_lowmem_and_valid' defined but 
>> not used [-Werror=unused-function]
static bool __init is_lowmem_and_valid(const char *name, phys_addr_t base,
   ^~~
   cc1: all warnings being treated as errors

vim +/is_lowmem_and_valid +273 arch/mips/kernel/setup.c

   267  }
   268  early_param("mem", early_parse_mem);
   269  
   270  /*
   271   * Helper method checking whether passed lowmem region is valid
   272   */
 > 273  static bool __init is_lowmem_and_valid(const char *name, phys_addr_t 
 > base,
   274 phys_addr_t size)
   275  {
   276  phys_addr_t end = base + size;

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


.config.gz
Description: application/gzip


Re: [PATCH 05/21] MIPS memblock: Alter initrd memory reservation method

2016-12-18 Thread kbuild test robot
Hi Serge,

[auto build test ERROR on linus/master]
[also build test ERROR on v4.9 next-20161216]
[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/Serge-Semin/MIPS-memblock-Remove-bootmem-code-and-switch-to-NO_BOOTMEM/20161219-105045
config: mips-jazz_defconfig (attached as .config)
compiler: mipsel-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=mips 

All errors (new ones prefixed by >>):

>> arch/mips/kernel/setup.c:273:20: error: 'is_lowmem_and_valid' defined but 
>> not used [-Werror=unused-function]
static bool __init is_lowmem_and_valid(const char *name, phys_addr_t base,
   ^~~
   cc1: all warnings being treated as errors

vim +/is_lowmem_and_valid +273 arch/mips/kernel/setup.c

   267  }
   268  early_param("mem", early_parse_mem);
   269  
   270  /*
   271   * Helper method checking whether passed lowmem region is valid
   272   */
 > 273  static bool __init is_lowmem_and_valid(const char *name, phys_addr_t 
 > base,
   274 phys_addr_t size)
   275  {
   276  phys_addr_t end = base + size;

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


.config.gz
Description: application/gzip


Re: [PATCH 2/5] dmaengine: Add support for custom data mapping

2016-12-18 Thread Andy Gross
On Sun, Dec 18, 2016 at 09:56:02PM +0530, Vinod Koul wrote:
> On Thu, Dec 15, 2016 at 03:25:52PM +0530, Abhishek Sahu wrote:
> > The current DMA APIs only support SGL or data in generic format.
> > The QCA BAM DMA engine data cannot be mapped with already
> > available APIs due to following reasons.
> > 
> > 1. The QCA BAM DMA engine uses custom flags which cannot be
> >mapped with generic DMA engine flags.
> > 2. Some peripheral driver like QCA QPIC NAND/LCD requires to
> >set specific flags (Like NWD, EOT) for some of the descriptors
> >in scatter gather list. The already available mapping APIs take
> >flags parameter in API itself and there is no support for
> >passing DMA specific flags for each SGL entry.
> > 
> > Now this patch adds the support for making the DMA descriptor from
> > custom data with new DMA mapping function prep_dma_custom_mapping.
> > The peripheral driver will pass the custom data in this function and
> > DMA engine driver will form the descriptor according to its own
> > logic. In future, this API can be used by any other DMA engine
> > drivers also which are unable to do DMA mapping with already
> > available API’s.
> > 
> > Signed-off-by: Abhishek Sahu 
> > ---
> >  include/linux/dmaengine.h | 5 +
> >  1 file changed, 5 insertions(+)
> > 
> > diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
> > index cc535a4..6324c1f 100644
> > --- a/include/linux/dmaengine.h
> > +++ b/include/linux/dmaengine.h
> > @@ -692,6 +692,8 @@ struct dma_filter {
> >   * be called after period_len bytes have been transferred.
> >   * @device_prep_interleaved_dma: Transfer expression in a generic way.
> >   * @device_prep_dma_imm_data: DMA's 8 byte immediate data to the dst 
> > address
> > + * @device_prep_dma_custom_mapping: prepares a dma operation from dma 
> > driver
> > + * specific custom data
> >   * @device_config: Pushes a new configuration to a channel, return 0 or an 
> > error
> >   * code
> >   * @device_pause: Pauses any transfer happening on a channel. Returns
> > @@ -783,6 +785,9 @@ struct dma_device {
> > struct dma_async_tx_descriptor *(*device_prep_dma_imm_data)(
> > struct dma_chan *chan, dma_addr_t dst, u64 data,
> > unsigned long flags);
> > +   struct dma_async_tx_descriptor *(*device_prep_dma_custom_mapping)(
> > +   struct dma_chan *chan, void *data,
> > +   unsigned long flags);
> 
> This needs a discussion. Why do you need to add a new API for framework.
> 
> What are NWD and EOT flags, cna you details out the flags?

These are the notify when done and end of transaction flags.  I believe the last
time we talked about this, we (Vinod and I)  agreed to just expose a QCOM only 
interface to set
the special transaction flags.  You'd then have to have some other API to fixup
the descriptor with the right qcom flags.

Ahbishek, correct me where i am wrong on the following:
So two main differences between a normal descriptor and a command descriptor:
1) size of the descriptor
2) the flag setting
3) data sent in is a modified scatter gather that includes flags , vs a normal
scatter gather

So the CMD descriptors in a given sgl can all have varying flags set? I'd assume
they all have CMD flag set.  Do the current users of the command descriptors
coalesce all of their requests into a big list?

So a couple of thoughts on how to deal with this:

1) Define a virtual channel for the command descriptors vs a normal DMA
transaction.  This lets you use the same hardware channel, but lets you discern
which descriptor format you need to use.  The only issue I see with this is the
required change in device tree binding to target the right type of channel (cmd
vs normal).

2) Provide an API to set flags for the descriptor on a whole descriptor basis.

3) If you have a set of transactions described by an sgl that has disparate use
of flags, you split the list and use a separate transaction.  In other words, we
need to enforce that the flag set API will be applied to all descriptors
described by an sgl.  This means that the whole transaction may be comprised of
multiple async TX descriptors.

Regards,
Andy


Re: [PATCH 2/5] dmaengine: Add support for custom data mapping

2016-12-18 Thread Andy Gross
On Sun, Dec 18, 2016 at 09:56:02PM +0530, Vinod Koul wrote:
> On Thu, Dec 15, 2016 at 03:25:52PM +0530, Abhishek Sahu wrote:
> > The current DMA APIs only support SGL or data in generic format.
> > The QCA BAM DMA engine data cannot be mapped with already
> > available APIs due to following reasons.
> > 
> > 1. The QCA BAM DMA engine uses custom flags which cannot be
> >mapped with generic DMA engine flags.
> > 2. Some peripheral driver like QCA QPIC NAND/LCD requires to
> >set specific flags (Like NWD, EOT) for some of the descriptors
> >in scatter gather list. The already available mapping APIs take
> >flags parameter in API itself and there is no support for
> >passing DMA specific flags for each SGL entry.
> > 
> > Now this patch adds the support for making the DMA descriptor from
> > custom data with new DMA mapping function prep_dma_custom_mapping.
> > The peripheral driver will pass the custom data in this function and
> > DMA engine driver will form the descriptor according to its own
> > logic. In future, this API can be used by any other DMA engine
> > drivers also which are unable to do DMA mapping with already
> > available API’s.
> > 
> > Signed-off-by: Abhishek Sahu 
> > ---
> >  include/linux/dmaengine.h | 5 +
> >  1 file changed, 5 insertions(+)
> > 
> > diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
> > index cc535a4..6324c1f 100644
> > --- a/include/linux/dmaengine.h
> > +++ b/include/linux/dmaengine.h
> > @@ -692,6 +692,8 @@ struct dma_filter {
> >   * be called after period_len bytes have been transferred.
> >   * @device_prep_interleaved_dma: Transfer expression in a generic way.
> >   * @device_prep_dma_imm_data: DMA's 8 byte immediate data to the dst 
> > address
> > + * @device_prep_dma_custom_mapping: prepares a dma operation from dma 
> > driver
> > + * specific custom data
> >   * @device_config: Pushes a new configuration to a channel, return 0 or an 
> > error
> >   * code
> >   * @device_pause: Pauses any transfer happening on a channel. Returns
> > @@ -783,6 +785,9 @@ struct dma_device {
> > struct dma_async_tx_descriptor *(*device_prep_dma_imm_data)(
> > struct dma_chan *chan, dma_addr_t dst, u64 data,
> > unsigned long flags);
> > +   struct dma_async_tx_descriptor *(*device_prep_dma_custom_mapping)(
> > +   struct dma_chan *chan, void *data,
> > +   unsigned long flags);
> 
> This needs a discussion. Why do you need to add a new API for framework.
> 
> What are NWD and EOT flags, cna you details out the flags?

These are the notify when done and end of transaction flags.  I believe the last
time we talked about this, we (Vinod and I)  agreed to just expose a QCOM only 
interface to set
the special transaction flags.  You'd then have to have some other API to fixup
the descriptor with the right qcom flags.

Ahbishek, correct me where i am wrong on the following:
So two main differences between a normal descriptor and a command descriptor:
1) size of the descriptor
2) the flag setting
3) data sent in is a modified scatter gather that includes flags , vs a normal
scatter gather

So the CMD descriptors in a given sgl can all have varying flags set? I'd assume
they all have CMD flag set.  Do the current users of the command descriptors
coalesce all of their requests into a big list?

So a couple of thoughts on how to deal with this:

1) Define a virtual channel for the command descriptors vs a normal DMA
transaction.  This lets you use the same hardware channel, but lets you discern
which descriptor format you need to use.  The only issue I see with this is the
required change in device tree binding to target the right type of channel (cmd
vs normal).

2) Provide an API to set flags for the descriptor on a whole descriptor basis.

3) If you have a set of transactions described by an sgl that has disparate use
of flags, you split the list and use a separate transaction.  In other words, we
need to enforce that the flag set API will be applied to all descriptors
described by an sgl.  This means that the whole transaction may be comprised of
multiple async TX descriptors.

Regards,
Andy


Re: [PATCH 01/21] MIPS memblock: Unpin dts memblock sanity check method

2016-12-18 Thread kbuild test robot
Hi Serge,

[auto build test WARNING on linus/master]
[also build test WARNING on v4.9 next-20161216]
[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/Serge-Semin/MIPS-memblock-Remove-bootmem-code-and-switch-to-NO_BOOTMEM/20161219-105045
config: openrisc-or1ksim_defconfig (attached as .config)
compiler: or32-linux-gcc (GCC) 4.5.1-or32-1.0rc1
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=openrisc 

All warnings (new ones prefixed by >>):

   drivers/of/fdt.c: In function 'sanity_check_dt_memory':
>> drivers/of/fdt.c:1125:4: warning: format '%llx' expects type 'long long 
>> unsigned int', but argument 2 has type 'phys_addr_t'
   drivers/of/fdt.c:1125:4: warning: format '%llx' expects type 'long long 
unsigned int', but argument 3 has type 'phys_addr_t'
   drivers/of/fdt.c:1129:3: warning: format '%llx' expects type 'long long 
unsigned int', but argument 2 has type 'phys_addr_t'
   drivers/of/fdt.c:1129:3: warning: format '%llx' expects type 'long long 
unsigned int', but argument 3 has type 'phys_addr_t'
   drivers/of/fdt.c:1133:3: warning: format '%llx' expects type 'long long 
unsigned int', but argument 2 has type 'phys_addr_t'
   drivers/of/fdt.c:1133:3: warning: format '%llx' expects type 'long long 
unsigned int', but argument 3 has type 'phys_addr_t'
   drivers/of/fdt.c:1138:3: warning: format '%llx' expects type 'long long 
unsigned int', but argument 2 has type 'phys_addr_t'
   drivers/of/fdt.c:1138:3: warning: format '%llx' expects type 'long long 
unsigned int', but argument 3 has type 'phys_addr_t'
   drivers/of/fdt.c:1144:3: warning: format '%llx' expects type 'long long 
unsigned int', but argument 2 has type 'phys_addr_t'
   drivers/of/fdt.c:1144:3: warning: format '%llx' expects type 'long long 
unsigned int', but argument 3 has type 'phys_addr_t'
   drivers/of/fdt.c:1147:3: warning: format '%llx' expects type 'long long 
unsigned int', but argument 2 has type 'phys_addr_t'
   drivers/of/fdt.c:1147:3: warning: format '%llx' expects type 'long long 
unsigned int', but argument 3 has type 'phys_addr_t'
   drivers/of/fdt.c:1151:3: warning: format '%llx' expects type 'long long 
unsigned int', but argument 2 has type 'phys_addr_t'
   drivers/of/fdt.c:1151:3: warning: format '%llx' expects type 'long long 
unsigned int', but argument 3 has type 'phys_addr_t'
   drivers/of/fdt.c:1157:3: warning: format '%llx' expects type 'long long 
unsigned int', but argument 2 has type 'phys_addr_t'
   drivers/of/fdt.c:1157:3: warning: format '%llx' expects type 'long long 
unsigned int', but argument 3 has type 'phys_addr_t'
   drivers/of/fdt.c:1161:3: warning: format '%llx' expects type 'long long 
unsigned int', but argument 2 has type 'phys_addr_t'
   drivers/of/fdt.c:1161:3: warning: format '%llx' expects type 'long long 
unsigned int', but argument 3 has type 'phys_addr_t'
   drivers/of/fdt.c: In function 'early_init_dt_add_memory_arch':
   drivers/of/fdt.c:1173:2: warning: passing argument 1 of 
'sanity_check_dt_memory' from incompatible pointer type
   drivers/of/fdt.c:1117:12: note: expected 'phys_addr_t *' but argument is of 
type 'u64 *'
   drivers/of/fdt.c:1173:2: warning: passing argument 2 of 
'sanity_check_dt_memory' from incompatible pointer type
   drivers/of/fdt.c:1117:12: note: expected 'phys_addr_t *' but argument is of 
type 'u64 *'

vim +1125 drivers/of/fdt.c

  1109  #ifdef CONFIG_HAVE_MEMBLOCK
  1110  #ifndef MIN_MEMBLOCK_ADDR
    #define MIN_MEMBLOCK_ADDR   __pa(PAGE_OFFSET)
  1112  #endif
  1113  #ifndef MAX_MEMBLOCK_ADDR
  1114  #define MAX_MEMBLOCK_ADDR   ((phys_addr_t)~0)
  1115  #endif
  1116  
  1117  int __init sanity_check_dt_memory(phys_addr_t *out_base,
  1118phys_addr_t *out_size)
  1119  {
  1120  phys_addr_t base = *out_base, size = *out_size;
  1121  const u64 phys_offset = MIN_MEMBLOCK_ADDR;
  1122  
  1123  if (!PAGE_ALIGNED(base)) {
  1124  if (size < PAGE_SIZE - (base & ~PAGE_MASK)) {
> 1125  pr_err("Memblock 0x%llx - 0x%llx isn't page 
> aligned\n",
  1126  base, base + size);
  1127  return -EINVAL;
  1128  }
  1129  pr_warn("Memblock 0x%llx - 0x%llx shifted to ",
  1130  base, base + size);
  1131  size -= PAGE_SIZE - (base & ~PAGE_MASK);
  1132  base = PAGE_ALIGN(base);
  1133  pr_cont("0x%llx - 0x%llx\n", base, base + size);

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


.config.gz

Re: [PATCH 10/21] MIPS memblock: Discard bootmem allocator initialization

2016-12-18 Thread kbuild test robot
Hi Serge,

[auto build test ERROR on linus/master]
[also build test ERROR on v4.9 next-20161216]
[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/Serge-Semin/MIPS-memblock-Remove-bootmem-code-and-switch-to-NO_BOOTMEM/20161219-105045
config: mips-allyesconfig (attached as .config)
compiler: mips-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=mips 

All errors (new ones prefixed by >>):

   arch/mips/kernel/setup.c: In function 'mips_reserve_elfcorehdr':
   arch/mips/kernel/setup.c:540:7: error: implicit declaration of function 
'is_vmcore_usable' [-Werror=implicit-function-declaration]
 if (!is_vmcore_usable())
  ^~~~
   arch/mips/kernel/setup.c:544:6: error: 'elfcorehdr_addr' undeclared (first 
use in this function)
 if (elfcorehdr_addr + elfcorehdr_size >= mips_lowmem_limit) {
 ^~~
   arch/mips/kernel/setup.c:544:6: note: each undeclared identifier is reported 
only once for each function it appears in
   arch/mips/kernel/setup.c:544:24: error: 'elfcorehdr_size' undeclared (first 
use in this function)
 if (elfcorehdr_addr + elfcorehdr_size >= mips_lowmem_limit) {
   ^~~
   In file included from include/linux/kernel.h:13:0,
from include/asm-generic/bug.h:13,
from arch/mips/include/asm/bug.h:41,
from include/linux/bug.h:4,
from include/linux/mmdebug.h:4,
from include/linux/mm.h:8,
from include/linux/memblock.h:18,
from arch/mips/kernel/setup.c:17:
   arch/mips/kernel/setup.c: In function 'find_pfn_limits':
>> arch/mips/kernel/setup.c:644:29: error: 'highstart_pfn' undeclared (first 
>> use in this function)
  min_low_pfn, max_low_pfn, highstart_pfn, highend_pfn, max_pfn);
^
   include/linux/printk.h:299:34: note: in definition of macro 'pr_info'
 printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
 ^~~
>> arch/mips/kernel/setup.c:644:44: error: 'highend_pfn' undeclared (first use 
>> in this function)
  min_low_pfn, max_low_pfn, highstart_pfn, highend_pfn, max_pfn);
   ^
   include/linux/printk.h:299:34: note: in definition of macro 'pr_info'
 printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
 ^~~
   cc1: some warnings being treated as errors

vim +/highstart_pfn +644 arch/mips/kernel/setup.c

   638  #ifdef CONFIG_HIGHMEM
   639  highstart_pfn = max_low_pfn;
   640  highend_pfn = max_pfn <= highstart_pfn ? highstart_pfn : 
max_pfn;
   641  #endif
   642  pr_info("PFNs: low min %lu, low max %lu, high start %lu, high 
end %lu,"
   643  "max %lu\n",
 > 644  min_low_pfn, max_low_pfn, highstart_pfn, highend_pfn, 
 > max_pfn);
   645  }
   646  
   647  /*

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


.config.gz
Description: application/gzip


Re: [PATCH 01/21] MIPS memblock: Unpin dts memblock sanity check method

2016-12-18 Thread kbuild test robot
Hi Serge,

[auto build test WARNING on linus/master]
[also build test WARNING on v4.9 next-20161216]
[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/Serge-Semin/MIPS-memblock-Remove-bootmem-code-and-switch-to-NO_BOOTMEM/20161219-105045
config: openrisc-or1ksim_defconfig (attached as .config)
compiler: or32-linux-gcc (GCC) 4.5.1-or32-1.0rc1
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=openrisc 

All warnings (new ones prefixed by >>):

   drivers/of/fdt.c: In function 'sanity_check_dt_memory':
>> drivers/of/fdt.c:1125:4: warning: format '%llx' expects type 'long long 
>> unsigned int', but argument 2 has type 'phys_addr_t'
   drivers/of/fdt.c:1125:4: warning: format '%llx' expects type 'long long 
unsigned int', but argument 3 has type 'phys_addr_t'
   drivers/of/fdt.c:1129:3: warning: format '%llx' expects type 'long long 
unsigned int', but argument 2 has type 'phys_addr_t'
   drivers/of/fdt.c:1129:3: warning: format '%llx' expects type 'long long 
unsigned int', but argument 3 has type 'phys_addr_t'
   drivers/of/fdt.c:1133:3: warning: format '%llx' expects type 'long long 
unsigned int', but argument 2 has type 'phys_addr_t'
   drivers/of/fdt.c:1133:3: warning: format '%llx' expects type 'long long 
unsigned int', but argument 3 has type 'phys_addr_t'
   drivers/of/fdt.c:1138:3: warning: format '%llx' expects type 'long long 
unsigned int', but argument 2 has type 'phys_addr_t'
   drivers/of/fdt.c:1138:3: warning: format '%llx' expects type 'long long 
unsigned int', but argument 3 has type 'phys_addr_t'
   drivers/of/fdt.c:1144:3: warning: format '%llx' expects type 'long long 
unsigned int', but argument 2 has type 'phys_addr_t'
   drivers/of/fdt.c:1144:3: warning: format '%llx' expects type 'long long 
unsigned int', but argument 3 has type 'phys_addr_t'
   drivers/of/fdt.c:1147:3: warning: format '%llx' expects type 'long long 
unsigned int', but argument 2 has type 'phys_addr_t'
   drivers/of/fdt.c:1147:3: warning: format '%llx' expects type 'long long 
unsigned int', but argument 3 has type 'phys_addr_t'
   drivers/of/fdt.c:1151:3: warning: format '%llx' expects type 'long long 
unsigned int', but argument 2 has type 'phys_addr_t'
   drivers/of/fdt.c:1151:3: warning: format '%llx' expects type 'long long 
unsigned int', but argument 3 has type 'phys_addr_t'
   drivers/of/fdt.c:1157:3: warning: format '%llx' expects type 'long long 
unsigned int', but argument 2 has type 'phys_addr_t'
   drivers/of/fdt.c:1157:3: warning: format '%llx' expects type 'long long 
unsigned int', but argument 3 has type 'phys_addr_t'
   drivers/of/fdt.c:1161:3: warning: format '%llx' expects type 'long long 
unsigned int', but argument 2 has type 'phys_addr_t'
   drivers/of/fdt.c:1161:3: warning: format '%llx' expects type 'long long 
unsigned int', but argument 3 has type 'phys_addr_t'
   drivers/of/fdt.c: In function 'early_init_dt_add_memory_arch':
   drivers/of/fdt.c:1173:2: warning: passing argument 1 of 
'sanity_check_dt_memory' from incompatible pointer type
   drivers/of/fdt.c:1117:12: note: expected 'phys_addr_t *' but argument is of 
type 'u64 *'
   drivers/of/fdt.c:1173:2: warning: passing argument 2 of 
'sanity_check_dt_memory' from incompatible pointer type
   drivers/of/fdt.c:1117:12: note: expected 'phys_addr_t *' but argument is of 
type 'u64 *'

vim +1125 drivers/of/fdt.c

  1109  #ifdef CONFIG_HAVE_MEMBLOCK
  1110  #ifndef MIN_MEMBLOCK_ADDR
    #define MIN_MEMBLOCK_ADDR   __pa(PAGE_OFFSET)
  1112  #endif
  1113  #ifndef MAX_MEMBLOCK_ADDR
  1114  #define MAX_MEMBLOCK_ADDR   ((phys_addr_t)~0)
  1115  #endif
  1116  
  1117  int __init sanity_check_dt_memory(phys_addr_t *out_base,
  1118phys_addr_t *out_size)
  1119  {
  1120  phys_addr_t base = *out_base, size = *out_size;
  1121  const u64 phys_offset = MIN_MEMBLOCK_ADDR;
  1122  
  1123  if (!PAGE_ALIGNED(base)) {
  1124  if (size < PAGE_SIZE - (base & ~PAGE_MASK)) {
> 1125  pr_err("Memblock 0x%llx - 0x%llx isn't page 
> aligned\n",
  1126  base, base + size);
  1127  return -EINVAL;
  1128  }
  1129  pr_warn("Memblock 0x%llx - 0x%llx shifted to ",
  1130  base, base + size);
  1131  size -= PAGE_SIZE - (base & ~PAGE_MASK);
  1132  base = PAGE_ALIGN(base);
  1133  pr_cont("0x%llx - 0x%llx\n", base, base + size);

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


.config.gz

Re: [PATCH 10/21] MIPS memblock: Discard bootmem allocator initialization

2016-12-18 Thread kbuild test robot
Hi Serge,

[auto build test ERROR on linus/master]
[also build test ERROR on v4.9 next-20161216]
[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/Serge-Semin/MIPS-memblock-Remove-bootmem-code-and-switch-to-NO_BOOTMEM/20161219-105045
config: mips-allyesconfig (attached as .config)
compiler: mips-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=mips 

All errors (new ones prefixed by >>):

   arch/mips/kernel/setup.c: In function 'mips_reserve_elfcorehdr':
   arch/mips/kernel/setup.c:540:7: error: implicit declaration of function 
'is_vmcore_usable' [-Werror=implicit-function-declaration]
 if (!is_vmcore_usable())
  ^~~~
   arch/mips/kernel/setup.c:544:6: error: 'elfcorehdr_addr' undeclared (first 
use in this function)
 if (elfcorehdr_addr + elfcorehdr_size >= mips_lowmem_limit) {
 ^~~
   arch/mips/kernel/setup.c:544:6: note: each undeclared identifier is reported 
only once for each function it appears in
   arch/mips/kernel/setup.c:544:24: error: 'elfcorehdr_size' undeclared (first 
use in this function)
 if (elfcorehdr_addr + elfcorehdr_size >= mips_lowmem_limit) {
   ^~~
   In file included from include/linux/kernel.h:13:0,
from include/asm-generic/bug.h:13,
from arch/mips/include/asm/bug.h:41,
from include/linux/bug.h:4,
from include/linux/mmdebug.h:4,
from include/linux/mm.h:8,
from include/linux/memblock.h:18,
from arch/mips/kernel/setup.c:17:
   arch/mips/kernel/setup.c: In function 'find_pfn_limits':
>> arch/mips/kernel/setup.c:644:29: error: 'highstart_pfn' undeclared (first 
>> use in this function)
  min_low_pfn, max_low_pfn, highstart_pfn, highend_pfn, max_pfn);
^
   include/linux/printk.h:299:34: note: in definition of macro 'pr_info'
 printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
 ^~~
>> arch/mips/kernel/setup.c:644:44: error: 'highend_pfn' undeclared (first use 
>> in this function)
  min_low_pfn, max_low_pfn, highstart_pfn, highend_pfn, max_pfn);
   ^
   include/linux/printk.h:299:34: note: in definition of macro 'pr_info'
 printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
 ^~~
   cc1: some warnings being treated as errors

vim +/highstart_pfn +644 arch/mips/kernel/setup.c

   638  #ifdef CONFIG_HIGHMEM
   639  highstart_pfn = max_low_pfn;
   640  highend_pfn = max_pfn <= highstart_pfn ? highstart_pfn : 
max_pfn;
   641  #endif
   642  pr_info("PFNs: low min %lu, low max %lu, high start %lu, high 
end %lu,"
   643  "max %lu\n",
 > 644  min_low_pfn, max_low_pfn, highstart_pfn, highend_pfn, 
 > max_pfn);
   645  }
   646  
   647  /*

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


.config.gz
Description: application/gzip


Re: [PATCH 01/21] MIPS memblock: Unpin dts memblock sanity check method

2016-12-18 Thread kbuild test robot
Hi Serge,

[auto build test WARNING on linus/master]
[also build test WARNING on v4.9 next-20161216]
[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/Serge-Semin/MIPS-memblock-Remove-bootmem-code-and-switch-to-NO_BOOTMEM/20161219-105045
config: i386-randconfig-i0-201651 (attached as .config)
compiler: gcc-4.8 (Debian 4.8.4-1) 4.8.4
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All warnings (new ones prefixed by >>):

   drivers/of/fdt.c: In function 'sanity_check_dt_memory':
>> drivers/of/fdt.c:1125:4: warning: format '%llx' expects argument of type 
>> 'long long unsigned int', but argument 2 has type 'phys_addr_t' [-Wformat=]
   pr_err("Memblock 0x%llx - 0x%llx isn't page aligned\n",
   ^
   drivers/of/fdt.c:1125:4: warning: format '%llx' expects argument of type 
'long long unsigned int', but argument 3 has type 'phys_addr_t' [-Wformat=]
   drivers/of/fdt.c:1129:3: warning: format '%llx' expects argument of type 
'long long unsigned int', but argument 2 has type 'phys_addr_t' [-Wformat=]
  pr_warn("Memblock 0x%llx - 0x%llx shifted to ",
  ^
   drivers/of/fdt.c:1129:3: warning: format '%llx' expects argument of type 
'long long unsigned int', but argument 3 has type 'phys_addr_t' [-Wformat=]
   drivers/of/fdt.c:1133:3: warning: format '%llx' expects argument of type 
'long long unsigned int', but argument 2 has type 'phys_addr_t' [-Wformat=]
  pr_cont("0x%llx - 0x%llx\n", base, base + size);
  ^
   drivers/of/fdt.c:1133:3: warning: format '%llx' expects argument of type 
'long long unsigned int', but argument 3 has type 'phys_addr_t' [-Wformat=]
   drivers/of/fdt.c:1138:3: warning: format '%llx' expects argument of type 
'long long unsigned int', but argument 2 has type 'phys_addr_t' [-Wformat=]
  pr_err("Memblock 0x%llx - 0x%llx exceeds max address\n",
  ^
   drivers/of/fdt.c:1138:3: warning: format '%llx' expects argument of type 
'long long unsigned int', but argument 3 has type 'phys_addr_t' [-Wformat=]
   drivers/of/fdt.c:1144:3: warning: format '%llx' expects argument of type 
'long long unsigned int', but argument 2 has type 'phys_addr_t' [-Wformat=]
  pr_warn("Memblock 0x%llx - 0x%llx truncated to ",
  ^
   drivers/of/fdt.c:1144:3: warning: format '%llx' expects argument of type 
'long long unsigned int', but argument 3 has type 'phys_addr_t' [-Wformat=]
   drivers/of/fdt.c:1147:3: warning: format '%llx' expects argument of type 
'long long unsigned int', but argument 2 has type 'phys_addr_t' [-Wformat=]
  pr_cont("0x%llx - 0x%llx\n", base, base + size);
  ^
   drivers/of/fdt.c:1147:3: warning: format '%llx' expects argument of type 
'long long unsigned int', but argument 3 has type 'phys_addr_t' [-Wformat=]
   drivers/of/fdt.c:1151:3: warning: format '%llx' expects argument of type 
'long long unsigned int', but argument 2 has type 'phys_addr_t' [-Wformat=]
  pr_err("Memblock 0x%llx - 0x%llx is below phys offset\n",
  ^
   drivers/of/fdt.c:1151:3: warning: format '%llx' expects argument of type 
'long long unsigned int', but argument 3 has type 'phys_addr_t' [-Wformat=]
   drivers/of/fdt.c:1157:3: warning: format '%llx' expects argument of type 
'long long unsigned int', but argument 2 has type 'phys_addr_t' [-Wformat=]
  pr_warn("Memblock 0x%llx - 0x%llx truncated to ",
  ^
   drivers/of/fdt.c:1157:3: warning: format '%llx' expects argument of type 
'long long unsigned int', but argument 3 has type 'phys_addr_t' [-Wformat=]
   drivers/of/fdt.c:1161:3: warning: format '%llx' expects argument of type 
'long long unsigned int', but argument 2 has type 'phys_addr_t' [-Wformat=]
  pr_cont("0x%llx - 0x%llx\n", base, base + size);
  ^
   drivers/of/fdt.c:1161:3: warning: format '%llx' expects argument of type 
'long long unsigned int', but argument 3 has type 'phys_addr_t' [-Wformat=]
   drivers/of/fdt.c: In function 'early_init_dt_add_memory_arch':
>> drivers/of/fdt.c:1173:2: warning: passing argument 1 of 
>> 'sanity_check_dt_memory' from incompatible pointer type [enabled by default]
 if (sanity_check_dt_memory(, ))
 ^
   drivers/of/fdt.c:1117:12: note: expected 'phys_addr_t *' but argument is of 
type 'u64 *'
int __init sanity_check_dt_memory(phys_addr_t *out_base,
   ^
   drivers/of/fdt.c:1173:2: warning: passing argument 2 of 
'sanity_check_dt_memory' from incompatible pointer type [enabled by default]
 if (sanity_check_dt_memory(, ))
 ^
   drivers/of/fdt.c:1117:12: note: expected 'phys_addr_t *' but argument is of 
type 'u64 *'
int __init sanity_check_dt_memory(phys_addr_t *out_base,
   ^

vim +1125 drivers/of/fdt.c

  1119  {
  1120  phys_addr_t base = *out_base, size = *out_size;
  1121  const u64 phys_offset = MIN_MEMBLOCK_ADDR;
  1122  
  1123  if (!PAGE_ALIGNED(base)) {
  1124  if (size 

Re: [PATCH 01/21] MIPS memblock: Unpin dts memblock sanity check method

2016-12-18 Thread kbuild test robot
Hi Serge,

[auto build test WARNING on linus/master]
[also build test WARNING on v4.9 next-20161216]
[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/Serge-Semin/MIPS-memblock-Remove-bootmem-code-and-switch-to-NO_BOOTMEM/20161219-105045
config: i386-randconfig-i0-201651 (attached as .config)
compiler: gcc-4.8 (Debian 4.8.4-1) 4.8.4
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All warnings (new ones prefixed by >>):

   drivers/of/fdt.c: In function 'sanity_check_dt_memory':
>> drivers/of/fdt.c:1125:4: warning: format '%llx' expects argument of type 
>> 'long long unsigned int', but argument 2 has type 'phys_addr_t' [-Wformat=]
   pr_err("Memblock 0x%llx - 0x%llx isn't page aligned\n",
   ^
   drivers/of/fdt.c:1125:4: warning: format '%llx' expects argument of type 
'long long unsigned int', but argument 3 has type 'phys_addr_t' [-Wformat=]
   drivers/of/fdt.c:1129:3: warning: format '%llx' expects argument of type 
'long long unsigned int', but argument 2 has type 'phys_addr_t' [-Wformat=]
  pr_warn("Memblock 0x%llx - 0x%llx shifted to ",
  ^
   drivers/of/fdt.c:1129:3: warning: format '%llx' expects argument of type 
'long long unsigned int', but argument 3 has type 'phys_addr_t' [-Wformat=]
   drivers/of/fdt.c:1133:3: warning: format '%llx' expects argument of type 
'long long unsigned int', but argument 2 has type 'phys_addr_t' [-Wformat=]
  pr_cont("0x%llx - 0x%llx\n", base, base + size);
  ^
   drivers/of/fdt.c:1133:3: warning: format '%llx' expects argument of type 
'long long unsigned int', but argument 3 has type 'phys_addr_t' [-Wformat=]
   drivers/of/fdt.c:1138:3: warning: format '%llx' expects argument of type 
'long long unsigned int', but argument 2 has type 'phys_addr_t' [-Wformat=]
  pr_err("Memblock 0x%llx - 0x%llx exceeds max address\n",
  ^
   drivers/of/fdt.c:1138:3: warning: format '%llx' expects argument of type 
'long long unsigned int', but argument 3 has type 'phys_addr_t' [-Wformat=]
   drivers/of/fdt.c:1144:3: warning: format '%llx' expects argument of type 
'long long unsigned int', but argument 2 has type 'phys_addr_t' [-Wformat=]
  pr_warn("Memblock 0x%llx - 0x%llx truncated to ",
  ^
   drivers/of/fdt.c:1144:3: warning: format '%llx' expects argument of type 
'long long unsigned int', but argument 3 has type 'phys_addr_t' [-Wformat=]
   drivers/of/fdt.c:1147:3: warning: format '%llx' expects argument of type 
'long long unsigned int', but argument 2 has type 'phys_addr_t' [-Wformat=]
  pr_cont("0x%llx - 0x%llx\n", base, base + size);
  ^
   drivers/of/fdt.c:1147:3: warning: format '%llx' expects argument of type 
'long long unsigned int', but argument 3 has type 'phys_addr_t' [-Wformat=]
   drivers/of/fdt.c:1151:3: warning: format '%llx' expects argument of type 
'long long unsigned int', but argument 2 has type 'phys_addr_t' [-Wformat=]
  pr_err("Memblock 0x%llx - 0x%llx is below phys offset\n",
  ^
   drivers/of/fdt.c:1151:3: warning: format '%llx' expects argument of type 
'long long unsigned int', but argument 3 has type 'phys_addr_t' [-Wformat=]
   drivers/of/fdt.c:1157:3: warning: format '%llx' expects argument of type 
'long long unsigned int', but argument 2 has type 'phys_addr_t' [-Wformat=]
  pr_warn("Memblock 0x%llx - 0x%llx truncated to ",
  ^
   drivers/of/fdt.c:1157:3: warning: format '%llx' expects argument of type 
'long long unsigned int', but argument 3 has type 'phys_addr_t' [-Wformat=]
   drivers/of/fdt.c:1161:3: warning: format '%llx' expects argument of type 
'long long unsigned int', but argument 2 has type 'phys_addr_t' [-Wformat=]
  pr_cont("0x%llx - 0x%llx\n", base, base + size);
  ^
   drivers/of/fdt.c:1161:3: warning: format '%llx' expects argument of type 
'long long unsigned int', but argument 3 has type 'phys_addr_t' [-Wformat=]
   drivers/of/fdt.c: In function 'early_init_dt_add_memory_arch':
>> drivers/of/fdt.c:1173:2: warning: passing argument 1 of 
>> 'sanity_check_dt_memory' from incompatible pointer type [enabled by default]
 if (sanity_check_dt_memory(, ))
 ^
   drivers/of/fdt.c:1117:12: note: expected 'phys_addr_t *' but argument is of 
type 'u64 *'
int __init sanity_check_dt_memory(phys_addr_t *out_base,
   ^
   drivers/of/fdt.c:1173:2: warning: passing argument 2 of 
'sanity_check_dt_memory' from incompatible pointer type [enabled by default]
 if (sanity_check_dt_memory(, ))
 ^
   drivers/of/fdt.c:1117:12: note: expected 'phys_addr_t *' but argument is of 
type 'u64 *'
int __init sanity_check_dt_memory(phys_addr_t *out_base,
   ^

vim +1125 drivers/of/fdt.c

  1119  {
  1120  phys_addr_t base = *out_base, size = *out_size;
  1121  const u64 phys_offset = MIN_MEMBLOCK_ADDR;
  1122  
  1123  if (!PAGE_ALIGNED(base)) {
  1124  if (size 

[PATCH] tpm, tpm_crb: Handle 64-bit resource in crb_check_resource()

2016-12-18 Thread Jiandi An
crb_check_resource() in TPM CRB driver calls
acpi_dev_resource_memory() which only handles 32-bit resources.
Adding a call to acpi_dev_resource_address_space() in TPM CRB
driver which handles 64-bit resources.

Signed-off-by: Jiandi An 
---
 drivers/char/tpm/tpm_crb.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/char/tpm/tpm_crb.c b/drivers/char/tpm/tpm_crb.c
index 717b6b4..86f355b 100644
--- a/drivers/char/tpm/tpm_crb.c
+++ b/drivers/char/tpm/tpm_crb.c
@@ -264,10 +264,12 @@ static bool crb_req_canceled(struct tpm_chip *chip, u8 
status)
 static int crb_check_resource(struct acpi_resource *ares, void *data)
 {
struct resource *io_res = data;
-   struct resource res;
+   struct resource_win win;
+   struct resource *res = &(win.res);
 
-   if (acpi_dev_resource_memory(ares, )) {
-   *io_res = res;
+   if (acpi_dev_resource_memory(ares, res) ||
+   acpi_dev_resource_address_space(ares, )) {
+   *io_res = *res;
io_res->name = NULL;
}
 
-- 
Jiandi An
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm 
Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux 
Foundation Collaborative Project.



[PATCH] tpm, tpm_crb: Handle 64-bit resource in crb_check_resource()

2016-12-18 Thread Jiandi An
crb_check_resource() in TPM CRB driver calls
acpi_dev_resource_memory() which only handles 32-bit resources.
Adding a call to acpi_dev_resource_address_space() in TPM CRB
driver which handles 64-bit resources.

Signed-off-by: Jiandi An 
---
 drivers/char/tpm/tpm_crb.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/char/tpm/tpm_crb.c b/drivers/char/tpm/tpm_crb.c
index 717b6b4..86f355b 100644
--- a/drivers/char/tpm/tpm_crb.c
+++ b/drivers/char/tpm/tpm_crb.c
@@ -264,10 +264,12 @@ static bool crb_req_canceled(struct tpm_chip *chip, u8 
status)
 static int crb_check_resource(struct acpi_resource *ares, void *data)
 {
struct resource *io_res = data;
-   struct resource res;
+   struct resource_win win;
+   struct resource *res = &(win.res);
 
-   if (acpi_dev_resource_memory(ares, )) {
-   *io_res = res;
+   if (acpi_dev_resource_memory(ares, res) ||
+   acpi_dev_resource_address_space(ares, )) {
+   *io_res = *res;
io_res->name = NULL;
}
 
-- 
Jiandi An
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm 
Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux 
Foundation Collaborative Project.



Re: [PATCH 02/21] MIPS memblock: Add dts mem and reserved-mem callbacks

2016-12-18 Thread kbuild test robot
Hi Serge,

[auto build test ERROR on linus/master]
[also build test ERROR on v4.9 next-20161216]
[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/Serge-Semin/MIPS-memblock-Remove-bootmem-code-and-switch-to-NO_BOOTMEM/20161219-105045
config: mips-rt305x_defconfig (attached as .config)
compiler: mipsel-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=mips 

All errors (new ones prefixed by >>):

   arch/mips/kernel/prom.c: In function 'early_init_dt_add_memory_arch':
>> arch/mips/kernel/prom.c:46:29: error: passing argument 1 of 
>> 'sanity_check_dt_memory' from incompatible pointer type 
>> [-Werror=incompatible-pointer-types]
 if (sanity_check_dt_memory(, ))
^
   In file included from arch/mips/kernel/prom.c:18:0:
   include/linux/of_fdt.h:93:12: note: expected 'phys_addr_t * {aka unsigned 
int *}' but argument is of type 'u64 * {aka long long unsigned int *}'
extern int sanity_check_dt_memory(phys_addr_t *base, phys_addr_t *size);
   ^~
   arch/mips/kernel/prom.c:46:36: error: passing argument 2 of 
'sanity_check_dt_memory' from incompatible pointer type 
[-Werror=incompatible-pointer-types]
 if (sanity_check_dt_memory(, ))
   ^
   In file included from arch/mips/kernel/prom.c:18:0:
   include/linux/of_fdt.h:93:12: note: expected 'phys_addr_t * {aka unsigned 
int *}' but argument is of type 'u64 * {aka long long unsigned int *}'
extern int sanity_check_dt_memory(phys_addr_t *base, phys_addr_t *size);
   ^~
   cc1: some warnings being treated as errors

vim +/sanity_check_dt_memory +46 arch/mips/kernel/prom.c

40  }
41  
42  #ifdef CONFIG_USE_OF
43  void __init early_init_dt_add_memory_arch(u64 base, u64 size)
44  {
45  /* Check whether specified region is well formed */
  > 46  if (sanity_check_dt_memory(, ))
47  return;
48  
49  /* Memory region should be in boot_mem_map, so use the old 
method */

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


.config.gz
Description: application/gzip


Re: [PATCH 02/21] MIPS memblock: Add dts mem and reserved-mem callbacks

2016-12-18 Thread kbuild test robot
Hi Serge,

[auto build test ERROR on linus/master]
[also build test ERROR on v4.9 next-20161216]
[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/Serge-Semin/MIPS-memblock-Remove-bootmem-code-and-switch-to-NO_BOOTMEM/20161219-105045
config: mips-rt305x_defconfig (attached as .config)
compiler: mipsel-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=mips 

All errors (new ones prefixed by >>):

   arch/mips/kernel/prom.c: In function 'early_init_dt_add_memory_arch':
>> arch/mips/kernel/prom.c:46:29: error: passing argument 1 of 
>> 'sanity_check_dt_memory' from incompatible pointer type 
>> [-Werror=incompatible-pointer-types]
 if (sanity_check_dt_memory(, ))
^
   In file included from arch/mips/kernel/prom.c:18:0:
   include/linux/of_fdt.h:93:12: note: expected 'phys_addr_t * {aka unsigned 
int *}' but argument is of type 'u64 * {aka long long unsigned int *}'
extern int sanity_check_dt_memory(phys_addr_t *base, phys_addr_t *size);
   ^~
   arch/mips/kernel/prom.c:46:36: error: passing argument 2 of 
'sanity_check_dt_memory' from incompatible pointer type 
[-Werror=incompatible-pointer-types]
 if (sanity_check_dt_memory(, ))
   ^
   In file included from arch/mips/kernel/prom.c:18:0:
   include/linux/of_fdt.h:93:12: note: expected 'phys_addr_t * {aka unsigned 
int *}' but argument is of type 'u64 * {aka long long unsigned int *}'
extern int sanity_check_dt_memory(phys_addr_t *base, phys_addr_t *size);
   ^~
   cc1: some warnings being treated as errors

vim +/sanity_check_dt_memory +46 arch/mips/kernel/prom.c

40  }
41  
42  #ifdef CONFIG_USE_OF
43  void __init early_init_dt_add_memory_arch(u64 base, u64 size)
44  {
45  /* Check whether specified region is well formed */
  > 46  if (sanity_check_dt_memory(, ))
47  return;
48  
49  /* Memory region should be in boot_mem_map, so use the old 
method */

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


.config.gz
Description: application/gzip


Re: [PATCH] ARM: disallow ARM_THUMB for ARMv4 builds

2016-12-18 Thread Nicolas Pitre
On Sun, 18 Dec 2016, Russell King - ARM Linux wrote:

> On Sun, Dec 18, 2016 at 03:04:24PM +, Ard Biesheuvel wrote:
> > The only issue I spotted is that the kuser_get_tls routine has only
> > two instruction slots for the return sequence, but we can easily work
> > around that by moving the TLS hardware instruction around in the
> > template (and update the memcpy accordingly in kuser_init()
> 
> You can't actually - everything in this page is ABI, and moving
> that breaks the ABI.
> 
> One thing I'm toying with is splitting out the kuser helpers.  That
> means we can build it according to the configuration, and select the
> appropriate version at run time.  Work in progress.

That's the best solution indeed.  In fact there is already some runtime 
patching of the kuser page for how to retrieve the tls value in 
kuser_init().


Nicolas


Re: [PATCH] ARM: disallow ARM_THUMB for ARMv4 builds

2016-12-18 Thread Nicolas Pitre
On Sun, 18 Dec 2016, Russell King - ARM Linux wrote:

> On Sun, Dec 18, 2016 at 03:04:24PM +, Ard Biesheuvel wrote:
> > The only issue I spotted is that the kuser_get_tls routine has only
> > two instruction slots for the return sequence, but we can easily work
> > around that by moving the TLS hardware instruction around in the
> > template (and update the memcpy accordingly in kuser_init()
> 
> You can't actually - everything in this page is ABI, and moving
> that breaks the ABI.
> 
> One thing I'm toying with is splitting out the kuser helpers.  That
> means we can build it according to the configuration, and select the
> appropriate version at run time.  Work in progress.

That's the best solution indeed.  In fact there is already some runtime 
patching of the kuser page for how to retrieve the tls value in 
kuser_init().


Nicolas


Re: [PATCH 07/21] MIPS memblock: Alter elfcorehdr parameters parser

2016-12-18 Thread kbuild test robot
Hi Serge,

[auto build test ERROR on linus/master]
[also build test ERROR on v4.9 next-20161216]
[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/Serge-Semin/MIPS-memblock-Remove-bootmem-code-and-switch-to-NO_BOOTMEM/20161219-105045
config: mips-allyesconfig (attached as .config)
compiler: mips-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=mips 

All errors (new ones prefixed by >>):

   arch/mips/kernel/setup.c: In function 'mips_reserve_elfcorehdr':
>> arch/mips/kernel/setup.c:439:7: error: implicit declaration of function 
>> 'is_vmcore_usable' [-Werror=implicit-function-declaration]
 if (!is_vmcore_usable())
  ^~~~
>> arch/mips/kernel/setup.c:443:6: error: 'elfcorehdr_addr' undeclared (first 
>> use in this function)
 if (elfcorehdr_addr + elfcorehdr_size >= mips_lowmem_limit) {
 ^~~
   arch/mips/kernel/setup.c:443:6: note: each undeclared identifier is reported 
only once for each function it appears in
>> arch/mips/kernel/setup.c:443:24: error: 'elfcorehdr_size' undeclared (first 
>> use in this function)
 if (elfcorehdr_addr + elfcorehdr_size >= mips_lowmem_limit) {
   ^~~
   cc1: some warnings being treated as errors

vim +/is_vmcore_usable +439 arch/mips/kernel/setup.c

   433  {
   434  #ifdef CONFIG_PROC_VMCORE
   435  /*
   436   * Don't reserve anything if kernel isn't booting after a panic 
and
   437   * vmcore is usable (see linux/crash_dump.h for details)
   438   */
 > 439  if (!is_vmcore_usable())
   440  return;
   441  
   442  /* Check whether the passed address belongs to low memory */
 > 443  if (elfcorehdr_addr + elfcorehdr_size >= mips_lowmem_limit) {
   444  pr_err("Elfcorehdr %08zx @ %pa doesn't belong to low 
memory",
   445  (size_t)elfcorehdr_size, _addr);
   446  return;

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


.config.gz
Description: application/gzip


Re: [PATCH 07/21] MIPS memblock: Alter elfcorehdr parameters parser

2016-12-18 Thread kbuild test robot
Hi Serge,

[auto build test ERROR on linus/master]
[also build test ERROR on v4.9 next-20161216]
[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/Serge-Semin/MIPS-memblock-Remove-bootmem-code-and-switch-to-NO_BOOTMEM/20161219-105045
config: mips-allyesconfig (attached as .config)
compiler: mips-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=mips 

All errors (new ones prefixed by >>):

   arch/mips/kernel/setup.c: In function 'mips_reserve_elfcorehdr':
>> arch/mips/kernel/setup.c:439:7: error: implicit declaration of function 
>> 'is_vmcore_usable' [-Werror=implicit-function-declaration]
 if (!is_vmcore_usable())
  ^~~~
>> arch/mips/kernel/setup.c:443:6: error: 'elfcorehdr_addr' undeclared (first 
>> use in this function)
 if (elfcorehdr_addr + elfcorehdr_size >= mips_lowmem_limit) {
 ^~~
   arch/mips/kernel/setup.c:443:6: note: each undeclared identifier is reported 
only once for each function it appears in
>> arch/mips/kernel/setup.c:443:24: error: 'elfcorehdr_size' undeclared (first 
>> use in this function)
 if (elfcorehdr_addr + elfcorehdr_size >= mips_lowmem_limit) {
   ^~~
   cc1: some warnings being treated as errors

vim +/is_vmcore_usable +439 arch/mips/kernel/setup.c

   433  {
   434  #ifdef CONFIG_PROC_VMCORE
   435  /*
   436   * Don't reserve anything if kernel isn't booting after a panic 
and
   437   * vmcore is usable (see linux/crash_dump.h for details)
   438   */
 > 439  if (!is_vmcore_usable())
   440  return;
   441  
   442  /* Check whether the passed address belongs to low memory */
 > 443  if (elfcorehdr_addr + elfcorehdr_size >= mips_lowmem_limit) {
   444  pr_err("Elfcorehdr %08zx @ %pa doesn't belong to low 
memory",
   445  (size_t)elfcorehdr_size, _addr);
   446  return;

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


.config.gz
Description: application/gzip


Re: [PATCH 19/21] MIPS memblock: Add print out method of kernel virtual memory layout

2016-12-18 Thread kbuild test robot
Hi Serge,

[auto build test ERROR on linus/master]
[also build test ERROR on v4.9 next-20161216]
[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/Serge-Semin/MIPS-memblock-Remove-bootmem-code-and-switch-to-NO_BOOTMEM/20161219-105045
config: mips-allyesconfig (attached as .config)
compiler: mips-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=mips 

All error/warnings (new ones prefixed by >>):

   In file included from arch/mips/include/asm/bug.h:4:0,
from include/linux/bug.h:4,
from arch/mips/mm/init.c:12:
   arch/mips/mm/init.c: In function 'mem_print_kmap_info':
>> arch/mips/mm/init.c:143:31: error: 'LAST_PKMAP' undeclared (first use in 
>> this function)
 BUILD_BUG_ON((PKMAP_BASE) + (LAST_PKMAP)*(PAGE_SIZE) < PAGE_OFFSET);
  ^
   include/linux/compiler.h:498:19: note: in definition of macro 
'__compiletime_assert'
  bool __cond = !(condition);\
  ^
   include/linux/compiler.h:518:2: note: in expansion of macro 
'_compiletime_assert'
 _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
 ^~~
   include/linux/bug.h:54:37: note: in expansion of macro 'compiletime_assert'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^~
   include/linux/bug.h:78:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
 BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
 ^~~~
>> arch/mips/mm/init.c:143:2: note: in expansion of macro 'BUILD_BUG_ON'
 BUILD_BUG_ON((PKMAP_BASE) + (LAST_PKMAP)*(PAGE_SIZE) < PAGE_OFFSET);
 ^~~~
   arch/mips/mm/init.c:143:31: note: each undeclared identifier is reported 
only once for each function it appears in
 BUILD_BUG_ON((PKMAP_BASE) + (LAST_PKMAP)*(PAGE_SIZE) < PAGE_OFFSET);
  ^
   include/linux/compiler.h:498:19: note: in definition of macro 
'__compiletime_assert'
  bool __cond = !(condition);\
  ^
   include/linux/compiler.h:518:2: note: in expansion of macro 
'_compiletime_assert'
 _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
 ^~~
   include/linux/bug.h:54:37: note: in expansion of macro 'compiletime_assert'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^~
   include/linux/bug.h:78:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
 BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
 ^~~~
>> arch/mips/mm/init.c:143:2: note: in expansion of macro 'BUILD_BUG_ON'
 BUILD_BUG_ON((PKMAP_BASE) + (LAST_PKMAP)*(PAGE_SIZE) < PAGE_OFFSET);
 ^~~~

vim +/LAST_PKMAP +143 arch/mips/mm/init.c

 6   * Copyright (C) 1994 - 2000 Ralf Baechle
 7   * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
 8   * Kevin D. Kissell, kev...@mips.com and Carsten Langgaard, 
carst...@mips.com
 9   * Copyright (C) 2000 MIPS Technologies, Inc.  All rights reserved.
10   * Copyright (C) 2016 T-Platforms. All Rights Reserved.
11   */
  > 12  #include 
13  #include 
14  #include 
15  #include 
16  #include 
17  #include 
18  #include 
19  #include 
20  #include 
21  #include 
22  #include 
23  #include 
24  #include 
25  #include 
26  #include 
27  #include 
28  #include 
29  #include 
30  #include 
31  #include 
32  #include 
33  #include 
34  #include 
35  #include 
36  
37  #include 
38  #include 
39  #include 
40  #include 
41  #include 
42  #include 
43  #include 
44  #include 
45  #include 
46  #include 
47  #include 
48  #include 
49  #include 
50  #include 
51  
52  /*
53   * We have up to 8 empty zeroed pages so we can map one of the right 
colour
54   * when needed.  This is necessary only on R4000 / R4400 SC and MC 
versions
55   * where we have to avoid VCED / VECI exceptions for good performance at
56   * any price.  Since page is never written to after the initialization 
we
57   * don't have to care about aliases on other CPUs.
58   */
59  unsigned long empty_zero_page, zero_page_mask;
60  EXPORT_SYMBOL_GPL(empty_zero_page);
61  EXPORT_SYMBOL(zero_page_mask);
62  
63  /*
64   * Initialize sparse memory sections setting node ids and indexes
65   */
66  static void __init mips_memory_present(void)
67  {
68  #ifdef 

Re: [PATCH 19/21] MIPS memblock: Add print out method of kernel virtual memory layout

2016-12-18 Thread kbuild test robot
Hi Serge,

[auto build test ERROR on linus/master]
[also build test ERROR on v4.9 next-20161216]
[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/Serge-Semin/MIPS-memblock-Remove-bootmem-code-and-switch-to-NO_BOOTMEM/20161219-105045
config: mips-allyesconfig (attached as .config)
compiler: mips-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=mips 

All error/warnings (new ones prefixed by >>):

   In file included from arch/mips/include/asm/bug.h:4:0,
from include/linux/bug.h:4,
from arch/mips/mm/init.c:12:
   arch/mips/mm/init.c: In function 'mem_print_kmap_info':
>> arch/mips/mm/init.c:143:31: error: 'LAST_PKMAP' undeclared (first use in 
>> this function)
 BUILD_BUG_ON((PKMAP_BASE) + (LAST_PKMAP)*(PAGE_SIZE) < PAGE_OFFSET);
  ^
   include/linux/compiler.h:498:19: note: in definition of macro 
'__compiletime_assert'
  bool __cond = !(condition);\
  ^
   include/linux/compiler.h:518:2: note: in expansion of macro 
'_compiletime_assert'
 _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
 ^~~
   include/linux/bug.h:54:37: note: in expansion of macro 'compiletime_assert'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^~
   include/linux/bug.h:78:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
 BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
 ^~~~
>> arch/mips/mm/init.c:143:2: note: in expansion of macro 'BUILD_BUG_ON'
 BUILD_BUG_ON((PKMAP_BASE) + (LAST_PKMAP)*(PAGE_SIZE) < PAGE_OFFSET);
 ^~~~
   arch/mips/mm/init.c:143:31: note: each undeclared identifier is reported 
only once for each function it appears in
 BUILD_BUG_ON((PKMAP_BASE) + (LAST_PKMAP)*(PAGE_SIZE) < PAGE_OFFSET);
  ^
   include/linux/compiler.h:498:19: note: in definition of macro 
'__compiletime_assert'
  bool __cond = !(condition);\
  ^
   include/linux/compiler.h:518:2: note: in expansion of macro 
'_compiletime_assert'
 _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
 ^~~
   include/linux/bug.h:54:37: note: in expansion of macro 'compiletime_assert'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^~
   include/linux/bug.h:78:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
 BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
 ^~~~
>> arch/mips/mm/init.c:143:2: note: in expansion of macro 'BUILD_BUG_ON'
 BUILD_BUG_ON((PKMAP_BASE) + (LAST_PKMAP)*(PAGE_SIZE) < PAGE_OFFSET);
 ^~~~

vim +/LAST_PKMAP +143 arch/mips/mm/init.c

 6   * Copyright (C) 1994 - 2000 Ralf Baechle
 7   * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
 8   * Kevin D. Kissell, kev...@mips.com and Carsten Langgaard, 
carst...@mips.com
 9   * Copyright (C) 2000 MIPS Technologies, Inc.  All rights reserved.
10   * Copyright (C) 2016 T-Platforms. All Rights Reserved.
11   */
  > 12  #include 
13  #include 
14  #include 
15  #include 
16  #include 
17  #include 
18  #include 
19  #include 
20  #include 
21  #include 
22  #include 
23  #include 
24  #include 
25  #include 
26  #include 
27  #include 
28  #include 
29  #include 
30  #include 
31  #include 
32  #include 
33  #include 
34  #include 
35  #include 
36  
37  #include 
38  #include 
39  #include 
40  #include 
41  #include 
42  #include 
43  #include 
44  #include 
45  #include 
46  #include 
47  #include 
48  #include 
49  #include 
50  #include 
51  
52  /*
53   * We have up to 8 empty zeroed pages so we can map one of the right 
colour
54   * when needed.  This is necessary only on R4000 / R4400 SC and MC 
versions
55   * where we have to avoid VCED / VECI exceptions for good performance at
56   * any price.  Since page is never written to after the initialization 
we
57   * don't have to care about aliases on other CPUs.
58   */
59  unsigned long empty_zero_page, zero_page_mask;
60  EXPORT_SYMBOL_GPL(empty_zero_page);
61  EXPORT_SYMBOL(zero_page_mask);
62  
63  /*
64   * Initialize sparse memory sections setting node ids and indexes
65   */
66  static void __init mips_memory_present(void)
67  {
68  #ifdef 

Re: [PATCH] ipc/sem.c: fix semop()/semop() locking failure

2016-12-18 Thread Davidlohr Bueso

Nit: the title is a bit unclear. How about:

ipc/sem.: fix semop() locking imbalance

Otherwise, Ack.

Thanks,
Davidlohr


Re: [PATCH] ipc/sem.c: fix semop()/semop() locking failure

2016-12-18 Thread Davidlohr Bueso

Nit: the title is a bit unclear. How about:

ipc/sem.: fix semop() locking imbalance

Otherwise, Ack.

Thanks,
Davidlohr


Re: [PATCH v2] kexec: add cond_resched into kimage_alloc_crash_control_pages

2016-12-18 Thread Baoquan He
On 12/09/16 at 03:16pm, Xunlei Pang wrote:
> On 12/09/2016 at 01:13 PM, zhong jiang wrote:
> > On 2016/12/8 17:41, Xunlei Pang wrote:
> >> On 12/08/2016 at 10:37 AM, zhongjiang wrote:
> >>> From: zhong jiang 
> >>>
> >>> A soft lookup will occur when I run trinity in syscall kexec_load.
> >>> the corresponding stack information is as follows.
> >>>
> >>> [  237.235937] BUG: soft lockup - CPU#6 stuck for 22s! [trinity-c6:13859]
> >>> [  237.242699] Kernel panic - not syncing: softlockup: hung tasks
> >>> [  237.248573] CPU: 6 PID: 13859 Comm: trinity-c6 Tainted: G   O 
> >>> L V---   3.10.0-327.28.3.35.zhongjiang.x86_64 #1
> >>> [  237.259984] Hardware name: Huawei Technologies Co., Ltd. Tecal BH622 
> >>> V2/BC01SRSA0, BIOS RMIBV386 06/30/2014
> >>> [  237.269752]  8187626b 18cfde31 88184c803e18 
> >>> 81638f16
> >>> [  237.277471]  88184c803e98 8163278f 0008 
> >>> 88184c803ea8
> >>> [  237.285190]  88184c803e48 18cfde31 88184c803e67 
> >>> 
> >>> [  237.292909] Call Trace:
> >>> [  237.295404][] dump_stack+0x19/0x1b
> >>> [  237.301352]  [] panic+0xd8/0x214
> >>> [  237.306196]  [] watchdog_timer_fn+0x1cc/0x1e0
> >>> [  237.312157]  [] ? watchdog_enable+0xc0/0xc0
> >>> [  237.317955]  [] __hrtimer_run_queues+0xd2/0x260
> >>> [  237.324087]  [] hrtimer_interrupt+0xb0/0x1e0
> >>> [  237.329963]  [] ? call_softirq+0x1c/0x30
> >>> [  237.335500]  [] local_apic_timer_interrupt+0x37/0x60
> >>> [  237.342228]  [] smp_apic_timer_interrupt+0x3f/0x60
> >>> [  237.348771]  [] apic_timer_interrupt+0x6d/0x80
> >>> [  237.354967][] ? 
> >>> kimage_alloc_control_pages+0x80/0x270
> >>> [  237.362875]  [] ? kmem_cache_alloc_trace+0x1ce/0x1f0
> >>> [  237.369592]  [] ? do_kimage_alloc_init+0x1f/0x90
> >>> [  237.375992]  [] kimage_alloc_init+0x12a/0x180
> >>> [  237.382103]  [] SyS_kexec_load+0x20a/0x260
> >>> [  237.387957]  [] system_call_fastpath+0x16/0x1b
> >>>
> >>> the first time allocate control pages may take too much time because
> >>> crash_res.end can be set to a higher value. we need to add cond_resched
> >>> to avoid the issue.
> >>>
> >>> The patch have been tested and above issue is not appear.
> >>>
> >>> Signed-off-by: zhong jiang 
> >>> ---
> >>>  kernel/kexec_core.c | 2 ++
> >>>  1 file changed, 2 insertions(+)
> >>>
> >>> diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c
> >>> index 5616755..bfc9621 100644
> >>> --- a/kernel/kexec_core.c
> >>> +++ b/kernel/kexec_core.c
> >>> @@ -441,6 +441,8 @@ static struct page 
> >>> *kimage_alloc_crash_control_pages(struct kimage *image,
> >>>   while (hole_end <= crashk_res.end) {
> >>>   unsigned long i;
> >>>  
> >>> + cond_resched();
> >>> +
> >> I can't see why it would take a long time to loop inside, the job it does 
> >> is simply to find a control area
> >> not overlapped with image->segment[], you can see the loop "for (i = 0; i 
> >> < image->nr_segments; i++)",
> >> @hole_end will be advanced to the end of its next nearby segment once 
> >> overlap was detected each loop,
> >> also there are limited (<=16) segments, so it won't take long to locate 
> >> the right area.
> >>
> >> Am I missing something?
> >>
> >> Regards,
> >> Xunlei
> >   if the crashkernel = auto is set in cmdline.  it represent crashk_res.end 
> > will exceed to 4G, the first allocate control pages will
> >   loop  million times. if we set crashk_res.end to the higher value 
> > manually,  you can image
> 
> How does "loop million times" happen? See my inlined comments prefixed with 
> "pxl".
> 
> kimage_alloc_crash_control_pages():
> while (hole_end <= crashk_res.end) {
> unsigned long i;
> 
> if (hole_end > KEXEC_CRASH_CONTROL_MEMORY_LIMIT)
> break;
> /* See if I overlap any of the segments */
> for (i = 0; i < image->nr_segments; i++) {  // pxl: max 16 loops, all 
> existent segments are not overlapped, though may not sorted.
> unsigned long mstart, mend;
> 
> mstart = image->segment[i].mem;
> mend   = mstart + image->segment[i].memsz - 1;
> if ((hole_end >= mstart) && (hole_start <= mend)) {
> /* Advance the hole to the end of the segment */
> hole_start = (mend + (size - 1)) & ~(size - 1);
> hole_end   = hole_start + size - 1;
> break;  // pxl: If overlap was found, break for loop, 
> @hole_end starts after the overlapped segment area, and will while loop again
> }
> }
> /* If I don't overlap any segments I have found my hole! */
> if (i == image->nr_segments) {
> pages = pfn_to_page(hole_start >> PAGE_SHIFT);
> image->control_page = hole_end;
> break;   // pxl: no overlap with all the segments, get the result 
> and break the while loop. END.
> }   
> }
> 
> 

Re: [PATCH v2] kexec: add cond_resched into kimage_alloc_crash_control_pages

2016-12-18 Thread Baoquan He
On 12/09/16 at 03:16pm, Xunlei Pang wrote:
> On 12/09/2016 at 01:13 PM, zhong jiang wrote:
> > On 2016/12/8 17:41, Xunlei Pang wrote:
> >> On 12/08/2016 at 10:37 AM, zhongjiang wrote:
> >>> From: zhong jiang 
> >>>
> >>> A soft lookup will occur when I run trinity in syscall kexec_load.
> >>> the corresponding stack information is as follows.
> >>>
> >>> [  237.235937] BUG: soft lockup - CPU#6 stuck for 22s! [trinity-c6:13859]
> >>> [  237.242699] Kernel panic - not syncing: softlockup: hung tasks
> >>> [  237.248573] CPU: 6 PID: 13859 Comm: trinity-c6 Tainted: G   O 
> >>> L V---   3.10.0-327.28.3.35.zhongjiang.x86_64 #1
> >>> [  237.259984] Hardware name: Huawei Technologies Co., Ltd. Tecal BH622 
> >>> V2/BC01SRSA0, BIOS RMIBV386 06/30/2014
> >>> [  237.269752]  8187626b 18cfde31 88184c803e18 
> >>> 81638f16
> >>> [  237.277471]  88184c803e98 8163278f 0008 
> >>> 88184c803ea8
> >>> [  237.285190]  88184c803e48 18cfde31 88184c803e67 
> >>> 
> >>> [  237.292909] Call Trace:
> >>> [  237.295404][] dump_stack+0x19/0x1b
> >>> [  237.301352]  [] panic+0xd8/0x214
> >>> [  237.306196]  [] watchdog_timer_fn+0x1cc/0x1e0
> >>> [  237.312157]  [] ? watchdog_enable+0xc0/0xc0
> >>> [  237.317955]  [] __hrtimer_run_queues+0xd2/0x260
> >>> [  237.324087]  [] hrtimer_interrupt+0xb0/0x1e0
> >>> [  237.329963]  [] ? call_softirq+0x1c/0x30
> >>> [  237.335500]  [] local_apic_timer_interrupt+0x37/0x60
> >>> [  237.342228]  [] smp_apic_timer_interrupt+0x3f/0x60
> >>> [  237.348771]  [] apic_timer_interrupt+0x6d/0x80
> >>> [  237.354967][] ? 
> >>> kimage_alloc_control_pages+0x80/0x270
> >>> [  237.362875]  [] ? kmem_cache_alloc_trace+0x1ce/0x1f0
> >>> [  237.369592]  [] ? do_kimage_alloc_init+0x1f/0x90
> >>> [  237.375992]  [] kimage_alloc_init+0x12a/0x180
> >>> [  237.382103]  [] SyS_kexec_load+0x20a/0x260
> >>> [  237.387957]  [] system_call_fastpath+0x16/0x1b
> >>>
> >>> the first time allocate control pages may take too much time because
> >>> crash_res.end can be set to a higher value. we need to add cond_resched
> >>> to avoid the issue.
> >>>
> >>> The patch have been tested and above issue is not appear.
> >>>
> >>> Signed-off-by: zhong jiang 
> >>> ---
> >>>  kernel/kexec_core.c | 2 ++
> >>>  1 file changed, 2 insertions(+)
> >>>
> >>> diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c
> >>> index 5616755..bfc9621 100644
> >>> --- a/kernel/kexec_core.c
> >>> +++ b/kernel/kexec_core.c
> >>> @@ -441,6 +441,8 @@ static struct page 
> >>> *kimage_alloc_crash_control_pages(struct kimage *image,
> >>>   while (hole_end <= crashk_res.end) {
> >>>   unsigned long i;
> >>>  
> >>> + cond_resched();
> >>> +
> >> I can't see why it would take a long time to loop inside, the job it does 
> >> is simply to find a control area
> >> not overlapped with image->segment[], you can see the loop "for (i = 0; i 
> >> < image->nr_segments; i++)",
> >> @hole_end will be advanced to the end of its next nearby segment once 
> >> overlap was detected each loop,
> >> also there are limited (<=16) segments, so it won't take long to locate 
> >> the right area.
> >>
> >> Am I missing something?
> >>
> >> Regards,
> >> Xunlei
> >   if the crashkernel = auto is set in cmdline.  it represent crashk_res.end 
> > will exceed to 4G, the first allocate control pages will
> >   loop  million times. if we set crashk_res.end to the higher value 
> > manually,  you can image
> 
> How does "loop million times" happen? See my inlined comments prefixed with 
> "pxl".
> 
> kimage_alloc_crash_control_pages():
> while (hole_end <= crashk_res.end) {
> unsigned long i;
> 
> if (hole_end > KEXEC_CRASH_CONTROL_MEMORY_LIMIT)
> break;
> /* See if I overlap any of the segments */
> for (i = 0; i < image->nr_segments; i++) {  // pxl: max 16 loops, all 
> existent segments are not overlapped, though may not sorted.
> unsigned long mstart, mend;
> 
> mstart = image->segment[i].mem;
> mend   = mstart + image->segment[i].memsz - 1;
> if ((hole_end >= mstart) && (hole_start <= mend)) {
> /* Advance the hole to the end of the segment */
> hole_start = (mend + (size - 1)) & ~(size - 1);
> hole_end   = hole_start + size - 1;
> break;  // pxl: If overlap was found, break for loop, 
> @hole_end starts after the overlapped segment area, and will while loop again
> }
> }
> /* If I don't overlap any segments I have found my hole! */
> if (i == image->nr_segments) {
> pages = pfn_to_page(hole_start >> PAGE_SHIFT);
> image->control_page = hole_end;
> break;   // pxl: no overlap with all the segments, get the result 
> and break the while loop. END.
> }   
> }
> 
> So, the worst "while" loops in theory would be 

Re: [PATCH] pci-error-recover: doc cleanup

2016-12-18 Thread Cao jin
Sorry for late.

On 12/09/2016 10:37 PM, Jonathan Corbet wrote:
> On Fri, 9 Dec 2016 14:37:47 +0800
> Cao jin  wrote:
> 
>> I am little confused too, even not sure if we are talking the same
>> *fatal error*, I am talking the fatal error defined in PCI Express spec,
>> chapter 6.2.2.2.1:
> 
> Therein lies my original discomfort with the change; it didn't seem to
> make sense to talk about recovering from a fatal error.  Perhaps making
> it "is done whenever a fatal error (as defined in section 6.2.2.2.1) has
> been detected that can be "solved" by resetting the link" or something
> like that to make it clear how the term is being used?
> 

I find that the .link_reset callback of struct pci_error_handlers isn't
called by anyone(if I didn't miss anything), and just a few drivers
implement this callback, and their implementation seems meaningless.

And the reset_link() provided by aer driver seems is a different thing
with .link_reset callback. So I am guessing this patch probably is not
quite suitable, and the doc maybe need update totally.

-- 
Sincerely,
Cao jin




Re: [PATCH] pci-error-recover: doc cleanup

2016-12-18 Thread Cao jin
Sorry for late.

On 12/09/2016 10:37 PM, Jonathan Corbet wrote:
> On Fri, 9 Dec 2016 14:37:47 +0800
> Cao jin  wrote:
> 
>> I am little confused too, even not sure if we are talking the same
>> *fatal error*, I am talking the fatal error defined in PCI Express spec,
>> chapter 6.2.2.2.1:
> 
> Therein lies my original discomfort with the change; it didn't seem to
> make sense to talk about recovering from a fatal error.  Perhaps making
> it "is done whenever a fatal error (as defined in section 6.2.2.2.1) has
> been detected that can be "solved" by resetting the link" or something
> like that to make it clear how the term is being used?
> 

I find that the .link_reset callback of struct pci_error_handlers isn't
called by anyone(if I didn't miss anything), and just a few drivers
implement this callback, and their implementation seems meaningless.

And the reset_link() provided by aer driver seems is a different thing
with .link_reset callback. So I am guessing this patch probably is not
quite suitable, and the doc maybe need update totally.

-- 
Sincerely,
Cao jin




[PATCH] vfs: fix isize/pos/len checks for reflink & dedupe

2016-12-18 Thread Darrick J. Wong
Strengthen the checking of pos/len vs. i_size, clarify the return values
for the clone prep function, and remove pointless code.

Signed-off-by: Darrick J. WOng 
---
 fs/ocfs2/refcounttree.c |2 +-
 fs/read_write.c |   18 +++---
 fs/xfs/xfs_reflink.c|2 +-
 3 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c
index b18465e..21723dd 100644
--- a/fs/ocfs2/refcounttree.c
+++ b/fs/ocfs2/refcounttree.c
@@ -4835,7 +4835,7 @@ int ocfs2_reflink_remap_range(struct file *file_in,
 
ret = vfs_clone_file_prep_inodes(inode_in, pos_in, inode_out, pos_out,
, is_dedupe);
-   if (ret || len == 0)
+   if (ret <= 0)
goto out_unlock;
 
/* Lock out changes to the allocation maps and remap. */
diff --git a/fs/read_write.c b/fs/read_write.c
index dbf3f7f..434da26 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -1671,6 +1671,9 @@ static int clone_verify_area(struct file *file, loff_t 
pos, u64 len, bool write)
  * Check that the two inodes are eligible for cloning, the ranges make
  * sense, and then flush all dirty data.  Caller must ensure that the
  * inodes have been locked against any other modifications.
+ *
+ * Returns: 0 for "nothing to clone", 1 for "something to clone", or
+ * the usual negative error code.
  */
 int vfs_clone_file_prep_inodes(struct inode *inode_in, loff_t pos_in,
   struct inode *inode_out, loff_t pos_out,
@@ -1697,17 +1700,15 @@ int vfs_clone_file_prep_inodes(struct inode *inode_in, 
loff_t pos_in,
 
/* Are we going all the way to the end? */
isize = i_size_read(inode_in);
-   if (isize == 0) {
-   *len = 0;
+   if (isize == 0)
return 0;
-   }
 
/* Zero length dedupe exits immediately; reflink goes to EOF. */
if (*len == 0) {
-   if (is_dedupe) {
-   *len = 0;
+   if (is_dedupe || pos_in == isize)
return 0;
-   }
+   else if (pos_in > isize)
+   return -EINVAL;
*len = isize - pos_in;
}
 
@@ -1771,7 +1772,7 @@ int vfs_clone_file_prep_inodes(struct inode *inode_in, 
loff_t pos_in,
return -EBADE;
}
 
-   return 0;
+   return 1;
 }
 EXPORT_SYMBOL(vfs_clone_file_prep_inodes);
 
@@ -1958,6 +1959,9 @@ int vfs_dedupe_file_range(struct file *file, struct 
file_dedupe_range *same)
goto out;
ret = 0;
 
+   if (off + len > i_size_read(src))
+   return -EINVAL;
+
/* pre-format output fields to sane values */
for (i = 0; i < count; i++) {
same->info[i].bytes_deduped = 0ULL;
diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
index 43c0042..2a8ea32 100644
--- a/fs/xfs/xfs_reflink.c
+++ b/fs/xfs/xfs_reflink.c
@@ -1215,7 +1215,7 @@ xfs_reflink_remap_range(
 
ret = vfs_clone_file_prep_inodes(inode_in, pos_in, inode_out, pos_out,
, is_dedupe);
-   if (ret || len == 0)
+   if (ret <= 0)
goto out_unlock;
 
trace_xfs_reflink_remap_range(src, pos_in, len, dest, pos_out);


[PATCH] vfs: fix isize/pos/len checks for reflink & dedupe

2016-12-18 Thread Darrick J. Wong
Strengthen the checking of pos/len vs. i_size, clarify the return values
for the clone prep function, and remove pointless code.

Signed-off-by: Darrick J. WOng 
---
 fs/ocfs2/refcounttree.c |2 +-
 fs/read_write.c |   18 +++---
 fs/xfs/xfs_reflink.c|2 +-
 3 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c
index b18465e..21723dd 100644
--- a/fs/ocfs2/refcounttree.c
+++ b/fs/ocfs2/refcounttree.c
@@ -4835,7 +4835,7 @@ int ocfs2_reflink_remap_range(struct file *file_in,
 
ret = vfs_clone_file_prep_inodes(inode_in, pos_in, inode_out, pos_out,
, is_dedupe);
-   if (ret || len == 0)
+   if (ret <= 0)
goto out_unlock;
 
/* Lock out changes to the allocation maps and remap. */
diff --git a/fs/read_write.c b/fs/read_write.c
index dbf3f7f..434da26 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -1671,6 +1671,9 @@ static int clone_verify_area(struct file *file, loff_t 
pos, u64 len, bool write)
  * Check that the two inodes are eligible for cloning, the ranges make
  * sense, and then flush all dirty data.  Caller must ensure that the
  * inodes have been locked against any other modifications.
+ *
+ * Returns: 0 for "nothing to clone", 1 for "something to clone", or
+ * the usual negative error code.
  */
 int vfs_clone_file_prep_inodes(struct inode *inode_in, loff_t pos_in,
   struct inode *inode_out, loff_t pos_out,
@@ -1697,17 +1700,15 @@ int vfs_clone_file_prep_inodes(struct inode *inode_in, 
loff_t pos_in,
 
/* Are we going all the way to the end? */
isize = i_size_read(inode_in);
-   if (isize == 0) {
-   *len = 0;
+   if (isize == 0)
return 0;
-   }
 
/* Zero length dedupe exits immediately; reflink goes to EOF. */
if (*len == 0) {
-   if (is_dedupe) {
-   *len = 0;
+   if (is_dedupe || pos_in == isize)
return 0;
-   }
+   else if (pos_in > isize)
+   return -EINVAL;
*len = isize - pos_in;
}
 
@@ -1771,7 +1772,7 @@ int vfs_clone_file_prep_inodes(struct inode *inode_in, 
loff_t pos_in,
return -EBADE;
}
 
-   return 0;
+   return 1;
 }
 EXPORT_SYMBOL(vfs_clone_file_prep_inodes);
 
@@ -1958,6 +1959,9 @@ int vfs_dedupe_file_range(struct file *file, struct 
file_dedupe_range *same)
goto out;
ret = 0;
 
+   if (off + len > i_size_read(src))
+   return -EINVAL;
+
/* pre-format output fields to sane values */
for (i = 0; i < count; i++) {
same->info[i].bytes_deduped = 0ULL;
diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
index 43c0042..2a8ea32 100644
--- a/fs/xfs/xfs_reflink.c
+++ b/fs/xfs/xfs_reflink.c
@@ -1215,7 +1215,7 @@ xfs_reflink_remap_range(
 
ret = vfs_clone_file_prep_inodes(inode_in, pos_in, inode_out, pos_out,
, is_dedupe);
-   if (ret || len == 0)
+   if (ret <= 0)
goto out_unlock;
 
trace_xfs_reflink_remap_range(src, pos_in, len, dest, pos_out);


Re: [PATCH v4 1/2] FPGA: Add TS-7300 FPGA manager

2016-12-18 Thread Moritz Fischer
On Sun, Dec 18, 2016 at 6:09 PM, Alan Tull  wrote:
> On Sun, 18 Dec 2016, Florian Fainelli wrote:
>
> Hi Florain,
>
>> Add support for loading bitstreams on the Altera Cyclone II FPGA
>> populated on the TS-7300 board. This is done through the configuration
>> and data registers offered through a memory interface between the EP93xx
>> SoC and the FPGA via an intermediate CPLD device.
>>
>> The EP93xx SoC on the TS-7300 does not have direct means of configuring
>> the on-board FPGA other than by using the special memory mapped
>> interface to the CPLD. No other entity on the system can control the
>> FPGA bitstream.
>>
>> Signed-off-by: Florian Fainelli 
>> ---
>>  drivers/fpga/Kconfig   |   7 ++
>>  drivers/fpga/Makefile  |   1 +
>>  drivers/fpga/ts73xx-fpga.c | 163 
>> +
>>  3 files changed, 171 insertions(+)
>>  create mode 100644 drivers/fpga/ts73xx-fpga.c
>>
>> diff --git a/drivers/fpga/Kconfig b/drivers/fpga/Kconfig
>> index ce861a2853a4..d9cbef60db80 100644
>> --- a/drivers/fpga/Kconfig
>> +++ b/drivers/fpga/Kconfig
>> @@ -33,6 +33,13 @@ config FPGA_MGR_SOCFPGA_A10
>>   help
>> FPGA manager driver support for Altera Arria10 SoCFPGA.
>>
>> +config FPGA_MGR_TS73XX
>> + tristate "Technologic Systems TS-73xx SBC FPGA Manager"
>> + depends on ARCH_EP93XX && MACH_TS72XX
>> + help
>> +   FPGA manager driver support for the Altera Cyclone II FPGA
>> +   present on the TS-73xx SBC boards.
>> +
>>  config FPGA_MGR_ZYNQ_FPGA
>>   tristate "Xilinx Zynq FPGA"
>>   depends on ARCH_ZYNQ || COMPILE_TEST
>> diff --git a/drivers/fpga/Makefile b/drivers/fpga/Makefile
>> index 8df07bcf42a6..a1160169e6d9 100644
>> --- a/drivers/fpga/Makefile
>> +++ b/drivers/fpga/Makefile
>> @@ -8,6 +8,7 @@ obj-$(CONFIG_FPGA)+= fpga-mgr.o
>>  # FPGA Manager Drivers
>>  obj-$(CONFIG_FPGA_MGR_SOCFPGA)   += socfpga.o
>>  obj-$(CONFIG_FPGA_MGR_SOCFPGA_A10)   += socfpga-a10.o
>> +obj-$(CONFIG_FPGA_MGR_TS73XX)+= ts73xx-fpga.o
>>  obj-$(CONFIG_FPGA_MGR_ZYNQ_FPGA) += zynq-fpga.o
>>
>>  # FPGA Bridge Drivers
>> diff --git a/drivers/fpga/ts73xx-fpga.c b/drivers/fpga/ts73xx-fpga.c
>> new file mode 100644
>> index ..5acdbcfe447b
>> --- /dev/null
>> +++ b/drivers/fpga/ts73xx-fpga.c
>> @@ -0,0 +1,163 @@
>> +/*
>> + * Technologic Systems TS-73xx SBC FPGA loader
>> + *
>> + * Copyright (C) 2016 Florian Fainelli 
>> + *
>> + * FPGA Manager Driver for the on-board Altera Cyclone II FPGA found on
>> + * TS-7300, heavily based on load_fpga.c in their vendor tree.
>> + *
>> + * This program is free software; you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License as published by
>> + * the Free Software Foundation; version 2 of the License.
>> + *
>> + * This program is distributed in the hope that it will be useful,
>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
>> + * GNU General Public License for more details.
>> + */
>> +
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +
>> +#define TS73XX_FPGA_DATA_REG 0
>> +#define TS73XX_FPGA_CONFIG_REG   1
>> +
>> +#define TS73XX_FPGA_WRITE_DONE   0x1
>> +#define TS73XX_FPGA_WRITE_DONE_TIMEOUT   1000/* us */
>
> If you add units to these timeouts/delays, it could prevent
> issues in the future.  Such as _USEC
>
>> +#define TS73XX_FPGA_RESET0x2
>> +#define TS73XX_FPGA_RESET_LOW_DELAY  30  /* us */
>> +#define TS73XX_FPGA_RESET_HIGH_DELAY 80  /* us */
>> +#define TS73XX_FPGA_LOAD_OK  0x4
>> +#define TS73XX_FPGA_CONFIG_LOAD  0x8
>> +
>> +struct ts73xx_fpga_priv {
>> + void __iomem*io_base;
>> + struct device   *dev;
>> +};
>> +
>> +static enum fpga_mgr_states ts73xx_fpga_state(struct fpga_manager *mgr)
>> +{
>> + return FPGA_MGR_STATE_UNKNOWN;
>> +}
>> +
>> +static int ts73xx_fpga_write_init(struct fpga_manager *mgr,
>> +   struct fpga_image_info *info,
>> +   const char *buf, size_t count)
>> +{
>> + struct ts73xx_fpga_priv *priv = mgr->priv;
>> +
>> + /* Reset the FPGA */
>> + writeb(0, priv->io_base + TS73XX_FPGA_CONFIG_REG);
>> + udelay(TS73XX_FPGA_RESET_LOW_DELAY);
>> + writeb(TS73XX_FPGA_RESET, priv->io_base + TS73XX_FPGA_CONFIG_REG);
>> + udelay(TS73XX_FPGA_RESET_HIGH_DELAY);
>> +
>> + return 0;
>> +}
>> +
>> +static int ts73xx_fpga_write(struct fpga_manager *mgr, const char *buf,
>> +  size_t count)
>> +{
>> + struct ts73xx_fpga_priv *priv = mgr->priv;
>> + size_t i = 0;
>> + int ret;
>> + u8 reg;
>> +
>> + while (count--) {
>> + ret = readb_poll_timeout(priv->io_base + 
>> 

Re: [PATCH v4 1/2] FPGA: Add TS-7300 FPGA manager

2016-12-18 Thread Moritz Fischer
On Sun, Dec 18, 2016 at 6:09 PM, Alan Tull  wrote:
> On Sun, 18 Dec 2016, Florian Fainelli wrote:
>
> Hi Florain,
>
>> Add support for loading bitstreams on the Altera Cyclone II FPGA
>> populated on the TS-7300 board. This is done through the configuration
>> and data registers offered through a memory interface between the EP93xx
>> SoC and the FPGA via an intermediate CPLD device.
>>
>> The EP93xx SoC on the TS-7300 does not have direct means of configuring
>> the on-board FPGA other than by using the special memory mapped
>> interface to the CPLD. No other entity on the system can control the
>> FPGA bitstream.
>>
>> Signed-off-by: Florian Fainelli 
>> ---
>>  drivers/fpga/Kconfig   |   7 ++
>>  drivers/fpga/Makefile  |   1 +
>>  drivers/fpga/ts73xx-fpga.c | 163 
>> +
>>  3 files changed, 171 insertions(+)
>>  create mode 100644 drivers/fpga/ts73xx-fpga.c
>>
>> diff --git a/drivers/fpga/Kconfig b/drivers/fpga/Kconfig
>> index ce861a2853a4..d9cbef60db80 100644
>> --- a/drivers/fpga/Kconfig
>> +++ b/drivers/fpga/Kconfig
>> @@ -33,6 +33,13 @@ config FPGA_MGR_SOCFPGA_A10
>>   help
>> FPGA manager driver support for Altera Arria10 SoCFPGA.
>>
>> +config FPGA_MGR_TS73XX
>> + tristate "Technologic Systems TS-73xx SBC FPGA Manager"
>> + depends on ARCH_EP93XX && MACH_TS72XX
>> + help
>> +   FPGA manager driver support for the Altera Cyclone II FPGA
>> +   present on the TS-73xx SBC boards.
>> +
>>  config FPGA_MGR_ZYNQ_FPGA
>>   tristate "Xilinx Zynq FPGA"
>>   depends on ARCH_ZYNQ || COMPILE_TEST
>> diff --git a/drivers/fpga/Makefile b/drivers/fpga/Makefile
>> index 8df07bcf42a6..a1160169e6d9 100644
>> --- a/drivers/fpga/Makefile
>> +++ b/drivers/fpga/Makefile
>> @@ -8,6 +8,7 @@ obj-$(CONFIG_FPGA)+= fpga-mgr.o
>>  # FPGA Manager Drivers
>>  obj-$(CONFIG_FPGA_MGR_SOCFPGA)   += socfpga.o
>>  obj-$(CONFIG_FPGA_MGR_SOCFPGA_A10)   += socfpga-a10.o
>> +obj-$(CONFIG_FPGA_MGR_TS73XX)+= ts73xx-fpga.o
>>  obj-$(CONFIG_FPGA_MGR_ZYNQ_FPGA) += zynq-fpga.o
>>
>>  # FPGA Bridge Drivers
>> diff --git a/drivers/fpga/ts73xx-fpga.c b/drivers/fpga/ts73xx-fpga.c
>> new file mode 100644
>> index ..5acdbcfe447b
>> --- /dev/null
>> +++ b/drivers/fpga/ts73xx-fpga.c
>> @@ -0,0 +1,163 @@
>> +/*
>> + * Technologic Systems TS-73xx SBC FPGA loader
>> + *
>> + * Copyright (C) 2016 Florian Fainelli 
>> + *
>> + * FPGA Manager Driver for the on-board Altera Cyclone II FPGA found on
>> + * TS-7300, heavily based on load_fpga.c in their vendor tree.
>> + *
>> + * This program is free software; you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License as published by
>> + * the Free Software Foundation; version 2 of the License.
>> + *
>> + * This program is distributed in the hope that it will be useful,
>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
>> + * GNU General Public License for more details.
>> + */
>> +
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +
>> +#define TS73XX_FPGA_DATA_REG 0
>> +#define TS73XX_FPGA_CONFIG_REG   1
>> +
>> +#define TS73XX_FPGA_WRITE_DONE   0x1
>> +#define TS73XX_FPGA_WRITE_DONE_TIMEOUT   1000/* us */
>
> If you add units to these timeouts/delays, it could prevent
> issues in the future.  Such as _USEC
>
>> +#define TS73XX_FPGA_RESET0x2
>> +#define TS73XX_FPGA_RESET_LOW_DELAY  30  /* us */
>> +#define TS73XX_FPGA_RESET_HIGH_DELAY 80  /* us */
>> +#define TS73XX_FPGA_LOAD_OK  0x4
>> +#define TS73XX_FPGA_CONFIG_LOAD  0x8
>> +
>> +struct ts73xx_fpga_priv {
>> + void __iomem*io_base;
>> + struct device   *dev;
>> +};
>> +
>> +static enum fpga_mgr_states ts73xx_fpga_state(struct fpga_manager *mgr)
>> +{
>> + return FPGA_MGR_STATE_UNKNOWN;
>> +}
>> +
>> +static int ts73xx_fpga_write_init(struct fpga_manager *mgr,
>> +   struct fpga_image_info *info,
>> +   const char *buf, size_t count)
>> +{
>> + struct ts73xx_fpga_priv *priv = mgr->priv;
>> +
>> + /* Reset the FPGA */
>> + writeb(0, priv->io_base + TS73XX_FPGA_CONFIG_REG);
>> + udelay(TS73XX_FPGA_RESET_LOW_DELAY);
>> + writeb(TS73XX_FPGA_RESET, priv->io_base + TS73XX_FPGA_CONFIG_REG);
>> + udelay(TS73XX_FPGA_RESET_HIGH_DELAY);
>> +
>> + return 0;
>> +}
>> +
>> +static int ts73xx_fpga_write(struct fpga_manager *mgr, const char *buf,
>> +  size_t count)
>> +{
>> + struct ts73xx_fpga_priv *priv = mgr->priv;
>> + size_t i = 0;
>> + int ret;
>> + u8 reg;
>> +
>> + while (count--) {
>> + ret = readb_poll_timeout(priv->io_base + 
>> TS73XX_FPGA_CONFIG_REG,
>> +  reg, 

Re: [PATCH v4 2/2] ARM: ep93xx: Register ts73xx-fpga manager driver for TS-7300

2016-12-18 Thread Moritz Fischer
On Sun, Dec 18, 2016 at 12:21 PM, Florian Fainelli  wrote:
> Register the TS-7300 FPGA manager device drivers which allows us to load
> bitstreams into the on-board Altera Cyclone II FPGA.
>
> Acked-by: H Hartley Sweeten 
Acked-by: Moritz Fischer 

> Signed-off-by: Florian Fainelli 
> ---
>  arch/arm/mach-ep93xx/ts72xx.c | 26 ++
>  1 file changed, 26 insertions(+)
>
> diff --git a/arch/arm/mach-ep93xx/ts72xx.c b/arch/arm/mach-ep93xx/ts72xx.c
> index 3b39ea353d30..acf72ea670ef 100644
> --- a/arch/arm/mach-ep93xx/ts72xx.c
> +++ b/arch/arm/mach-ep93xx/ts72xx.c
> @@ -230,6 +230,28 @@ static struct ep93xx_eth_data __initdata ts72xx_eth_data 
> = {
> .phy_id = 1,
>  };
>
> +#if IS_ENABLED(CONFIG_FPGA_MGR_TS73XX)
> +
> +/* Relative to EP93XX_CS1_PHYS_BASE */
> +#define TS73XX_FPGA_LOADER_BASE0x03c0
> +
> +static struct resource ts73xx_fpga_resources[] = {
> +   {
> +   .start  = EP93XX_CS1_PHYS_BASE + TS73XX_FPGA_LOADER_BASE,
> +   .end= EP93XX_CS1_PHYS_BASE + TS73XX_FPGA_LOADER_BASE + 1,
> +   .flags  = IORESOURCE_MEM,
> +   },
> +};
> +
> +static struct platform_device ts73xx_fpga_device = {
> +   .name   = "ts73xx-fpga-mgr",
> +   .id = -1,
> +   .resource = ts73xx_fpga_resources,
> +   .num_resources = ARRAY_SIZE(ts73xx_fpga_resources),
> +};
> +
> +#endif
> +
>  static void __init ts72xx_init_machine(void)
>  {
> ep93xx_init_devices();
> @@ -238,6 +260,10 @@ static void __init ts72xx_init_machine(void)
> platform_device_register(_wdt_device);
>
> ep93xx_register_eth(_eth_data, 1);
> +#if IS_ENABLED(CONFIG_FPGA_MGR_TS73XX)
> +   if (board_is_ts7300())
> +   platform_device_register(_fpga_device);
> +#endif
>  }
>
>  MACHINE_START(TS72XX, "Technologic Systems TS-72xx SBC")
> --
> 2.9.3
>

Thanks,

Moritz


Re: [PATCH v4 2/2] ARM: ep93xx: Register ts73xx-fpga manager driver for TS-7300

2016-12-18 Thread Moritz Fischer
On Sun, Dec 18, 2016 at 12:21 PM, Florian Fainelli  wrote:
> Register the TS-7300 FPGA manager device drivers which allows us to load
> bitstreams into the on-board Altera Cyclone II FPGA.
>
> Acked-by: H Hartley Sweeten 
Acked-by: Moritz Fischer 

> Signed-off-by: Florian Fainelli 
> ---
>  arch/arm/mach-ep93xx/ts72xx.c | 26 ++
>  1 file changed, 26 insertions(+)
>
> diff --git a/arch/arm/mach-ep93xx/ts72xx.c b/arch/arm/mach-ep93xx/ts72xx.c
> index 3b39ea353d30..acf72ea670ef 100644
> --- a/arch/arm/mach-ep93xx/ts72xx.c
> +++ b/arch/arm/mach-ep93xx/ts72xx.c
> @@ -230,6 +230,28 @@ static struct ep93xx_eth_data __initdata ts72xx_eth_data 
> = {
> .phy_id = 1,
>  };
>
> +#if IS_ENABLED(CONFIG_FPGA_MGR_TS73XX)
> +
> +/* Relative to EP93XX_CS1_PHYS_BASE */
> +#define TS73XX_FPGA_LOADER_BASE0x03c0
> +
> +static struct resource ts73xx_fpga_resources[] = {
> +   {
> +   .start  = EP93XX_CS1_PHYS_BASE + TS73XX_FPGA_LOADER_BASE,
> +   .end= EP93XX_CS1_PHYS_BASE + TS73XX_FPGA_LOADER_BASE + 1,
> +   .flags  = IORESOURCE_MEM,
> +   },
> +};
> +
> +static struct platform_device ts73xx_fpga_device = {
> +   .name   = "ts73xx-fpga-mgr",
> +   .id = -1,
> +   .resource = ts73xx_fpga_resources,
> +   .num_resources = ARRAY_SIZE(ts73xx_fpga_resources),
> +};
> +
> +#endif
> +
>  static void __init ts72xx_init_machine(void)
>  {
> ep93xx_init_devices();
> @@ -238,6 +260,10 @@ static void __init ts72xx_init_machine(void)
> platform_device_register(_wdt_device);
>
> ep93xx_register_eth(_eth_data, 1);
> +#if IS_ENABLED(CONFIG_FPGA_MGR_TS73XX)
> +   if (board_is_ts7300())
> +   platform_device_register(_fpga_device);
> +#endif
>  }
>
>  MACHINE_START(TS72XX, "Technologic Systems TS-72xx SBC")
> --
> 2.9.3
>

Thanks,

Moritz


[PATCH] Xen: ARM: Zero reserved fields of xatp before making hypervisor call

2016-12-18 Thread Jiandi An
Ensure all reserved fields of xatp are zero before making hypervisor
call to XEN in xen_map_device_mmio().  xenmem_add_to_physmap_one() in
XEN fails the mapping request if extra.res reserved field in xatp is
not zero for XENMAPSPACE_dev_mmio request.

Signed-off-by: Jiandi An 
---
 drivers/xen/arm-device.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/xen/arm-device.c b/drivers/xen/arm-device.c
index 778acf8..208273b 100644
--- a/drivers/xen/arm-device.c
+++ b/drivers/xen/arm-device.c
@@ -87,6 +87,9 @@ static int xen_map_device_mmio(const struct resource 
*resources,
idxs[j] = XEN_PFN_DOWN(r->start) + j;
}
 
+   /* Ensure reserved fields are set to zero */
+   memset(, 0, sizeof(xatp));
+
xatp.domid = DOMID_SELF;
xatp.size = nr;
xatp.space = XENMAPSPACE_dev_mmio;
-- 
Jiandi An
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm 
Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux 
Foundation Collaborative Project.



[PATCH] Xen: ARM: Zero reserved fields of xatp before making hypervisor call

2016-12-18 Thread Jiandi An
Ensure all reserved fields of xatp are zero before making hypervisor
call to XEN in xen_map_device_mmio().  xenmem_add_to_physmap_one() in
XEN fails the mapping request if extra.res reserved field in xatp is
not zero for XENMAPSPACE_dev_mmio request.

Signed-off-by: Jiandi An 
---
 drivers/xen/arm-device.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/xen/arm-device.c b/drivers/xen/arm-device.c
index 778acf8..208273b 100644
--- a/drivers/xen/arm-device.c
+++ b/drivers/xen/arm-device.c
@@ -87,6 +87,9 @@ static int xen_map_device_mmio(const struct resource 
*resources,
idxs[j] = XEN_PFN_DOWN(r->start) + j;
}
 
+   /* Ensure reserved fields are set to zero */
+   memset(, 0, sizeof(xatp));
+
xatp.domid = DOMID_SELF;
xatp.size = nr;
xatp.space = XENMAPSPACE_dev_mmio;
-- 
Jiandi An
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm 
Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux 
Foundation Collaborative Project.



linux-next: Tree for Dec 19

2016-12-18 Thread Stephen Rothwell
Hi all,

Please do not add any material for v4.11 to your linux-next included
branches until after v4.10-rc1 has been released.

Changes since 20161216:

New tree: target-bva

The overlayfs tree gained conflicts against Linus' tree.

The kvm tree gained a build failure so I used the version from
next-20161216.

The target-bva tree gained a conflict against Linus' tree.

I removed one patch from the akpm tree that was causing run time problems.

Non-merge commits (relative to Linus' tree): 557
 871 files changed, 27536 insertions(+), 8149 deletions(-)



I have created today's linux-next tree at
git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
(patches at http://www.kernel.org/pub/linux/kernel/next/ ).  If you
are tracking the linux-next tree using git, you should not use "git pull"
to do so as that will try to merge the new linux-next release with the
old one.  You should use "git fetch" and checkout or reset to the new
master.

You can see which trees have been included by looking in the Next/Trees
file in the source.  There are also quilt-import.log and merge.log
files in the Next directory.  Between each merge, the tree was built
with a ppc64_defconfig for powerpc and an allmodconfig (with
CONFIG_BUILD_DOCSRC=n) for x86_64, a multi_v7_defconfig for arm and a
native build of tools/perf. After the final fixups (if any), I do an
x86_64 modules_install followed by builds for x86_64 allnoconfig,
powerpc allnoconfig (32 and 64 bit), ppc44x_defconfig, allyesconfig
(with KALLSYMS_EXTRA_PASS=1) and pseries_le_defconfig and i386, sparc
and sparc64 defconfig.

Below is a summary of the state of the merge.

I am currently merging 246 trees (counting Linus' and 35 trees of bug
fix patches pending for the current merge release).

Stats about the size of the tree over time can be seen at
http://neuling.org/linux-next-size.html .

Status of my local build tests will be at
http://kisskb.ellerman.id.au/linux-next .  If maintainers want to give
advice about cross compilers/configs that work, we are always open to add
more builds.

Thanks to Randy Dunlap for doing many randconfig builds.  And to Paul
Gortmaker for triage and bug fixes.

-- 
Cheers,
Stephen Rothwell

$ git checkout master
$ git reset --hard stable
Merging origin/master (f7dd3b1734ea Merge branch 'x86-timers-for-linus' of 
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip)
Merging fixes/master (30066ce675d3 Merge branch 'linus' of 
git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6)
Merging kbuild-current/rc-fixes (152b695d7437 builddeb: fix cross-building to 
arm64 producing host-arch debs)
Merging arc-current/for-curr (7badf6fefca8 ARC: axs10x: really enable ARC PGU)
Merging arm-current/fixes (8478132a8784 Revert "arm: move exports to 
definitions")
Merging m68k-current/for-linus (7e251bb21ae0 m68k: Fix ndelay() macro)
Merging metag-fixes/fixes (35d04077ad96 metag: Only define 
atomic_dec_if_positive conditionally)
Merging powerpc-fixes/fixes (69973b830859 Linux 4.9)
Merging sparc/master (8fa3b6f9392b Merge tag 'cris-for-4.10' of 
git://git.kernel.org/pub/scm/linux/kernel/git/jesper/cris)
Merging net/master (52f40e9d657c Merge 
git://git.kernel.org/pub/scm/linux/kernel/git/davem/net)
Merging ipsec/master (bc3913a5378c Merge 
git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc)
Merging netfilter/master (a220871be66f virtio-net: correctly enable multiqueue)
Merging ipvs/master (045169816b31 Merge branch 'linus' of 
git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6)
Merging wireless-drivers/master (fcd2042e8d36 mwifiex: printk() overflow with 
32-byte SSIDs)
Merging mac80211/master (a17d93ff3a95 mac80211: fix legacy and invalid rx-rate 
report)
Merging sound-current/for-linus (995c6a7fd9b9 ALSA: hiface: Fix M2Tech hiFace 
driver sampling rate change)
Merging pci-current/for-linus (e42010d8207f PCI: Set Read Completion Boundary 
to 128 iff Root Port supports it (_HPX))
Merging driver-core.current/driver-core-linus (cdb98c2698b4 Revert "nvme: add 
support for the Write Zeroes command")
Merging tty.current/tty-linus (cdb98c2698b4 Revert "nvme: add support for the 
Write Zeroes command")
Merging usb.current/usb-linus (cdb98c2698b4 Revert "nvme: add support for the 
Write Zeroes command")
Merging usb-gadget-fixes/fixes (05e78c6933d6 usb: gadget: f_fs: fix wrong 
parenthesis in ffs_func_req_match())
Merging usb-serial-fixes/usb-linus (46490c347df4 USB: serial: option: add dlink 
dwm-158)
Merging usb-chipidea-fixes/ci-for-usb-stable (c7fbb09b2ea1 usb: chipidea: move 
the lock initialization to core file)
Merging phy/fixes (4320f9d4c183 phy: sun4i: check PMU presence when poking 
unknown bit of pmu)
Merging staging.current/staging-linus (cdb98c2698b4 Revert "nvme: add support 
for the Write Zeroes command")
Merging char-misc.current/char-misc-linus (cdb98c2698b4 Revert "nvme: add 
support for the Write Zeroes command")
Merging 

linux-next: Tree for Dec 19

2016-12-18 Thread Stephen Rothwell
Hi all,

Please do not add any material for v4.11 to your linux-next included
branches until after v4.10-rc1 has been released.

Changes since 20161216:

New tree: target-bva

The overlayfs tree gained conflicts against Linus' tree.

The kvm tree gained a build failure so I used the version from
next-20161216.

The target-bva tree gained a conflict against Linus' tree.

I removed one patch from the akpm tree that was causing run time problems.

Non-merge commits (relative to Linus' tree): 557
 871 files changed, 27536 insertions(+), 8149 deletions(-)



I have created today's linux-next tree at
git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
(patches at http://www.kernel.org/pub/linux/kernel/next/ ).  If you
are tracking the linux-next tree using git, you should not use "git pull"
to do so as that will try to merge the new linux-next release with the
old one.  You should use "git fetch" and checkout or reset to the new
master.

You can see which trees have been included by looking in the Next/Trees
file in the source.  There are also quilt-import.log and merge.log
files in the Next directory.  Between each merge, the tree was built
with a ppc64_defconfig for powerpc and an allmodconfig (with
CONFIG_BUILD_DOCSRC=n) for x86_64, a multi_v7_defconfig for arm and a
native build of tools/perf. After the final fixups (if any), I do an
x86_64 modules_install followed by builds for x86_64 allnoconfig,
powerpc allnoconfig (32 and 64 bit), ppc44x_defconfig, allyesconfig
(with KALLSYMS_EXTRA_PASS=1) and pseries_le_defconfig and i386, sparc
and sparc64 defconfig.

Below is a summary of the state of the merge.

I am currently merging 246 trees (counting Linus' and 35 trees of bug
fix patches pending for the current merge release).

Stats about the size of the tree over time can be seen at
http://neuling.org/linux-next-size.html .

Status of my local build tests will be at
http://kisskb.ellerman.id.au/linux-next .  If maintainers want to give
advice about cross compilers/configs that work, we are always open to add
more builds.

Thanks to Randy Dunlap for doing many randconfig builds.  And to Paul
Gortmaker for triage and bug fixes.

-- 
Cheers,
Stephen Rothwell

$ git checkout master
$ git reset --hard stable
Merging origin/master (f7dd3b1734ea Merge branch 'x86-timers-for-linus' of 
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip)
Merging fixes/master (30066ce675d3 Merge branch 'linus' of 
git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6)
Merging kbuild-current/rc-fixes (152b695d7437 builddeb: fix cross-building to 
arm64 producing host-arch debs)
Merging arc-current/for-curr (7badf6fefca8 ARC: axs10x: really enable ARC PGU)
Merging arm-current/fixes (8478132a8784 Revert "arm: move exports to 
definitions")
Merging m68k-current/for-linus (7e251bb21ae0 m68k: Fix ndelay() macro)
Merging metag-fixes/fixes (35d04077ad96 metag: Only define 
atomic_dec_if_positive conditionally)
Merging powerpc-fixes/fixes (69973b830859 Linux 4.9)
Merging sparc/master (8fa3b6f9392b Merge tag 'cris-for-4.10' of 
git://git.kernel.org/pub/scm/linux/kernel/git/jesper/cris)
Merging net/master (52f40e9d657c Merge 
git://git.kernel.org/pub/scm/linux/kernel/git/davem/net)
Merging ipsec/master (bc3913a5378c Merge 
git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc)
Merging netfilter/master (a220871be66f virtio-net: correctly enable multiqueue)
Merging ipvs/master (045169816b31 Merge branch 'linus' of 
git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6)
Merging wireless-drivers/master (fcd2042e8d36 mwifiex: printk() overflow with 
32-byte SSIDs)
Merging mac80211/master (a17d93ff3a95 mac80211: fix legacy and invalid rx-rate 
report)
Merging sound-current/for-linus (995c6a7fd9b9 ALSA: hiface: Fix M2Tech hiFace 
driver sampling rate change)
Merging pci-current/for-linus (e42010d8207f PCI: Set Read Completion Boundary 
to 128 iff Root Port supports it (_HPX))
Merging driver-core.current/driver-core-linus (cdb98c2698b4 Revert "nvme: add 
support for the Write Zeroes command")
Merging tty.current/tty-linus (cdb98c2698b4 Revert "nvme: add support for the 
Write Zeroes command")
Merging usb.current/usb-linus (cdb98c2698b4 Revert "nvme: add support for the 
Write Zeroes command")
Merging usb-gadget-fixes/fixes (05e78c6933d6 usb: gadget: f_fs: fix wrong 
parenthesis in ffs_func_req_match())
Merging usb-serial-fixes/usb-linus (46490c347df4 USB: serial: option: add dlink 
dwm-158)
Merging usb-chipidea-fixes/ci-for-usb-stable (c7fbb09b2ea1 usb: chipidea: move 
the lock initialization to core file)
Merging phy/fixes (4320f9d4c183 phy: sun4i: check PMU presence when poking 
unknown bit of pmu)
Merging staging.current/staging-linus (cdb98c2698b4 Revert "nvme: add support 
for the Write Zeroes command")
Merging char-misc.current/char-misc-linus (cdb98c2698b4 Revert "nvme: add 
support for the Write Zeroes command")
Merging 

Re: [PATCH] extcon: 3gpio: add driver for USB OTG port controlled by 3 GPIOs

2016-12-18 Thread kbuild test robot
Hi David,

[auto build test ERROR on chanwoo-extcon/extcon-next]
[also build test ERROR on v4.9 next-20161216]
[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/Hans-de-Goede/extcon-3gpio-add-driver-for-USB-OTG-port-controlled-by-3-GPIOs/20161219-082834
base:   https://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon.git 
extcon-next
config: blackfin-allmodconfig (attached as .config)
compiler: bfin-uclinux-gcc (GCC) 6.2.0
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=blackfin 

All error/warnings (new ones prefixed by >>):

>> drivers/extcon/extcon-3gpio_otg.c:185:1: warning: data definition has no 
>> type or storage class
MODULE_DEVICE_TABLE(acpi, usb_otg_acpi_match);
^~~
>> drivers/extcon/extcon-3gpio_otg.c:185:1: error: type defaults to 'int' in 
>> declaration of 'MODULE_DEVICE_TABLE' [-Werror=implicit-int]
>> drivers/extcon/extcon-3gpio_otg.c:185:1: warning: parameter names (without 
>> types) in function declaration
   In file included from include/linux/acpi.h:27:0,
from drivers/extcon/extcon-3gpio_otg.c:21:
   include/linux/device.h:1353:1: warning: data definition has no type or 
storage class
module_init(__driver##_init); \
^
>> include/linux/platform_device.h:228:2: note: in expansion of macro 
>> 'module_driver'
 module_driver(__platform_driver, platform_driver_register, \
 ^
>> drivers/extcon/extcon-3gpio_otg.c:197:1: note: in expansion of macro 
>> 'module_platform_driver'
module_platform_driver(usb_otg_driver);
^~
>> include/linux/device.h:1353:1: error: type defaults to 'int' in declaration 
>> of 'module_init' [-Werror=implicit-int]
module_init(__driver##_init); \
^
>> include/linux/platform_device.h:228:2: note: in expansion of macro 
>> 'module_driver'
 module_driver(__platform_driver, platform_driver_register, \
 ^
>> drivers/extcon/extcon-3gpio_otg.c:197:1: note: in expansion of macro 
>> 'module_platform_driver'
module_platform_driver(usb_otg_driver);
^~
   drivers/extcon/extcon-3gpio_otg.c:197:1: warning: parameter names (without 
types) in function declaration
   In file included from include/linux/acpi.h:27:0,
from drivers/extcon/extcon-3gpio_otg.c:21:
   include/linux/device.h:1358:1: warning: data definition has no type or 
storage class
module_exit(__driver##_exit);
^
>> include/linux/platform_device.h:228:2: note: in expansion of macro 
>> 'module_driver'
 module_driver(__platform_driver, platform_driver_register, \
 ^
>> drivers/extcon/extcon-3gpio_otg.c:197:1: note: in expansion of macro 
>> 'module_platform_driver'
module_platform_driver(usb_otg_driver);
^~
>> include/linux/device.h:1358:1: error: type defaults to 'int' in declaration 
>> of 'module_exit' [-Werror=implicit-int]
module_exit(__driver##_exit);
^
>> include/linux/platform_device.h:228:2: note: in expansion of macro 
>> 'module_driver'
 module_driver(__platform_driver, platform_driver_register, \
 ^
>> drivers/extcon/extcon-3gpio_otg.c:197:1: note: in expansion of macro 
>> 'module_platform_driver'
module_platform_driver(usb_otg_driver);
^~
   drivers/extcon/extcon-3gpio_otg.c:197:1: warning: parameter names (without 
types) in function declaration
>> drivers/extcon/extcon-3gpio_otg.c:199:15: error: expected declaration 
>> specifiers or '...' before string constant
MODULE_AUTHOR("Hans de Goede ");
  ^
   drivers/extcon/extcon-3gpio_otg.c:200:20: error: expected declaration 
specifiers or '...' before string constant
MODULE_DESCRIPTION("3 GPIO USB OTG extcon driver");
   ^~
   drivers/extcon/extcon-3gpio_otg.c:201:16: error: expected declaration 
specifiers or '...' before string constant
MODULE_LICENSE("GPL");
   ^
   In file included from include/linux/acpi.h:27:0,
from drivers/extcon/extcon-3gpio_otg.c:21:
   drivers/extcon/extcon-3gpio_otg.c:197:24: warning: 'usb_otg_driver_exit' 
defined but not used [-Wunused-function]
module_platform_driver(usb_otg_driver);
   ^
   include/linux/device.h:1354:20: note: in definition of macro 'module_driver'
static void __exit __driver##_exit(void) \
   ^~~~
>> drivers/extcon/extcon-3gpio_otg.c:197:1: note: in expansion of macro 
>> 'module_platform_driver'
module_platform_driver(usb_otg_driver);
^~
   

Re: [PATCH] extcon: 3gpio: add driver for USB OTG port controlled by 3 GPIOs

2016-12-18 Thread kbuild test robot
Hi David,

[auto build test ERROR on chanwoo-extcon/extcon-next]
[also build test ERROR on v4.9 next-20161216]
[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/Hans-de-Goede/extcon-3gpio-add-driver-for-USB-OTG-port-controlled-by-3-GPIOs/20161219-082834
base:   https://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon.git 
extcon-next
config: blackfin-allmodconfig (attached as .config)
compiler: bfin-uclinux-gcc (GCC) 6.2.0
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=blackfin 

All error/warnings (new ones prefixed by >>):

>> drivers/extcon/extcon-3gpio_otg.c:185:1: warning: data definition has no 
>> type or storage class
MODULE_DEVICE_TABLE(acpi, usb_otg_acpi_match);
^~~
>> drivers/extcon/extcon-3gpio_otg.c:185:1: error: type defaults to 'int' in 
>> declaration of 'MODULE_DEVICE_TABLE' [-Werror=implicit-int]
>> drivers/extcon/extcon-3gpio_otg.c:185:1: warning: parameter names (without 
>> types) in function declaration
   In file included from include/linux/acpi.h:27:0,
from drivers/extcon/extcon-3gpio_otg.c:21:
   include/linux/device.h:1353:1: warning: data definition has no type or 
storage class
module_init(__driver##_init); \
^
>> include/linux/platform_device.h:228:2: note: in expansion of macro 
>> 'module_driver'
 module_driver(__platform_driver, platform_driver_register, \
 ^
>> drivers/extcon/extcon-3gpio_otg.c:197:1: note: in expansion of macro 
>> 'module_platform_driver'
module_platform_driver(usb_otg_driver);
^~
>> include/linux/device.h:1353:1: error: type defaults to 'int' in declaration 
>> of 'module_init' [-Werror=implicit-int]
module_init(__driver##_init); \
^
>> include/linux/platform_device.h:228:2: note: in expansion of macro 
>> 'module_driver'
 module_driver(__platform_driver, platform_driver_register, \
 ^
>> drivers/extcon/extcon-3gpio_otg.c:197:1: note: in expansion of macro 
>> 'module_platform_driver'
module_platform_driver(usb_otg_driver);
^~
   drivers/extcon/extcon-3gpio_otg.c:197:1: warning: parameter names (without 
types) in function declaration
   In file included from include/linux/acpi.h:27:0,
from drivers/extcon/extcon-3gpio_otg.c:21:
   include/linux/device.h:1358:1: warning: data definition has no type or 
storage class
module_exit(__driver##_exit);
^
>> include/linux/platform_device.h:228:2: note: in expansion of macro 
>> 'module_driver'
 module_driver(__platform_driver, platform_driver_register, \
 ^
>> drivers/extcon/extcon-3gpio_otg.c:197:1: note: in expansion of macro 
>> 'module_platform_driver'
module_platform_driver(usb_otg_driver);
^~
>> include/linux/device.h:1358:1: error: type defaults to 'int' in declaration 
>> of 'module_exit' [-Werror=implicit-int]
module_exit(__driver##_exit);
^
>> include/linux/platform_device.h:228:2: note: in expansion of macro 
>> 'module_driver'
 module_driver(__platform_driver, platform_driver_register, \
 ^
>> drivers/extcon/extcon-3gpio_otg.c:197:1: note: in expansion of macro 
>> 'module_platform_driver'
module_platform_driver(usb_otg_driver);
^~
   drivers/extcon/extcon-3gpio_otg.c:197:1: warning: parameter names (without 
types) in function declaration
>> drivers/extcon/extcon-3gpio_otg.c:199:15: error: expected declaration 
>> specifiers or '...' before string constant
MODULE_AUTHOR("Hans de Goede ");
  ^
   drivers/extcon/extcon-3gpio_otg.c:200:20: error: expected declaration 
specifiers or '...' before string constant
MODULE_DESCRIPTION("3 GPIO USB OTG extcon driver");
   ^~
   drivers/extcon/extcon-3gpio_otg.c:201:16: error: expected declaration 
specifiers or '...' before string constant
MODULE_LICENSE("GPL");
   ^
   In file included from include/linux/acpi.h:27:0,
from drivers/extcon/extcon-3gpio_otg.c:21:
   drivers/extcon/extcon-3gpio_otg.c:197:24: warning: 'usb_otg_driver_exit' 
defined but not used [-Wunused-function]
module_platform_driver(usb_otg_driver);
   ^
   include/linux/device.h:1354:20: note: in definition of macro 'module_driver'
static void __exit __driver##_exit(void) \
   ^~~~
>> drivers/extcon/extcon-3gpio_otg.c:197:1: note: in expansion of macro 
>> 'module_platform_driver'
module_platform_driver(usb_otg_driver);
^~
   drivers/extcon/extcon-3gpio_otg.c:197:24: warning: 

Re: [PATCH 2/3] of/overlay: sysfs based ABI for dt overlays

2016-12-18 Thread kbuild test robot
Hi Heinrich,

[auto build test ERROR on linus/master]
[also build test ERROR on next-20161216]
[cannot apply to glikely/devicetree/next robh/for-next v4.9]
[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/Heinrich-Schuchardt/of-overlay-sysfs-based-ABI-for-dt-overlays/20161219-093606
config: i386-randconfig-r0-12190124 (attached as .config)
compiler: gcc-5 (Debian 5.4.1-2) 5.4.1 20160904
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All error/warnings (new ones prefixed by >>):

   drivers/of/ov_sysfs.c: In function 'of_create_overlay_from_file':
   drivers/of/ov_sysfs.c:69:12: error: implicit declaration of function 
'of_fdt_unflatten_tree' [-Werror=implicit-function-declaration]
 overlay = of_fdt_unflatten_tree((unsigned long *) buffer, NULL, NULL);
   ^
>> drivers/of/ov_sysfs.c:69:10: warning: assignment makes pointer from integer 
>> without a cast [-Wint-conversion]
 overlay = of_fdt_unflatten_tree((unsigned long *) buffer, NULL, NULL);
 ^
   cc1: some warnings being treated as errors

vim +/of_fdt_unflatten_tree +69 drivers/of/ov_sysfs.c

63  offset < fdt_totalsize(buffer)) {
64  pr_err("OF: Size of %s does not match header 
information\n",
65 path);
66  ret = -EINVAL;
67  goto err_file_read;
68  }
  > 69  overlay = of_fdt_unflatten_tree((unsigned long *) buffer, NULL, 
NULL);
70  if (overlay == NULL) {
71  pr_err("OF: Cannot unflatten %s\n", path);
72  ret = -EINVAL;

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


.config.gz
Description: application/gzip


Re: [PATCH 2/3] of/overlay: sysfs based ABI for dt overlays

2016-12-18 Thread kbuild test robot
Hi Heinrich,

[auto build test ERROR on linus/master]
[also build test ERROR on next-20161216]
[cannot apply to glikely/devicetree/next robh/for-next v4.9]
[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/Heinrich-Schuchardt/of-overlay-sysfs-based-ABI-for-dt-overlays/20161219-093606
config: i386-randconfig-r0-12190124 (attached as .config)
compiler: gcc-5 (Debian 5.4.1-2) 5.4.1 20160904
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All error/warnings (new ones prefixed by >>):

   drivers/of/ov_sysfs.c: In function 'of_create_overlay_from_file':
   drivers/of/ov_sysfs.c:69:12: error: implicit declaration of function 
'of_fdt_unflatten_tree' [-Werror=implicit-function-declaration]
 overlay = of_fdt_unflatten_tree((unsigned long *) buffer, NULL, NULL);
   ^
>> drivers/of/ov_sysfs.c:69:10: warning: assignment makes pointer from integer 
>> without a cast [-Wint-conversion]
 overlay = of_fdt_unflatten_tree((unsigned long *) buffer, NULL, NULL);
 ^
   cc1: some warnings being treated as errors

vim +/of_fdt_unflatten_tree +69 drivers/of/ov_sysfs.c

63  offset < fdt_totalsize(buffer)) {
64  pr_err("OF: Size of %s does not match header 
information\n",
65 path);
66  ret = -EINVAL;
67  goto err_file_read;
68  }
  > 69  overlay = of_fdt_unflatten_tree((unsigned long *) buffer, NULL, 
NULL);
70  if (overlay == NULL) {
71  pr_err("OF: Cannot unflatten %s\n", path);
72  ret = -EINVAL;

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


.config.gz
Description: application/gzip


[PATCH 01/21] MIPS memblock: Unpin dts memblock sanity check method

2016-12-18 Thread Serge Semin
It's necessary to check whether retrieved from dts memory regions
fits to page alignment and limits restrictions. Sometimes it is
necessary to perform the same checks, but ito add the memory regions
into a different subsystem. MIPS is going to be that case.

Signed-off-by: Serge Semin 
---
 drivers/of/fdt.c   | 47 +++-
 include/linux/of_fdt.h |  1 +
 2 files changed, 35 insertions(+), 13 deletions(-)

diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 1f98156..1ee958f 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -983,44 +983,65 @@ int __init early_init_dt_scan_chosen(unsigned long node, 
const char *uname,
 #define MAX_MEMBLOCK_ADDR  ((phys_addr_t)~0)
 #endif
 
-void __init __weak early_init_dt_add_memory_arch(u64 base, u64 size)
+int __init sanity_check_dt_memory(phys_addr_t *out_base,
+ phys_addr_t *out_size)
 {
+   phys_addr_t base = *out_base, size = *out_size;
const u64 phys_offset = MIN_MEMBLOCK_ADDR;
 
if (!PAGE_ALIGNED(base)) {
if (size < PAGE_SIZE - (base & ~PAGE_MASK)) {
-   pr_warn("Ignoring memory block 0x%llx - 0x%llx\n",
+   pr_err("Memblock 0x%llx - 0x%llx isn't page aligned\n",
base, base + size);
-   return;
+   return -EINVAL;
}
+   pr_warn("Memblock 0x%llx - 0x%llx shifted to ",
+   base, base + size);
size -= PAGE_SIZE - (base & ~PAGE_MASK);
base = PAGE_ALIGN(base);
+   pr_cont("0x%llx - 0x%llx\n", base, base + size);
}
size &= PAGE_MASK;
 
if (base > MAX_MEMBLOCK_ADDR) {
-   pr_warning("Ignoring memory block 0x%llx - 0x%llx\n",
-   base, base + size);
-   return;
+   pr_err("Memblock 0x%llx - 0x%llx exceeds max address\n",
+   base, base + size);
+   return -EINVAL;
}
 
if (base + size - 1 > MAX_MEMBLOCK_ADDR) {
-   pr_warning("Ignoring memory range 0x%llx - 0x%llx\n",
-   ((u64)MAX_MEMBLOCK_ADDR) + 1, base + size);
+   pr_warn("Memblock 0x%llx - 0x%llx truncated to ",
+   base, base + size);
size = MAX_MEMBLOCK_ADDR - base + 1;
+   pr_cont("0x%llx - 0x%llx\n", base, base + size);
}
 
if (base + size < phys_offset) {
-   pr_warning("Ignoring memory block 0x%llx - 0x%llx\n",
-  base, base + size);
-   return;
+   pr_err("Memblock 0x%llx - 0x%llx is below phys offset\n",
+   base, base + size);
+   return -EINVAL;
}
+
if (base < phys_offset) {
-   pr_warning("Ignoring memory range 0x%llx - 0x%llx\n",
-  base, phys_offset);
+   pr_warn("Memblock 0x%llx - 0x%llx truncated to ",
+   base, base + size);
size -= phys_offset - base;
base = phys_offset;
+   pr_cont("0x%llx - 0x%llx\n", base, base + size);
}
+
+   /* Set the output base address and size */
+   *out_base = base;
+   *out_size = size;
+
+   return 0;
+}
+
+void __init __weak early_init_dt_add_memory_arch(u64 base, u64 size)
+{
+   if (sanity_check_dt_memory(, ))
+   return;
+
memblock_add(base, size);
 }
 
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index df9ef38..ddf93c5 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -84,6 +84,7 @@ extern const void *of_flat_dt_match_machine(const void 
*default_match,
const void * (*get_next_compat)(const char * const**));
 
 /* Other Prototypes */
+extern int sanity_check_dt_memory(phys_addr_t *base, phys_addr_t *size);
 extern void unflatten_device_tree(void);
 extern void unflatten_and_copy_device_tree(void);
 extern void early_init_devtree(void *);
-- 
2.6.6



[PATCH 01/21] MIPS memblock: Unpin dts memblock sanity check method

2016-12-18 Thread Serge Semin
It's necessary to check whether retrieved from dts memory regions
fits to page alignment and limits restrictions. Sometimes it is
necessary to perform the same checks, but ito add the memory regions
into a different subsystem. MIPS is going to be that case.

Signed-off-by: Serge Semin 
---
 drivers/of/fdt.c   | 47 +++-
 include/linux/of_fdt.h |  1 +
 2 files changed, 35 insertions(+), 13 deletions(-)

diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 1f98156..1ee958f 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -983,44 +983,65 @@ int __init early_init_dt_scan_chosen(unsigned long node, 
const char *uname,
 #define MAX_MEMBLOCK_ADDR  ((phys_addr_t)~0)
 #endif
 
-void __init __weak early_init_dt_add_memory_arch(u64 base, u64 size)
+int __init sanity_check_dt_memory(phys_addr_t *out_base,
+ phys_addr_t *out_size)
 {
+   phys_addr_t base = *out_base, size = *out_size;
const u64 phys_offset = MIN_MEMBLOCK_ADDR;
 
if (!PAGE_ALIGNED(base)) {
if (size < PAGE_SIZE - (base & ~PAGE_MASK)) {
-   pr_warn("Ignoring memory block 0x%llx - 0x%llx\n",
+   pr_err("Memblock 0x%llx - 0x%llx isn't page aligned\n",
base, base + size);
-   return;
+   return -EINVAL;
}
+   pr_warn("Memblock 0x%llx - 0x%llx shifted to ",
+   base, base + size);
size -= PAGE_SIZE - (base & ~PAGE_MASK);
base = PAGE_ALIGN(base);
+   pr_cont("0x%llx - 0x%llx\n", base, base + size);
}
size &= PAGE_MASK;
 
if (base > MAX_MEMBLOCK_ADDR) {
-   pr_warning("Ignoring memory block 0x%llx - 0x%llx\n",
-   base, base + size);
-   return;
+   pr_err("Memblock 0x%llx - 0x%llx exceeds max address\n",
+   base, base + size);
+   return -EINVAL;
}
 
if (base + size - 1 > MAX_MEMBLOCK_ADDR) {
-   pr_warning("Ignoring memory range 0x%llx - 0x%llx\n",
-   ((u64)MAX_MEMBLOCK_ADDR) + 1, base + size);
+   pr_warn("Memblock 0x%llx - 0x%llx truncated to ",
+   base, base + size);
size = MAX_MEMBLOCK_ADDR - base + 1;
+   pr_cont("0x%llx - 0x%llx\n", base, base + size);
}
 
if (base + size < phys_offset) {
-   pr_warning("Ignoring memory block 0x%llx - 0x%llx\n",
-  base, base + size);
-   return;
+   pr_err("Memblock 0x%llx - 0x%llx is below phys offset\n",
+   base, base + size);
+   return -EINVAL;
}
+
if (base < phys_offset) {
-   pr_warning("Ignoring memory range 0x%llx - 0x%llx\n",
-  base, phys_offset);
+   pr_warn("Memblock 0x%llx - 0x%llx truncated to ",
+   base, base + size);
size -= phys_offset - base;
base = phys_offset;
+   pr_cont("0x%llx - 0x%llx\n", base, base + size);
}
+
+   /* Set the output base address and size */
+   *out_base = base;
+   *out_size = size;
+
+   return 0;
+}
+
+void __init __weak early_init_dt_add_memory_arch(u64 base, u64 size)
+{
+   if (sanity_check_dt_memory(, ))
+   return;
+
memblock_add(base, size);
 }
 
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index df9ef38..ddf93c5 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -84,6 +84,7 @@ extern const void *of_flat_dt_match_machine(const void 
*default_match,
const void * (*get_next_compat)(const char * const**));
 
 /* Other Prototypes */
+extern int sanity_check_dt_memory(phys_addr_t *base, phys_addr_t *size);
 extern void unflatten_device_tree(void);
 extern void unflatten_and_copy_device_tree(void);
 extern void early_init_devtree(void *);
-- 
2.6.6



  1   2   3   4   5   6   >