Re: [PATCH] tpm_crb: fix mapping of the buffers

2016-04-18 Thread Jarkko Sakkinen
On Tue, Apr 19, 2016 at 07:59:24AM +0300, Jarkko Sakkinen wrote:
> On Mon, Apr 18, 2016 at 05:34:57PM -0600, Jason Gunthorpe wrote:
> > On Tue, Apr 19, 2016 at 02:08:00AM +0300, Jarkko Sakkinen wrote:
> > > On my Lenovo x250 the following situation occurs:
> > > 
> > > [18697.813871] tpm_crb MSFT0101:00: can't request region for resource
> > > [mem 0xacdff080-0xacdf]
> > 
> > Sigh, the BIOS vendors seem to be screwing this up a lot.. No doubt
> > because the spec doesn't really say what to do very well...
> > 
> > > The mapping of the control area interleaves the mapping of the command
> > > buffer. The control area is mapped over page, which is not right. It
> > > should mapped over sizeof(struct crb_control_area).
> > 
> > Good
> > 
> > > Fixing this issue unmasks another issue. Command and response buffers
> > > can interleave and they do interleave on this machine.
> > 
> > Do they 100% overlap because one is 'read' and the other is 'write'?
> 
> 100% so it is kind of sane configuration.
> 
> > Or did the BIOS guys screw up the length of one of the regions, and
> > they were supposed to be back to back? In which case it is just luck
> > this proposed patch solves the issue :(
> > 
> > The request_io stuff is there specifically to prevent two peices of
> > code from trying to control the same registers, I'm really reluctant to
> > work-around it like this, though granted, crazy BIOS is a fine good reason.
> > 
> > Is this patch below enough to deal with it sanely?
> > 
> > If you do stick with this then:
> > 
> > > -static void __iomem *crb_map_res(struct device *dev, struct crb_priv 
> > > *priv,
> > > -  struct resource *io_res, u64 start, u32 size)
> > > +static int crb_map_res(struct device *dev, struct crb_priv *priv,
> > > +int res_i, u64 start, u32 size)
> > 
> > I wouldn't change the signature at all, just add a counter to the priv and
> > 'append to the list'
> > 
> > This change is creating a lot of needless churn which is not good at
> > all for the stable rules.
> > 
> > Removing the pointer return is not an improvement..
> 
> Point taken but then it is better to make the fix even more localized. If
> the physical addresses are equal, check the buffer sizes for sanity.
> If they are not equal, emit FW_BUG and return -EINVAL.

This is also correct way to handle the situation according to

http://www.trustedcomputinggroup.org/resources/pc_client_platform_tpm_profile_ptp_specification

In the table in the section 5.5.3.1 it is stated about rsp_size
that:

"Note:: If command and response buffers are implemented as a single
buffer, this field SHALL be identical to the value in the
TPM_CRB_CTRL_CMD_SIZE_x buffer."

/Jarkko

> I'll send an updated patch after I've done all testing rounds with my
> laptop and Haswell NUC.
> 
> /Jarkko
> 
> > >  {
> > > + u8 __iomem *ptr;
> > > + int i;
> > > +
> > >   struct resource new_res = {
> > >   .start  = start,
> > >   .end= start + size - 1,
> > > @@ -245,12 +257,25 @@ static void __iomem *crb_map_res(struct device 
> > > *dev, struct crb_priv *priv,
> > >  
> > >   /* Detect a 64 bit address on a 32 bit system */
> > >   if (start != new_res.start)
> > > - return ERR_PTR(-EINVAL);
> > > + return -EINVAL;
> > >  
> > > - if (!resource_contains(io_res, _res))
> > > - return devm_ioremap_resource(dev, _res);
> > > + for (i = 0; i < CRB_NR_RESOURCES; i++) {
> > > + if (resource_contains(>res[i], _res)) {
> > > + priv->res[res_i] = new_res;
> > > + priv->res_ptr[res_i] = priv->res_ptr[i] +
> > > + (new_res.start - priv->res[i].start);
> > > + return 0;
> > > + }
> > > + }
> > 
> > 
> > Just add:
> > 
> >id = priv->num_res++;
> >priv->res[id] = *io_res;
> >priv->res_ptr[id] = priv->iobase + (new_res.start  - io_res->start);
> >return priv->res_ptr[id];
> > 
> > And drop all the other hunks, except for the sizeof change and the
> > above loop.
> > 
> > Maybe print a FW bug if it overlaps with id != 0, that is just
> > crazy beans.
> > 
> > Jason
> > 
> > diff --git a/drivers/char/tpm/tpm_crb.c b/drivers/char/tpm/tpm_crb.c
> > index 20155d55a62b..0a87c813d004 100644
> > --- a/drivers/char/tpm/tpm_crb.c
> > +++ b/drivers/char/tpm/tpm_crb.c
> > @@ -253,7 +253,7 @@ static int crb_map_io(struct acpi_device *device, 
> > struct crb_priv *priv,
> > struct list_head resources;
> > struct resource io_res;
> > struct device *dev = >dev;
> > -   u64 pa;
> > +   u64 cmd_pa,rsp_pa;
> > int ret;
> >  
> > INIT_LIST_HEAD();
> > @@ -274,22 +274,33 @@ static int crb_map_io(struct acpi_device *device, 
> > struct crb_priv *priv,
> > return PTR_ERR(priv->iobase);
> >  
> > priv->cca = crb_map_res(dev, priv, _res, buf->control_address,
> > -   0x1000);
> > +   sizeof(*priv->cca));
> > if 

Re: [PATCH] tpm_crb: fix mapping of the buffers

2016-04-18 Thread Jarkko Sakkinen
On Tue, Apr 19, 2016 at 07:59:24AM +0300, Jarkko Sakkinen wrote:
> On Mon, Apr 18, 2016 at 05:34:57PM -0600, Jason Gunthorpe wrote:
> > On Tue, Apr 19, 2016 at 02:08:00AM +0300, Jarkko Sakkinen wrote:
> > > On my Lenovo x250 the following situation occurs:
> > > 
> > > [18697.813871] tpm_crb MSFT0101:00: can't request region for resource
> > > [mem 0xacdff080-0xacdf]
> > 
> > Sigh, the BIOS vendors seem to be screwing this up a lot.. No doubt
> > because the spec doesn't really say what to do very well...
> > 
> > > The mapping of the control area interleaves the mapping of the command
> > > buffer. The control area is mapped over page, which is not right. It
> > > should mapped over sizeof(struct crb_control_area).
> > 
> > Good
> > 
> > > Fixing this issue unmasks another issue. Command and response buffers
> > > can interleave and they do interleave on this machine.
> > 
> > Do they 100% overlap because one is 'read' and the other is 'write'?
> 
> 100% so it is kind of sane configuration.
> 
> > Or did the BIOS guys screw up the length of one of the regions, and
> > they were supposed to be back to back? In which case it is just luck
> > this proposed patch solves the issue :(
> > 
> > The request_io stuff is there specifically to prevent two peices of
> > code from trying to control the same registers, I'm really reluctant to
> > work-around it like this, though granted, crazy BIOS is a fine good reason.
> > 
> > Is this patch below enough to deal with it sanely?
> > 
> > If you do stick with this then:
> > 
> > > -static void __iomem *crb_map_res(struct device *dev, struct crb_priv 
> > > *priv,
> > > -  struct resource *io_res, u64 start, u32 size)
> > > +static int crb_map_res(struct device *dev, struct crb_priv *priv,
> > > +int res_i, u64 start, u32 size)
> > 
> > I wouldn't change the signature at all, just add a counter to the priv and
> > 'append to the list'
> > 
> > This change is creating a lot of needless churn which is not good at
> > all for the stable rules.
> > 
> > Removing the pointer return is not an improvement..
> 
> Point taken but then it is better to make the fix even more localized. If
> the physical addresses are equal, check the buffer sizes for sanity.
> If they are not equal, emit FW_BUG and return -EINVAL.

This is also correct way to handle the situation according to

http://www.trustedcomputinggroup.org/resources/pc_client_platform_tpm_profile_ptp_specification

In the table in the section 5.5.3.1 it is stated about rsp_size
that:

"Note:: If command and response buffers are implemented as a single
buffer, this field SHALL be identical to the value in the
TPM_CRB_CTRL_CMD_SIZE_x buffer."

/Jarkko

> I'll send an updated patch after I've done all testing rounds with my
> laptop and Haswell NUC.
> 
> /Jarkko
> 
> > >  {
> > > + u8 __iomem *ptr;
> > > + int i;
> > > +
> > >   struct resource new_res = {
> > >   .start  = start,
> > >   .end= start + size - 1,
> > > @@ -245,12 +257,25 @@ static void __iomem *crb_map_res(struct device 
> > > *dev, struct crb_priv *priv,
> > >  
> > >   /* Detect a 64 bit address on a 32 bit system */
> > >   if (start != new_res.start)
> > > - return ERR_PTR(-EINVAL);
> > > + return -EINVAL;
> > >  
> > > - if (!resource_contains(io_res, _res))
> > > - return devm_ioremap_resource(dev, _res);
> > > + for (i = 0; i < CRB_NR_RESOURCES; i++) {
> > > + if (resource_contains(>res[i], _res)) {
> > > + priv->res[res_i] = new_res;
> > > + priv->res_ptr[res_i] = priv->res_ptr[i] +
> > > + (new_res.start - priv->res[i].start);
> > > + return 0;
> > > + }
> > > + }
> > 
> > 
> > Just add:
> > 
> >id = priv->num_res++;
> >priv->res[id] = *io_res;
> >priv->res_ptr[id] = priv->iobase + (new_res.start  - io_res->start);
> >return priv->res_ptr[id];
> > 
> > And drop all the other hunks, except for the sizeof change and the
> > above loop.
> > 
> > Maybe print a FW bug if it overlaps with id != 0, that is just
> > crazy beans.
> > 
> > Jason
> > 
> > diff --git a/drivers/char/tpm/tpm_crb.c b/drivers/char/tpm/tpm_crb.c
> > index 20155d55a62b..0a87c813d004 100644
> > --- a/drivers/char/tpm/tpm_crb.c
> > +++ b/drivers/char/tpm/tpm_crb.c
> > @@ -253,7 +253,7 @@ static int crb_map_io(struct acpi_device *device, 
> > struct crb_priv *priv,
> > struct list_head resources;
> > struct resource io_res;
> > struct device *dev = >dev;
> > -   u64 pa;
> > +   u64 cmd_pa,rsp_pa;
> > int ret;
> >  
> > INIT_LIST_HEAD();
> > @@ -274,22 +274,33 @@ static int crb_map_io(struct acpi_device *device, 
> > struct crb_priv *priv,
> > return PTR_ERR(priv->iobase);
> >  
> > priv->cca = crb_map_res(dev, priv, _res, buf->control_address,
> > -   0x1000);
> > +   sizeof(*priv->cca));
> > if 

Re: [PATCH 4.5 000/124] 4.5.2-stable review

2016-04-18 Thread Greg Kroah-Hartman
On Mon, Apr 18, 2016 at 10:35:12AM -0600, Shuah Khan wrote:
> On 04/17/2016 08:27 PM, Greg Kroah-Hartman wrote:
> > This is the start of the stable review cycle for the 4.5.2 release.
> > There are 124 patches in this series, all will be posted as a response
> > to this one.  If anyone has any issues with these being applied, please
> > let me know.
> > 
> > Responses should be made by Wed Apr 20 02:25:31 UTC 2016.
> > Anything received after that time might be too late.
> > 
> > The whole patch series can be found in one patch at:
> > kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.5.2-rc1.gz
> > and the diffstat can be found below.
> > 
> 
> Compiled and booted on my test system. No dmesg regressions.

Thanks for testing these and letting me know.

greg k-h


Re: [PATCH 4.5 000/124] 4.5.2-stable review

2016-04-18 Thread Greg Kroah-Hartman
On Mon, Apr 18, 2016 at 10:35:12AM -0600, Shuah Khan wrote:
> On 04/17/2016 08:27 PM, Greg Kroah-Hartman wrote:
> > This is the start of the stable review cycle for the 4.5.2 release.
> > There are 124 patches in this series, all will be posted as a response
> > to this one.  If anyone has any issues with these being applied, please
> > let me know.
> > 
> > Responses should be made by Wed Apr 20 02:25:31 UTC 2016.
> > Anything received after that time might be too late.
> > 
> > The whole patch series can be found in one patch at:
> > kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.5.2-rc1.gz
> > and the diffstat can be found below.
> > 
> 
> Compiled and booted on my test system. No dmesg regressions.

Thanks for testing these and letting me know.

greg k-h


Re: [PATCH 4.5 000/124] 4.5.2-stable review

2016-04-18 Thread Greg Kroah-Hartman
On Mon, Apr 18, 2016 at 09:35:32AM -0700, Guenter Roeck wrote:
> On Mon, Apr 18, 2016 at 11:27:52AM +0900, Greg Kroah-Hartman wrote:
> > This is the start of the stable review cycle for the 4.5.2 release.
> > There are 124 patches in this series, all will be posted as a response
> > to this one.  If anyone has any issues with these being applied, please
> > let me know.
> > 
> > Responses should be made by Wed Apr 20 02:25:31 UTC 2016.
> > Anything received after that time might be too late.
> > 
> Build results:
>   total: 147 pass: 147 fail: 0
> Qemu test results:
>   total: 104 pass: 104 fail: 0

Thanks for testing all of these and letting me know.

greg k-h


Re: [PATCH 4.5 000/124] 4.5.2-stable review

2016-04-18 Thread Greg Kroah-Hartman
On Mon, Apr 18, 2016 at 09:35:32AM -0700, Guenter Roeck wrote:
> On Mon, Apr 18, 2016 at 11:27:52AM +0900, Greg Kroah-Hartman wrote:
> > This is the start of the stable review cycle for the 4.5.2 release.
> > There are 124 patches in this series, all will be posted as a response
> > to this one.  If anyone has any issues with these being applied, please
> > let me know.
> > 
> > Responses should be made by Wed Apr 20 02:25:31 UTC 2016.
> > Anything received after that time might be too late.
> > 
> Build results:
>   total: 147 pass: 147 fail: 0
> Qemu test results:
>   total: 104 pass: 104 fail: 0

Thanks for testing all of these and letting me know.

greg k-h


Re: [PATCH 4.5 000/124] 4.5.2-stable review

2016-04-18 Thread Greg Kroah-Hartman
On Mon, Apr 18, 2016 at 12:27:12AM -0700, kernelci.org bot wrote:
> stable-queue boot: 25 boots: 0 failed, 25 passed (v4.5.1-124-ga7f91925a8c9)
> 
> Full Boot Summary: 
> https://kernelci.org/boot/all/job/stable-queue/kernel/v4.5.1-124-ga7f91925a8c9/
> Full Build Summary: 
> https://kernelci.org/build/stable-queue/kernel/v4.5.1-124-ga7f91925a8c9/
> 
> Tree: stable-queue
> Branch: local/linux-4.5.y.queue
> Git Describe: v4.5.1-124-ga7f91925a8c9
> Git Commit: a7f91925a8c9fd192ccc6dfcb91d5468d318b264
> Git URL: git://server.roeck-us.net/git/linux-stable.git
> Tested: 6 unique boards, 3 SoC families, 8 builds out of 141

Thanks for this, and the other testing reports.

greg k-h


Re: [PATCH 4.5 000/124] 4.5.2-stable review

2016-04-18 Thread Greg Kroah-Hartman
On Mon, Apr 18, 2016 at 12:27:12AM -0700, kernelci.org bot wrote:
> stable-queue boot: 25 boots: 0 failed, 25 passed (v4.5.1-124-ga7f91925a8c9)
> 
> Full Boot Summary: 
> https://kernelci.org/boot/all/job/stable-queue/kernel/v4.5.1-124-ga7f91925a8c9/
> Full Build Summary: 
> https://kernelci.org/build/stable-queue/kernel/v4.5.1-124-ga7f91925a8c9/
> 
> Tree: stable-queue
> Branch: local/linux-4.5.y.queue
> Git Describe: v4.5.1-124-ga7f91925a8c9
> Git Commit: a7f91925a8c9fd192ccc6dfcb91d5468d318b264
> Git URL: git://server.roeck-us.net/git/linux-stable.git
> Tested: 6 unique boards, 3 SoC families, 8 builds out of 141

Thanks for this, and the other testing reports.

greg k-h


Re: [PATCH 4.4 000/137] 4.4.8-stable review

2016-04-18 Thread Greg Kroah-Hartman
On Mon, Apr 18, 2016 at 12:47:13AM -0700, kernelci.org bot wrote:
> stable-queue boot: 207 boots: 4 failed, 202 passed with 1 offline 
> (v4.4.7-137-ge7e3ac8ffeb8)
> 
> Full Boot Summary: 
> https://kernelci.org/boot/all/job/stable-queue/kernel/v4.4.7-137-ge7e3ac8ffeb8/
> Full Build Summary: 
> https://kernelci.org/build/stable-queue/kernel/v4.4.7-137-ge7e3ac8ffeb8/
> 
> Tree: stable-queue
> Branch: local/linux-4.4.y.queue
> Git Describe: v4.4.7-137-ge7e3ac8ffeb8
> Git Commit: e7e3ac8ffeb83283846cee3690cbac5cb87499dc
> Git URL: git://server.roeck-us.net/git/linux-stable.git
> Tested: 42 unique boards, 12 SoC families, 26 builds out of 139
> 
> Boot Failures Detected: 
> https://kernelci.org/boot/?v4.4.7-137-ge7e3ac8ffeb8
> 
> arm:
> 
> multi_v7_defconfig+CONFIG_THUMB2_KERNEL=y:
> socfpga_cyclone5_socrates: 1 failed lab
> 
> imx_v4_v5_defconfig:
> imx27-phytec-phycard-s-rdk: 1 failed lab
> 
> multi_v5_defconfig:
> imx27-phytec-phycard-s-rdk: 1 failed lab
> 
> socfpga_defconfig:
> socfpga_cyclone5_socrates: 1 failed lab

Are these failures to be expected?

thanks,

greg k-h


Re: [PATCH 4.4 000/137] 4.4.8-stable review

2016-04-18 Thread Greg Kroah-Hartman
On Mon, Apr 18, 2016 at 12:47:13AM -0700, kernelci.org bot wrote:
> stable-queue boot: 207 boots: 4 failed, 202 passed with 1 offline 
> (v4.4.7-137-ge7e3ac8ffeb8)
> 
> Full Boot Summary: 
> https://kernelci.org/boot/all/job/stable-queue/kernel/v4.4.7-137-ge7e3ac8ffeb8/
> Full Build Summary: 
> https://kernelci.org/build/stable-queue/kernel/v4.4.7-137-ge7e3ac8ffeb8/
> 
> Tree: stable-queue
> Branch: local/linux-4.4.y.queue
> Git Describe: v4.4.7-137-ge7e3ac8ffeb8
> Git Commit: e7e3ac8ffeb83283846cee3690cbac5cb87499dc
> Git URL: git://server.roeck-us.net/git/linux-stable.git
> Tested: 42 unique boards, 12 SoC families, 26 builds out of 139
> 
> Boot Failures Detected: 
> https://kernelci.org/boot/?v4.4.7-137-ge7e3ac8ffeb8
> 
> arm:
> 
> multi_v7_defconfig+CONFIG_THUMB2_KERNEL=y:
> socfpga_cyclone5_socrates: 1 failed lab
> 
> imx_v4_v5_defconfig:
> imx27-phytec-phycard-s-rdk: 1 failed lab
> 
> multi_v5_defconfig:
> imx27-phytec-phycard-s-rdk: 1 failed lab
> 
> socfpga_defconfig:
> socfpga_cyclone5_socrates: 1 failed lab

Are these failures to be expected?

thanks,

greg k-h


Re: [PATCH] mm/memory-failure: fix race with compound page split/merge

2016-04-18 Thread Konstantin Khlebnikov
On Tue, Apr 19, 2016 at 2:15 AM, Naoya Horiguchi
 wrote:
> # CCed Andrew,
>
> On Mon, Apr 18, 2016 at 02:43:45PM +0300, Konstantin Khlebnikov wrote:
>> Get_hwpoison_page() must recheck relation between head and tail pages.
>>
>> Signed-off-by: Konstantin Khlebnikov 
>
> Looks good to me. Without this recheck, the race causes kernel to pin
> an irrelevant page, and finally makes kernel crash for refcount mismcach...

Yep. I seen that a lot. Unfortunately that was in 3.18 branch and
it'll took several months to verify this fix.
This code and page reference counting overall have changed
significantly since then, so probably here is more bugs.
For example, I'm not sure about races with atomic set for page
reference counting,
I've found and removed couple in mellanox driver but there're more in
mm and net.

>
> Acked-by: Naoya Horiguchi 
>
>> ---
>>  mm/memory-failure.c |   10 +-
>>  1 file changed, 9 insertions(+), 1 deletion(-)
>>
>> diff --git a/mm/memory-failure.c b/mm/memory-failure.c
>> index 78f5f2641b91..ca5acee53b7a 100644
>> --- a/mm/memory-failure.c
>> +++ b/mm/memory-failure.c
>> @@ -888,7 +888,15 @@ int get_hwpoison_page(struct page *page)
>>   }
>>   }
>>
>> - return get_page_unless_zero(head);
>> + if (get_page_unless_zero(head)) {
>> + if (head == compound_head(page))
>> + return 1;
>> +
>> + pr_info("MCE: %#lx cannot catch tail\n", page_to_pfn(page));
>
> Recently Chen Yucong replaced the label "MCE:" with "Memory failure:",
> but the resolution is trivial, I think.
>
> Thanks,
> Naoya Horiguchi
>
>> + put_page(head);
>> + }
>> +
>> + return 0;
>>  }
>>  EXPORT_SYMBOL_GPL(get_hwpoison_page);
>>
>>
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majord...@kvack.org.  For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: mailto:"d...@kvack.org;> em...@kvack.org 


Re: [PATCH] mm/memory-failure: fix race with compound page split/merge

2016-04-18 Thread Konstantin Khlebnikov
On Tue, Apr 19, 2016 at 2:15 AM, Naoya Horiguchi
 wrote:
> # CCed Andrew,
>
> On Mon, Apr 18, 2016 at 02:43:45PM +0300, Konstantin Khlebnikov wrote:
>> Get_hwpoison_page() must recheck relation between head and tail pages.
>>
>> Signed-off-by: Konstantin Khlebnikov 
>
> Looks good to me. Without this recheck, the race causes kernel to pin
> an irrelevant page, and finally makes kernel crash for refcount mismcach...

Yep. I seen that a lot. Unfortunately that was in 3.18 branch and
it'll took several months to verify this fix.
This code and page reference counting overall have changed
significantly since then, so probably here is more bugs.
For example, I'm not sure about races with atomic set for page
reference counting,
I've found and removed couple in mellanox driver but there're more in
mm and net.

>
> Acked-by: Naoya Horiguchi 
>
>> ---
>>  mm/memory-failure.c |   10 +-
>>  1 file changed, 9 insertions(+), 1 deletion(-)
>>
>> diff --git a/mm/memory-failure.c b/mm/memory-failure.c
>> index 78f5f2641b91..ca5acee53b7a 100644
>> --- a/mm/memory-failure.c
>> +++ b/mm/memory-failure.c
>> @@ -888,7 +888,15 @@ int get_hwpoison_page(struct page *page)
>>   }
>>   }
>>
>> - return get_page_unless_zero(head);
>> + if (get_page_unless_zero(head)) {
>> + if (head == compound_head(page))
>> + return 1;
>> +
>> + pr_info("MCE: %#lx cannot catch tail\n", page_to_pfn(page));
>
> Recently Chen Yucong replaced the label "MCE:" with "Memory failure:",
> but the resolution is trivial, I think.
>
> Thanks,
> Naoya Horiguchi
>
>> + put_page(head);
>> + }
>> +
>> + return 0;
>>  }
>>  EXPORT_SYMBOL_GPL(get_hwpoison_page);
>>
>>
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majord...@kvack.org.  For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: mailto:"d...@kvack.org;> em...@kvack.org 


Re: [PATCH] ARM: dts: exynos: Remove unsupported s2mps11 regulator bindings from Exynos5420 boards

2016-04-18 Thread Krzysztof Kozlowski
On 04/18/2016 06:52 PM, Javier Martinez Canillas wrote:
> Hello Krzysztof,
> 
> On 04/18/2016 03:44 AM, Krzysztof Kozlowski wrote:
>> The bindings like s2mps11,buck6-ramp-enable or s2mps11,buck2-ramp-delay
>> where ignored. They were never parse by s2mps11 regulator driver. Also
>> the values used in these bindings were equal to default reset values of
>> S2MPS11 device. It is safe to remove them.
>>
>> Signed-off-by: Krzysztof Kozlowski 
>> ---
> 
> The patch looks good to me.
> 
> Reviewed-by: Javier Martinez Canillas 

Thanks.

> 
> On a related note, the s5m8767 regulator driver parses similar DT properties
> ("s5m8767,pmic-buck-ramp-delay", "s5m8767,pmic-buck2-ramp-enable", etc) that
> are not in Documentation/devicetree/bindings/regulator/samsung,s5m8767.txt.
> 
> So those should either be added to the binding doc or removed from the driver
> if are not correct (I don't have documentation for the s5m8767 PMIC but the
> DT properties are not use by any DTS in mainline using the s5m8767 PMIC).

That's the grey area. :) I mean that instead of making these implemented
bindings an interface, they should rather be converted to standard
regulator bindings. However the device is quite old, not used on newer
boards, so there is no interest in improving this. In the same time
removal of this code is not strictly necessary. Its existence does not hurt.

Best regards,
Krzysztof


Re: [PATCH] ARM: dts: exynos: Remove unsupported s2mps11 regulator bindings from Exynos5420 boards

2016-04-18 Thread Krzysztof Kozlowski
On 04/18/2016 06:52 PM, Javier Martinez Canillas wrote:
> Hello Krzysztof,
> 
> On 04/18/2016 03:44 AM, Krzysztof Kozlowski wrote:
>> The bindings like s2mps11,buck6-ramp-enable or s2mps11,buck2-ramp-delay
>> where ignored. They were never parse by s2mps11 regulator driver. Also
>> the values used in these bindings were equal to default reset values of
>> S2MPS11 device. It is safe to remove them.
>>
>> Signed-off-by: Krzysztof Kozlowski 
>> ---
> 
> The patch looks good to me.
> 
> Reviewed-by: Javier Martinez Canillas 

Thanks.

> 
> On a related note, the s5m8767 regulator driver parses similar DT properties
> ("s5m8767,pmic-buck-ramp-delay", "s5m8767,pmic-buck2-ramp-enable", etc) that
> are not in Documentation/devicetree/bindings/regulator/samsung,s5m8767.txt.
> 
> So those should either be added to the binding doc or removed from the driver
> if are not correct (I don't have documentation for the s5m8767 PMIC but the
> DT properties are not use by any DTS in mainline using the s5m8767 PMIC).

That's the grey area. :) I mean that instead of making these implemented
bindings an interface, they should rather be converted to standard
regulator bindings. However the device is quite old, not used on newer
boards, so there is no interest in improving this. In the same time
removal of this code is not strictly necessary. Its existence does not hurt.

Best regards,
Krzysztof


Re: [PATCH] efi: Use GFP_ATOMIC instead of GFP_KERNEL

2016-04-18 Thread Vaishali Thakkar


On Monday 18 April 2016 02:48 AM, Matt Fleming wrote:
> On Fri, 15 Apr, at 08:38:37AM, Julia Lawall wrote:
>> I looked at it a bit with Vaishali.  I wonder if it would be possible at 
>> least to have only one flag? Then one wouldn't have to maintain the 
>> subtle relationship between atomic and duplicates.  I'm not sure that it 
>> would help Coccinelle, but at least one could see more quickly that 
>> Coccinelle is giving a false positive.
> Yeah, that would be a good idea.
>
> How about we drop the @atomic parameter and simply use @duplicates to
> figure out whether to perform duplicate detection, which we should
> note in the comment of efivar_init() cannot be performed atomically.
> Bonus points if someone can clean up the code flow too.
I think using only @duplicates would be helpful to make code
more clear. I can actually clean up the code flow but it may take
some time for me to send the patches as I  already have some other
work with me.

Do you want to go for it? Or for now we can just go for dropping @atomic
parameter. 

> Otherwise, efivar_init() is done while holding a spinlock.

-- 
Vaishali



Re: [PATCH] efi: Use GFP_ATOMIC instead of GFP_KERNEL

2016-04-18 Thread Vaishali Thakkar


On Monday 18 April 2016 02:48 AM, Matt Fleming wrote:
> On Fri, 15 Apr, at 08:38:37AM, Julia Lawall wrote:
>> I looked at it a bit with Vaishali.  I wonder if it would be possible at 
>> least to have only one flag? Then one wouldn't have to maintain the 
>> subtle relationship between atomic and duplicates.  I'm not sure that it 
>> would help Coccinelle, but at least one could see more quickly that 
>> Coccinelle is giving a false positive.
> Yeah, that would be a good idea.
>
> How about we drop the @atomic parameter and simply use @duplicates to
> figure out whether to perform duplicate detection, which we should
> note in the comment of efivar_init() cannot be performed atomically.
> Bonus points if someone can clean up the code flow too.
I think using only @duplicates would be helpful to make code
more clear. I can actually clean up the code flow but it may take
some time for me to send the patches as I  already have some other
work with me.

Do you want to go for it? Or for now we can just go for dropping @atomic
parameter. 

> Otherwise, efivar_init() is done while holding a spinlock.

-- 
Vaishali



[PATCH] Input: Change BTN_TOOL_FINGER flag when hover event trigger

2016-04-18 Thread DusonLin
Only ABS_DISTANCE is not enough for upper OS to distingiush hover event
be triggered from object from faraway to and close touchpad surface or
from object prepare to leave the touchpad surface. Add BTN_TOOL_FINGER
flag to help it.

 object_from_farawayobject_inside_hover_area
object_touch_surface
BTN_TOUCH 0  0
1
BTN_TOOL_FINGER   0  1
1
ABS_DISTANCE  0  1
0

Signed-off by: Duson Lin 
---
 drivers/hid/hid-magicmouse.c |  2 +-
 drivers/input/input-mt.c |  7 +--
 drivers/input/mouse/elan_i2c_core.c  | 15 +--
 drivers/input/mouse/elantech.c   |  2 +-
 drivers/input/mouse/focaltech.c  |  2 +-
 drivers/input/mouse/synaptics.c  |  2 +-
 drivers/input/touchscreen/atmel_mxt_ts.c |  2 +-
 drivers/input/touchscreen/edt-ft5x06.c   |  2 +-
 drivers/input/touchscreen/egalax_ts.c|  2 +-
 drivers/input/touchscreen/ili210x.c  |  2 +-
 drivers/input/touchscreen/mms114.c   |  4 ++--
 drivers/input/touchscreen/penmount.c |  2 +-
 drivers/input/touchscreen/rohm_bu21023.c |  2 +-
 drivers/input/touchscreen/wacom_w8001.c  |  2 +-
 include/linux/input/mt.h |  3 ++-
 15 files changed, 29 insertions(+), 22 deletions(-)

diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
index d6fa496..584e98b 100644
--- a/drivers/hid/hid-magicmouse.c
+++ b/drivers/hid/hid-magicmouse.c
@@ -353,7 +353,7 @@ static int magicmouse_raw_event(struct hid_device *hdev,
input_report_rel(input, REL_Y, y);
} else { /* USB_DEVICE_ID_APPLE_MAGICTRACKPAD */
input_report_key(input, BTN_MOUSE, clicks & 1);
-   input_mt_report_pointer_emulation(input, true);
+   input_mt_report_pointer_emulation(input, true, false);
}
 
input_sync(input);
diff --git a/drivers/input/input-mt.c b/drivers/input/input-mt.c
index 54fce56..30855a5 100644
--- a/drivers/input/input-mt.c
+++ b/drivers/input/input-mt.c
@@ -184,6 +184,7 @@ EXPORT_SYMBOL(input_mt_report_finger_count);
  * input_mt_report_pointer_emulation() - common pointer emulation
  * @dev: input device with allocated MT slots
  * @use_count: report number of active contacts as finger count
+ * @hover: report ABS_DISTANCE as hover event
  *
  * Performs legacy pointer emulation via BTN_TOUCH, ABS_X, ABS_Y and
  * ABS_PRESSURE. Touchpad finger count is emulated if use_count is true.
@@ -191,7 +192,8 @@ EXPORT_SYMBOL(input_mt_report_finger_count);
  * The input core ensures only the KEY and ABS axes already setup for
  * this device will produce output.
  */
-void input_mt_report_pointer_emulation(struct input_dev *dev, bool
use_count)
+void input_mt_report_pointer_emulation(struct input_dev *dev, bool
use_count,
+   bool hover)
 {
struct input_mt *mt = dev->mt;
struct input_mt_slot *oldest;
@@ -220,6 +222,7 @@ void input_mt_report_pointer_emulation(struct input_dev
*dev, bool use_count)
input_event(dev, EV_KEY, BTN_TOUCH, count > 0);
if (use_count)
input_mt_report_finger_count(dev, count);
+   input_event(dev, EV_ABS, ABS_DISTANCE, hover);
 
if (oldest) {
int x = input_mt_get_value(oldest, ABS_MT_POSITION_X);
@@ -290,7 +293,7 @@ void input_mt_sync_frame(struct input_dev *dev)
if ((mt->flags & INPUT_MT_POINTER) && !(mt->flags &
INPUT_MT_SEMI_MT))
use_count = true;
 
-   input_mt_report_pointer_emulation(dev, use_count);
+   input_mt_report_pointer_emulation(dev, use_count, false);
 
mt->frame++;
 }
diff --git a/drivers/input/mouse/elan_i2c_core.c
b/drivers/input/mouse/elan_i2c_core.c
index 2f58985..8b5e75a 100644
--- a/drivers/input/mouse/elan_i2c_core.c
+++ b/drivers/input/mouse/elan_i2c_core.c
@@ -4,7 +4,7 @@
  * Copyright (c) 2013 ELAN Microelectronics Corp.
  *
  * Author: 林政維 (Duson Lin) 
- * Version: 1.6.0
+ * Version: 1.6.2
  *
  * Based on cyapa driver:
  * copyright (c) 2011-2012 Cypress Semiconductor, Inc.
@@ -40,7 +40,7 @@
 #include "elan_i2c.h"
 
 #define DRIVER_NAME"elan_i2c"
-#define ELAN_DRIVER_VERSION"1.6.1"
+#define ELAN_DRIVER_VERSION"1.6.2"
 #define ELAN_VENDOR_ID 0x04f3
 #define ETP_MAX_PRESSURE   255
 #define ETP_FWIDTH_REDUCE  90
@@ -845,7 +845,7 @@ static void elan_report_absolute(struct elan_tp_data
*data, u8 *packet)
 {
struct input_dev *input = data->input;
u8 *finger_data = [ETP_FINGER_DATA_OFFSET];
-   int i;
+   int i, valid_count = 0;
u8 tp_info = packet[ETP_TOUCH_INFO_OFFSET];
u8 hover_info = packet[ETP_HOVER_INFO_OFFSET];
bool contact_valid, hover_event;
@@ -855,13 +855,16 @@ static void elan_report_absolute(struct elan_tp_data
*data, u8 *packet)
contact_valid = tp_info & (1U 

[PATCH] Input: Change BTN_TOOL_FINGER flag when hover event trigger

2016-04-18 Thread DusonLin
Only ABS_DISTANCE is not enough for upper OS to distingiush hover event
be triggered from object from faraway to and close touchpad surface or
from object prepare to leave the touchpad surface. Add BTN_TOOL_FINGER
flag to help it.

 object_from_farawayobject_inside_hover_area
object_touch_surface
BTN_TOUCH 0  0
1
BTN_TOOL_FINGER   0  1
1
ABS_DISTANCE  0  1
0

Signed-off by: Duson Lin 
---
 drivers/hid/hid-magicmouse.c |  2 +-
 drivers/input/input-mt.c |  7 +--
 drivers/input/mouse/elan_i2c_core.c  | 15 +--
 drivers/input/mouse/elantech.c   |  2 +-
 drivers/input/mouse/focaltech.c  |  2 +-
 drivers/input/mouse/synaptics.c  |  2 +-
 drivers/input/touchscreen/atmel_mxt_ts.c |  2 +-
 drivers/input/touchscreen/edt-ft5x06.c   |  2 +-
 drivers/input/touchscreen/egalax_ts.c|  2 +-
 drivers/input/touchscreen/ili210x.c  |  2 +-
 drivers/input/touchscreen/mms114.c   |  4 ++--
 drivers/input/touchscreen/penmount.c |  2 +-
 drivers/input/touchscreen/rohm_bu21023.c |  2 +-
 drivers/input/touchscreen/wacom_w8001.c  |  2 +-
 include/linux/input/mt.h |  3 ++-
 15 files changed, 29 insertions(+), 22 deletions(-)

diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
index d6fa496..584e98b 100644
--- a/drivers/hid/hid-magicmouse.c
+++ b/drivers/hid/hid-magicmouse.c
@@ -353,7 +353,7 @@ static int magicmouse_raw_event(struct hid_device *hdev,
input_report_rel(input, REL_Y, y);
} else { /* USB_DEVICE_ID_APPLE_MAGICTRACKPAD */
input_report_key(input, BTN_MOUSE, clicks & 1);
-   input_mt_report_pointer_emulation(input, true);
+   input_mt_report_pointer_emulation(input, true, false);
}
 
input_sync(input);
diff --git a/drivers/input/input-mt.c b/drivers/input/input-mt.c
index 54fce56..30855a5 100644
--- a/drivers/input/input-mt.c
+++ b/drivers/input/input-mt.c
@@ -184,6 +184,7 @@ EXPORT_SYMBOL(input_mt_report_finger_count);
  * input_mt_report_pointer_emulation() - common pointer emulation
  * @dev: input device with allocated MT slots
  * @use_count: report number of active contacts as finger count
+ * @hover: report ABS_DISTANCE as hover event
  *
  * Performs legacy pointer emulation via BTN_TOUCH, ABS_X, ABS_Y and
  * ABS_PRESSURE. Touchpad finger count is emulated if use_count is true.
@@ -191,7 +192,8 @@ EXPORT_SYMBOL(input_mt_report_finger_count);
  * The input core ensures only the KEY and ABS axes already setup for
  * this device will produce output.
  */
-void input_mt_report_pointer_emulation(struct input_dev *dev, bool
use_count)
+void input_mt_report_pointer_emulation(struct input_dev *dev, bool
use_count,
+   bool hover)
 {
struct input_mt *mt = dev->mt;
struct input_mt_slot *oldest;
@@ -220,6 +222,7 @@ void input_mt_report_pointer_emulation(struct input_dev
*dev, bool use_count)
input_event(dev, EV_KEY, BTN_TOUCH, count > 0);
if (use_count)
input_mt_report_finger_count(dev, count);
+   input_event(dev, EV_ABS, ABS_DISTANCE, hover);
 
if (oldest) {
int x = input_mt_get_value(oldest, ABS_MT_POSITION_X);
@@ -290,7 +293,7 @@ void input_mt_sync_frame(struct input_dev *dev)
if ((mt->flags & INPUT_MT_POINTER) && !(mt->flags &
INPUT_MT_SEMI_MT))
use_count = true;
 
-   input_mt_report_pointer_emulation(dev, use_count);
+   input_mt_report_pointer_emulation(dev, use_count, false);
 
mt->frame++;
 }
diff --git a/drivers/input/mouse/elan_i2c_core.c
b/drivers/input/mouse/elan_i2c_core.c
index 2f58985..8b5e75a 100644
--- a/drivers/input/mouse/elan_i2c_core.c
+++ b/drivers/input/mouse/elan_i2c_core.c
@@ -4,7 +4,7 @@
  * Copyright (c) 2013 ELAN Microelectronics Corp.
  *
  * Author: 林政維 (Duson Lin) 
- * Version: 1.6.0
+ * Version: 1.6.2
  *
  * Based on cyapa driver:
  * copyright (c) 2011-2012 Cypress Semiconductor, Inc.
@@ -40,7 +40,7 @@
 #include "elan_i2c.h"
 
 #define DRIVER_NAME"elan_i2c"
-#define ELAN_DRIVER_VERSION"1.6.1"
+#define ELAN_DRIVER_VERSION"1.6.2"
 #define ELAN_VENDOR_ID 0x04f3
 #define ETP_MAX_PRESSURE   255
 #define ETP_FWIDTH_REDUCE  90
@@ -845,7 +845,7 @@ static void elan_report_absolute(struct elan_tp_data
*data, u8 *packet)
 {
struct input_dev *input = data->input;
u8 *finger_data = [ETP_FINGER_DATA_OFFSET];
-   int i;
+   int i, valid_count = 0;
u8 tp_info = packet[ETP_TOUCH_INFO_OFFSET];
u8 hover_info = packet[ETP_HOVER_INFO_OFFSET];
bool contact_valid, hover_event;
@@ -855,13 +855,16 @@ static void elan_report_absolute(struct elan_tp_data
*data, u8 *packet)
contact_valid = tp_info & (1U << (3 + i));

RE: [PATCH 1/1] mmc: sdhci-pci: add Support of Synopsys DWC_MSHC IP

2016-04-18 Thread Prabu Thangamuthu
Hi Greg K-H,

> On  Tuesday, April 19, 2016 12:25 AM, Greg Kroah-Hartman Wrote:
>
> > diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index
> > 247da8c..01f743b 100644
> > --- a/include/linux/pci_ids.h
> > +++ b/include/linux/pci_ids.h
> > @@ -2318,6 +2318,9 @@
> >  #define PCI_DEVICE_ID_CENATEK_IDE  0x0001
> >
> >  #define PCI_VENDOR_ID_SYNOPSYS 0x16c3
> > +#define PCI_DEVICE_ID_MOBSTOR_HAPS51   0xc101
> > +#define PCI_DEVICE_ID_MSHC_HAPS51  0xc201
> > +#define PCI_DEVICE_ID_MSHC_HAPSDX  0xc202
> 
> Please read the top of this file for why you should not add any new entries to
> it. 

Thank you for pointing it. 
I will update the Patch accordingly.

Regards,
Prabu Thangamuthu.


RE: [PATCH 1/1] mmc: sdhci-pci: add Support of Synopsys DWC_MSHC IP

2016-04-18 Thread Prabu Thangamuthu
Hi Greg K-H,

> On  Tuesday, April 19, 2016 12:25 AM, Greg Kroah-Hartman Wrote:
>
> > diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index
> > 247da8c..01f743b 100644
> > --- a/include/linux/pci_ids.h
> > +++ b/include/linux/pci_ids.h
> > @@ -2318,6 +2318,9 @@
> >  #define PCI_DEVICE_ID_CENATEK_IDE  0x0001
> >
> >  #define PCI_VENDOR_ID_SYNOPSYS 0x16c3
> > +#define PCI_DEVICE_ID_MOBSTOR_HAPS51   0xc101
> > +#define PCI_DEVICE_ID_MSHC_HAPS51  0xc201
> > +#define PCI_DEVICE_ID_MSHC_HAPSDX  0xc202
> 
> Please read the top of this file for why you should not add any new entries to
> it. 

Thank you for pointing it. 
I will update the Patch accordingly.

Regards,
Prabu Thangamuthu.


linux-next: Tree for Apr 19

2016-04-18 Thread Stephen Rothwell
Hi all,

Changes since 20160418:

The tip tree still had its build failures and gainde a confict against
the pm tree.

The gpio tree lost its build failure.

The akpm-current tree still had its build failure for which I applied
a patch.

Non-merge commits (relative to Linus' tree): 4507
 4203 files changed, 169185 insertions(+), 93996 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
(this fails its final link) and pseries_le_defconfig and i386, sparc
and sparc64 defconfig.

Below is a summary of the state of the merge.

I am currently merging 232 trees (counting Linus' and 35 trees of patches
pending for Linus' tree).

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 (95d0c4277c27 Merge branch 'for-linus' of 
git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux)
Merging fixes/master (9735a22799b9 Linux 4.6-rc2)
Merging kbuild-current/rc-fixes (3d1450d54a4f Makefile: Force gzip and xz on 
module install)
Merging arc-current/for-curr (421e31e58c2a ARCv2: Enable LOCKDEP)
Merging arm-current/fixes (9c18fcf7ae0e ARM: 8551/2: DMA: Fix kzalloc flags in 
__dma_alloc)
Merging m68k-current/for-linus (7b8ba82ad4ad m68k/defconfig: Update defconfigs 
for v4.6-rc2)
Merging metag-fixes/fixes (0164a711c97b metag: Fix ioremap_wc/ioremap_cached 
build errors)
Merging powerpc-fixes/fixes (71528d8bd7a8 powerpc: Correct used_vsr comment)
Merging powerpc-merge-mpe/fixes (bc0195aad0da Linux 4.2-rc2)
Merging sparc/master (5ec712934ce1 sparc: Write up preadv2/pwritev2 syscalls.)
Merging net/master (ab2ed0171a50 macsec: fix crypto Kconfig dependency)
Merging ipsec/master (d6af1a31cc72 vti: Add pmtu handling to vti_xmit.)
Merging ipvs/master (bcf493428840 netfilter: ebtables: Fix extension lookup 
with identical name)
Merging wireless-drivers/master (de478a61389c ath9k: 
ar5008_hw_cmn_spur_mitigate: add missing mask_m & mask_p initialisation)
Merging mac80211/master (8f815cdde3e5 nl80211: check netlink protocol in socket 
release notification)
Merging sound-current/for-linus (ed0739b577f2 ALSA - hda: hdmi check NULL 
pointer in hdmi_set_chmap)
Merging pci-current/for-linus (67e658794ca1 cxgb4: Set VPD size so we can read 
both VPD structures)
Merging driver-core.current/driver-core-linus (c3b46c73264b Linux 4.6-rc4)
Merging tty.current/tty-linus (c3b46c73264b Linux 4.6-rc4)
Merging usb.current/usb-linus (c3b46c73264b Linux 4.6-rc4)
Merging usb-gadget-fixes/fixes (c3b46c73264b Linux 4.6-rc4)
Merging usb-serial-fixes/usb-linus (bf1620068911 Linux 4.6-rc3)
Merging usb-chipidea-fixes/ci-for-usb-stable (d144dfea8af7 usb: chipidea: otg: 
change workqueue ci_otg as freezable)
Merging staging.current/staging-linus (bf1620068911 Linux 4.6-rc3)
Merging char-misc.current/char-misc-linus (c3b46c73264b Linux 4.6-rc4)
Merging input-current/for-linus (eda5ecc0a6b8 Input: pmic8xxx-pwrkey - fix 
algorithm for converting trigger delay)
Merging crypto-current/master (f709b45ec461 crypto: ccp - Prevent information 
leakage on export)
Merging ide/master (1993b176a822 Merge 
git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide)
Merging devicetree-current/devicetree/merge (f76502aa9140 of/dynamic: Fix test 
for PPC_PSERIES)
Merging rr-fixes/fixes (8244062ef1e5 modules: fix longstanding /proc/kallsyms 
vs module insertion race.)
Merging vfio-fixes/for-linus (8160c4e45582 vfio: fix ioctl error handling)
Merging kselftest-fixes/fixes (505ce68c6da3 selftest/seccomp: Fix the 
seccomp(2) signature)
Merging backlight-fixes/for-backlight-fixes (68feaca0b13e backlight: pwm: 
Handle EPROBE_DEFER while requesting

linux-next: Tree for Apr 19

2016-04-18 Thread Stephen Rothwell
Hi all,

Changes since 20160418:

The tip tree still had its build failures and gainde a confict against
the pm tree.

The gpio tree lost its build failure.

The akpm-current tree still had its build failure for which I applied
a patch.

Non-merge commits (relative to Linus' tree): 4507
 4203 files changed, 169185 insertions(+), 93996 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
(this fails its final link) and pseries_le_defconfig and i386, sparc
and sparc64 defconfig.

Below is a summary of the state of the merge.

I am currently merging 232 trees (counting Linus' and 35 trees of patches
pending for Linus' tree).

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 (95d0c4277c27 Merge branch 'for-linus' of 
git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux)
Merging fixes/master (9735a22799b9 Linux 4.6-rc2)
Merging kbuild-current/rc-fixes (3d1450d54a4f Makefile: Force gzip and xz on 
module install)
Merging arc-current/for-curr (421e31e58c2a ARCv2: Enable LOCKDEP)
Merging arm-current/fixes (9c18fcf7ae0e ARM: 8551/2: DMA: Fix kzalloc flags in 
__dma_alloc)
Merging m68k-current/for-linus (7b8ba82ad4ad m68k/defconfig: Update defconfigs 
for v4.6-rc2)
Merging metag-fixes/fixes (0164a711c97b metag: Fix ioremap_wc/ioremap_cached 
build errors)
Merging powerpc-fixes/fixes (71528d8bd7a8 powerpc: Correct used_vsr comment)
Merging powerpc-merge-mpe/fixes (bc0195aad0da Linux 4.2-rc2)
Merging sparc/master (5ec712934ce1 sparc: Write up preadv2/pwritev2 syscalls.)
Merging net/master (ab2ed0171a50 macsec: fix crypto Kconfig dependency)
Merging ipsec/master (d6af1a31cc72 vti: Add pmtu handling to vti_xmit.)
Merging ipvs/master (bcf493428840 netfilter: ebtables: Fix extension lookup 
with identical name)
Merging wireless-drivers/master (de478a61389c ath9k: 
ar5008_hw_cmn_spur_mitigate: add missing mask_m & mask_p initialisation)
Merging mac80211/master (8f815cdde3e5 nl80211: check netlink protocol in socket 
release notification)
Merging sound-current/for-linus (ed0739b577f2 ALSA - hda: hdmi check NULL 
pointer in hdmi_set_chmap)
Merging pci-current/for-linus (67e658794ca1 cxgb4: Set VPD size so we can read 
both VPD structures)
Merging driver-core.current/driver-core-linus (c3b46c73264b Linux 4.6-rc4)
Merging tty.current/tty-linus (c3b46c73264b Linux 4.6-rc4)
Merging usb.current/usb-linus (c3b46c73264b Linux 4.6-rc4)
Merging usb-gadget-fixes/fixes (c3b46c73264b Linux 4.6-rc4)
Merging usb-serial-fixes/usb-linus (bf1620068911 Linux 4.6-rc3)
Merging usb-chipidea-fixes/ci-for-usb-stable (d144dfea8af7 usb: chipidea: otg: 
change workqueue ci_otg as freezable)
Merging staging.current/staging-linus (bf1620068911 Linux 4.6-rc3)
Merging char-misc.current/char-misc-linus (c3b46c73264b Linux 4.6-rc4)
Merging input-current/for-linus (eda5ecc0a6b8 Input: pmic8xxx-pwrkey - fix 
algorithm for converting trigger delay)
Merging crypto-current/master (f709b45ec461 crypto: ccp - Prevent information 
leakage on export)
Merging ide/master (1993b176a822 Merge 
git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide)
Merging devicetree-current/devicetree/merge (f76502aa9140 of/dynamic: Fix test 
for PPC_PSERIES)
Merging rr-fixes/fixes (8244062ef1e5 modules: fix longstanding /proc/kallsyms 
vs module insertion race.)
Merging vfio-fixes/for-linus (8160c4e45582 vfio: fix ioctl error handling)
Merging kselftest-fixes/fixes (505ce68c6da3 selftest/seccomp: Fix the 
seccomp(2) signature)
Merging backlight-fixes/for-backlight-fixes (68feaca0b13e backlight: pwm: 
Handle EPROBE_DEFER while requesting

Re: [RFC] iio: st: Add lsm9ds0 support for gyro accel and magny

2016-04-18 Thread Lucas De Marchi
On Mon, Apr 18, 2016 at 4:51 PM, Jonathan Cameron  wrote:
> On 18/04/16 11:25, Crestez Dan Leonard wrote:
>> On 04/18/2016 09:07 AM, Denis Ciocca wrote:
>> Then st_combo_* implementation functions would forward to st_magn_* or
>> st_accel_* depending on chan->type. Does this make sense?
> Perhaps. If you have a short term need for this perhaps Denis and you can
> work together to speed up what he has 'in the works' for this?
> No point in duplicating work!
>
> The gyro element can go forward separately in the meantime.

Isn't LSM9DS0 just a package of LSM303D and L3GD20 that could reuse
the drivers already present?


Lucas De Marchi


Re: [RFC] iio: st: Add lsm9ds0 support for gyro accel and magny

2016-04-18 Thread Lucas De Marchi
On Mon, Apr 18, 2016 at 4:51 PM, Jonathan Cameron  wrote:
> On 18/04/16 11:25, Crestez Dan Leonard wrote:
>> On 04/18/2016 09:07 AM, Denis Ciocca wrote:
>> Then st_combo_* implementation functions would forward to st_magn_* or
>> st_accel_* depending on chan->type. Does this make sense?
> Perhaps. If you have a short term need for this perhaps Denis and you can
> work together to speed up what he has 'in the works' for this?
> No point in duplicating work!
>
> The gyro element can go forward separately in the meantime.

Isn't LSM9DS0 just a package of LSM303D and L3GD20 that could reuse
the drivers already present?


Lucas De Marchi


[PATCH v3 06/18] wcn36xx: Add helper macros to cast sta to priv

2016-04-18 Thread Bjorn Andersson
From: Pontus Fuchs 

While poking at this I also change two related things. I rename one
variable to make the names consistent. I also move one assignment of
priv_sta to the declaration to save a few lines.

Signed-off-by: Pontus Fuchs 
Signed-off-by: Bjorn Andersson 
---
 drivers/net/wireless/ath/wcn36xx/main.c| 14 ++
 drivers/net/wireless/ath/wcn36xx/smd.c | 12 ++--
 drivers/net/wireless/ath/wcn36xx/wcn36xx.h |  6 ++
 3 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/main.c 
b/drivers/net/wireless/ath/wcn36xx/main.c
index 4781b5e8deb3..30f015d3a9e6 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -373,7 +373,7 @@ static void wcn36xx_tx(struct ieee80211_hw *hw,
struct wcn36xx_sta *sta_priv = NULL;
 
if (control->sta)
-   sta_priv = (struct wcn36xx_sta *)control->sta->drv_priv;
+   sta_priv = wcn36xx_sta_to_priv(control->sta);
 
if (wcn36xx_start_tx(wcn, sta_priv, skb))
ieee80211_free_txskb(wcn->hw, skb);
@@ -518,7 +518,7 @@ static void wcn36xx_update_allowed_rates(struct 
ieee80211_sta *sta,
 {
int i, size;
u16 *rates_table;
-   struct wcn36xx_sta *sta_priv = (struct wcn36xx_sta *)sta->drv_priv;
+   struct wcn36xx_sta *sta_priv = wcn36xx_sta_to_priv(sta);
u32 rates = sta->supp_rates[band];
 
memset(_priv->supported_rates, 0,
@@ -661,7 +661,7 @@ static void wcn36xx_bss_info_changed(struct ieee80211_hw 
*hw,
rcu_read_unlock();
goto out;
}
-   sta_priv = (struct wcn36xx_sta *)sta->drv_priv;
+   sta_priv = wcn36xx_sta_to_priv(sta);
 
wcn36xx_update_allowed_rates(sta, WCN36XX_BAND(wcn));
 
@@ -791,7 +791,7 @@ static int wcn36xx_sta_add(struct ieee80211_hw *hw, struct 
ieee80211_vif *vif,
 {
struct wcn36xx *wcn = hw->priv;
struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif);
-   struct wcn36xx_sta *sta_priv = (struct wcn36xx_sta *)sta->drv_priv;
+   struct wcn36xx_sta *sta_priv = wcn36xx_sta_to_priv(sta);
wcn36xx_dbg(WCN36XX_DBG_MAC, "mac sta add vif %p sta %pM\n",
vif, sta->addr);
 
@@ -816,7 +816,7 @@ static int wcn36xx_sta_remove(struct ieee80211_hw *hw,
 {
struct wcn36xx *wcn = hw->priv;
struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif);
-   struct wcn36xx_sta *sta_priv = (struct wcn36xx_sta *)sta->drv_priv;
+   struct wcn36xx_sta *sta_priv = wcn36xx_sta_to_priv(sta);
 
wcn36xx_dbg(WCN36XX_DBG_MAC, "mac sta remove vif %p sta %pM index %d\n",
vif, sta->addr, sta_priv->sta_index);
@@ -858,7 +858,7 @@ static int wcn36xx_ampdu_action(struct ieee80211_hw *hw,
struct ieee80211_ampdu_params *params)
 {
struct wcn36xx *wcn = hw->priv;
-   struct wcn36xx_sta *sta_priv = NULL;
+   struct wcn36xx_sta *sta_priv = wcn36xx_sta_to_priv(params->sta);
struct ieee80211_sta *sta = params->sta;
enum ieee80211_ampdu_mlme_action action = params->action;
u16 tid = params->tid;
@@ -867,8 +867,6 @@ static int wcn36xx_ampdu_action(struct ieee80211_hw *hw,
wcn36xx_dbg(WCN36XX_DBG_MAC, "mac ampdu action action %d tid %d\n",
action, tid);
 
-   sta_priv = (struct wcn36xx_sta *)sta->drv_priv;
-
switch (action) {
case IEEE80211_AMPDU_RX_START:
sta_priv->tid = tid;
diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c 
b/drivers/net/wireless/ath/wcn36xx/smd.c
index 6d4aa9250ca8..ff56138528b6 100644
--- a/drivers/net/wireless/ath/wcn36xx/smd.c
+++ b/drivers/net/wireless/ath/wcn36xx/smd.c
@@ -192,7 +192,7 @@ static void wcn36xx_smd_set_sta_params(struct wcn36xx *wcn,
struct wcn36xx_hal_config_sta_params *sta_params)
 {
struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif);
-   struct wcn36xx_sta *priv_sta = NULL;
+   struct wcn36xx_sta *sta_priv = NULL;
if (vif->type == NL80211_IFTYPE_ADHOC ||
vif->type == NL80211_IFTYPE_AP ||
vif->type == NL80211_IFTYPE_MESH_POINT) {
@@ -228,17 +228,17 @@ static void wcn36xx_smd_set_sta_params(struct wcn36xx 
*wcn,
sta_params->p2p = 0;
 
if (sta) {
-   priv_sta = (struct wcn36xx_sta *)sta->drv_priv;
+   sta_priv = wcn36xx_sta_to_priv(sta);
if (NL80211_IFTYPE_STATION == vif->type)
memcpy(_params->bssid, sta->addr, ETH_ALEN);
else
memcpy(_params->mac, sta->addr, ETH_ALEN);
sta_params->wmm_enabled = sta->wme;
sta_params->max_sp_len = sta->max_sp;
-   sta_params->aid = priv_sta->aid;
+

[PATCH v3 00/18] wcn36xx fixes

2016-04-18 Thread Bjorn Andersson
The bulk of the following patches have been sitting in Eugene's Github tree for
quite some time. They fix various issues existing in the mainline drivers, so
they should be merged there too.

Also included are two new fixes, of my own; the important one being the
reordering of deletion of the bss, as this crashes the firmware on the
Dragonbaord 410c (apq8016 with pronto & wcn3620).

Lastly is a patch that adds a bunch of new capabilities found in the downstream
driver.

Changes since v2:
- Restore BEACON_TEMPLATE_SIZE to not break UPDATE_PROBE_RSP_TEMPLATE_REQ
- Added patch to correct WCN36XX_HAL_RMV_BSSKEY_RSP decoder
- Added patch with missing capabilities from downstream

Changes since v1:
- Reorder patch 6 and 7 to not break the build temporarily
- Inline fix from Jason Mobarak in the TIM PVM padding

Bjorn Andersson (3):
  wcn36xx: Delete BSS before idling link
  wcn36xx: Correct remove bss key response encoding
  wcn36xx: Fill in capability list

Pontus Fuchs (15):
  wcn36xx: Clean up wcn36xx_smd_send_beacon
  wcn36xx: Pad TIM PVM if needed
  wcn36xx: Add helper macros to cast vif to private vif and vice versa
  wcn36xx: Use consistent name for private vif
  wcn36xx: Use define for invalid index and fix typo
  wcn36xx: Add helper macros to cast sta to priv
  wcn36xx: Fetch private sta data from sta entry instead of from vif
  wcn36xx: Remove sta pointer in private vif struct
  wcn36xx: Parse trigger_ba response properly
  wcn36xx: Copy all members in config_sta v1 conversion
  wcn36xx: Use allocated self sta index instead of hard coded
  wcn36xx: Clear encrypt_type when deleting bss key
  wcn36xx: Track association state
  wcn36xx: Implement multicast filtering
  wcn36xx: Use correct command struct for EXIT_BMPS_REQ

 drivers/net/wireless/ath/wcn36xx/debug.c   |  12 +-
 drivers/net/wireless/ath/wcn36xx/hal.h |  55 ++-
 drivers/net/wireless/ath/wcn36xx/main.c| 133 +
 drivers/net/wireless/ath/wcn36xx/pmc.c |   4 +-
 drivers/net/wireless/ath/wcn36xx/smd.c | 224 +++--
 drivers/net/wireless/ath/wcn36xx/smd.h |  12 +-
 drivers/net/wireless/ath/wcn36xx/txrx.c|   8 +-
 drivers/net/wireless/ath/wcn36xx/wcn36xx.h |  20 ++-
 8 files changed, 336 insertions(+), 132 deletions(-)

-- 
2.5.0



[PATCH v3 00/18] wcn36xx fixes

2016-04-18 Thread Bjorn Andersson
The bulk of the following patches have been sitting in Eugene's Github tree for
quite some time. They fix various issues existing in the mainline drivers, so
they should be merged there too.

Also included are two new fixes, of my own; the important one being the
reordering of deletion of the bss, as this crashes the firmware on the
Dragonbaord 410c (apq8016 with pronto & wcn3620).

Lastly is a patch that adds a bunch of new capabilities found in the downstream
driver.

Changes since v2:
- Restore BEACON_TEMPLATE_SIZE to not break UPDATE_PROBE_RSP_TEMPLATE_REQ
- Added patch to correct WCN36XX_HAL_RMV_BSSKEY_RSP decoder
- Added patch with missing capabilities from downstream

Changes since v1:
- Reorder patch 6 and 7 to not break the build temporarily
- Inline fix from Jason Mobarak in the TIM PVM padding

Bjorn Andersson (3):
  wcn36xx: Delete BSS before idling link
  wcn36xx: Correct remove bss key response encoding
  wcn36xx: Fill in capability list

Pontus Fuchs (15):
  wcn36xx: Clean up wcn36xx_smd_send_beacon
  wcn36xx: Pad TIM PVM if needed
  wcn36xx: Add helper macros to cast vif to private vif and vice versa
  wcn36xx: Use consistent name for private vif
  wcn36xx: Use define for invalid index and fix typo
  wcn36xx: Add helper macros to cast sta to priv
  wcn36xx: Fetch private sta data from sta entry instead of from vif
  wcn36xx: Remove sta pointer in private vif struct
  wcn36xx: Parse trigger_ba response properly
  wcn36xx: Copy all members in config_sta v1 conversion
  wcn36xx: Use allocated self sta index instead of hard coded
  wcn36xx: Clear encrypt_type when deleting bss key
  wcn36xx: Track association state
  wcn36xx: Implement multicast filtering
  wcn36xx: Use correct command struct for EXIT_BMPS_REQ

 drivers/net/wireless/ath/wcn36xx/debug.c   |  12 +-
 drivers/net/wireless/ath/wcn36xx/hal.h |  55 ++-
 drivers/net/wireless/ath/wcn36xx/main.c| 133 +
 drivers/net/wireless/ath/wcn36xx/pmc.c |   4 +-
 drivers/net/wireless/ath/wcn36xx/smd.c | 224 +++--
 drivers/net/wireless/ath/wcn36xx/smd.h |  12 +-
 drivers/net/wireless/ath/wcn36xx/txrx.c|   8 +-
 drivers/net/wireless/ath/wcn36xx/wcn36xx.h |  20 ++-
 8 files changed, 336 insertions(+), 132 deletions(-)

-- 
2.5.0



[PATCH v3 06/18] wcn36xx: Add helper macros to cast sta to priv

2016-04-18 Thread Bjorn Andersson
From: Pontus Fuchs 

While poking at this I also change two related things. I rename one
variable to make the names consistent. I also move one assignment of
priv_sta to the declaration to save a few lines.

Signed-off-by: Pontus Fuchs 
Signed-off-by: Bjorn Andersson 
---
 drivers/net/wireless/ath/wcn36xx/main.c| 14 ++
 drivers/net/wireless/ath/wcn36xx/smd.c | 12 ++--
 drivers/net/wireless/ath/wcn36xx/wcn36xx.h |  6 ++
 3 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/main.c 
b/drivers/net/wireless/ath/wcn36xx/main.c
index 4781b5e8deb3..30f015d3a9e6 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -373,7 +373,7 @@ static void wcn36xx_tx(struct ieee80211_hw *hw,
struct wcn36xx_sta *sta_priv = NULL;
 
if (control->sta)
-   sta_priv = (struct wcn36xx_sta *)control->sta->drv_priv;
+   sta_priv = wcn36xx_sta_to_priv(control->sta);
 
if (wcn36xx_start_tx(wcn, sta_priv, skb))
ieee80211_free_txskb(wcn->hw, skb);
@@ -518,7 +518,7 @@ static void wcn36xx_update_allowed_rates(struct 
ieee80211_sta *sta,
 {
int i, size;
u16 *rates_table;
-   struct wcn36xx_sta *sta_priv = (struct wcn36xx_sta *)sta->drv_priv;
+   struct wcn36xx_sta *sta_priv = wcn36xx_sta_to_priv(sta);
u32 rates = sta->supp_rates[band];
 
memset(_priv->supported_rates, 0,
@@ -661,7 +661,7 @@ static void wcn36xx_bss_info_changed(struct ieee80211_hw 
*hw,
rcu_read_unlock();
goto out;
}
-   sta_priv = (struct wcn36xx_sta *)sta->drv_priv;
+   sta_priv = wcn36xx_sta_to_priv(sta);
 
wcn36xx_update_allowed_rates(sta, WCN36XX_BAND(wcn));
 
@@ -791,7 +791,7 @@ static int wcn36xx_sta_add(struct ieee80211_hw *hw, struct 
ieee80211_vif *vif,
 {
struct wcn36xx *wcn = hw->priv;
struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif);
-   struct wcn36xx_sta *sta_priv = (struct wcn36xx_sta *)sta->drv_priv;
+   struct wcn36xx_sta *sta_priv = wcn36xx_sta_to_priv(sta);
wcn36xx_dbg(WCN36XX_DBG_MAC, "mac sta add vif %p sta %pM\n",
vif, sta->addr);
 
@@ -816,7 +816,7 @@ static int wcn36xx_sta_remove(struct ieee80211_hw *hw,
 {
struct wcn36xx *wcn = hw->priv;
struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif);
-   struct wcn36xx_sta *sta_priv = (struct wcn36xx_sta *)sta->drv_priv;
+   struct wcn36xx_sta *sta_priv = wcn36xx_sta_to_priv(sta);
 
wcn36xx_dbg(WCN36XX_DBG_MAC, "mac sta remove vif %p sta %pM index %d\n",
vif, sta->addr, sta_priv->sta_index);
@@ -858,7 +858,7 @@ static int wcn36xx_ampdu_action(struct ieee80211_hw *hw,
struct ieee80211_ampdu_params *params)
 {
struct wcn36xx *wcn = hw->priv;
-   struct wcn36xx_sta *sta_priv = NULL;
+   struct wcn36xx_sta *sta_priv = wcn36xx_sta_to_priv(params->sta);
struct ieee80211_sta *sta = params->sta;
enum ieee80211_ampdu_mlme_action action = params->action;
u16 tid = params->tid;
@@ -867,8 +867,6 @@ static int wcn36xx_ampdu_action(struct ieee80211_hw *hw,
wcn36xx_dbg(WCN36XX_DBG_MAC, "mac ampdu action action %d tid %d\n",
action, tid);
 
-   sta_priv = (struct wcn36xx_sta *)sta->drv_priv;
-
switch (action) {
case IEEE80211_AMPDU_RX_START:
sta_priv->tid = tid;
diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c 
b/drivers/net/wireless/ath/wcn36xx/smd.c
index 6d4aa9250ca8..ff56138528b6 100644
--- a/drivers/net/wireless/ath/wcn36xx/smd.c
+++ b/drivers/net/wireless/ath/wcn36xx/smd.c
@@ -192,7 +192,7 @@ static void wcn36xx_smd_set_sta_params(struct wcn36xx *wcn,
struct wcn36xx_hal_config_sta_params *sta_params)
 {
struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif);
-   struct wcn36xx_sta *priv_sta = NULL;
+   struct wcn36xx_sta *sta_priv = NULL;
if (vif->type == NL80211_IFTYPE_ADHOC ||
vif->type == NL80211_IFTYPE_AP ||
vif->type == NL80211_IFTYPE_MESH_POINT) {
@@ -228,17 +228,17 @@ static void wcn36xx_smd_set_sta_params(struct wcn36xx 
*wcn,
sta_params->p2p = 0;
 
if (sta) {
-   priv_sta = (struct wcn36xx_sta *)sta->drv_priv;
+   sta_priv = wcn36xx_sta_to_priv(sta);
if (NL80211_IFTYPE_STATION == vif->type)
memcpy(_params->bssid, sta->addr, ETH_ALEN);
else
memcpy(_params->mac, sta->addr, ETH_ALEN);
sta_params->wmm_enabled = sta->wme;
sta_params->max_sp_len = sta->max_sp;
-   sta_params->aid = priv_sta->aid;
+   sta_params->aid = sta_priv->aid;

Re: [PATCH] net: w5100: don't build spi driver without w5100

2016-04-18 Thread David Miller
From: Arnd Bergmann 
Date: Mon, 18 Apr 2016 23:58:30 +0200

> The w5100-spi driver front-end only makes sense when the w5100
> core driver is enabled, not for a configuration that only has w5300:
 ...
> This adds an appropriate Kconfig dependency.
> 
> Signed-off-by: Arnd Bergmann 
> Fixes: 630cf09751fe ("net: w5100: support SPI interface mode")

Applied, thanks a lot.


Re: [PATCH] net: w5100: don't build spi driver without w5100

2016-04-18 Thread David Miller
From: Arnd Bergmann 
Date: Mon, 18 Apr 2016 23:58:30 +0200

> The w5100-spi driver front-end only makes sense when the w5100
> core driver is enabled, not for a configuration that only has w5300:
 ...
> This adds an appropriate Kconfig dependency.
> 
> Signed-off-by: Arnd Bergmann 
> Fixes: 630cf09751fe ("net: w5100: support SPI interface mode")

Applied, thanks a lot.


[PATCH v3 02/18] wcn36xx: Pad TIM PVM if needed

2016-04-18 Thread Bjorn Andersson
From: Pontus Fuchs 

The wcn36xx FW expects a fixed size TIM PVM in the beacon template. If
supplied with a shorter than expected PVM it will overwrite the IE
following the TIM.

Squashed with fix from Jason Mobarak :
Patch "wcn36xx: Pad TIM PVM if needed" has caused a regression in mesh
beaconing.  The field tim_off is always 0 for mesh mode, and thus
pvm_len (referring to the TIM length field) and pad are both incorrectly
calculated.  Thus, msg_body.beacon_length is incorrectly calculated for
mesh mode. Fix this.

Signed-off-by: Pontus Fuchs 
Signed-off-by: Jason Mobarak 
[bjorn: squashed in Jason's fixup]
Signed-off-by: Bjorn Andersson 
---

Changes since v1:
- Merged in Jason's patch for skipping the padding in mesh mode.

 drivers/net/wireless/ath/wcn36xx/hal.h |  3 +++
 drivers/net/wireless/ath/wcn36xx/smd.c | 27 +--
 2 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/hal.h 
b/drivers/net/wireless/ath/wcn36xx/hal.h
index d713204f755d..3af16cba3d12 100644
--- a/drivers/net/wireless/ath/wcn36xx/hal.h
+++ b/drivers/net/wireless/ath/wcn36xx/hal.h
@@ -54,6 +54,9 @@
 /* Default Beacon template size */
 #define BEACON_TEMPLATE_SIZE 0x180
 
+/* Minimum PVM size that the FW expects. See comment in smd.c for details. */
+#define TIM_MIN_PVM_SIZE 6
+
 /* Param Change Bitmap sent to HAL */
 #define PARAM_BCN_INTERVAL_CHANGED  (1 << 0)
 #define PARAM_SHORT_PREAMBLE_CHANGED (1 << 1)
diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c 
b/drivers/net/wireless/ath/wcn36xx/smd.c
index ff3ed2461a69..089a7e445cd6 100644
--- a/drivers/net/wireless/ath/wcn36xx/smd.c
+++ b/drivers/net/wireless/ath/wcn36xx/smd.c
@@ -1375,12 +1375,19 @@ int wcn36xx_smd_send_beacon(struct wcn36xx *wcn, struct 
ieee80211_vif *vif,
u16 p2p_off)
 {
struct wcn36xx_hal_send_beacon_req_msg msg_body;
-   int ret = 0;
+   int ret = 0, pad, pvm_len;
 
mutex_lock(>hal_mutex);
INIT_HAL_MSG(msg_body, WCN36XX_HAL_SEND_BEACON_REQ);
 
-   msg_body.beacon_length = skb_beacon->len;
+   pvm_len = skb_beacon->data[tim_off + 1] - 3;
+   pad = TIM_MIN_PVM_SIZE - pvm_len;
+
+   /* Padding is irrelevant to mesh mode since tim_off is always 0. */
+   if (vif->type == NL80211_IFTYPE_MESH_POINT)
+   pad = 0;
+
+   msg_body.beacon_length = skb_beacon->len + pad;
/* TODO need to find out why + 6 is needed */
msg_body.beacon_length6 = msg_body.beacon_length + 6;
 
@@ -1393,6 +1400,22 @@ int wcn36xx_smd_send_beacon(struct wcn36xx *wcn, struct 
ieee80211_vif *vif,
memcpy(msg_body.beacon, skb_beacon->data, skb_beacon->len);
memcpy(msg_body.bssid, vif->addr, ETH_ALEN);
 
+   if (pad > 0) {
+   /*
+* The wcn36xx FW has a fixed size for the PVM in the TIM. If
+* given the beacon template from mac80211 with a PVM shorter
+* than the FW expectes it will overwrite the data after the
+* TIM.
+*/
+   wcn36xx_dbg(WCN36XX_DBG_HAL, "Pad TIM PVM. %d bytes at %d\n",
+   pad, pvm_len);
+   memmove(_body.beacon[tim_off + 5 + pvm_len + pad],
+   _body.beacon[tim_off + 5 + pvm_len],
+   skb_beacon->len - (tim_off + 5 + pvm_len));
+   memset(_body.beacon[tim_off + 5 + pvm_len], 0, pad);
+   msg_body.beacon[tim_off + 1] += pad;
+   }
+
/* TODO need to find out why this is needed? */
if (vif->type == NL80211_IFTYPE_MESH_POINT)
/* mesh beacon don't need this, so push further down */
-- 
2.5.0



[PATCH v3 05/18] wcn36xx: Use define for invalid index and fix typo

2016-04-18 Thread Bjorn Andersson
From: Pontus Fuchs 

Signed-off-by: Pontus Fuchs 
Signed-off-by: Bjorn Andersson 
---
 drivers/net/wireless/ath/wcn36xx/hal.h  | 2 +-
 drivers/net/wireless/ath/wcn36xx/main.c | 4 ++--
 drivers/net/wireless/ath/wcn36xx/smd.c  | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/hal.h 
b/drivers/net/wireless/ath/wcn36xx/hal.h
index 3af16cba3d12..433d9801a0ae 100644
--- a/drivers/net/wireless/ath/wcn36xx/hal.h
+++ b/drivers/net/wireless/ath/wcn36xx/hal.h
@@ -48,7 +48,7 @@
 
 #define WCN36XX_HAL_IPV4_ADDR_LEN   4
 
-#define WALN_HAL_STA_INVALID_IDX 0xFF
+#define WCN36XX_HAL_STA_INVALID_IDX 0xFF
 #define WCN36XX_HAL_BSS_INVALID_IDX 0xFF
 
 /* Default Beacon template size */
diff --git a/drivers/net/wireless/ath/wcn36xx/main.c 
b/drivers/net/wireless/ath/wcn36xx/main.c
index 62cb9ffd854c..4781b5e8deb3 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -618,7 +618,7 @@ static void wcn36xx_bss_info_changed(struct ieee80211_hw 
*hw,
 
if (!is_zero_ether_addr(bss_conf->bssid)) {
vif_priv->is_joining = true;
-   vif_priv->bss_index = 0xff;
+   vif_priv->bss_index = WCN36XX_HAL_BSS_INVALID_IDX;
wcn36xx_smd_join(wcn, bss_conf->bssid,
 vif->addr, WCN36XX_HW_CHANNEL(wcn));
wcn36xx_smd_config_bss(wcn, vif, NULL,
@@ -711,7 +711,7 @@ static void wcn36xx_bss_info_changed(struct ieee80211_hw 
*hw,
 
if (bss_conf->enable_beacon) {
vif_priv->dtim_period = bss_conf->dtim_period;
-   vif_priv->bss_index = 0xff;
+   vif_priv->bss_index = WCN36XX_HAL_BSS_INVALID_IDX;
wcn36xx_smd_config_bss(wcn, vif, NULL,
   vif->addr, false);
skb = ieee80211_beacon_get_tim(hw, vif, _off,
diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c 
b/drivers/net/wireless/ath/wcn36xx/smd.c
index 170440ed5d85..6d4aa9250ca8 100644
--- a/drivers/net/wireless/ath/wcn36xx/smd.c
+++ b/drivers/net/wireless/ath/wcn36xx/smd.c
@@ -197,7 +197,7 @@ static void wcn36xx_smd_set_sta_params(struct wcn36xx *wcn,
vif->type == NL80211_IFTYPE_AP ||
vif->type == NL80211_IFTYPE_MESH_POINT) {
sta_params->type = 1;
-   sta_params->sta_index = 0xFF;
+   sta_params->sta_index = WCN36XX_HAL_STA_INVALID_IDX;
} else {
sta_params->type = 0;
sta_params->sta_index = 1;
-- 
2.5.0



[PATCH v3 04/18] wcn36xx: Use consistent name for private vif

2016-04-18 Thread Bjorn Andersson
From: Pontus Fuchs 

Some code used priv_vif and some used vif_priv. Convert all to vif_priv
for consistency.

Signed-off-by: Pontus Fuchs 
Signed-off-by: Bjorn Andersson 
---
 drivers/net/wireless/ath/wcn36xx/smd.c | 28 ++--
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c 
b/drivers/net/wireless/ath/wcn36xx/smd.c
index cc1b3b7a4ff9..170440ed5d85 100644
--- a/drivers/net/wireless/ath/wcn36xx/smd.c
+++ b/drivers/net/wireless/ath/wcn36xx/smd.c
@@ -191,7 +191,7 @@ static void wcn36xx_smd_set_sta_params(struct wcn36xx *wcn,
struct ieee80211_sta *sta,
struct wcn36xx_hal_config_sta_params *sta_params)
 {
-   struct wcn36xx_vif *priv_vif = wcn36xx_vif_to_priv(vif);
+   struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif);
struct wcn36xx_sta *priv_sta = NULL;
if (vif->type == NL80211_IFTYPE_ADHOC ||
vif->type == NL80211_IFTYPE_AP ||
@@ -215,7 +215,7 @@ static void wcn36xx_smd_set_sta_params(struct wcn36xx *wcn,
else
memcpy(_params->bssid, vif->addr, ETH_ALEN);
 
-   sta_params->encrypt_type = priv_vif->encrypt_type;
+   sta_params->encrypt_type = vif_priv->encrypt_type;
sta_params->short_preamble_supported = true;
 
sta_params->rifs_mode = 0;
@@ -224,7 +224,7 @@ static void wcn36xx_smd_set_sta_params(struct wcn36xx *wcn,
sta_params->uapsd = 0;
sta_params->mimo_ps = WCN36XX_HAL_HT_MIMO_PS_STATIC;
sta_params->max_ampdu_duration = 0;
-   sta_params->bssid_index = priv_vif->bss_index;
+   sta_params->bssid_index = vif_priv->bss_index;
sta_params->p2p = 0;
 
if (sta) {
@@ -726,7 +726,7 @@ static int wcn36xx_smd_add_sta_self_rsp(struct wcn36xx *wcn,
size_t len)
 {
struct wcn36xx_hal_add_sta_self_rsp_msg *rsp;
-   struct wcn36xx_vif *priv_vif = wcn36xx_vif_to_priv(vif);
+   struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif);
 
if (len < sizeof(*rsp))
return -EINVAL;
@@ -743,8 +743,8 @@ static int wcn36xx_smd_add_sta_self_rsp(struct wcn36xx *wcn,
"hal add sta self status %d self_sta_index %d dpu_index 
%d\n",
rsp->status, rsp->self_sta_index, rsp->dpu_index);
 
-   priv_vif->self_sta_index = rsp->self_sta_index;
-   priv_vif->self_dpu_desc_index = rsp->dpu_index;
+   vif_priv->self_sta_index = rsp->self_sta_index;
+   vif_priv->self_dpu_desc_index = rsp->dpu_index;
 
return 0;
 }
@@ -1175,7 +1175,7 @@ static int wcn36xx_smd_config_bss_rsp(struct wcn36xx *wcn,
 {
struct wcn36xx_hal_config_bss_rsp_msg *rsp;
struct wcn36xx_hal_config_bss_rsp_params *params;
-   struct wcn36xx_vif *priv_vif = wcn36xx_vif_to_priv(vif);
+   struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif);
 
if (len < sizeof(*rsp))
return -EINVAL;
@@ -1198,14 +1198,14 @@ static int wcn36xx_smd_config_bss_rsp(struct wcn36xx 
*wcn,
params->bss_bcast_sta_idx, params->mac,
params->tx_mgmt_power, params->ucast_dpu_signature);
 
-   priv_vif->bss_index = params->bss_index;
+   vif_priv->bss_index = params->bss_index;
 
-   if (priv_vif->sta) {
-   priv_vif->sta->bss_sta_index =  params->bss_sta_index;
-   priv_vif->sta->bss_dpu_desc_index = params->dpu_desc_index;
+   if (vif_priv->sta) {
+   vif_priv->sta->bss_sta_index =  params->bss_sta_index;
+   vif_priv->sta->bss_dpu_desc_index = params->dpu_desc_index;
}
 
-   priv_vif->self_ucast_dpu_sign = params->ucast_dpu_signature;
+   vif_priv->self_ucast_dpu_sign = params->ucast_dpu_signature;
 
return 0;
 }
@@ -1343,13 +1343,13 @@ out:
 int wcn36xx_smd_delete_bss(struct wcn36xx *wcn, struct ieee80211_vif *vif)
 {
struct wcn36xx_hal_delete_bss_req_msg msg_body;
-   struct wcn36xx_vif *priv_vif = wcn36xx_vif_to_priv(vif);
+   struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif);
int ret = 0;
 
mutex_lock(>hal_mutex);
INIT_HAL_MSG(msg_body, WCN36XX_HAL_DELETE_BSS_REQ);
 
-   msg_body.bss_index = priv_vif->bss_index;
+   msg_body.bss_index = vif_priv->bss_index;
 
PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
 
-- 
2.5.0



[PATCH v3 02/18] wcn36xx: Pad TIM PVM if needed

2016-04-18 Thread Bjorn Andersson
From: Pontus Fuchs 

The wcn36xx FW expects a fixed size TIM PVM in the beacon template. If
supplied with a shorter than expected PVM it will overwrite the IE
following the TIM.

Squashed with fix from Jason Mobarak :
Patch "wcn36xx: Pad TIM PVM if needed" has caused a regression in mesh
beaconing.  The field tim_off is always 0 for mesh mode, and thus
pvm_len (referring to the TIM length field) and pad are both incorrectly
calculated.  Thus, msg_body.beacon_length is incorrectly calculated for
mesh mode. Fix this.

Signed-off-by: Pontus Fuchs 
Signed-off-by: Jason Mobarak 
[bjorn: squashed in Jason's fixup]
Signed-off-by: Bjorn Andersson 
---

Changes since v1:
- Merged in Jason's patch for skipping the padding in mesh mode.

 drivers/net/wireless/ath/wcn36xx/hal.h |  3 +++
 drivers/net/wireless/ath/wcn36xx/smd.c | 27 +--
 2 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/hal.h 
b/drivers/net/wireless/ath/wcn36xx/hal.h
index d713204f755d..3af16cba3d12 100644
--- a/drivers/net/wireless/ath/wcn36xx/hal.h
+++ b/drivers/net/wireless/ath/wcn36xx/hal.h
@@ -54,6 +54,9 @@
 /* Default Beacon template size */
 #define BEACON_TEMPLATE_SIZE 0x180
 
+/* Minimum PVM size that the FW expects. See comment in smd.c for details. */
+#define TIM_MIN_PVM_SIZE 6
+
 /* Param Change Bitmap sent to HAL */
 #define PARAM_BCN_INTERVAL_CHANGED  (1 << 0)
 #define PARAM_SHORT_PREAMBLE_CHANGED (1 << 1)
diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c 
b/drivers/net/wireless/ath/wcn36xx/smd.c
index ff3ed2461a69..089a7e445cd6 100644
--- a/drivers/net/wireless/ath/wcn36xx/smd.c
+++ b/drivers/net/wireless/ath/wcn36xx/smd.c
@@ -1375,12 +1375,19 @@ int wcn36xx_smd_send_beacon(struct wcn36xx *wcn, struct 
ieee80211_vif *vif,
u16 p2p_off)
 {
struct wcn36xx_hal_send_beacon_req_msg msg_body;
-   int ret = 0;
+   int ret = 0, pad, pvm_len;
 
mutex_lock(>hal_mutex);
INIT_HAL_MSG(msg_body, WCN36XX_HAL_SEND_BEACON_REQ);
 
-   msg_body.beacon_length = skb_beacon->len;
+   pvm_len = skb_beacon->data[tim_off + 1] - 3;
+   pad = TIM_MIN_PVM_SIZE - pvm_len;
+
+   /* Padding is irrelevant to mesh mode since tim_off is always 0. */
+   if (vif->type == NL80211_IFTYPE_MESH_POINT)
+   pad = 0;
+
+   msg_body.beacon_length = skb_beacon->len + pad;
/* TODO need to find out why + 6 is needed */
msg_body.beacon_length6 = msg_body.beacon_length + 6;
 
@@ -1393,6 +1400,22 @@ int wcn36xx_smd_send_beacon(struct wcn36xx *wcn, struct 
ieee80211_vif *vif,
memcpy(msg_body.beacon, skb_beacon->data, skb_beacon->len);
memcpy(msg_body.bssid, vif->addr, ETH_ALEN);
 
+   if (pad > 0) {
+   /*
+* The wcn36xx FW has a fixed size for the PVM in the TIM. If
+* given the beacon template from mac80211 with a PVM shorter
+* than the FW expectes it will overwrite the data after the
+* TIM.
+*/
+   wcn36xx_dbg(WCN36XX_DBG_HAL, "Pad TIM PVM. %d bytes at %d\n",
+   pad, pvm_len);
+   memmove(_body.beacon[tim_off + 5 + pvm_len + pad],
+   _body.beacon[tim_off + 5 + pvm_len],
+   skb_beacon->len - (tim_off + 5 + pvm_len));
+   memset(_body.beacon[tim_off + 5 + pvm_len], 0, pad);
+   msg_body.beacon[tim_off + 1] += pad;
+   }
+
/* TODO need to find out why this is needed? */
if (vif->type == NL80211_IFTYPE_MESH_POINT)
/* mesh beacon don't need this, so push further down */
-- 
2.5.0



[PATCH v3 05/18] wcn36xx: Use define for invalid index and fix typo

2016-04-18 Thread Bjorn Andersson
From: Pontus Fuchs 

Signed-off-by: Pontus Fuchs 
Signed-off-by: Bjorn Andersson 
---
 drivers/net/wireless/ath/wcn36xx/hal.h  | 2 +-
 drivers/net/wireless/ath/wcn36xx/main.c | 4 ++--
 drivers/net/wireless/ath/wcn36xx/smd.c  | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/hal.h 
b/drivers/net/wireless/ath/wcn36xx/hal.h
index 3af16cba3d12..433d9801a0ae 100644
--- a/drivers/net/wireless/ath/wcn36xx/hal.h
+++ b/drivers/net/wireless/ath/wcn36xx/hal.h
@@ -48,7 +48,7 @@
 
 #define WCN36XX_HAL_IPV4_ADDR_LEN   4
 
-#define WALN_HAL_STA_INVALID_IDX 0xFF
+#define WCN36XX_HAL_STA_INVALID_IDX 0xFF
 #define WCN36XX_HAL_BSS_INVALID_IDX 0xFF
 
 /* Default Beacon template size */
diff --git a/drivers/net/wireless/ath/wcn36xx/main.c 
b/drivers/net/wireless/ath/wcn36xx/main.c
index 62cb9ffd854c..4781b5e8deb3 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -618,7 +618,7 @@ static void wcn36xx_bss_info_changed(struct ieee80211_hw 
*hw,
 
if (!is_zero_ether_addr(bss_conf->bssid)) {
vif_priv->is_joining = true;
-   vif_priv->bss_index = 0xff;
+   vif_priv->bss_index = WCN36XX_HAL_BSS_INVALID_IDX;
wcn36xx_smd_join(wcn, bss_conf->bssid,
 vif->addr, WCN36XX_HW_CHANNEL(wcn));
wcn36xx_smd_config_bss(wcn, vif, NULL,
@@ -711,7 +711,7 @@ static void wcn36xx_bss_info_changed(struct ieee80211_hw 
*hw,
 
if (bss_conf->enable_beacon) {
vif_priv->dtim_period = bss_conf->dtim_period;
-   vif_priv->bss_index = 0xff;
+   vif_priv->bss_index = WCN36XX_HAL_BSS_INVALID_IDX;
wcn36xx_smd_config_bss(wcn, vif, NULL,
   vif->addr, false);
skb = ieee80211_beacon_get_tim(hw, vif, _off,
diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c 
b/drivers/net/wireless/ath/wcn36xx/smd.c
index 170440ed5d85..6d4aa9250ca8 100644
--- a/drivers/net/wireless/ath/wcn36xx/smd.c
+++ b/drivers/net/wireless/ath/wcn36xx/smd.c
@@ -197,7 +197,7 @@ static void wcn36xx_smd_set_sta_params(struct wcn36xx *wcn,
vif->type == NL80211_IFTYPE_AP ||
vif->type == NL80211_IFTYPE_MESH_POINT) {
sta_params->type = 1;
-   sta_params->sta_index = 0xFF;
+   sta_params->sta_index = WCN36XX_HAL_STA_INVALID_IDX;
} else {
sta_params->type = 0;
sta_params->sta_index = 1;
-- 
2.5.0



[PATCH v3 04/18] wcn36xx: Use consistent name for private vif

2016-04-18 Thread Bjorn Andersson
From: Pontus Fuchs 

Some code used priv_vif and some used vif_priv. Convert all to vif_priv
for consistency.

Signed-off-by: Pontus Fuchs 
Signed-off-by: Bjorn Andersson 
---
 drivers/net/wireless/ath/wcn36xx/smd.c | 28 ++--
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c 
b/drivers/net/wireless/ath/wcn36xx/smd.c
index cc1b3b7a4ff9..170440ed5d85 100644
--- a/drivers/net/wireless/ath/wcn36xx/smd.c
+++ b/drivers/net/wireless/ath/wcn36xx/smd.c
@@ -191,7 +191,7 @@ static void wcn36xx_smd_set_sta_params(struct wcn36xx *wcn,
struct ieee80211_sta *sta,
struct wcn36xx_hal_config_sta_params *sta_params)
 {
-   struct wcn36xx_vif *priv_vif = wcn36xx_vif_to_priv(vif);
+   struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif);
struct wcn36xx_sta *priv_sta = NULL;
if (vif->type == NL80211_IFTYPE_ADHOC ||
vif->type == NL80211_IFTYPE_AP ||
@@ -215,7 +215,7 @@ static void wcn36xx_smd_set_sta_params(struct wcn36xx *wcn,
else
memcpy(_params->bssid, vif->addr, ETH_ALEN);
 
-   sta_params->encrypt_type = priv_vif->encrypt_type;
+   sta_params->encrypt_type = vif_priv->encrypt_type;
sta_params->short_preamble_supported = true;
 
sta_params->rifs_mode = 0;
@@ -224,7 +224,7 @@ static void wcn36xx_smd_set_sta_params(struct wcn36xx *wcn,
sta_params->uapsd = 0;
sta_params->mimo_ps = WCN36XX_HAL_HT_MIMO_PS_STATIC;
sta_params->max_ampdu_duration = 0;
-   sta_params->bssid_index = priv_vif->bss_index;
+   sta_params->bssid_index = vif_priv->bss_index;
sta_params->p2p = 0;
 
if (sta) {
@@ -726,7 +726,7 @@ static int wcn36xx_smd_add_sta_self_rsp(struct wcn36xx *wcn,
size_t len)
 {
struct wcn36xx_hal_add_sta_self_rsp_msg *rsp;
-   struct wcn36xx_vif *priv_vif = wcn36xx_vif_to_priv(vif);
+   struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif);
 
if (len < sizeof(*rsp))
return -EINVAL;
@@ -743,8 +743,8 @@ static int wcn36xx_smd_add_sta_self_rsp(struct wcn36xx *wcn,
"hal add sta self status %d self_sta_index %d dpu_index 
%d\n",
rsp->status, rsp->self_sta_index, rsp->dpu_index);
 
-   priv_vif->self_sta_index = rsp->self_sta_index;
-   priv_vif->self_dpu_desc_index = rsp->dpu_index;
+   vif_priv->self_sta_index = rsp->self_sta_index;
+   vif_priv->self_dpu_desc_index = rsp->dpu_index;
 
return 0;
 }
@@ -1175,7 +1175,7 @@ static int wcn36xx_smd_config_bss_rsp(struct wcn36xx *wcn,
 {
struct wcn36xx_hal_config_bss_rsp_msg *rsp;
struct wcn36xx_hal_config_bss_rsp_params *params;
-   struct wcn36xx_vif *priv_vif = wcn36xx_vif_to_priv(vif);
+   struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif);
 
if (len < sizeof(*rsp))
return -EINVAL;
@@ -1198,14 +1198,14 @@ static int wcn36xx_smd_config_bss_rsp(struct wcn36xx 
*wcn,
params->bss_bcast_sta_idx, params->mac,
params->tx_mgmt_power, params->ucast_dpu_signature);
 
-   priv_vif->bss_index = params->bss_index;
+   vif_priv->bss_index = params->bss_index;
 
-   if (priv_vif->sta) {
-   priv_vif->sta->bss_sta_index =  params->bss_sta_index;
-   priv_vif->sta->bss_dpu_desc_index = params->dpu_desc_index;
+   if (vif_priv->sta) {
+   vif_priv->sta->bss_sta_index =  params->bss_sta_index;
+   vif_priv->sta->bss_dpu_desc_index = params->dpu_desc_index;
}
 
-   priv_vif->self_ucast_dpu_sign = params->ucast_dpu_signature;
+   vif_priv->self_ucast_dpu_sign = params->ucast_dpu_signature;
 
return 0;
 }
@@ -1343,13 +1343,13 @@ out:
 int wcn36xx_smd_delete_bss(struct wcn36xx *wcn, struct ieee80211_vif *vif)
 {
struct wcn36xx_hal_delete_bss_req_msg msg_body;
-   struct wcn36xx_vif *priv_vif = wcn36xx_vif_to_priv(vif);
+   struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif);
int ret = 0;
 
mutex_lock(>hal_mutex);
INIT_HAL_MSG(msg_body, WCN36XX_HAL_DELETE_BSS_REQ);
 
-   msg_body.bss_index = priv_vif->bss_index;
+   msg_body.bss_index = vif_priv->bss_index;
 
PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
 
-- 
2.5.0



[PATCH] ARM: suppress "include/generated/mach-types.h is up to date."

2016-04-18 Thread Masahiro Yamada
For incremental build, "include/generated/mach-types.h is up to date"
is every time displayed like follows:

$ make ARCH=arm
  CHK include/config/kernel.release
  CHK include/generated/uapi/linux/version.h
  CHK include/generated/utsrelease.h
make[1]: `include/generated/mach-types.h' is up to date.
  CHK include/generated/bounds.h
  CHK include/generated/timeconst.h
  CHK include/generated/asm-offsets.h

This commit avoids such a clumsy log and introduces Kbuild standard
log style:

  GEN include/generated/mach-types.h

Signed-off-by: Masahiro Yamada 
---

KernelVersion: 4.6-rc4

 arch/arm/tools/Makefile | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/arch/arm/tools/Makefile b/arch/arm/tools/Makefile
index 32d05c8..6e4cd18 100644
--- a/arch/arm/tools/Makefile
+++ b/arch/arm/tools/Makefile
@@ -4,7 +4,10 @@
 # Copyright (C) 2001 Russell King
 #
 
-include/generated/mach-types.h: $(src)/gen-mach-types $(src)/mach-types
-   @$(kecho) '  Generating $@'
-   @mkdir -p $(dir $@)
-   $(Q)$(AWK) -f $^ > $@ || { rm -f $@; /bin/false; }
+quiet_cmd_gen_mach = GEN $@
+  cmd_gen_mach = mkdir -p $(dir $@) && \
+$(AWK) -f $(filter-out $(PHONY),$^) > $@ || \
+{ rm -f $@; /bin/false; }
+
+include/generated/mach-types.h: $(src)/gen-mach-types $(src)/mach-types FORCE
+   $(call if_changed,gen_mach)
-- 
1.9.1



[PATCH] ARM: suppress "include/generated/mach-types.h is up to date."

2016-04-18 Thread Masahiro Yamada
For incremental build, "include/generated/mach-types.h is up to date"
is every time displayed like follows:

$ make ARCH=arm
  CHK include/config/kernel.release
  CHK include/generated/uapi/linux/version.h
  CHK include/generated/utsrelease.h
make[1]: `include/generated/mach-types.h' is up to date.
  CHK include/generated/bounds.h
  CHK include/generated/timeconst.h
  CHK include/generated/asm-offsets.h

This commit avoids such a clumsy log and introduces Kbuild standard
log style:

  GEN include/generated/mach-types.h

Signed-off-by: Masahiro Yamada 
---

KernelVersion: 4.6-rc4

 arch/arm/tools/Makefile | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/arch/arm/tools/Makefile b/arch/arm/tools/Makefile
index 32d05c8..6e4cd18 100644
--- a/arch/arm/tools/Makefile
+++ b/arch/arm/tools/Makefile
@@ -4,7 +4,10 @@
 # Copyright (C) 2001 Russell King
 #
 
-include/generated/mach-types.h: $(src)/gen-mach-types $(src)/mach-types
-   @$(kecho) '  Generating $@'
-   @mkdir -p $(dir $@)
-   $(Q)$(AWK) -f $^ > $@ || { rm -f $@; /bin/false; }
+quiet_cmd_gen_mach = GEN $@
+  cmd_gen_mach = mkdir -p $(dir $@) && \
+$(AWK) -f $(filter-out $(PHONY),$^) > $@ || \
+{ rm -f $@; /bin/false; }
+
+include/generated/mach-types.h: $(src)/gen-mach-types $(src)/mach-types FORCE
+   $(call if_changed,gen_mach)
-- 
1.9.1



[PATCH v3 07/18] wcn36xx: Fetch private sta data from sta entry instead of from vif

2016-04-18 Thread Bjorn Andersson
From: Pontus Fuchs 

For consistency with other code.

Signed-off-by: Pontus Fuchs 
Signed-off-by: Bjorn Andersson 
---

Changes since v1:
- Reordered after the now previous patch, to make wcn36xx_sta_to_priv()
  available before we use it

 drivers/net/wireless/ath/wcn36xx/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/main.c 
b/drivers/net/wireless/ath/wcn36xx/main.c
index 30f015d3a9e6..a23738deb5b3 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -386,7 +386,7 @@ static int wcn36xx_set_key(struct ieee80211_hw *hw, enum 
set_key_cmd cmd,
 {
struct wcn36xx *wcn = hw->priv;
struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif);
-   struct wcn36xx_sta *sta_priv = vif_priv->sta;
+   struct wcn36xx_sta *sta_priv = wcn36xx_sta_to_priv(sta);
int ret = 0;
u8 key[WLAN_MAX_KEY_LEN];
 
-- 
2.5.0



[PATCH v3 01/18] wcn36xx: Clean up wcn36xx_smd_send_beacon

2016-04-18 Thread Bjorn Andersson
From: Pontus Fuchs 

Needed for coming improvements. No functional changes.

Signed-off-by: Pontus Fuchs 
[bjorn: restored BEACON_TEMPLATE_SIZE define to 0x180]
Signed-off-by: Bjorn Andersson 
---

Changes since v2:
- Subtract sizeof(beacon_length) instead of modifying BEACON_TEMPLATE_SIZE,
  which is used in other places as well.

 drivers/net/wireless/ath/wcn36xx/hal.h |  5 -
 drivers/net/wireless/ath/wcn36xx/smd.c | 12 +---
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/hal.h 
b/drivers/net/wireless/ath/wcn36xx/hal.h
index b947de0fb2e5..d713204f755d 100644
--- a/drivers/net/wireless/ath/wcn36xx/hal.h
+++ b/drivers/net/wireless/ath/wcn36xx/hal.h
@@ -2884,11 +2884,14 @@ struct update_beacon_rsp_msg {
 struct wcn36xx_hal_send_beacon_req_msg {
struct wcn36xx_hal_msg_header header;
 
+   /* length of the template + 6. Only qcom knows why */
+   u32 beacon_length6;
+
/* length of the template. */
u32 beacon_length;
 
/* Beacon data. */
-   u8 beacon[BEACON_TEMPLATE_SIZE];
+   u8 beacon[BEACON_TEMPLATE_SIZE - sizeof(u32)];
 
u8 bssid[ETH_ALEN];
 
diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c 
b/drivers/net/wireless/ath/wcn36xx/smd.c
index 74f56a81ad9a..ff3ed2461a69 100644
--- a/drivers/net/wireless/ath/wcn36xx/smd.c
+++ b/drivers/net/wireless/ath/wcn36xx/smd.c
@@ -1380,19 +1380,17 @@ int wcn36xx_smd_send_beacon(struct wcn36xx *wcn, struct 
ieee80211_vif *vif,
mutex_lock(>hal_mutex);
INIT_HAL_MSG(msg_body, WCN36XX_HAL_SEND_BEACON_REQ);
 
-   /* TODO need to find out why this is needed? */
-   msg_body.beacon_length = skb_beacon->len + 6;
+   msg_body.beacon_length = skb_beacon->len;
+   /* TODO need to find out why + 6 is needed */
+   msg_body.beacon_length6 = msg_body.beacon_length + 6;
 
-   if (BEACON_TEMPLATE_SIZE > msg_body.beacon_length) {
-   memcpy(_body.beacon, _beacon->len, sizeof(u32));
-   memcpy(&(msg_body.beacon[4]), skb_beacon->data,
-  skb_beacon->len);
-   } else {
+   if (msg_body.beacon_length > BEACON_TEMPLATE_SIZE) {
wcn36xx_err("Beacon is to big: beacon size=%d\n",
  msg_body.beacon_length);
ret = -ENOMEM;
goto out;
}
+   memcpy(msg_body.beacon, skb_beacon->data, skb_beacon->len);
memcpy(msg_body.bssid, vif->addr, ETH_ALEN);
 
/* TODO need to find out why this is needed? */
-- 
2.5.0



[PATCH v3 07/18] wcn36xx: Fetch private sta data from sta entry instead of from vif

2016-04-18 Thread Bjorn Andersson
From: Pontus Fuchs 

For consistency with other code.

Signed-off-by: Pontus Fuchs 
Signed-off-by: Bjorn Andersson 
---

Changes since v1:
- Reordered after the now previous patch, to make wcn36xx_sta_to_priv()
  available before we use it

 drivers/net/wireless/ath/wcn36xx/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/main.c 
b/drivers/net/wireless/ath/wcn36xx/main.c
index 30f015d3a9e6..a23738deb5b3 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -386,7 +386,7 @@ static int wcn36xx_set_key(struct ieee80211_hw *hw, enum 
set_key_cmd cmd,
 {
struct wcn36xx *wcn = hw->priv;
struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif);
-   struct wcn36xx_sta *sta_priv = vif_priv->sta;
+   struct wcn36xx_sta *sta_priv = wcn36xx_sta_to_priv(sta);
int ret = 0;
u8 key[WLAN_MAX_KEY_LEN];
 
-- 
2.5.0



[PATCH v3 01/18] wcn36xx: Clean up wcn36xx_smd_send_beacon

2016-04-18 Thread Bjorn Andersson
From: Pontus Fuchs 

Needed for coming improvements. No functional changes.

Signed-off-by: Pontus Fuchs 
[bjorn: restored BEACON_TEMPLATE_SIZE define to 0x180]
Signed-off-by: Bjorn Andersson 
---

Changes since v2:
- Subtract sizeof(beacon_length) instead of modifying BEACON_TEMPLATE_SIZE,
  which is used in other places as well.

 drivers/net/wireless/ath/wcn36xx/hal.h |  5 -
 drivers/net/wireless/ath/wcn36xx/smd.c | 12 +---
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/hal.h 
b/drivers/net/wireless/ath/wcn36xx/hal.h
index b947de0fb2e5..d713204f755d 100644
--- a/drivers/net/wireless/ath/wcn36xx/hal.h
+++ b/drivers/net/wireless/ath/wcn36xx/hal.h
@@ -2884,11 +2884,14 @@ struct update_beacon_rsp_msg {
 struct wcn36xx_hal_send_beacon_req_msg {
struct wcn36xx_hal_msg_header header;
 
+   /* length of the template + 6. Only qcom knows why */
+   u32 beacon_length6;
+
/* length of the template. */
u32 beacon_length;
 
/* Beacon data. */
-   u8 beacon[BEACON_TEMPLATE_SIZE];
+   u8 beacon[BEACON_TEMPLATE_SIZE - sizeof(u32)];
 
u8 bssid[ETH_ALEN];
 
diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c 
b/drivers/net/wireless/ath/wcn36xx/smd.c
index 74f56a81ad9a..ff3ed2461a69 100644
--- a/drivers/net/wireless/ath/wcn36xx/smd.c
+++ b/drivers/net/wireless/ath/wcn36xx/smd.c
@@ -1380,19 +1380,17 @@ int wcn36xx_smd_send_beacon(struct wcn36xx *wcn, struct 
ieee80211_vif *vif,
mutex_lock(>hal_mutex);
INIT_HAL_MSG(msg_body, WCN36XX_HAL_SEND_BEACON_REQ);
 
-   /* TODO need to find out why this is needed? */
-   msg_body.beacon_length = skb_beacon->len + 6;
+   msg_body.beacon_length = skb_beacon->len;
+   /* TODO need to find out why + 6 is needed */
+   msg_body.beacon_length6 = msg_body.beacon_length + 6;
 
-   if (BEACON_TEMPLATE_SIZE > msg_body.beacon_length) {
-   memcpy(_body.beacon, _beacon->len, sizeof(u32));
-   memcpy(&(msg_body.beacon[4]), skb_beacon->data,
-  skb_beacon->len);
-   } else {
+   if (msg_body.beacon_length > BEACON_TEMPLATE_SIZE) {
wcn36xx_err("Beacon is to big: beacon size=%d\n",
  msg_body.beacon_length);
ret = -ENOMEM;
goto out;
}
+   memcpy(msg_body.beacon, skb_beacon->data, skb_beacon->len);
memcpy(msg_body.bssid, vif->addr, ETH_ALEN);
 
/* TODO need to find out why this is needed? */
-- 
2.5.0



[PATCH v3 12/18] wcn36xx: Clear encrypt_type when deleting bss key

2016-04-18 Thread Bjorn Andersson
From: Pontus Fuchs 

This fixes a problem connecting to an open network after being
connected to an encrypted network.

Signed-off-by: Pontus Fuchs 
Signed-off-by: Bjorn Andersson 
---
 drivers/net/wireless/ath/wcn36xx/main.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/wireless/ath/wcn36xx/main.c 
b/drivers/net/wireless/ath/wcn36xx/main.c
index 7c06ca9fdd2c..f9c77de94583 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -471,6 +471,7 @@ static int wcn36xx_set_key(struct ieee80211_hw *hw, enum 
set_key_cmd cmd,
break;
case DISABLE_KEY:
if (!(IEEE80211_KEY_FLAG_PAIRWISE & key_conf->flags)) {
+   vif_priv->encrypt_type = WCN36XX_HAL_ED_NONE;
wcn36xx_smd_remove_bsskey(wcn,
vif_priv->encrypt_type,
key_conf->keyidx);
@@ -626,6 +627,7 @@ static void wcn36xx_bss_info_changed(struct ieee80211_hw 
*hw,
} else {
vif_priv->is_joining = false;
wcn36xx_smd_delete_bss(wcn, vif);
+   vif_priv->encrypt_type = WCN36XX_HAL_ED_NONE;
}
}
 
-- 
2.5.0



[PATCH v3 17/18] wcn36xx: Correct remove bss key response encoding

2016-04-18 Thread Bjorn Andersson
The WCN36XX_HAL_RMV_BSSKEY_RSP carries a single u32 with "status", so we
can use the standard status check function for decoding the result.

This is the last user of the v2 status checker, so remove the struct and
helper function.

Signed-off-by: Bjorn Andersson 
---

Changes since v2:
- Added this patch to the series

 drivers/net/wireless/ath/wcn36xx/smd.c | 19 +--
 drivers/net/wireless/ath/wcn36xx/smd.h |  9 -
 2 files changed, 1 insertion(+), 27 deletions(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c 
b/drivers/net/wireless/ath/wcn36xx/smd.c
index c15501c06eb2..5f6ca3124bd8 100644
--- a/drivers/net/wireless/ath/wcn36xx/smd.c
+++ b/drivers/net/wireless/ath/wcn36xx/smd.c
@@ -312,22 +312,6 @@ static int wcn36xx_smd_rsp_status_check(void *buf, size_t 
len)
return 0;
 }
 
-static int wcn36xx_smd_rsp_status_check_v2(struct wcn36xx *wcn, void *buf,
-size_t len)
-{
-   struct wcn36xx_fw_msg_status_rsp_v2 *rsp;
-
-   if (len < sizeof(struct wcn36xx_hal_msg_header) + sizeof(*rsp))
-   return wcn36xx_smd_rsp_status_check(buf, len);
-
-   rsp = buf + sizeof(struct wcn36xx_hal_msg_header);
-
-   if (WCN36XX_FW_MSG_RESULT_SUCCESS != rsp->status)
-   return rsp->status;
-
-   return 0;
-}
-
 int wcn36xx_smd_load_nv(struct wcn36xx *wcn)
 {
struct nv_data *nv_d;
@@ -1647,8 +1631,7 @@ int wcn36xx_smd_remove_bsskey(struct wcn36xx *wcn,
wcn36xx_err("Sending hal_remove_bsskey failed\n");
goto out;
}
-   ret = wcn36xx_smd_rsp_status_check_v2(wcn, wcn->hal_buf,
- wcn->hal_rsp_len);
+   ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
if (ret) {
wcn36xx_err("hal_remove_bsskey response failed err=%d\n", ret);
goto out;
diff --git a/drivers/net/wireless/ath/wcn36xx/smd.h 
b/drivers/net/wireless/ath/wcn36xx/smd.h
index c1b76d75cf85..d74d781f4c8d 100644
--- a/drivers/net/wireless/ath/wcn36xx/smd.h
+++ b/drivers/net/wireless/ath/wcn36xx/smd.h
@@ -44,15 +44,6 @@ struct wcn36xx_fw_msg_status_rsp {
u32 status;
 } __packed;
 
-/* wcn3620 returns this for tigger_ba */
-
-struct wcn36xx_fw_msg_status_rsp_v2 {
-   u8  bss_id[6];
-   u32 status __packed;
-   u16 count_following_candidates __packed;
-   /* candidate list follows */
-};
-
 struct wcn36xx_hal_ind_msg {
struct list_head list;
u8 *msg;
-- 
2.5.0



[PATCH v3 08/18] wcn36xx: Remove sta pointer in private vif struct

2016-04-18 Thread Bjorn Andersson
From: Pontus Fuchs 

This does not work with multiple sta's in a vif.

Signed-off-by: Pontus Fuchs 
Signed-off-by: Bjorn Andersson 
---
 drivers/net/wireless/ath/wcn36xx/main.c|  3 ---
 drivers/net/wireless/ath/wcn36xx/smd.c | 28 +++-
 drivers/net/wireless/ath/wcn36xx/wcn36xx.h |  1 -
 3 files changed, 15 insertions(+), 17 deletions(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/main.c 
b/drivers/net/wireless/ath/wcn36xx/main.c
index a23738deb5b3..7c06ca9fdd2c 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -796,7 +796,6 @@ static int wcn36xx_sta_add(struct ieee80211_hw *hw, struct 
ieee80211_vif *vif,
vif, sta->addr);
 
spin_lock_init(_priv->ampdu_lock);
-   vif_priv->sta = sta_priv;
sta_priv->vif = vif_priv;
/*
 * For STA mode HW will be configured on BSS_CHANGED_ASSOC because
@@ -815,14 +814,12 @@ static int wcn36xx_sta_remove(struct ieee80211_hw *hw,
  struct ieee80211_sta *sta)
 {
struct wcn36xx *wcn = hw->priv;
-   struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif);
struct wcn36xx_sta *sta_priv = wcn36xx_sta_to_priv(sta);
 
wcn36xx_dbg(WCN36XX_DBG_MAC, "mac sta remove vif %p sta %pM index %d\n",
vif, sta->addr, sta_priv->sta_index);
 
wcn36xx_smd_delete_sta(wcn, sta_priv->sta_index);
-   vif_priv->sta = NULL;
sta_priv->vif = NULL;
return 0;
 }
diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c 
b/drivers/net/wireless/ath/wcn36xx/smd.c
index ff56138528b6..76c6856ed932 100644
--- a/drivers/net/wireless/ath/wcn36xx/smd.c
+++ b/drivers/net/wireless/ath/wcn36xx/smd.c
@@ -1170,6 +1170,7 @@ static int wcn36xx_smd_config_bss_v1(struct wcn36xx *wcn,
 
 static int wcn36xx_smd_config_bss_rsp(struct wcn36xx *wcn,
  struct ieee80211_vif *vif,
+ struct ieee80211_sta *sta,
  void *buf,
  size_t len)
 {
@@ -1200,9 +1201,10 @@ static int wcn36xx_smd_config_bss_rsp(struct wcn36xx 
*wcn,
 
vif_priv->bss_index = params->bss_index;
 
-   if (vif_priv->sta) {
-   vif_priv->sta->bss_sta_index =  params->bss_sta_index;
-   vif_priv->sta->bss_dpu_desc_index = params->dpu_desc_index;
+   if (sta) {
+   struct wcn36xx_sta *sta_priv = wcn36xx_sta_to_priv(sta);
+   sta_priv->bss_sta_index = params->bss_sta_index;
+   sta_priv->bss_dpu_desc_index = params->dpu_desc_index;
}
 
vif_priv->self_ucast_dpu_sign = params->ucast_dpu_signature;
@@ -1329,6 +1331,7 @@ int wcn36xx_smd_config_bss(struct wcn36xx *wcn, struct 
ieee80211_vif *vif,
}
ret = wcn36xx_smd_config_bss_rsp(wcn,
 vif,
+sta,
 wcn->hal_buf,
 wcn->hal_rsp_len);
if (ret) {
@@ -2058,25 +2061,24 @@ static int wcn36xx_smd_delete_sta_context_ind(struct 
wcn36xx *wcn,
 {
struct wcn36xx_hal_delete_sta_context_ind_msg *rsp = buf;
struct wcn36xx_vif *tmp;
-   struct ieee80211_sta *sta = NULL;
+   struct ieee80211_sta *sta;
 
if (len != sizeof(*rsp)) {
wcn36xx_warn("Corrupted delete sta indication\n");
return -EIO;
}
 
+   wcn36xx_dbg(WCN36XX_DBG_HAL, "delete station indication %pM index %d\n",
+   rsp->addr2, rsp->sta_id);
+
list_for_each_entry(tmp, >vif_list, list) {
-   if (sta && (tmp->sta->sta_index == rsp->sta_id)) {
-   sta = container_of((void *)tmp->sta,
-struct ieee80211_sta,
-drv_priv);
-   wcn36xx_dbg(WCN36XX_DBG_HAL,
-   "delete station indication %pM index %d\n",
-   rsp->addr2,
-   rsp->sta_id);
+   rcu_read_lock();
+   sta = ieee80211_find_sta(wcn36xx_priv_to_vif(tmp), rsp->addr2);
+   if (sta)
ieee80211_report_low_ack(sta, 0);
+   rcu_read_unlock();
+   if (sta)
return 0;
-   }
}
 
wcn36xx_warn("STA with addr %pM and index %d not found\n",
diff --git a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h 
b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
index c368a34c8de7..54000db0af1a 100644
--- a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
+++ b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
@@ -125,7 +125,6 @@ struct wcn36xx_platform_ctrl_ops {
  */
 struct wcn36xx_vif {

[PATCH v3 12/18] wcn36xx: Clear encrypt_type when deleting bss key

2016-04-18 Thread Bjorn Andersson
From: Pontus Fuchs 

This fixes a problem connecting to an open network after being
connected to an encrypted network.

Signed-off-by: Pontus Fuchs 
Signed-off-by: Bjorn Andersson 
---
 drivers/net/wireless/ath/wcn36xx/main.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/wireless/ath/wcn36xx/main.c 
b/drivers/net/wireless/ath/wcn36xx/main.c
index 7c06ca9fdd2c..f9c77de94583 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -471,6 +471,7 @@ static int wcn36xx_set_key(struct ieee80211_hw *hw, enum 
set_key_cmd cmd,
break;
case DISABLE_KEY:
if (!(IEEE80211_KEY_FLAG_PAIRWISE & key_conf->flags)) {
+   vif_priv->encrypt_type = WCN36XX_HAL_ED_NONE;
wcn36xx_smd_remove_bsskey(wcn,
vif_priv->encrypt_type,
key_conf->keyidx);
@@ -626,6 +627,7 @@ static void wcn36xx_bss_info_changed(struct ieee80211_hw 
*hw,
} else {
vif_priv->is_joining = false;
wcn36xx_smd_delete_bss(wcn, vif);
+   vif_priv->encrypt_type = WCN36XX_HAL_ED_NONE;
}
}
 
-- 
2.5.0



[PATCH v3 17/18] wcn36xx: Correct remove bss key response encoding

2016-04-18 Thread Bjorn Andersson
The WCN36XX_HAL_RMV_BSSKEY_RSP carries a single u32 with "status", so we
can use the standard status check function for decoding the result.

This is the last user of the v2 status checker, so remove the struct and
helper function.

Signed-off-by: Bjorn Andersson 
---

Changes since v2:
- Added this patch to the series

 drivers/net/wireless/ath/wcn36xx/smd.c | 19 +--
 drivers/net/wireless/ath/wcn36xx/smd.h |  9 -
 2 files changed, 1 insertion(+), 27 deletions(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c 
b/drivers/net/wireless/ath/wcn36xx/smd.c
index c15501c06eb2..5f6ca3124bd8 100644
--- a/drivers/net/wireless/ath/wcn36xx/smd.c
+++ b/drivers/net/wireless/ath/wcn36xx/smd.c
@@ -312,22 +312,6 @@ static int wcn36xx_smd_rsp_status_check(void *buf, size_t 
len)
return 0;
 }
 
-static int wcn36xx_smd_rsp_status_check_v2(struct wcn36xx *wcn, void *buf,
-size_t len)
-{
-   struct wcn36xx_fw_msg_status_rsp_v2 *rsp;
-
-   if (len < sizeof(struct wcn36xx_hal_msg_header) + sizeof(*rsp))
-   return wcn36xx_smd_rsp_status_check(buf, len);
-
-   rsp = buf + sizeof(struct wcn36xx_hal_msg_header);
-
-   if (WCN36XX_FW_MSG_RESULT_SUCCESS != rsp->status)
-   return rsp->status;
-
-   return 0;
-}
-
 int wcn36xx_smd_load_nv(struct wcn36xx *wcn)
 {
struct nv_data *nv_d;
@@ -1647,8 +1631,7 @@ int wcn36xx_smd_remove_bsskey(struct wcn36xx *wcn,
wcn36xx_err("Sending hal_remove_bsskey failed\n");
goto out;
}
-   ret = wcn36xx_smd_rsp_status_check_v2(wcn, wcn->hal_buf,
- wcn->hal_rsp_len);
+   ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
if (ret) {
wcn36xx_err("hal_remove_bsskey response failed err=%d\n", ret);
goto out;
diff --git a/drivers/net/wireless/ath/wcn36xx/smd.h 
b/drivers/net/wireless/ath/wcn36xx/smd.h
index c1b76d75cf85..d74d781f4c8d 100644
--- a/drivers/net/wireless/ath/wcn36xx/smd.h
+++ b/drivers/net/wireless/ath/wcn36xx/smd.h
@@ -44,15 +44,6 @@ struct wcn36xx_fw_msg_status_rsp {
u32 status;
 } __packed;
 
-/* wcn3620 returns this for tigger_ba */
-
-struct wcn36xx_fw_msg_status_rsp_v2 {
-   u8  bss_id[6];
-   u32 status __packed;
-   u16 count_following_candidates __packed;
-   /* candidate list follows */
-};
-
 struct wcn36xx_hal_ind_msg {
struct list_head list;
u8 *msg;
-- 
2.5.0



[PATCH v3 08/18] wcn36xx: Remove sta pointer in private vif struct

2016-04-18 Thread Bjorn Andersson
From: Pontus Fuchs 

This does not work with multiple sta's in a vif.

Signed-off-by: Pontus Fuchs 
Signed-off-by: Bjorn Andersson 
---
 drivers/net/wireless/ath/wcn36xx/main.c|  3 ---
 drivers/net/wireless/ath/wcn36xx/smd.c | 28 +++-
 drivers/net/wireless/ath/wcn36xx/wcn36xx.h |  1 -
 3 files changed, 15 insertions(+), 17 deletions(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/main.c 
b/drivers/net/wireless/ath/wcn36xx/main.c
index a23738deb5b3..7c06ca9fdd2c 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -796,7 +796,6 @@ static int wcn36xx_sta_add(struct ieee80211_hw *hw, struct 
ieee80211_vif *vif,
vif, sta->addr);
 
spin_lock_init(_priv->ampdu_lock);
-   vif_priv->sta = sta_priv;
sta_priv->vif = vif_priv;
/*
 * For STA mode HW will be configured on BSS_CHANGED_ASSOC because
@@ -815,14 +814,12 @@ static int wcn36xx_sta_remove(struct ieee80211_hw *hw,
  struct ieee80211_sta *sta)
 {
struct wcn36xx *wcn = hw->priv;
-   struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif);
struct wcn36xx_sta *sta_priv = wcn36xx_sta_to_priv(sta);
 
wcn36xx_dbg(WCN36XX_DBG_MAC, "mac sta remove vif %p sta %pM index %d\n",
vif, sta->addr, sta_priv->sta_index);
 
wcn36xx_smd_delete_sta(wcn, sta_priv->sta_index);
-   vif_priv->sta = NULL;
sta_priv->vif = NULL;
return 0;
 }
diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c 
b/drivers/net/wireless/ath/wcn36xx/smd.c
index ff56138528b6..76c6856ed932 100644
--- a/drivers/net/wireless/ath/wcn36xx/smd.c
+++ b/drivers/net/wireless/ath/wcn36xx/smd.c
@@ -1170,6 +1170,7 @@ static int wcn36xx_smd_config_bss_v1(struct wcn36xx *wcn,
 
 static int wcn36xx_smd_config_bss_rsp(struct wcn36xx *wcn,
  struct ieee80211_vif *vif,
+ struct ieee80211_sta *sta,
  void *buf,
  size_t len)
 {
@@ -1200,9 +1201,10 @@ static int wcn36xx_smd_config_bss_rsp(struct wcn36xx 
*wcn,
 
vif_priv->bss_index = params->bss_index;
 
-   if (vif_priv->sta) {
-   vif_priv->sta->bss_sta_index =  params->bss_sta_index;
-   vif_priv->sta->bss_dpu_desc_index = params->dpu_desc_index;
+   if (sta) {
+   struct wcn36xx_sta *sta_priv = wcn36xx_sta_to_priv(sta);
+   sta_priv->bss_sta_index = params->bss_sta_index;
+   sta_priv->bss_dpu_desc_index = params->dpu_desc_index;
}
 
vif_priv->self_ucast_dpu_sign = params->ucast_dpu_signature;
@@ -1329,6 +1331,7 @@ int wcn36xx_smd_config_bss(struct wcn36xx *wcn, struct 
ieee80211_vif *vif,
}
ret = wcn36xx_smd_config_bss_rsp(wcn,
 vif,
+sta,
 wcn->hal_buf,
 wcn->hal_rsp_len);
if (ret) {
@@ -2058,25 +2061,24 @@ static int wcn36xx_smd_delete_sta_context_ind(struct 
wcn36xx *wcn,
 {
struct wcn36xx_hal_delete_sta_context_ind_msg *rsp = buf;
struct wcn36xx_vif *tmp;
-   struct ieee80211_sta *sta = NULL;
+   struct ieee80211_sta *sta;
 
if (len != sizeof(*rsp)) {
wcn36xx_warn("Corrupted delete sta indication\n");
return -EIO;
}
 
+   wcn36xx_dbg(WCN36XX_DBG_HAL, "delete station indication %pM index %d\n",
+   rsp->addr2, rsp->sta_id);
+
list_for_each_entry(tmp, >vif_list, list) {
-   if (sta && (tmp->sta->sta_index == rsp->sta_id)) {
-   sta = container_of((void *)tmp->sta,
-struct ieee80211_sta,
-drv_priv);
-   wcn36xx_dbg(WCN36XX_DBG_HAL,
-   "delete station indication %pM index %d\n",
-   rsp->addr2,
-   rsp->sta_id);
+   rcu_read_lock();
+   sta = ieee80211_find_sta(wcn36xx_priv_to_vif(tmp), rsp->addr2);
+   if (sta)
ieee80211_report_low_ack(sta, 0);
+   rcu_read_unlock();
+   if (sta)
return 0;
-   }
}
 
wcn36xx_warn("STA with addr %pM and index %d not found\n",
diff --git a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h 
b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
index c368a34c8de7..54000db0af1a 100644
--- a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
+++ b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
@@ -125,7 +125,6 @@ struct wcn36xx_platform_ctrl_ops {
  */
 struct wcn36xx_vif {
struct list_head list;
-   struct wcn36xx_sta *sta;
u8 

[PATCH v3 14/18] wcn36xx: Implement multicast filtering

2016-04-18 Thread Bjorn Andersson
From: Pontus Fuchs 

Pass the multicast list to FW.

This patch also adds a way to build the smd command in place. This is
needed because the MC list command is too big for the stack.

Signed-off-by: Pontus Fuchs 
[bjorn: dropped FIF_PROMISC_IN_BSS usage]
Signed-off-by: Bjorn Andersson 
---
 drivers/net/wireless/ath/wcn36xx/hal.h  |  6 ++--
 drivers/net/wireless/ath/wcn36xx/main.c | 50 ++--
 drivers/net/wireless/ath/wcn36xx/smd.c  | 51 +
 drivers/net/wireless/ath/wcn36xx/smd.h  |  3 ++
 4 files changed, 104 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/hal.h 
b/drivers/net/wireless/ath/wcn36xx/hal.h
index 433d9801a0ae..ec64c47f918b 100644
--- a/drivers/net/wireless/ath/wcn36xx/hal.h
+++ b/drivers/net/wireless/ath/wcn36xx/hal.h
@@ -4267,9 +4267,9 @@ struct wcn36xx_hal_rcv_flt_mc_addr_list_type {
u8 data_offset;
 
u32 mc_addr_count;
-   u8 mc_addr[ETH_ALEN][WCN36XX_HAL_MAX_NUM_MULTICAST_ADDRESS];
+   u8 mc_addr[WCN36XX_HAL_MAX_NUM_MULTICAST_ADDRESS][ETH_ALEN];
u8 bss_index;
-};
+} __packed;
 
 struct wcn36xx_hal_set_pkt_filter_rsp_msg {
struct wcn36xx_hal_msg_header header;
@@ -4323,7 +4323,7 @@ struct wcn36xx_hal_rcv_flt_pkt_clear_rsp_msg {
 struct wcn36xx_hal_rcv_flt_pkt_set_mc_list_req_msg {
struct wcn36xx_hal_msg_header header;
struct wcn36xx_hal_rcv_flt_mc_addr_list_type mc_addr_list;
-};
+} __packed;
 
 struct wcn36xx_hal_rcv_flt_pkt_set_mc_list_rsp_msg {
struct wcn36xx_hal_msg_header header;
diff --git a/drivers/net/wireless/ath/wcn36xx/main.c 
b/drivers/net/wireless/ath/wcn36xx/main.c
index 253cece1b660..c0ba7b0775b3 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -287,6 +287,7 @@ static int wcn36xx_start(struct ieee80211_hw *hw)
}
 
wcn36xx_detect_chip_version(wcn);
+   wcn36xx_smd_update_cfg(wcn, WCN36XX_HAL_CFG_ENABLE_MC_ADDR_LIST, 1);
 
/* DMA channel initialization */
ret = wcn36xx_dxe_init(wcn);
@@ -354,15 +355,57 @@ static int wcn36xx_config(struct ieee80211_hw *hw, u32 
changed)
return 0;
 }
 
-#define WCN36XX_SUPPORTED_FILTERS (0)
-
 static void wcn36xx_configure_filter(struct ieee80211_hw *hw,
 unsigned int changed,
 unsigned int *total, u64 multicast)
 {
+   struct wcn36xx_hal_rcv_flt_mc_addr_list_type *fp;
+   struct wcn36xx *wcn = hw->priv;
+   struct wcn36xx_vif *tmp;
+   struct ieee80211_vif *vif = NULL;
+
wcn36xx_dbg(WCN36XX_DBG_MAC, "mac configure filter\n");
 
-   *total &= WCN36XX_SUPPORTED_FILTERS;
+   *total &= FIF_ALLMULTI;
+
+   fp = (void *)(unsigned long)multicast;
+   list_for_each_entry(tmp, >vif_list, list) {
+   vif = wcn36xx_priv_to_vif(tmp);
+
+   /* FW handles MC filtering only when connected as STA */
+   if (*total & FIF_ALLMULTI)
+   wcn36xx_smd_set_mc_list(wcn, vif, NULL);
+   else if (NL80211_IFTYPE_STATION == vif->type && tmp->sta_assoc)
+   wcn36xx_smd_set_mc_list(wcn, vif, fp);
+   }
+   kfree(fp);
+}
+
+static u64 wcn36xx_prepare_multicast(struct ieee80211_hw *hw,
+struct netdev_hw_addr_list *mc_list)
+{
+   struct wcn36xx_hal_rcv_flt_mc_addr_list_type *fp;
+   struct netdev_hw_addr *ha;
+
+   wcn36xx_dbg(WCN36XX_DBG_MAC, "mac prepare multicast list\n");
+   fp = kzalloc(sizeof(*fp), GFP_ATOMIC);
+   if (!fp) {
+   wcn36xx_err("Out of memory setting filters.\n");
+   return 0;
+   }
+
+   fp->mc_addr_count = 0;
+   /* update multicast filtering parameters */
+   if (netdev_hw_addr_list_count(mc_list) <=
+   WCN36XX_HAL_MAX_NUM_MULTICAST_ADDRESS) {
+   netdev_hw_addr_list_for_each(ha, mc_list) {
+   memcpy(fp->mc_addr[fp->mc_addr_count],
+   ha->addr, ETH_ALEN);
+   fp->mc_addr_count++;
+   }
+   }
+
+   return (u64)(unsigned long)fp;
 }
 
 static void wcn36xx_tx(struct ieee80211_hw *hw,
@@ -920,6 +963,7 @@ static const struct ieee80211_ops wcn36xx_ops = {
.resume = wcn36xx_resume,
 #endif
.config = wcn36xx_config,
+   .prepare_multicast  = wcn36xx_prepare_multicast,
.configure_filter   = wcn36xx_configure_filter,
.tx = wcn36xx_tx,
.set_key= wcn36xx_set_key,
diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c 
b/drivers/net/wireless/ath/wcn36xx/smd.c
index e0d5631657c1..b1bdc229e560 100644
--- a/drivers/net/wireless/ath/wcn36xx/smd.c
+++ b/drivers/net/wireless/ath/wcn36xx/smd.c
@@ -271,6 +271,16 @@ out:
 

[PATCH v3 09/18] wcn36xx: Parse trigger_ba response properly

2016-04-18 Thread Bjorn Andersson
From: Pontus Fuchs 

This message does not follow the canonical format and needs it's own
parser.

Signed-off-by: Pontus Fuchs 
Signed-off-by: Bjorn Andersson 
---
 drivers/net/wireless/ath/wcn36xx/smd.c | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c 
b/drivers/net/wireless/ath/wcn36xx/smd.c
index 76c6856ed932..7f315d098f52 100644
--- a/drivers/net/wireless/ath/wcn36xx/smd.c
+++ b/drivers/net/wireless/ath/wcn36xx/smd.c
@@ -1968,6 +1968,17 @@ out:
return ret;
 }
 
+static int wcn36xx_smd_trigger_ba_rsp(void *buf, int len)
+{
+   struct wcn36xx_hal_trigger_ba_rsp_msg *rsp;
+
+   if (len < sizeof(*rsp))
+   return -EINVAL;
+
+   rsp = (struct wcn36xx_hal_trigger_ba_rsp_msg *) buf;
+   return rsp->status;
+}
+
 int wcn36xx_smd_trigger_ba(struct wcn36xx *wcn, u8 sta_index)
 {
struct wcn36xx_hal_trigger_ba_req_msg msg_body;
@@ -1992,8 +2003,7 @@ int wcn36xx_smd_trigger_ba(struct wcn36xx *wcn, u8 
sta_index)
wcn36xx_err("Sending hal_trigger_ba failed\n");
goto out;
}
-   ret = wcn36xx_smd_rsp_status_check_v2(wcn, wcn->hal_buf,
-   wcn->hal_rsp_len);
+   ret = wcn36xx_smd_trigger_ba_rsp(wcn->hal_buf, wcn->hal_rsp_len);
if (ret) {
wcn36xx_err("hal_trigger_ba response failed err=%d\n", ret);
goto out;
-- 
2.5.0



[PATCH v3 15/18] wcn36xx: Use correct command struct for EXIT_BMPS_REQ

2016-04-18 Thread Bjorn Andersson
From: Pontus Fuchs 

EXIT_BMPS_REQ was using the command struct for ENTER_BMPS_REQ. I
spotted this when looking at command dumps.

Signed-off-by: Pontus Fuchs 
Signed-off-by: Bjorn Andersson 
---
 drivers/net/wireless/ath/wcn36xx/smd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c 
b/drivers/net/wireless/ath/wcn36xx/smd.c
index b1bdc229e560..c15501c06eb2 100644
--- a/drivers/net/wireless/ath/wcn36xx/smd.c
+++ b/drivers/net/wireless/ath/wcn36xx/smd.c
@@ -1690,7 +1690,7 @@ out:
 
 int wcn36xx_smd_exit_bmps(struct wcn36xx *wcn, struct ieee80211_vif *vif)
 {
-   struct wcn36xx_hal_enter_bmps_req_msg msg_body;
+   struct wcn36xx_hal_exit_bmps_req_msg msg_body;
struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif);
int ret = 0;
 
-- 
2.5.0



[PATCH v3 10/18] wcn36xx: Copy all members in config_sta v1 conversion

2016-04-18 Thread Bjorn Andersson
From: Pontus Fuchs 

When converting to version 1 of the config_sta struct not all
members where copied. This fixes the problem of multicast frames
not being delivered on an encrypted network.

Signed-off-by: Pontus Fuchs 
Signed-off-by: Bjorn Andersson 
---
 drivers/net/wireless/ath/wcn36xx/smd.c | 19 +--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c 
b/drivers/net/wireless/ath/wcn36xx/smd.c
index 7f315d098f52..ebb446272d21 100644
--- a/drivers/net/wireless/ath/wcn36xx/smd.c
+++ b/drivers/net/wireless/ath/wcn36xx/smd.c
@@ -949,17 +949,32 @@ static void wcn36xx_smd_convert_sta_to_v1(struct wcn36xx 
*wcn,
memcpy(>mac, orig->mac, ETH_ALEN);
v1->aid = orig->aid;
v1->type = orig->type;
+   v1->short_preamble_supported = orig->short_preamble_supported;
v1->listen_interval = orig->listen_interval;
+   v1->wmm_enabled = orig->wmm_enabled;
v1->ht_capable = orig->ht_capable;
-
+   v1->tx_channel_width_set = orig->tx_channel_width_set;
+   v1->rifs_mode = orig->rifs_mode;
+   v1->lsig_txop_protection = orig->lsig_txop_protection;
v1->max_ampdu_size = orig->max_ampdu_size;
v1->max_ampdu_density = orig->max_ampdu_density;
v1->sgi_40mhz = orig->sgi_40mhz;
v1->sgi_20Mhz = orig->sgi_20Mhz;
-
+   v1->rmf = orig->rmf;
+   v1->encrypt_type = orig->encrypt_type;
+   v1->action = orig->action;
+   v1->uapsd = orig->uapsd;
+   v1->max_sp_len = orig->max_sp_len;
+   v1->green_field_capable = orig->green_field_capable;
+   v1->mimo_ps = orig->mimo_ps;
+   v1->delayed_ba_support = orig->delayed_ba_support;
+   v1->max_ampdu_duration = orig->max_ampdu_duration;
+   v1->dsss_cck_mode_40mhz = orig->dsss_cck_mode_40mhz;
memcpy(>supported_rates, >supported_rates,
   sizeof(orig->supported_rates));
v1->sta_index = orig->sta_index;
+   v1->bssid_index = orig->bssid_index;
+   v1->p2p = orig->p2p;
 }
 
 static int wcn36xx_smd_config_sta_rsp(struct wcn36xx *wcn,
-- 
2.5.0



[PATCH v3 09/18] wcn36xx: Parse trigger_ba response properly

2016-04-18 Thread Bjorn Andersson
From: Pontus Fuchs 

This message does not follow the canonical format and needs it's own
parser.

Signed-off-by: Pontus Fuchs 
Signed-off-by: Bjorn Andersson 
---
 drivers/net/wireless/ath/wcn36xx/smd.c | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c 
b/drivers/net/wireless/ath/wcn36xx/smd.c
index 76c6856ed932..7f315d098f52 100644
--- a/drivers/net/wireless/ath/wcn36xx/smd.c
+++ b/drivers/net/wireless/ath/wcn36xx/smd.c
@@ -1968,6 +1968,17 @@ out:
return ret;
 }
 
+static int wcn36xx_smd_trigger_ba_rsp(void *buf, int len)
+{
+   struct wcn36xx_hal_trigger_ba_rsp_msg *rsp;
+
+   if (len < sizeof(*rsp))
+   return -EINVAL;
+
+   rsp = (struct wcn36xx_hal_trigger_ba_rsp_msg *) buf;
+   return rsp->status;
+}
+
 int wcn36xx_smd_trigger_ba(struct wcn36xx *wcn, u8 sta_index)
 {
struct wcn36xx_hal_trigger_ba_req_msg msg_body;
@@ -1992,8 +2003,7 @@ int wcn36xx_smd_trigger_ba(struct wcn36xx *wcn, u8 
sta_index)
wcn36xx_err("Sending hal_trigger_ba failed\n");
goto out;
}
-   ret = wcn36xx_smd_rsp_status_check_v2(wcn, wcn->hal_buf,
-   wcn->hal_rsp_len);
+   ret = wcn36xx_smd_trigger_ba_rsp(wcn->hal_buf, wcn->hal_rsp_len);
if (ret) {
wcn36xx_err("hal_trigger_ba response failed err=%d\n", ret);
goto out;
-- 
2.5.0



[PATCH v3 15/18] wcn36xx: Use correct command struct for EXIT_BMPS_REQ

2016-04-18 Thread Bjorn Andersson
From: Pontus Fuchs 

EXIT_BMPS_REQ was using the command struct for ENTER_BMPS_REQ. I
spotted this when looking at command dumps.

Signed-off-by: Pontus Fuchs 
Signed-off-by: Bjorn Andersson 
---
 drivers/net/wireless/ath/wcn36xx/smd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c 
b/drivers/net/wireless/ath/wcn36xx/smd.c
index b1bdc229e560..c15501c06eb2 100644
--- a/drivers/net/wireless/ath/wcn36xx/smd.c
+++ b/drivers/net/wireless/ath/wcn36xx/smd.c
@@ -1690,7 +1690,7 @@ out:
 
 int wcn36xx_smd_exit_bmps(struct wcn36xx *wcn, struct ieee80211_vif *vif)
 {
-   struct wcn36xx_hal_enter_bmps_req_msg msg_body;
+   struct wcn36xx_hal_exit_bmps_req_msg msg_body;
struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif);
int ret = 0;
 
-- 
2.5.0



[PATCH v3 10/18] wcn36xx: Copy all members in config_sta v1 conversion

2016-04-18 Thread Bjorn Andersson
From: Pontus Fuchs 

When converting to version 1 of the config_sta struct not all
members where copied. This fixes the problem of multicast frames
not being delivered on an encrypted network.

Signed-off-by: Pontus Fuchs 
Signed-off-by: Bjorn Andersson 
---
 drivers/net/wireless/ath/wcn36xx/smd.c | 19 +--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c 
b/drivers/net/wireless/ath/wcn36xx/smd.c
index 7f315d098f52..ebb446272d21 100644
--- a/drivers/net/wireless/ath/wcn36xx/smd.c
+++ b/drivers/net/wireless/ath/wcn36xx/smd.c
@@ -949,17 +949,32 @@ static void wcn36xx_smd_convert_sta_to_v1(struct wcn36xx 
*wcn,
memcpy(>mac, orig->mac, ETH_ALEN);
v1->aid = orig->aid;
v1->type = orig->type;
+   v1->short_preamble_supported = orig->short_preamble_supported;
v1->listen_interval = orig->listen_interval;
+   v1->wmm_enabled = orig->wmm_enabled;
v1->ht_capable = orig->ht_capable;
-
+   v1->tx_channel_width_set = orig->tx_channel_width_set;
+   v1->rifs_mode = orig->rifs_mode;
+   v1->lsig_txop_protection = orig->lsig_txop_protection;
v1->max_ampdu_size = orig->max_ampdu_size;
v1->max_ampdu_density = orig->max_ampdu_density;
v1->sgi_40mhz = orig->sgi_40mhz;
v1->sgi_20Mhz = orig->sgi_20Mhz;
-
+   v1->rmf = orig->rmf;
+   v1->encrypt_type = orig->encrypt_type;
+   v1->action = orig->action;
+   v1->uapsd = orig->uapsd;
+   v1->max_sp_len = orig->max_sp_len;
+   v1->green_field_capable = orig->green_field_capable;
+   v1->mimo_ps = orig->mimo_ps;
+   v1->delayed_ba_support = orig->delayed_ba_support;
+   v1->max_ampdu_duration = orig->max_ampdu_duration;
+   v1->dsss_cck_mode_40mhz = orig->dsss_cck_mode_40mhz;
memcpy(>supported_rates, >supported_rates,
   sizeof(orig->supported_rates));
v1->sta_index = orig->sta_index;
+   v1->bssid_index = orig->bssid_index;
+   v1->p2p = orig->p2p;
 }
 
 static int wcn36xx_smd_config_sta_rsp(struct wcn36xx *wcn,
-- 
2.5.0



[PATCH v3 14/18] wcn36xx: Implement multicast filtering

2016-04-18 Thread Bjorn Andersson
From: Pontus Fuchs 

Pass the multicast list to FW.

This patch also adds a way to build the smd command in place. This is
needed because the MC list command is too big for the stack.

Signed-off-by: Pontus Fuchs 
[bjorn: dropped FIF_PROMISC_IN_BSS usage]
Signed-off-by: Bjorn Andersson 
---
 drivers/net/wireless/ath/wcn36xx/hal.h  |  6 ++--
 drivers/net/wireless/ath/wcn36xx/main.c | 50 ++--
 drivers/net/wireless/ath/wcn36xx/smd.c  | 51 +
 drivers/net/wireless/ath/wcn36xx/smd.h  |  3 ++
 4 files changed, 104 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/hal.h 
b/drivers/net/wireless/ath/wcn36xx/hal.h
index 433d9801a0ae..ec64c47f918b 100644
--- a/drivers/net/wireless/ath/wcn36xx/hal.h
+++ b/drivers/net/wireless/ath/wcn36xx/hal.h
@@ -4267,9 +4267,9 @@ struct wcn36xx_hal_rcv_flt_mc_addr_list_type {
u8 data_offset;
 
u32 mc_addr_count;
-   u8 mc_addr[ETH_ALEN][WCN36XX_HAL_MAX_NUM_MULTICAST_ADDRESS];
+   u8 mc_addr[WCN36XX_HAL_MAX_NUM_MULTICAST_ADDRESS][ETH_ALEN];
u8 bss_index;
-};
+} __packed;
 
 struct wcn36xx_hal_set_pkt_filter_rsp_msg {
struct wcn36xx_hal_msg_header header;
@@ -4323,7 +4323,7 @@ struct wcn36xx_hal_rcv_flt_pkt_clear_rsp_msg {
 struct wcn36xx_hal_rcv_flt_pkt_set_mc_list_req_msg {
struct wcn36xx_hal_msg_header header;
struct wcn36xx_hal_rcv_flt_mc_addr_list_type mc_addr_list;
-};
+} __packed;
 
 struct wcn36xx_hal_rcv_flt_pkt_set_mc_list_rsp_msg {
struct wcn36xx_hal_msg_header header;
diff --git a/drivers/net/wireless/ath/wcn36xx/main.c 
b/drivers/net/wireless/ath/wcn36xx/main.c
index 253cece1b660..c0ba7b0775b3 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -287,6 +287,7 @@ static int wcn36xx_start(struct ieee80211_hw *hw)
}
 
wcn36xx_detect_chip_version(wcn);
+   wcn36xx_smd_update_cfg(wcn, WCN36XX_HAL_CFG_ENABLE_MC_ADDR_LIST, 1);
 
/* DMA channel initialization */
ret = wcn36xx_dxe_init(wcn);
@@ -354,15 +355,57 @@ static int wcn36xx_config(struct ieee80211_hw *hw, u32 
changed)
return 0;
 }
 
-#define WCN36XX_SUPPORTED_FILTERS (0)
-
 static void wcn36xx_configure_filter(struct ieee80211_hw *hw,
 unsigned int changed,
 unsigned int *total, u64 multicast)
 {
+   struct wcn36xx_hal_rcv_flt_mc_addr_list_type *fp;
+   struct wcn36xx *wcn = hw->priv;
+   struct wcn36xx_vif *tmp;
+   struct ieee80211_vif *vif = NULL;
+
wcn36xx_dbg(WCN36XX_DBG_MAC, "mac configure filter\n");
 
-   *total &= WCN36XX_SUPPORTED_FILTERS;
+   *total &= FIF_ALLMULTI;
+
+   fp = (void *)(unsigned long)multicast;
+   list_for_each_entry(tmp, >vif_list, list) {
+   vif = wcn36xx_priv_to_vif(tmp);
+
+   /* FW handles MC filtering only when connected as STA */
+   if (*total & FIF_ALLMULTI)
+   wcn36xx_smd_set_mc_list(wcn, vif, NULL);
+   else if (NL80211_IFTYPE_STATION == vif->type && tmp->sta_assoc)
+   wcn36xx_smd_set_mc_list(wcn, vif, fp);
+   }
+   kfree(fp);
+}
+
+static u64 wcn36xx_prepare_multicast(struct ieee80211_hw *hw,
+struct netdev_hw_addr_list *mc_list)
+{
+   struct wcn36xx_hal_rcv_flt_mc_addr_list_type *fp;
+   struct netdev_hw_addr *ha;
+
+   wcn36xx_dbg(WCN36XX_DBG_MAC, "mac prepare multicast list\n");
+   fp = kzalloc(sizeof(*fp), GFP_ATOMIC);
+   if (!fp) {
+   wcn36xx_err("Out of memory setting filters.\n");
+   return 0;
+   }
+
+   fp->mc_addr_count = 0;
+   /* update multicast filtering parameters */
+   if (netdev_hw_addr_list_count(mc_list) <=
+   WCN36XX_HAL_MAX_NUM_MULTICAST_ADDRESS) {
+   netdev_hw_addr_list_for_each(ha, mc_list) {
+   memcpy(fp->mc_addr[fp->mc_addr_count],
+   ha->addr, ETH_ALEN);
+   fp->mc_addr_count++;
+   }
+   }
+
+   return (u64)(unsigned long)fp;
 }
 
 static void wcn36xx_tx(struct ieee80211_hw *hw,
@@ -920,6 +963,7 @@ static const struct ieee80211_ops wcn36xx_ops = {
.resume = wcn36xx_resume,
 #endif
.config = wcn36xx_config,
+   .prepare_multicast  = wcn36xx_prepare_multicast,
.configure_filter   = wcn36xx_configure_filter,
.tx = wcn36xx_tx,
.set_key= wcn36xx_set_key,
diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c 
b/drivers/net/wireless/ath/wcn36xx/smd.c
index e0d5631657c1..b1bdc229e560 100644
--- a/drivers/net/wireless/ath/wcn36xx/smd.c
+++ b/drivers/net/wireless/ath/wcn36xx/smd.c
@@ -271,6 +271,16 @@ out:
return ret;
 }
 
+static void init_hal_msg(struct wcn36xx_hal_msg_header 

[PATCH v3 11/18] wcn36xx: Use allocated self sta index instead of hard coded

2016-04-18 Thread Bjorn Andersson
From: Pontus Fuchs 

Signed-off-by: Pontus Fuchs 
Signed-off-by: Bjorn Andersson 
---
 drivers/net/wireless/ath/wcn36xx/smd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c 
b/drivers/net/wireless/ath/wcn36xx/smd.c
index ebb446272d21..e0d5631657c1 100644
--- a/drivers/net/wireless/ath/wcn36xx/smd.c
+++ b/drivers/net/wireless/ath/wcn36xx/smd.c
@@ -200,7 +200,7 @@ static void wcn36xx_smd_set_sta_params(struct wcn36xx *wcn,
sta_params->sta_index = WCN36XX_HAL_STA_INVALID_IDX;
} else {
sta_params->type = 0;
-   sta_params->sta_index = 1;
+   sta_params->sta_index = vif_priv->self_sta_index;
}
 
sta_params->listen_interval = WCN36XX_LISTEN_INTERVAL(wcn);
-- 
2.5.0



[PATCH v3 11/18] wcn36xx: Use allocated self sta index instead of hard coded

2016-04-18 Thread Bjorn Andersson
From: Pontus Fuchs 

Signed-off-by: Pontus Fuchs 
Signed-off-by: Bjorn Andersson 
---
 drivers/net/wireless/ath/wcn36xx/smd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c 
b/drivers/net/wireless/ath/wcn36xx/smd.c
index ebb446272d21..e0d5631657c1 100644
--- a/drivers/net/wireless/ath/wcn36xx/smd.c
+++ b/drivers/net/wireless/ath/wcn36xx/smd.c
@@ -200,7 +200,7 @@ static void wcn36xx_smd_set_sta_params(struct wcn36xx *wcn,
sta_params->sta_index = WCN36XX_HAL_STA_INVALID_IDX;
} else {
sta_params->type = 0;
-   sta_params->sta_index = 1;
+   sta_params->sta_index = vif_priv->self_sta_index;
}
 
sta_params->listen_interval = WCN36XX_LISTEN_INTERVAL(wcn);
-- 
2.5.0



[PATCH v3 03/18] wcn36xx: Add helper macros to cast vif to private vif and vice versa

2016-04-18 Thread Bjorn Andersson
From: Pontus Fuchs 

Makes the code a little easier to read.

Signed-off-by: Pontus Fuchs 
Signed-off-by: Bjorn Andersson 
---
 drivers/net/wireless/ath/wcn36xx/debug.c   | 12 +++-
 drivers/net/wireless/ath/wcn36xx/main.c| 16 +++-
 drivers/net/wireless/ath/wcn36xx/pmc.c |  4 ++--
 drivers/net/wireless/ath/wcn36xx/smd.c | 24 ++--
 drivers/net/wireless/ath/wcn36xx/txrx.c|  8 ++--
 drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 12 
 6 files changed, 36 insertions(+), 40 deletions(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/debug.c 
b/drivers/net/wireless/ath/wcn36xx/debug.c
index ef44a2da644d..2a6bb62e785c 100644
--- a/drivers/net/wireless/ath/wcn36xx/debug.c
+++ b/drivers/net/wireless/ath/wcn36xx/debug.c
@@ -33,9 +33,7 @@ static ssize_t read_file_bool_bmps(struct file *file, char 
__user *user_buf,
char buf[3];
 
list_for_each_entry(vif_priv, >vif_list, list) {
-   vif = container_of((void *)vif_priv,
-  struct ieee80211_vif,
-  drv_priv);
+   vif = wcn36xx_priv_to_vif(vif_priv);
if (NL80211_IFTYPE_STATION == vif->type) {
if (vif_priv->pw_state == WCN36XX_BMPS)
buf[0] = '1';
@@ -70,9 +68,7 @@ static ssize_t write_file_bool_bmps(struct file *file,
case 'Y':
case '1':
list_for_each_entry(vif_priv, >vif_list, list) {
-   vif = container_of((void *)vif_priv,
-  struct ieee80211_vif,
-  drv_priv);
+   vif = wcn36xx_priv_to_vif(vif_priv);
if (NL80211_IFTYPE_STATION == vif->type) {
wcn36xx_enable_keep_alive_null_packet(wcn, vif);
wcn36xx_pmc_enter_bmps_state(wcn, vif);
@@ -83,9 +79,7 @@ static ssize_t write_file_bool_bmps(struct file *file,
case 'N':
case '0':
list_for_each_entry(vif_priv, >vif_list, list) {
-   vif = container_of((void *)vif_priv,
-  struct ieee80211_vif,
-  drv_priv);
+   vif = wcn36xx_priv_to_vif(vif_priv);
if (NL80211_IFTYPE_STATION == vif->type)
wcn36xx_pmc_exit_bmps_state(wcn, vif);
}
diff --git a/drivers/net/wireless/ath/wcn36xx/main.c 
b/drivers/net/wireless/ath/wcn36xx/main.c
index a27279c2c695..62cb9ffd854c 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -346,9 +346,7 @@ static int wcn36xx_config(struct ieee80211_hw *hw, u32 
changed)
wcn36xx_dbg(WCN36XX_DBG_MAC, "wcn36xx_config channel 
switch=%d\n",
ch);
list_for_each_entry(tmp, >vif_list, list) {
-   vif = container_of((void *)tmp,
-  struct ieee80211_vif,
-  drv_priv);
+   vif = wcn36xx_priv_to_vif(tmp);
wcn36xx_smd_switch_channel(wcn, vif, ch);
}
}
@@ -387,7 +385,7 @@ static int wcn36xx_set_key(struct ieee80211_hw *hw, enum 
set_key_cmd cmd,
   struct ieee80211_key_conf *key_conf)
 {
struct wcn36xx *wcn = hw->priv;
-   struct wcn36xx_vif *vif_priv = (struct wcn36xx_vif *)vif->drv_priv;
+   struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif);
struct wcn36xx_sta *sta_priv = vif_priv->sta;
int ret = 0;
u8 key[WLAN_MAX_KEY_LEN];
@@ -590,7 +588,7 @@ static void wcn36xx_bss_info_changed(struct ieee80211_hw 
*hw,
struct sk_buff *skb = NULL;
u16 tim_off, tim_len;
enum wcn36xx_hal_link_state link_state;
-   struct wcn36xx_vif *vif_priv = (struct wcn36xx_vif *)vif->drv_priv;
+   struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif);
 
wcn36xx_dbg(WCN36XX_DBG_MAC, "mac bss info changed vif %p changed 
0x%08x\n",
vif, changed);
@@ -757,7 +755,7 @@ static void wcn36xx_remove_interface(struct ieee80211_hw 
*hw,
 struct ieee80211_vif *vif)
 {
struct wcn36xx *wcn = hw->priv;
-   struct wcn36xx_vif *vif_priv = (struct wcn36xx_vif *)vif->drv_priv;
+   struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif);
wcn36xx_dbg(WCN36XX_DBG_MAC, "mac remove interface vif %p\n", vif);
 
list_del(_priv->list);
@@ -768,7 +766,7 @@ static int wcn36xx_add_interface(struct ieee80211_hw *hw,
 struct ieee80211_vif *vif)
 {
struct wcn36xx *wcn = hw->priv;
-   struct 

[PATCH v3 03/18] wcn36xx: Add helper macros to cast vif to private vif and vice versa

2016-04-18 Thread Bjorn Andersson
From: Pontus Fuchs 

Makes the code a little easier to read.

Signed-off-by: Pontus Fuchs 
Signed-off-by: Bjorn Andersson 
---
 drivers/net/wireless/ath/wcn36xx/debug.c   | 12 +++-
 drivers/net/wireless/ath/wcn36xx/main.c| 16 +++-
 drivers/net/wireless/ath/wcn36xx/pmc.c |  4 ++--
 drivers/net/wireless/ath/wcn36xx/smd.c | 24 ++--
 drivers/net/wireless/ath/wcn36xx/txrx.c|  8 ++--
 drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 12 
 6 files changed, 36 insertions(+), 40 deletions(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/debug.c 
b/drivers/net/wireless/ath/wcn36xx/debug.c
index ef44a2da644d..2a6bb62e785c 100644
--- a/drivers/net/wireless/ath/wcn36xx/debug.c
+++ b/drivers/net/wireless/ath/wcn36xx/debug.c
@@ -33,9 +33,7 @@ static ssize_t read_file_bool_bmps(struct file *file, char 
__user *user_buf,
char buf[3];
 
list_for_each_entry(vif_priv, >vif_list, list) {
-   vif = container_of((void *)vif_priv,
-  struct ieee80211_vif,
-  drv_priv);
+   vif = wcn36xx_priv_to_vif(vif_priv);
if (NL80211_IFTYPE_STATION == vif->type) {
if (vif_priv->pw_state == WCN36XX_BMPS)
buf[0] = '1';
@@ -70,9 +68,7 @@ static ssize_t write_file_bool_bmps(struct file *file,
case 'Y':
case '1':
list_for_each_entry(vif_priv, >vif_list, list) {
-   vif = container_of((void *)vif_priv,
-  struct ieee80211_vif,
-  drv_priv);
+   vif = wcn36xx_priv_to_vif(vif_priv);
if (NL80211_IFTYPE_STATION == vif->type) {
wcn36xx_enable_keep_alive_null_packet(wcn, vif);
wcn36xx_pmc_enter_bmps_state(wcn, vif);
@@ -83,9 +79,7 @@ static ssize_t write_file_bool_bmps(struct file *file,
case 'N':
case '0':
list_for_each_entry(vif_priv, >vif_list, list) {
-   vif = container_of((void *)vif_priv,
-  struct ieee80211_vif,
-  drv_priv);
+   vif = wcn36xx_priv_to_vif(vif_priv);
if (NL80211_IFTYPE_STATION == vif->type)
wcn36xx_pmc_exit_bmps_state(wcn, vif);
}
diff --git a/drivers/net/wireless/ath/wcn36xx/main.c 
b/drivers/net/wireless/ath/wcn36xx/main.c
index a27279c2c695..62cb9ffd854c 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -346,9 +346,7 @@ static int wcn36xx_config(struct ieee80211_hw *hw, u32 
changed)
wcn36xx_dbg(WCN36XX_DBG_MAC, "wcn36xx_config channel 
switch=%d\n",
ch);
list_for_each_entry(tmp, >vif_list, list) {
-   vif = container_of((void *)tmp,
-  struct ieee80211_vif,
-  drv_priv);
+   vif = wcn36xx_priv_to_vif(tmp);
wcn36xx_smd_switch_channel(wcn, vif, ch);
}
}
@@ -387,7 +385,7 @@ static int wcn36xx_set_key(struct ieee80211_hw *hw, enum 
set_key_cmd cmd,
   struct ieee80211_key_conf *key_conf)
 {
struct wcn36xx *wcn = hw->priv;
-   struct wcn36xx_vif *vif_priv = (struct wcn36xx_vif *)vif->drv_priv;
+   struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif);
struct wcn36xx_sta *sta_priv = vif_priv->sta;
int ret = 0;
u8 key[WLAN_MAX_KEY_LEN];
@@ -590,7 +588,7 @@ static void wcn36xx_bss_info_changed(struct ieee80211_hw 
*hw,
struct sk_buff *skb = NULL;
u16 tim_off, tim_len;
enum wcn36xx_hal_link_state link_state;
-   struct wcn36xx_vif *vif_priv = (struct wcn36xx_vif *)vif->drv_priv;
+   struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif);
 
wcn36xx_dbg(WCN36XX_DBG_MAC, "mac bss info changed vif %p changed 
0x%08x\n",
vif, changed);
@@ -757,7 +755,7 @@ static void wcn36xx_remove_interface(struct ieee80211_hw 
*hw,
 struct ieee80211_vif *vif)
 {
struct wcn36xx *wcn = hw->priv;
-   struct wcn36xx_vif *vif_priv = (struct wcn36xx_vif *)vif->drv_priv;
+   struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif);
wcn36xx_dbg(WCN36XX_DBG_MAC, "mac remove interface vif %p\n", vif);
 
list_del(_priv->list);
@@ -768,7 +766,7 @@ static int wcn36xx_add_interface(struct ieee80211_hw *hw,
 struct ieee80211_vif *vif)
 {
struct wcn36xx *wcn = hw->priv;
-   struct wcn36xx_vif *vif_priv = (struct wcn36xx_vif *)vif->drv_priv;
+   struct 

[PATCH v3 13/18] wcn36xx: Track association state

2016-04-18 Thread Bjorn Andersson
From: Pontus Fuchs 

Knowing the association state is needed for mc filtering.

Signed-off-by: Pontus Fuchs 
Signed-off-by: Bjorn Andersson 
---
 drivers/net/wireless/ath/wcn36xx/main.c| 2 ++
 drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 1 +
 2 files changed, 3 insertions(+)

diff --git a/drivers/net/wireless/ath/wcn36xx/main.c 
b/drivers/net/wireless/ath/wcn36xx/main.c
index f9c77de94583..253cece1b660 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -655,6 +655,7 @@ static void wcn36xx_bss_info_changed(struct ieee80211_hw 
*hw,
 vif->addr,
 bss_conf->aid);
 
+   vif_priv->sta_assoc = true;
rcu_read_lock();
sta = ieee80211_find_sta(vif, bss_conf->bssid);
if (!sta) {
@@ -686,6 +687,7 @@ static void wcn36xx_bss_info_changed(struct ieee80211_hw 
*hw,
bss_conf->bssid,
vif->addr,
bss_conf->aid);
+   vif_priv->sta_assoc = false;
wcn36xx_smd_set_link_st(wcn,
bss_conf->bssid,
vif->addr,
diff --git a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h 
b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
index 54000db0af1a..7433d67a5929 100644
--- a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
+++ b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
@@ -128,6 +128,7 @@ struct wcn36xx_vif {
u8 dtim_period;
enum ani_ed_type encrypt_type;
bool is_joining;
+   bool sta_assoc;
struct wcn36xx_hal_mac_ssid ssid;
 
/* Power management */
-- 
2.5.0



[PATCH v3 16/18] wcn36xx: Delete BSS before idling link

2016-04-18 Thread Bjorn Andersson
When disabling the beacon we must delete the bss before idling the link.

Signed-off-by: Bjorn Andersson 
---

Changes since v2:
- Added this patch to the series

 drivers/net/wireless/ath/wcn36xx/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/main.c 
b/drivers/net/wireless/ath/wcn36xx/main.c
index c0ba7b0775b3..680217506b3d 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -779,9 +779,9 @@ static void wcn36xx_bss_info_changed(struct ieee80211_hw 
*hw,
wcn36xx_smd_set_link_st(wcn, vif->addr, vif->addr,
link_state);
} else {
+   wcn36xx_smd_delete_bss(wcn, vif);
wcn36xx_smd_set_link_st(wcn, vif->addr, vif->addr,
WCN36XX_HAL_LINK_IDLE_STATE);
-   wcn36xx_smd_delete_bss(wcn, vif);
}
}
 out:
-- 
2.5.0



[PATCH v3 16/18] wcn36xx: Delete BSS before idling link

2016-04-18 Thread Bjorn Andersson
When disabling the beacon we must delete the bss before idling the link.

Signed-off-by: Bjorn Andersson 
---

Changes since v2:
- Added this patch to the series

 drivers/net/wireless/ath/wcn36xx/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/main.c 
b/drivers/net/wireless/ath/wcn36xx/main.c
index c0ba7b0775b3..680217506b3d 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -779,9 +779,9 @@ static void wcn36xx_bss_info_changed(struct ieee80211_hw 
*hw,
wcn36xx_smd_set_link_st(wcn, vif->addr, vif->addr,
link_state);
} else {
+   wcn36xx_smd_delete_bss(wcn, vif);
wcn36xx_smd_set_link_st(wcn, vif->addr, vif->addr,
WCN36XX_HAL_LINK_IDLE_STATE);
-   wcn36xx_smd_delete_bss(wcn, vif);
}
}
 out:
-- 
2.5.0



[PATCH v3 13/18] wcn36xx: Track association state

2016-04-18 Thread Bjorn Andersson
From: Pontus Fuchs 

Knowing the association state is needed for mc filtering.

Signed-off-by: Pontus Fuchs 
Signed-off-by: Bjorn Andersson 
---
 drivers/net/wireless/ath/wcn36xx/main.c| 2 ++
 drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 1 +
 2 files changed, 3 insertions(+)

diff --git a/drivers/net/wireless/ath/wcn36xx/main.c 
b/drivers/net/wireless/ath/wcn36xx/main.c
index f9c77de94583..253cece1b660 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -655,6 +655,7 @@ static void wcn36xx_bss_info_changed(struct ieee80211_hw 
*hw,
 vif->addr,
 bss_conf->aid);
 
+   vif_priv->sta_assoc = true;
rcu_read_lock();
sta = ieee80211_find_sta(vif, bss_conf->bssid);
if (!sta) {
@@ -686,6 +687,7 @@ static void wcn36xx_bss_info_changed(struct ieee80211_hw 
*hw,
bss_conf->bssid,
vif->addr,
bss_conf->aid);
+   vif_priv->sta_assoc = false;
wcn36xx_smd_set_link_st(wcn,
bss_conf->bssid,
vif->addr,
diff --git a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h 
b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
index 54000db0af1a..7433d67a5929 100644
--- a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
+++ b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
@@ -128,6 +128,7 @@ struct wcn36xx_vif {
u8 dtim_period;
enum ani_ed_type encrypt_type;
bool is_joining;
+   bool sta_assoc;
struct wcn36xx_hal_mac_ssid ssid;
 
/* Power management */
-- 
2.5.0



[PATCH v3 18/18] wcn36xx: Fill in capability list

2016-04-18 Thread Bjorn Andersson
Fill in the capability list with more values from the downstream driver.

Signed-off-by: Bjorn Andersson 
---

Changes since v2:
- Added this patch to the series

 drivers/net/wireless/ath/wcn36xx/hal.h  | 39 
 drivers/net/wireless/ath/wcn36xx/main.c | 40 -
 2 files changed, 78 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/hal.h 
b/drivers/net/wireless/ath/wcn36xx/hal.h
index ec64c47f918b..658bfb8baabe 100644
--- a/drivers/net/wireless/ath/wcn36xx/hal.h
+++ b/drivers/net/wireless/ath/wcn36xx/hal.h
@@ -4389,6 +4389,45 @@ enum place_holder_in_cap_bitmap {
RTT = 20,
RATECTRL = 21,
WOW = 22,
+   WLAN_ROAM_SCAN_OFFLOAD = 23,
+   SPECULATIVE_PS_POLL = 24,
+   SCAN_SCH = 25,
+   IBSS_HEARTBEAT_OFFLOAD = 26,
+   WLAN_SCAN_OFFLOAD = 27,
+   WLAN_PERIODIC_TX_PTRN = 28,
+   ADVANCE_TDLS = 29,
+   BATCH_SCAN = 30,
+   FW_IN_TX_PATH = 31,
+   EXTENDED_NSOFFLOAD_SLOT = 32,
+   CH_SWITCH_V1 = 33,
+   HT40_OBSS_SCAN = 34,
+   UPDATE_CHANNEL_LIST = 35,
+   WLAN_MCADDR_FLT = 36,
+   WLAN_CH144 = 37,
+   NAN = 38,
+   TDLS_SCAN_COEXISTENCE = 39,
+   LINK_LAYER_STATS_MEAS = 40,
+   MU_MIMO = 41,
+   EXTENDED_SCAN = 42,
+   DYNAMIC_WMM_PS = 43,
+   MAC_SPOOFED_SCAN = 44,
+   BMU_ERROR_GENERIC_RECOVERY = 45,
+   DISA = 46,
+   FW_STATS = 47,
+   WPS_PRBRSP_TMPL = 48,
+   BCN_IE_FLT_DELTA = 49,
+   TDLS_OFF_CHANNEL = 51,
+   RTT3 = 52,
+   MGMT_FRAME_LOGGING = 53,
+   ENHANCED_TXBD_COMPLETION = 54,
+   LOGGING_ENHANCEMENT = 55,
+   EXT_SCAN_ENHANCED = 56,
+   MEMORY_DUMP_SUPPORTED = 57,
+   PER_PKT_STATS_SUPPORTED = 58,
+   EXT_LL_STAT = 60,
+   WIFI_CONFIG = 61,
+   ANTENNA_DIVERSITY_SELECTION = 62,
+
MAX_FEATURE_SUPPORTED = 128,
 };
 
diff --git a/drivers/net/wireless/ath/wcn36xx/main.c 
b/drivers/net/wireless/ath/wcn36xx/main.c
index 680217506b3d..fe81b2a7c8d9 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -201,7 +201,45 @@ static const char * const wcn36xx_caps_names[] = {
"BCN_FILTER",   /* 19 */
"RTT",  /* 20 */
"RATECTRL", /* 21 */
-   "WOW"   /* 22 */
+   "WOW",  /* 22 */
+   "WLAN_ROAM_SCAN_OFFLOAD",   /* 23 */
+   "SPECULATIVE_PS_POLL",  /* 24 */
+   "SCAN_SCH", /* 25 */
+   "IBSS_HEARTBEAT_OFFLOAD",   /* 26 */
+   "WLAN_SCAN_OFFLOAD",/* 27 */
+   "WLAN_PERIODIC_TX_PTRN",/* 28 */
+   "ADVANCE_TDLS", /* 29 */
+   "BATCH_SCAN",   /* 30 */
+   "FW_IN_TX_PATH",/* 31 */
+   "EXTENDED_NSOFFLOAD_SLOT",  /* 32 */
+   "CH_SWITCH_V1", /* 33 */
+   "HT40_OBSS_SCAN",   /* 34 */
+   "UPDATE_CHANNEL_LIST",  /* 35 */
+   "WLAN_MCADDR_FLT",  /* 36 */
+   "WLAN_CH144",   /* 37 */
+   "NAN",  /* 38 */
+   "TDLS_SCAN_COEXISTENCE",/* 39 */
+   "LINK_LAYER_STATS_MEAS",/* 40 */
+   "MU_MIMO",  /* 41 */
+   "EXTENDED_SCAN",/* 42 */
+   "DYNAMIC_WMM_PS",   /* 43 */
+   "MAC_SPOOFED_SCAN", /* 44 */
+   "BMU_ERROR_GENERIC_RECOVERY",   /* 45 */
+   "DISA", /* 46 */
+   "FW_STATS", /* 47 */
+   "WPS_PRBRSP_TMPL",  /* 48 */
+   "BCN_IE_FLT_DELTA", /* 49 */
+   "TDLS_OFF_CHANNEL", /* 51 */
+   "RTT3", /* 52 */
+   "MGMT_FRAME_LOGGING",   /* 53 */
+   "ENHANCED_TXBD_COMPLETION", /* 54 */
+   "LOGGING_ENHANCEMENT",  /* 55 */
+   "EXT_SCAN_ENHANCED",/* 56 */
+   "MEMORY_DUMP_SUPPORTED",/* 57 */
+   "PER_PKT_STATS_SUPPORTED",  /* 58 */
+   "EXT_LL_STAT",  /* 60 */
+   "WIFI_CONFIG",  /* 61 */
+   "ANTENNA_DIVERSITY_SELECTION",  /* 62 */
 };
 
 static const char *wcn36xx_get_cap_name(enum place_holder_in_cap_bitmap x)
-- 
2.5.0



[PATCH v3 18/18] wcn36xx: Fill in capability list

2016-04-18 Thread Bjorn Andersson
Fill in the capability list with more values from the downstream driver.

Signed-off-by: Bjorn Andersson 
---

Changes since v2:
- Added this patch to the series

 drivers/net/wireless/ath/wcn36xx/hal.h  | 39 
 drivers/net/wireless/ath/wcn36xx/main.c | 40 -
 2 files changed, 78 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/hal.h 
b/drivers/net/wireless/ath/wcn36xx/hal.h
index ec64c47f918b..658bfb8baabe 100644
--- a/drivers/net/wireless/ath/wcn36xx/hal.h
+++ b/drivers/net/wireless/ath/wcn36xx/hal.h
@@ -4389,6 +4389,45 @@ enum place_holder_in_cap_bitmap {
RTT = 20,
RATECTRL = 21,
WOW = 22,
+   WLAN_ROAM_SCAN_OFFLOAD = 23,
+   SPECULATIVE_PS_POLL = 24,
+   SCAN_SCH = 25,
+   IBSS_HEARTBEAT_OFFLOAD = 26,
+   WLAN_SCAN_OFFLOAD = 27,
+   WLAN_PERIODIC_TX_PTRN = 28,
+   ADVANCE_TDLS = 29,
+   BATCH_SCAN = 30,
+   FW_IN_TX_PATH = 31,
+   EXTENDED_NSOFFLOAD_SLOT = 32,
+   CH_SWITCH_V1 = 33,
+   HT40_OBSS_SCAN = 34,
+   UPDATE_CHANNEL_LIST = 35,
+   WLAN_MCADDR_FLT = 36,
+   WLAN_CH144 = 37,
+   NAN = 38,
+   TDLS_SCAN_COEXISTENCE = 39,
+   LINK_LAYER_STATS_MEAS = 40,
+   MU_MIMO = 41,
+   EXTENDED_SCAN = 42,
+   DYNAMIC_WMM_PS = 43,
+   MAC_SPOOFED_SCAN = 44,
+   BMU_ERROR_GENERIC_RECOVERY = 45,
+   DISA = 46,
+   FW_STATS = 47,
+   WPS_PRBRSP_TMPL = 48,
+   BCN_IE_FLT_DELTA = 49,
+   TDLS_OFF_CHANNEL = 51,
+   RTT3 = 52,
+   MGMT_FRAME_LOGGING = 53,
+   ENHANCED_TXBD_COMPLETION = 54,
+   LOGGING_ENHANCEMENT = 55,
+   EXT_SCAN_ENHANCED = 56,
+   MEMORY_DUMP_SUPPORTED = 57,
+   PER_PKT_STATS_SUPPORTED = 58,
+   EXT_LL_STAT = 60,
+   WIFI_CONFIG = 61,
+   ANTENNA_DIVERSITY_SELECTION = 62,
+
MAX_FEATURE_SUPPORTED = 128,
 };
 
diff --git a/drivers/net/wireless/ath/wcn36xx/main.c 
b/drivers/net/wireless/ath/wcn36xx/main.c
index 680217506b3d..fe81b2a7c8d9 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -201,7 +201,45 @@ static const char * const wcn36xx_caps_names[] = {
"BCN_FILTER",   /* 19 */
"RTT",  /* 20 */
"RATECTRL", /* 21 */
-   "WOW"   /* 22 */
+   "WOW",  /* 22 */
+   "WLAN_ROAM_SCAN_OFFLOAD",   /* 23 */
+   "SPECULATIVE_PS_POLL",  /* 24 */
+   "SCAN_SCH", /* 25 */
+   "IBSS_HEARTBEAT_OFFLOAD",   /* 26 */
+   "WLAN_SCAN_OFFLOAD",/* 27 */
+   "WLAN_PERIODIC_TX_PTRN",/* 28 */
+   "ADVANCE_TDLS", /* 29 */
+   "BATCH_SCAN",   /* 30 */
+   "FW_IN_TX_PATH",/* 31 */
+   "EXTENDED_NSOFFLOAD_SLOT",  /* 32 */
+   "CH_SWITCH_V1", /* 33 */
+   "HT40_OBSS_SCAN",   /* 34 */
+   "UPDATE_CHANNEL_LIST",  /* 35 */
+   "WLAN_MCADDR_FLT",  /* 36 */
+   "WLAN_CH144",   /* 37 */
+   "NAN",  /* 38 */
+   "TDLS_SCAN_COEXISTENCE",/* 39 */
+   "LINK_LAYER_STATS_MEAS",/* 40 */
+   "MU_MIMO",  /* 41 */
+   "EXTENDED_SCAN",/* 42 */
+   "DYNAMIC_WMM_PS",   /* 43 */
+   "MAC_SPOOFED_SCAN", /* 44 */
+   "BMU_ERROR_GENERIC_RECOVERY",   /* 45 */
+   "DISA", /* 46 */
+   "FW_STATS", /* 47 */
+   "WPS_PRBRSP_TMPL",  /* 48 */
+   "BCN_IE_FLT_DELTA", /* 49 */
+   "TDLS_OFF_CHANNEL", /* 51 */
+   "RTT3", /* 52 */
+   "MGMT_FRAME_LOGGING",   /* 53 */
+   "ENHANCED_TXBD_COMPLETION", /* 54 */
+   "LOGGING_ENHANCEMENT",  /* 55 */
+   "EXT_SCAN_ENHANCED",/* 56 */
+   "MEMORY_DUMP_SUPPORTED",/* 57 */
+   "PER_PKT_STATS_SUPPORTED",  /* 58 */
+   "EXT_LL_STAT",  /* 60 */
+   "WIFI_CONFIG",  /* 61 */
+   "ANTENNA_DIVERSITY_SELECTION",  /* 62 */
 };
 
 static const char *wcn36xx_get_cap_name(enum place_holder_in_cap_bitmap x)
-- 
2.5.0



Re: [PATCH] tpm_crb: fix mapping of the buffers

2016-04-18 Thread Jarkko Sakkinen
On Mon, Apr 18, 2016 at 05:34:57PM -0600, Jason Gunthorpe wrote:
> On Tue, Apr 19, 2016 at 02:08:00AM +0300, Jarkko Sakkinen wrote:
> > On my Lenovo x250 the following situation occurs:
> > 
> > [18697.813871] tpm_crb MSFT0101:00: can't request region for resource
> > [mem 0xacdff080-0xacdf]
> 
> Sigh, the BIOS vendors seem to be screwing this up a lot.. No doubt
> because the spec doesn't really say what to do very well...
> 
> > The mapping of the control area interleaves the mapping of the command
> > buffer. The control area is mapped over page, which is not right. It
> > should mapped over sizeof(struct crb_control_area).
> 
> Good
> 
> > Fixing this issue unmasks another issue. Command and response buffers
> > can interleave and they do interleave on this machine.
> 
> Do they 100% overlap because one is 'read' and the other is 'write'?

100% so it is kind of sane configuration.

> Or did the BIOS guys screw up the length of one of the regions, and
> they were supposed to be back to back? In which case it is just luck
> this proposed patch solves the issue :(
> 
> The request_io stuff is there specifically to prevent two peices of
> code from trying to control the same registers, I'm really reluctant to
> work-around it like this, though granted, crazy BIOS is a fine good reason.
> 
> Is this patch below enough to deal with it sanely?
> 
> If you do stick with this then:
> 
> > -static void __iomem *crb_map_res(struct device *dev, struct crb_priv *priv,
> > -struct resource *io_res, u64 start, u32 size)
> > +static int crb_map_res(struct device *dev, struct crb_priv *priv,
> > +  int res_i, u64 start, u32 size)
> 
> I wouldn't change the signature at all, just add a counter to the priv and
> 'append to the list'
> 
> This change is creating a lot of needless churn which is not good at
> all for the stable rules.
> 
> Removing the pointer return is not an improvement..

Point taken but then it is better to make the fix even more localized. If
the physical addresses are equal, check the buffer sizes for sanity.
If they are not equal, emit FW_BUG and return -EINVAL.

I'll send an updated patch after I've done all testing rounds with my
laptop and Haswell NUC.

/Jarkko

> >  {
> > +   u8 __iomem *ptr;
> > +   int i;
> > +
> > struct resource new_res = {
> > .start  = start,
> > .end= start + size - 1,
> > @@ -245,12 +257,25 @@ static void __iomem *crb_map_res(struct device *dev, 
> > struct crb_priv *priv,
> >  
> > /* Detect a 64 bit address on a 32 bit system */
> > if (start != new_res.start)
> > -   return ERR_PTR(-EINVAL);
> > +   return -EINVAL;
> >  
> > -   if (!resource_contains(io_res, _res))
> > -   return devm_ioremap_resource(dev, _res);
> > +   for (i = 0; i < CRB_NR_RESOURCES; i++) {
> > +   if (resource_contains(>res[i], _res)) {
> > +   priv->res[res_i] = new_res;
> > +   priv->res_ptr[res_i] = priv->res_ptr[i] +
> > +   (new_res.start - priv->res[i].start);
> > +   return 0;
> > +   }
> > +   }
> 
> 
> Just add:
> 
>id = priv->num_res++;
>priv->res[id] = *io_res;
>priv->res_ptr[id] = priv->iobase + (new_res.start  - io_res->start);
>return priv->res_ptr[id];
> 
> And drop all the other hunks, except for the sizeof change and the
> above loop.
> 
> Maybe print a FW bug if it overlaps with id != 0, that is just
> crazy beans.
> 
> Jason
> 
> diff --git a/drivers/char/tpm/tpm_crb.c b/drivers/char/tpm/tpm_crb.c
> index 20155d55a62b..0a87c813d004 100644
> --- a/drivers/char/tpm/tpm_crb.c
> +++ b/drivers/char/tpm/tpm_crb.c
> @@ -253,7 +253,7 @@ static int crb_map_io(struct acpi_device *device, struct 
> crb_priv *priv,
>   struct list_head resources;
>   struct resource io_res;
>   struct device *dev = >dev;
> - u64 pa;
> + u64 cmd_pa,rsp_pa;
>   int ret;
>  
>   INIT_LIST_HEAD();
> @@ -274,22 +274,33 @@ static int crb_map_io(struct acpi_device *device, 
> struct crb_priv *priv,
>   return PTR_ERR(priv->iobase);
>  
>   priv->cca = crb_map_res(dev, priv, _res, buf->control_address,
> - 0x1000);
> + sizeof(*priv->cca));
>   if (IS_ERR(priv->cca))
>   return PTR_ERR(priv->cca);
>  
> - pa = ((u64) ioread32(>cca->cmd_pa_high) << 32) |
> -   (u64) ioread32(>cca->cmd_pa_low);
> - priv->cmd = crb_map_res(dev, priv, _res, pa,
> - ioread32(>cca->cmd_size));
> - if (IS_ERR(priv->cmd))
> - return PTR_ERR(priv->cmd);
> -
> + cmd_pa = ((u64) ioread32(>cca->cmd_pa_high) << 32) |
> + (u64) ioread32(>cca->cmd_pa_low);
>   memcpy_fromio(, >cca->rsp_pa, 8);
> - pa = le64_to_cpu(pa);
> - priv->rsp = crb_map_res(dev, priv, _res, pa,
> - ioread32(>cca->rsp_size));
> - 

Re: [PATCH] tpm_crb: fix mapping of the buffers

2016-04-18 Thread Jarkko Sakkinen
On Mon, Apr 18, 2016 at 05:34:57PM -0600, Jason Gunthorpe wrote:
> On Tue, Apr 19, 2016 at 02:08:00AM +0300, Jarkko Sakkinen wrote:
> > On my Lenovo x250 the following situation occurs:
> > 
> > [18697.813871] tpm_crb MSFT0101:00: can't request region for resource
> > [mem 0xacdff080-0xacdf]
> 
> Sigh, the BIOS vendors seem to be screwing this up a lot.. No doubt
> because the spec doesn't really say what to do very well...
> 
> > The mapping of the control area interleaves the mapping of the command
> > buffer. The control area is mapped over page, which is not right. It
> > should mapped over sizeof(struct crb_control_area).
> 
> Good
> 
> > Fixing this issue unmasks another issue. Command and response buffers
> > can interleave and they do interleave on this machine.
> 
> Do they 100% overlap because one is 'read' and the other is 'write'?

100% so it is kind of sane configuration.

> Or did the BIOS guys screw up the length of one of the regions, and
> they were supposed to be back to back? In which case it is just luck
> this proposed patch solves the issue :(
> 
> The request_io stuff is there specifically to prevent two peices of
> code from trying to control the same registers, I'm really reluctant to
> work-around it like this, though granted, crazy BIOS is a fine good reason.
> 
> Is this patch below enough to deal with it sanely?
> 
> If you do stick with this then:
> 
> > -static void __iomem *crb_map_res(struct device *dev, struct crb_priv *priv,
> > -struct resource *io_res, u64 start, u32 size)
> > +static int crb_map_res(struct device *dev, struct crb_priv *priv,
> > +  int res_i, u64 start, u32 size)
> 
> I wouldn't change the signature at all, just add a counter to the priv and
> 'append to the list'
> 
> This change is creating a lot of needless churn which is not good at
> all for the stable rules.
> 
> Removing the pointer return is not an improvement..

Point taken but then it is better to make the fix even more localized. If
the physical addresses are equal, check the buffer sizes for sanity.
If they are not equal, emit FW_BUG and return -EINVAL.

I'll send an updated patch after I've done all testing rounds with my
laptop and Haswell NUC.

/Jarkko

> >  {
> > +   u8 __iomem *ptr;
> > +   int i;
> > +
> > struct resource new_res = {
> > .start  = start,
> > .end= start + size - 1,
> > @@ -245,12 +257,25 @@ static void __iomem *crb_map_res(struct device *dev, 
> > struct crb_priv *priv,
> >  
> > /* Detect a 64 bit address on a 32 bit system */
> > if (start != new_res.start)
> > -   return ERR_PTR(-EINVAL);
> > +   return -EINVAL;
> >  
> > -   if (!resource_contains(io_res, _res))
> > -   return devm_ioremap_resource(dev, _res);
> > +   for (i = 0; i < CRB_NR_RESOURCES; i++) {
> > +   if (resource_contains(>res[i], _res)) {
> > +   priv->res[res_i] = new_res;
> > +   priv->res_ptr[res_i] = priv->res_ptr[i] +
> > +   (new_res.start - priv->res[i].start);
> > +   return 0;
> > +   }
> > +   }
> 
> 
> Just add:
> 
>id = priv->num_res++;
>priv->res[id] = *io_res;
>priv->res_ptr[id] = priv->iobase + (new_res.start  - io_res->start);
>return priv->res_ptr[id];
> 
> And drop all the other hunks, except for the sizeof change and the
> above loop.
> 
> Maybe print a FW bug if it overlaps with id != 0, that is just
> crazy beans.
> 
> Jason
> 
> diff --git a/drivers/char/tpm/tpm_crb.c b/drivers/char/tpm/tpm_crb.c
> index 20155d55a62b..0a87c813d004 100644
> --- a/drivers/char/tpm/tpm_crb.c
> +++ b/drivers/char/tpm/tpm_crb.c
> @@ -253,7 +253,7 @@ static int crb_map_io(struct acpi_device *device, struct 
> crb_priv *priv,
>   struct list_head resources;
>   struct resource io_res;
>   struct device *dev = >dev;
> - u64 pa;
> + u64 cmd_pa,rsp_pa;
>   int ret;
>  
>   INIT_LIST_HEAD();
> @@ -274,22 +274,33 @@ static int crb_map_io(struct acpi_device *device, 
> struct crb_priv *priv,
>   return PTR_ERR(priv->iobase);
>  
>   priv->cca = crb_map_res(dev, priv, _res, buf->control_address,
> - 0x1000);
> + sizeof(*priv->cca));
>   if (IS_ERR(priv->cca))
>   return PTR_ERR(priv->cca);
>  
> - pa = ((u64) ioread32(>cca->cmd_pa_high) << 32) |
> -   (u64) ioread32(>cca->cmd_pa_low);
> - priv->cmd = crb_map_res(dev, priv, _res, pa,
> - ioread32(>cca->cmd_size));
> - if (IS_ERR(priv->cmd))
> - return PTR_ERR(priv->cmd);
> -
> + cmd_pa = ((u64) ioread32(>cca->cmd_pa_high) << 32) |
> + (u64) ioread32(>cca->cmd_pa_low);
>   memcpy_fromio(, >cca->rsp_pa, 8);
> - pa = le64_to_cpu(pa);
> - priv->rsp = crb_map_res(dev, priv, _res, pa,
> - ioread32(>cca->rsp_size));
> - 

[RFC v4 4/4] CMDQ: suspend/resume protection

2016-04-18 Thread HS Liao
Add suspend/resume protection mechanism to prevent active task(s) in
suspend.

Signed-off-by: HS Liao 
---
 drivers/soc/mediatek/mtk-cmdq.c |  289 ++-
 1 file changed, 282 insertions(+), 7 deletions(-)

diff --git a/drivers/soc/mediatek/mtk-cmdq.c b/drivers/soc/mediatek/mtk-cmdq.c
index 2224459..63adb7c 100644
--- a/drivers/soc/mediatek/mtk-cmdq.c
+++ b/drivers/soc/mediatek/mtk-cmdq.c
@@ -51,6 +51,7 @@
 #define CMDQ_CLK_NAME  "gce"
 
 #define CMDQ_CURR_IRQ_STATUS_OFFSET0x010
+#define CMDQ_CURR_LOADED_THR_OFFSET0x018
 #define CMDQ_THR_SLOT_CYCLES_OFFSET0x030
 
 #define CMDQ_THR_BASE  0x100
@@ -150,6 +151,7 @@ enum cmdq_code {
 enum cmdq_task_state {
TASK_STATE_IDLE,/* free task */
TASK_STATE_BUSY,/* task running on a thread */
+   TASK_STATE_KILLED,  /* task process being killed */
TASK_STATE_ERROR,   /* task execution error */
TASK_STATE_START_ERROR, /* fail to start task execution */
TASK_STATE_DONE,/* task finished */
@@ -198,6 +200,8 @@ struct cmdq_thread {
 
 struct cmdq {
struct device   *dev;
+   struct notifier_block   pm_notifier;
+
void __iomem*base;
u32 irq;
 
@@ -220,8 +224,14 @@ struct cmdq {
 
/* mutex, spinlock, flag */
struct mutextask_mutex; /* for task list */
+   spinlock_t  thread_lock;/* for cmdq hardware thread */
+   atomic_tthread_usage;
spinlock_t  exec_lock;  /* for exec task */
 
+   /* suspend */
+   atomic_tsuspending;
+   boolsuspended;
+
/* wait thread acquiring */
wait_queue_head_t   thread_dispatch_queue;
 
@@ -377,14 +387,22 @@ static struct cmdq_task *cmdq_task_create(struct cmdq 
*cmdq)
return task;
 }
 
-static void cmdq_task_release_internal(struct cmdq_task *task)
+static void cmdq_task_release_unlocked(struct cmdq_task *task)
 {
struct cmdq *cmdq = task->cmdq;
 
-   mutex_lock(>cmdq->task_mutex);
+   /* This func should be inside cmdq->task_mutex mutex */
+   lockdep_assert_held(>task_mutex);
+
cmdq_task_free_command_buffer(task);
list_del(>list_entry);
kmem_cache_free(cmdq->task_cache, task);
+}
+
+static void cmdq_task_release_internal(struct cmdq_task *task)
+{
+   mutex_lock(>cmdq->task_mutex);
+   cmdq_task_release_unlocked(task);
mutex_unlock(>cmdq->task_mutex);
 }
 
@@ -503,6 +521,7 @@ static struct cmdq_thread *cmdq_thread_get(struct cmdq 
*cmdq, u64 flag)
return NULL;
 
cmdq_clk_enable(cmdq);
+   atomic_inc(>thread_usage);
return thread;
 }
 
@@ -512,6 +531,7 @@ static void cmdq_thread_put(struct cmdq *cmdq, struct 
cmdq_thread *thread)
return;
 
cmdq_clk_disable(cmdq);
+   atomic_dec(>thread_usage);
 }
 
 static int cmdq_thread_suspend(struct cmdq *cmdq, struct cmdq_thread *thread)
@@ -613,6 +633,80 @@ static int cmdq_thread_remove_task_by_index(struct 
cmdq_thread *thread,
return 0;
 }
 
+static int cmdq_thread_force_remove_task(struct cmdq_task *task)
+{
+   struct cmdq *cmdq = task->cmdq;
+   struct cmdq_thread *thread = task->thread;
+   int status;
+   int cookie;
+   struct cmdq_task *exec_task;
+
+   status = cmdq_thread_suspend(cmdq, thread);
+
+   cmdq_thread_writel(thread, CMDQ_THR_NO_TIMEOUT,
+  CMDQ_THR_INST_CYCLES_OFFSET);
+
+   /* The cookie of the task currently being processed */
+   cookie = cmdq_thread_get_cookie(thread) + 1;
+
+   exec_task = thread->cur_task[cookie % CMDQ_MAX_TASK_IN_THREAD];
+   if (exec_task == task) {
+   dma_addr_t eoc_pa = task->mva_base + task->command_size - 16;
+
+   /* The task is executed now, set the PC to EOC for bypass */
+   cmdq_thread_writel(thread, eoc_pa, CMDQ_THR_CURR_ADDR_OFFSET);
+
+   thread->cur_task[cookie % CMDQ_MAX_TASK_IN_THREAD] = NULL;
+   task->task_state = TASK_STATE_KILLED;
+   } else {
+   int i, j;
+   u32 *task_base, *exec_task_base;
+
+   j = thread->task_count;
+   for (i = cookie; j > 0; j--, i++) {
+   i %= CMDQ_MAX_TASK_IN_THREAD;
+
+   exec_task = thread->cur_task[i];
+   if (!exec_task)
+   continue;
+
+   task_base = task->va_base;
+   exec_task_base = exec_task->va_base;
+   if ((exec_task_base[exec_task->num_cmd - 1] ==
+CMDQ_JUMP_BY_OFFSET) &&
+   (exec_task_base[exec_task->num_cmd - 2] ==
+CMDQ_JUMP_TO_BEGIN)) {
+   

[RFC v4 4/4] CMDQ: suspend/resume protection

2016-04-18 Thread HS Liao
Add suspend/resume protection mechanism to prevent active task(s) in
suspend.

Signed-off-by: HS Liao 
---
 drivers/soc/mediatek/mtk-cmdq.c |  289 ++-
 1 file changed, 282 insertions(+), 7 deletions(-)

diff --git a/drivers/soc/mediatek/mtk-cmdq.c b/drivers/soc/mediatek/mtk-cmdq.c
index 2224459..63adb7c 100644
--- a/drivers/soc/mediatek/mtk-cmdq.c
+++ b/drivers/soc/mediatek/mtk-cmdq.c
@@ -51,6 +51,7 @@
 #define CMDQ_CLK_NAME  "gce"
 
 #define CMDQ_CURR_IRQ_STATUS_OFFSET0x010
+#define CMDQ_CURR_LOADED_THR_OFFSET0x018
 #define CMDQ_THR_SLOT_CYCLES_OFFSET0x030
 
 #define CMDQ_THR_BASE  0x100
@@ -150,6 +151,7 @@ enum cmdq_code {
 enum cmdq_task_state {
TASK_STATE_IDLE,/* free task */
TASK_STATE_BUSY,/* task running on a thread */
+   TASK_STATE_KILLED,  /* task process being killed */
TASK_STATE_ERROR,   /* task execution error */
TASK_STATE_START_ERROR, /* fail to start task execution */
TASK_STATE_DONE,/* task finished */
@@ -198,6 +200,8 @@ struct cmdq_thread {
 
 struct cmdq {
struct device   *dev;
+   struct notifier_block   pm_notifier;
+
void __iomem*base;
u32 irq;
 
@@ -220,8 +224,14 @@ struct cmdq {
 
/* mutex, spinlock, flag */
struct mutextask_mutex; /* for task list */
+   spinlock_t  thread_lock;/* for cmdq hardware thread */
+   atomic_tthread_usage;
spinlock_t  exec_lock;  /* for exec task */
 
+   /* suspend */
+   atomic_tsuspending;
+   boolsuspended;
+
/* wait thread acquiring */
wait_queue_head_t   thread_dispatch_queue;
 
@@ -377,14 +387,22 @@ static struct cmdq_task *cmdq_task_create(struct cmdq 
*cmdq)
return task;
 }
 
-static void cmdq_task_release_internal(struct cmdq_task *task)
+static void cmdq_task_release_unlocked(struct cmdq_task *task)
 {
struct cmdq *cmdq = task->cmdq;
 
-   mutex_lock(>cmdq->task_mutex);
+   /* This func should be inside cmdq->task_mutex mutex */
+   lockdep_assert_held(>task_mutex);
+
cmdq_task_free_command_buffer(task);
list_del(>list_entry);
kmem_cache_free(cmdq->task_cache, task);
+}
+
+static void cmdq_task_release_internal(struct cmdq_task *task)
+{
+   mutex_lock(>cmdq->task_mutex);
+   cmdq_task_release_unlocked(task);
mutex_unlock(>cmdq->task_mutex);
 }
 
@@ -503,6 +521,7 @@ static struct cmdq_thread *cmdq_thread_get(struct cmdq 
*cmdq, u64 flag)
return NULL;
 
cmdq_clk_enable(cmdq);
+   atomic_inc(>thread_usage);
return thread;
 }
 
@@ -512,6 +531,7 @@ static void cmdq_thread_put(struct cmdq *cmdq, struct 
cmdq_thread *thread)
return;
 
cmdq_clk_disable(cmdq);
+   atomic_dec(>thread_usage);
 }
 
 static int cmdq_thread_suspend(struct cmdq *cmdq, struct cmdq_thread *thread)
@@ -613,6 +633,80 @@ static int cmdq_thread_remove_task_by_index(struct 
cmdq_thread *thread,
return 0;
 }
 
+static int cmdq_thread_force_remove_task(struct cmdq_task *task)
+{
+   struct cmdq *cmdq = task->cmdq;
+   struct cmdq_thread *thread = task->thread;
+   int status;
+   int cookie;
+   struct cmdq_task *exec_task;
+
+   status = cmdq_thread_suspend(cmdq, thread);
+
+   cmdq_thread_writel(thread, CMDQ_THR_NO_TIMEOUT,
+  CMDQ_THR_INST_CYCLES_OFFSET);
+
+   /* The cookie of the task currently being processed */
+   cookie = cmdq_thread_get_cookie(thread) + 1;
+
+   exec_task = thread->cur_task[cookie % CMDQ_MAX_TASK_IN_THREAD];
+   if (exec_task == task) {
+   dma_addr_t eoc_pa = task->mva_base + task->command_size - 16;
+
+   /* The task is executed now, set the PC to EOC for bypass */
+   cmdq_thread_writel(thread, eoc_pa, CMDQ_THR_CURR_ADDR_OFFSET);
+
+   thread->cur_task[cookie % CMDQ_MAX_TASK_IN_THREAD] = NULL;
+   task->task_state = TASK_STATE_KILLED;
+   } else {
+   int i, j;
+   u32 *task_base, *exec_task_base;
+
+   j = thread->task_count;
+   for (i = cookie; j > 0; j--, i++) {
+   i %= CMDQ_MAX_TASK_IN_THREAD;
+
+   exec_task = thread->cur_task[i];
+   if (!exec_task)
+   continue;
+
+   task_base = task->va_base;
+   exec_task_base = exec_task->va_base;
+   if ((exec_task_base[exec_task->num_cmd - 1] ==
+CMDQ_JUMP_BY_OFFSET) &&
+   (exec_task_base[exec_task->num_cmd - 2] ==
+CMDQ_JUMP_TO_BEGIN)) {
+   /* reached 

[RFC v4 1/4] dt-bindings: soc: Add documentation for the MediaTek GCE unit

2016-04-18 Thread HS Liao
This adds documentation for the MediaTek Global Command Engine (GCE) unit
found in MT8173 SoCs.

Signed-off-by: HS Liao 
Acked-by: Rob Herring 
---
 .../devicetree/bindings/soc/mediatek/gce.txt   |   34 
 1 file changed, 34 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/mediatek/gce.txt

diff --git a/Documentation/devicetree/bindings/soc/mediatek/gce.txt 
b/Documentation/devicetree/bindings/soc/mediatek/gce.txt
new file mode 100644
index 000..eff07e2
--- /dev/null
+++ b/Documentation/devicetree/bindings/soc/mediatek/gce.txt
@@ -0,0 +1,34 @@
+MediaTek GCE
+===
+
+The Global Command Engine (GCE) is used to help read/write registers with
+critical time limitation, such as updating display configuration during the
+vblank. The GCE can be used to implement the Command Queue (CMDQ) driver.
+
+Required properties:
+- compatible: Must be "mediatek,mt8173-gce"
+- reg: Address range of the GCE unit
+- interrupts: The interrupt signal from the GCE block
+- clock: Clocks according to the common clock binding
+- clock-names: Must be "gce" to stand for GCE clock
+
+Required properties for a client device:
+- mediatek,gce: Should point to the respective GCE block
+
+Example:
+
+   gce: gce@10212000 {
+   compatible = "mediatek,mt8173-gce";
+   reg = <0 0x10212000 0 0x1000>;
+   interrupts = ;
+   clocks = < CLK_INFRA_GCE>;
+   clock-names = "gce";
+   };
+
+Example for a client device:
+
+   mmsys: clock-controller@1400 {
+   compatible = "mediatek,mt8173-mmsys";
+   mediatek,gce = <>;
+   ...
+   };
-- 
1.7.9.5



[RFC v4 2/4] CMDQ: Mediatek CMDQ driver

2016-04-18 Thread HS Liao
This patch is first version of Mediatek Command Queue(CMDQ) driver. The
CMDQ is used to help read/write registers with critical time limitation,
such as updating display configuration during the vblank. It controls
Global Command Engine (GCE) hardware to achieve this requirement.
Currently, CMDQ only supports display related hardwares, but we expect
it can be extended to other hardwares for future requirements.

Signed-off-by: HS Liao 
---
 drivers/soc/mediatek/Kconfig|   10 +
 drivers/soc/mediatek/Makefile   |1 +
 drivers/soc/mediatek/mtk-cmdq.c | 1722 +++
 include/soc/mediatek/cmdq.h |  197 +
 4 files changed, 1930 insertions(+)
 create mode 100644 drivers/soc/mediatek/mtk-cmdq.c
 create mode 100644 include/soc/mediatek/cmdq.h

diff --git a/drivers/soc/mediatek/Kconfig b/drivers/soc/mediatek/Kconfig
index 0a4ea80..c4ad75c 100644
--- a/drivers/soc/mediatek/Kconfig
+++ b/drivers/soc/mediatek/Kconfig
@@ -1,6 +1,16 @@
 #
 # MediaTek SoC drivers
 #
+config MTK_CMDQ
+   bool "MediaTek CMDQ Support"
+   depends on ARCH_MEDIATEK || COMPILE_TEST
+   select MTK_INFRACFG
+   help
+ Say yes here to add support for the MediaTek Command Queue (CMDQ)
+ driver. The CMDQ is used to help read/write registers with critical
+ time limitation, such as updating display configuration during the
+ vblank.
+
 config MTK_INFRACFG
bool "MediaTek INFRACFG Support"
depends on ARCH_MEDIATEK || COMPILE_TEST
diff --git a/drivers/soc/mediatek/Makefile b/drivers/soc/mediatek/Makefile
index 12998b0..f7397ef 100644
--- a/drivers/soc/mediatek/Makefile
+++ b/drivers/soc/mediatek/Makefile
@@ -1,3 +1,4 @@
+obj-$(CONFIG_MTK_CMDQ) += mtk-cmdq.o
 obj-$(CONFIG_MTK_INFRACFG) += mtk-infracfg.o
 obj-$(CONFIG_MTK_PMIC_WRAP) += mtk-pmic-wrap.o
 obj-$(CONFIG_MTK_SCPSYS) += mtk-scpsys.o
diff --git a/drivers/soc/mediatek/mtk-cmdq.c b/drivers/soc/mediatek/mtk-cmdq.c
new file mode 100644
index 000..2224459
--- /dev/null
+++ b/drivers/soc/mediatek/mtk-cmdq.c
@@ -0,0 +1,1722 @@
+/*
+ * Copyright (c) 2015 MediaTek Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * 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 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define CMDQ_MAX_THREAD_COUNT  3 /* general, main, sub */
+#define CMDQ_MAX_TASK_IN_THREAD2
+
+#define CMDQ_INITIAL_CMD_BLOCK_SIZEPAGE_SIZE
+#define CMDQ_INST_SIZE 8 /* instruction is 64-bit */
+
+/*
+ * cmdq_thread cookie value is from 0 to CMDQ_MAX_COOKIE_VALUE.
+ * And, this value also be used as MASK.
+ */
+#define CMDQ_MAX_COOKIE_VALUE  0x
+#define CMDQ_COOKIE_MASK   CMDQ_MAX_COOKIE_VALUE
+
+#define CMDQ_DEFAULT_TIMEOUT_MS1000
+#define CMDQ_ACQUIRE_THREAD_TIMEOUT_MS 5000
+
+#define CMDQ_DRIVER_DEVICE_NAME"mtk_cmdq"
+
+#define CMDQ_CLK_NAME  "gce"
+
+#define CMDQ_CURR_IRQ_STATUS_OFFSET0x010
+#define CMDQ_THR_SLOT_CYCLES_OFFSET0x030
+
+#define CMDQ_THR_BASE  0x100
+#define CMDQ_THR_SHIFT 0x080
+#define CMDQ_THR_WARM_RESET_OFFSET 0x00
+#define CMDQ_THR_ENABLE_TASK_OFFSET0x04
+#define CMDQ_THR_SUSPEND_TASK_OFFSET   0x08
+#define CMDQ_THR_CURR_STATUS_OFFSET0x0c
+#define CMDQ_THR_IRQ_STATUS_OFFSET 0x10
+#define CMDQ_THR_IRQ_ENABLE_OFFSET 0x14
+#define CMDQ_THR_CURR_ADDR_OFFSET  0x20
+#define CMDQ_THR_END_ADDR_OFFSET   0x24
+#define CMDQ_THR_EXEC_CNT_OFFSET   0x28
+#define CMDQ_THR_CFG_OFFSET0x40
+#define CMDQ_THR_INST_CYCLES_OFFSET0x50
+
+#define CMDQ_SYNC_TOKEN_SETBIT(16)
+#define CMDQ_IRQ_MASK  0x
+
+#define CMDQ_THR_ENABLED   0x1
+#define CMDQ_THR_DISABLED  0x0
+#define CMDQ_THR_SUSPEND   0x1
+#define CMDQ_THR_RESUME0x0
+#define CMDQ_THR_STATUS_SUSPENDED  BIT(1)
+#define CMDQ_THR_WARM_RESETBIT(0)
+#define CMDQ_THR_SLOT_CYCLES   0x3200
+#define CMDQ_THR_NO_TIMEOUT0x0
+#define CMDQ_THR_PRIORITY  3
+#define CMDQ_THR_IRQ_DONE  0x1
+#define CMDQ_THR_IRQ_ERROR 0x12
+#define CMDQ_THR_IRQ_EN0x13 /* done + error */
+#define CMDQ_THR_IRQ_MASK  0x13
+#define CMDQ_THR_EXECUTING BIT(31)
+
+#define CMDQ_ARG_A_MASK0xff
+#define 

[RFC v4 1/4] dt-bindings: soc: Add documentation for the MediaTek GCE unit

2016-04-18 Thread HS Liao
This adds documentation for the MediaTek Global Command Engine (GCE) unit
found in MT8173 SoCs.

Signed-off-by: HS Liao 
Acked-by: Rob Herring 
---
 .../devicetree/bindings/soc/mediatek/gce.txt   |   34 
 1 file changed, 34 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/mediatek/gce.txt

diff --git a/Documentation/devicetree/bindings/soc/mediatek/gce.txt 
b/Documentation/devicetree/bindings/soc/mediatek/gce.txt
new file mode 100644
index 000..eff07e2
--- /dev/null
+++ b/Documentation/devicetree/bindings/soc/mediatek/gce.txt
@@ -0,0 +1,34 @@
+MediaTek GCE
+===
+
+The Global Command Engine (GCE) is used to help read/write registers with
+critical time limitation, such as updating display configuration during the
+vblank. The GCE can be used to implement the Command Queue (CMDQ) driver.
+
+Required properties:
+- compatible: Must be "mediatek,mt8173-gce"
+- reg: Address range of the GCE unit
+- interrupts: The interrupt signal from the GCE block
+- clock: Clocks according to the common clock binding
+- clock-names: Must be "gce" to stand for GCE clock
+
+Required properties for a client device:
+- mediatek,gce: Should point to the respective GCE block
+
+Example:
+
+   gce: gce@10212000 {
+   compatible = "mediatek,mt8173-gce";
+   reg = <0 0x10212000 0 0x1000>;
+   interrupts = ;
+   clocks = < CLK_INFRA_GCE>;
+   clock-names = "gce";
+   };
+
+Example for a client device:
+
+   mmsys: clock-controller@1400 {
+   compatible = "mediatek,mt8173-mmsys";
+   mediatek,gce = <>;
+   ...
+   };
-- 
1.7.9.5



[RFC v4 2/4] CMDQ: Mediatek CMDQ driver

2016-04-18 Thread HS Liao
This patch is first version of Mediatek Command Queue(CMDQ) driver. The
CMDQ is used to help read/write registers with critical time limitation,
such as updating display configuration during the vblank. It controls
Global Command Engine (GCE) hardware to achieve this requirement.
Currently, CMDQ only supports display related hardwares, but we expect
it can be extended to other hardwares for future requirements.

Signed-off-by: HS Liao 
---
 drivers/soc/mediatek/Kconfig|   10 +
 drivers/soc/mediatek/Makefile   |1 +
 drivers/soc/mediatek/mtk-cmdq.c | 1722 +++
 include/soc/mediatek/cmdq.h |  197 +
 4 files changed, 1930 insertions(+)
 create mode 100644 drivers/soc/mediatek/mtk-cmdq.c
 create mode 100644 include/soc/mediatek/cmdq.h

diff --git a/drivers/soc/mediatek/Kconfig b/drivers/soc/mediatek/Kconfig
index 0a4ea80..c4ad75c 100644
--- a/drivers/soc/mediatek/Kconfig
+++ b/drivers/soc/mediatek/Kconfig
@@ -1,6 +1,16 @@
 #
 # MediaTek SoC drivers
 #
+config MTK_CMDQ
+   bool "MediaTek CMDQ Support"
+   depends on ARCH_MEDIATEK || COMPILE_TEST
+   select MTK_INFRACFG
+   help
+ Say yes here to add support for the MediaTek Command Queue (CMDQ)
+ driver. The CMDQ is used to help read/write registers with critical
+ time limitation, such as updating display configuration during the
+ vblank.
+
 config MTK_INFRACFG
bool "MediaTek INFRACFG Support"
depends on ARCH_MEDIATEK || COMPILE_TEST
diff --git a/drivers/soc/mediatek/Makefile b/drivers/soc/mediatek/Makefile
index 12998b0..f7397ef 100644
--- a/drivers/soc/mediatek/Makefile
+++ b/drivers/soc/mediatek/Makefile
@@ -1,3 +1,4 @@
+obj-$(CONFIG_MTK_CMDQ) += mtk-cmdq.o
 obj-$(CONFIG_MTK_INFRACFG) += mtk-infracfg.o
 obj-$(CONFIG_MTK_PMIC_WRAP) += mtk-pmic-wrap.o
 obj-$(CONFIG_MTK_SCPSYS) += mtk-scpsys.o
diff --git a/drivers/soc/mediatek/mtk-cmdq.c b/drivers/soc/mediatek/mtk-cmdq.c
new file mode 100644
index 000..2224459
--- /dev/null
+++ b/drivers/soc/mediatek/mtk-cmdq.c
@@ -0,0 +1,1722 @@
+/*
+ * Copyright (c) 2015 MediaTek Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * 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 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define CMDQ_MAX_THREAD_COUNT  3 /* general, main, sub */
+#define CMDQ_MAX_TASK_IN_THREAD2
+
+#define CMDQ_INITIAL_CMD_BLOCK_SIZEPAGE_SIZE
+#define CMDQ_INST_SIZE 8 /* instruction is 64-bit */
+
+/*
+ * cmdq_thread cookie value is from 0 to CMDQ_MAX_COOKIE_VALUE.
+ * And, this value also be used as MASK.
+ */
+#define CMDQ_MAX_COOKIE_VALUE  0x
+#define CMDQ_COOKIE_MASK   CMDQ_MAX_COOKIE_VALUE
+
+#define CMDQ_DEFAULT_TIMEOUT_MS1000
+#define CMDQ_ACQUIRE_THREAD_TIMEOUT_MS 5000
+
+#define CMDQ_DRIVER_DEVICE_NAME"mtk_cmdq"
+
+#define CMDQ_CLK_NAME  "gce"
+
+#define CMDQ_CURR_IRQ_STATUS_OFFSET0x010
+#define CMDQ_THR_SLOT_CYCLES_OFFSET0x030
+
+#define CMDQ_THR_BASE  0x100
+#define CMDQ_THR_SHIFT 0x080
+#define CMDQ_THR_WARM_RESET_OFFSET 0x00
+#define CMDQ_THR_ENABLE_TASK_OFFSET0x04
+#define CMDQ_THR_SUSPEND_TASK_OFFSET   0x08
+#define CMDQ_THR_CURR_STATUS_OFFSET0x0c
+#define CMDQ_THR_IRQ_STATUS_OFFSET 0x10
+#define CMDQ_THR_IRQ_ENABLE_OFFSET 0x14
+#define CMDQ_THR_CURR_ADDR_OFFSET  0x20
+#define CMDQ_THR_END_ADDR_OFFSET   0x24
+#define CMDQ_THR_EXEC_CNT_OFFSET   0x28
+#define CMDQ_THR_CFG_OFFSET0x40
+#define CMDQ_THR_INST_CYCLES_OFFSET0x50
+
+#define CMDQ_SYNC_TOKEN_SETBIT(16)
+#define CMDQ_IRQ_MASK  0x
+
+#define CMDQ_THR_ENABLED   0x1
+#define CMDQ_THR_DISABLED  0x0
+#define CMDQ_THR_SUSPEND   0x1
+#define CMDQ_THR_RESUME0x0
+#define CMDQ_THR_STATUS_SUSPENDED  BIT(1)
+#define CMDQ_THR_WARM_RESETBIT(0)
+#define CMDQ_THR_SLOT_CYCLES   0x3200
+#define CMDQ_THR_NO_TIMEOUT0x0
+#define CMDQ_THR_PRIORITY  3
+#define CMDQ_THR_IRQ_DONE  0x1
+#define CMDQ_THR_IRQ_ERROR 0x12
+#define CMDQ_THR_IRQ_EN0x13 /* done + error */
+#define CMDQ_THR_IRQ_MASK  0x13
+#define CMDQ_THR_EXECUTING BIT(31)
+
+#define CMDQ_ARG_A_MASK0xff
+#define CMDQ_ARG_A_WRITE_MASK  

[RFC v4 3/4] arm64: dts: mt8173: Add GCE node

2016-04-18 Thread HS Liao
This patch adds the device node of the GCE hardware for CMDQ module.

Signed-off-by: HS Liao 
---
 arch/arm64/boot/dts/mediatek/mt8173.dtsi |8 
 1 file changed, 8 insertions(+)

diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi 
b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
index eab7efc..63d1718 100644
--- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
@@ -300,6 +300,14 @@
#clock-cells = <1>;
};
 
+   gce: gce@10212000 {
+   compatible = "mediatek,mt8173-gce";
+   reg = <0 0x10212000 0 0x1000>;
+   interrupts = ;
+   clocks = < CLK_INFRA_GCE>;
+   clock-names = "gce";
+   };
+
gic: interrupt-controller@1022 {
compatible = "arm,gic-400";
#interrupt-cells = <3>;
-- 
1.7.9.5



[RFC v4 3/4] arm64: dts: mt8173: Add GCE node

2016-04-18 Thread HS Liao
This patch adds the device node of the GCE hardware for CMDQ module.

Signed-off-by: HS Liao 
---
 arch/arm64/boot/dts/mediatek/mt8173.dtsi |8 
 1 file changed, 8 insertions(+)

diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi 
b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
index eab7efc..63d1718 100644
--- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
@@ -300,6 +300,14 @@
#clock-cells = <1>;
};
 
+   gce: gce@10212000 {
+   compatible = "mediatek,mt8173-gce";
+   reg = <0 0x10212000 0 0x1000>;
+   interrupts = ;
+   clocks = < CLK_INFRA_GCE>;
+   clock-names = "gce";
+   };
+
gic: interrupt-controller@1022 {
compatible = "arm,gic-400";
#interrupt-cells = <3>;
-- 
1.7.9.5



[RFC v4 0/4] Mediatek MT8173 CMDQ support

2016-04-18 Thread HS Liao

Hi,

This is Mediatek MT8173 Command Queue(CMDQ) driver. The CMDQ is used
to help read/write registers with critical time limitation, such as
updating display configuration during the vblank. It controls Global
Command Engine (GCE) hardware to achieve this requirement.

These patches have a build dependency on top of v4.6-rc1.

Changes since v3:
 - rebase to v4.6-rc1
 - pass both arm and arm64 arch compilation
 - fix bug of removing free task list in v3
 - marchal return error code
 - use offset instead of physical address
 - centralize release flow
 - add "suspend/resume protection" patch
 - add queue_work() in cmdq_auto_release() to prevent no more flush
   or interrupt to consume waiting tasks
 - remove some debug or redundant code
 - rewrite some code to shrink code size

Best regards,
HS Liao

HS Liao (4):
  dt-bindings: soc: Add documentation for the MediaTek GCE unit
  CMDQ: Mediatek CMDQ driver
  arm64: dts: mt8173: Add GCE node
  CMDQ: suspend/resume protection

 .../devicetree/bindings/soc/mediatek/gce.txt   |   34 +
 arch/arm64/boot/dts/mediatek/mt8173.dtsi   |8 +
 drivers/soc/mediatek/Kconfig   |   10 +
 drivers/soc/mediatek/Makefile  |1 +
 drivers/soc/mediatek/mtk-cmdq.c| 1997 
 include/soc/mediatek/cmdq.h|  197 ++
 6 files changed, 2247 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/mediatek/gce.txt
 create mode 100644 drivers/soc/mediatek/mtk-cmdq.c
 create mode 100644 include/soc/mediatek/cmdq.h

-- 
1.7.9.5




[RFC v4 0/4] Mediatek MT8173 CMDQ support

2016-04-18 Thread HS Liao

Hi,

This is Mediatek MT8173 Command Queue(CMDQ) driver. The CMDQ is used
to help read/write registers with critical time limitation, such as
updating display configuration during the vblank. It controls Global
Command Engine (GCE) hardware to achieve this requirement.

These patches have a build dependency on top of v4.6-rc1.

Changes since v3:
 - rebase to v4.6-rc1
 - pass both arm and arm64 arch compilation
 - fix bug of removing free task list in v3
 - marchal return error code
 - use offset instead of physical address
 - centralize release flow
 - add "suspend/resume protection" patch
 - add queue_work() in cmdq_auto_release() to prevent no more flush
   or interrupt to consume waiting tasks
 - remove some debug or redundant code
 - rewrite some code to shrink code size

Best regards,
HS Liao

HS Liao (4):
  dt-bindings: soc: Add documentation for the MediaTek GCE unit
  CMDQ: Mediatek CMDQ driver
  arm64: dts: mt8173: Add GCE node
  CMDQ: suspend/resume protection

 .../devicetree/bindings/soc/mediatek/gce.txt   |   34 +
 arch/arm64/boot/dts/mediatek/mt8173.dtsi   |8 +
 drivers/soc/mediatek/Kconfig   |   10 +
 drivers/soc/mediatek/Makefile  |1 +
 drivers/soc/mediatek/mtk-cmdq.c| 1997 
 include/soc/mediatek/cmdq.h|  197 ++
 6 files changed, 2247 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/mediatek/gce.txt
 create mode 100644 drivers/soc/mediatek/mtk-cmdq.c
 create mode 100644 include/soc/mediatek/cmdq.h

-- 
1.7.9.5




[MAINTAINERS] Update email address

2016-04-18 Thread Ananth N Mavinakayanahalli
The current ID is going away soon... update email address

Signed-off-by: Ananth N Mavinakayanahalli 

diff --git a/MAINTAINERS b/MAINTAINERS
index 1d5b4be..dc23998 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -6400,7 +6400,7 @@ F:mm/kmemleak.c
 F: mm/kmemleak-test.c
 
 KPROBES
-M: Ananth N Mavinakayanahalli 
+M: Ananth N Mavinakayanahalli 
 M: Anil S Keshavamurthy 
 M: "David S. Miller" 
 M: Masami Hiramatsu 



[MAINTAINERS] Update email address

2016-04-18 Thread Ananth N Mavinakayanahalli
The current ID is going away soon... update email address

Signed-off-by: Ananth N Mavinakayanahalli 

diff --git a/MAINTAINERS b/MAINTAINERS
index 1d5b4be..dc23998 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -6400,7 +6400,7 @@ F:mm/kmemleak.c
 F: mm/kmemleak-test.c
 
 KPROBES
-M: Ananth N Mavinakayanahalli 
+M: Ananth N Mavinakayanahalli 
 M: Anil S Keshavamurthy 
 M: "David S. Miller" 
 M: Masami Hiramatsu 



Runtime warning due to commit 'ARM: OMAP: Catch callers of revision information prior to it being populated' in -next

2016-04-18 Thread Guenter Roeck

Hi,

commit 'ARM: OMAP: Catch callers of revision information prior to it
being populated' results in a runtime warning on various non-OMAP
architectures. I have seen it with the following qemu tests.

arm:vexpress-a9:multi_v7_defconfig:vexpress-v2p-ca9
arm:vexpress-a15:multi_v7_defconfig:vexpress-v2p-ca15-tc1
arm:xilinx-zynq-a9:multi_v7_defconfig:zynq-zc702
arm:xilinx-zynq-a9:multi_v7_defconfig:zynq-zc706
arm:xilinx-zynq-a9:multi_v7_defconfig:zynq-zed
arm:midway:multi_v7_defconfig:ecx-2000
arm:smdkc210:multi_v7_defconfig:exynos4210-smdkv310

It is also reported by kernelci.org in at least one boot test for imx6q-cm-fx6.

The warning is as follows.

[ cut here ]
WARNING: CPU: 0 PID: 1 at arch/arm/mach-omap2/id.c:49 omap_rev+0x3c/0x50
Modules linked in:
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.6.0-rc2-next-20160411 #1
Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
[] (unwind_backtrace) from [] (show_stack+0x10/0x14)
[] (show_stack) from [] (dump_stack+0x84/0xa4)
[] (dump_stack) from [] (__warn+0xd4/0x100)
[] (__warn) from [] (warn_slowpath_null+0x20/0x28)
[] (warn_slowpath_null) from [] (omap_rev+0x3c/0x50)
[] (omap_rev) from [] (__omap4_sar_ram_init+0x8/0x88)
[] (__omap4_sar_ram_init) from [] 
(do_one_initcall+0x3c/0x16c)
[] (do_one_initcall) from [] 
(kernel_init_freeable+0x70/0x1ec)
[] (kernel_init_freeable) from [] (kernel_init+0x8/0x110)
[] (kernel_init) from [] (ret_from_fork+0x14/0x3c)
---[ end trace cb88537fdc8fa200 ]---

Please have a look.

Thanks,
Guenter


Runtime warning due to commit 'ARM: OMAP: Catch callers of revision information prior to it being populated' in -next

2016-04-18 Thread Guenter Roeck

Hi,

commit 'ARM: OMAP: Catch callers of revision information prior to it
being populated' results in a runtime warning on various non-OMAP
architectures. I have seen it with the following qemu tests.

arm:vexpress-a9:multi_v7_defconfig:vexpress-v2p-ca9
arm:vexpress-a15:multi_v7_defconfig:vexpress-v2p-ca15-tc1
arm:xilinx-zynq-a9:multi_v7_defconfig:zynq-zc702
arm:xilinx-zynq-a9:multi_v7_defconfig:zynq-zc706
arm:xilinx-zynq-a9:multi_v7_defconfig:zynq-zed
arm:midway:multi_v7_defconfig:ecx-2000
arm:smdkc210:multi_v7_defconfig:exynos4210-smdkv310

It is also reported by kernelci.org in at least one boot test for imx6q-cm-fx6.

The warning is as follows.

[ cut here ]
WARNING: CPU: 0 PID: 1 at arch/arm/mach-omap2/id.c:49 omap_rev+0x3c/0x50
Modules linked in:
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.6.0-rc2-next-20160411 #1
Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
[] (unwind_backtrace) from [] (show_stack+0x10/0x14)
[] (show_stack) from [] (dump_stack+0x84/0xa4)
[] (dump_stack) from [] (__warn+0xd4/0x100)
[] (__warn) from [] (warn_slowpath_null+0x20/0x28)
[] (warn_slowpath_null) from [] (omap_rev+0x3c/0x50)
[] (omap_rev) from [] (__omap4_sar_ram_init+0x8/0x88)
[] (__omap4_sar_ram_init) from [] 
(do_one_initcall+0x3c/0x16c)
[] (do_one_initcall) from [] 
(kernel_init_freeable+0x70/0x1ec)
[] (kernel_init_freeable) from [] (kernel_init+0x8/0x110)
[] (kernel_init) from [] (ret_from_fork+0x14/0x3c)
---[ end trace cb88537fdc8fa200 ]---

Please have a look.

Thanks,
Guenter


Re: [PATCH v2 1/1] powerpc/86xx: Add support for Emerson/Artesyn MVME7100

2016-04-18 Thread Scott Wood
On Mon, 2016-04-18 at 09:57 +0200, Alessio Igor Bogani wrote:
> + pci0: pcie@f1008000 {
> + reg = <0xf1008000 0x1000>;
> + ranges = <0x0200 0x0 0x8000 0x8000 0x0
> 0x5000
> +   0x0100 0x0 0x 0xf000 0x0
> 0x0080>;
> + pcie@0 {
> + ranges = <0x0200 0x0 0x8000
> +   0x0200 0x0 0x8000
> +   0x0 0x5000
> +
> +   0x0100 0x0 0x
> +   0x0100 0x0 0x
> +   0x0 0x0080>;
> + };
> + };
> +
> + pci1: pcie@f1009000 {
> + compatible = "fsl,mpc8641-pcie";
> + device_type = "pci";
> + #size-cells = <2>;
> + #address-cells = <3>;
> + reg = <0xf1009000 0x1000>;
> + bus-range = <0 0xff>;

Why are pci0 and pci1 so different?  Why does mpc8641si-post.dtsi not have
pci1?

> +asm(".globl _zimage_start\n\
> + _zimage_start:\n\
> + mfmsr   10\n\
> + rlwinm  10,10,0,~(1<<15)/* Clear MSR_EE */\n\
> + sync\n\
> + mtmsr   10\n\
> + isync\n\
> + b _zimage_start_lib\n\
> +");

Please put this in an asm file.

Is U-Boot really not clearing MSR[EE]?  How old is this U-Boot?

> diff --git a/arch/powerpc/boot/ppcboot.h b/arch/powerpc/boot/ppcboot.h
> index 6ae6f90..7b758be 100644
> --- a/arch/powerpc/boot/ppcboot.h
> +++ b/arch/powerpc/boot/ppcboot.h
> @@ -43,7 +43,7 @@ typedef struct bd_info {
>   unsigned long   bi_sramstart;   /* start of SRAM memory
> */
>   unsigned long   bi_sramsize;/* size  of SRAM
> memory */
>  #if defined(TARGET_8xx) || defined(TARGET_CPM2) || defined(TARGET_85xx) ||\
> - defined(TARGET_83xx)
> + defined(TARGET_83xx) || defined(TARGET_MVME7100)
>   unsigned long   bi_immr_base;   /* base of IMMR register
> */
>  #endif

TARGET_86xx would match the U-Boot definition better.

> +/*
> + * Called very early, device-tree isn't unflattened
> + */
> +static int __init mvme7100_probe(void)
> +{
> + unsigned long root = of_get_flat_dt_root();
> +
> + if (!of_flat_dt_is_compatible(root, "artesyn,MVME7100"))
> + return 0;
> +
> + _set_L2CR(_get_L2CR() | L2CR_L2E);
> + return 1;
> +}

U-Boot doesn't enable L2 cache?

-Scott



Re: [PATCH v2 1/1] powerpc/86xx: Add support for Emerson/Artesyn MVME7100

2016-04-18 Thread Scott Wood
On Mon, 2016-04-18 at 09:57 +0200, Alessio Igor Bogani wrote:
> + pci0: pcie@f1008000 {
> + reg = <0xf1008000 0x1000>;
> + ranges = <0x0200 0x0 0x8000 0x8000 0x0
> 0x5000
> +   0x0100 0x0 0x 0xf000 0x0
> 0x0080>;
> + pcie@0 {
> + ranges = <0x0200 0x0 0x8000
> +   0x0200 0x0 0x8000
> +   0x0 0x5000
> +
> +   0x0100 0x0 0x
> +   0x0100 0x0 0x
> +   0x0 0x0080>;
> + };
> + };
> +
> + pci1: pcie@f1009000 {
> + compatible = "fsl,mpc8641-pcie";
> + device_type = "pci";
> + #size-cells = <2>;
> + #address-cells = <3>;
> + reg = <0xf1009000 0x1000>;
> + bus-range = <0 0xff>;

Why are pci0 and pci1 so different?  Why does mpc8641si-post.dtsi not have
pci1?

> +asm(".globl _zimage_start\n\
> + _zimage_start:\n\
> + mfmsr   10\n\
> + rlwinm  10,10,0,~(1<<15)/* Clear MSR_EE */\n\
> + sync\n\
> + mtmsr   10\n\
> + isync\n\
> + b _zimage_start_lib\n\
> +");

Please put this in an asm file.

Is U-Boot really not clearing MSR[EE]?  How old is this U-Boot?

> diff --git a/arch/powerpc/boot/ppcboot.h b/arch/powerpc/boot/ppcboot.h
> index 6ae6f90..7b758be 100644
> --- a/arch/powerpc/boot/ppcboot.h
> +++ b/arch/powerpc/boot/ppcboot.h
> @@ -43,7 +43,7 @@ typedef struct bd_info {
>   unsigned long   bi_sramstart;   /* start of SRAM memory
> */
>   unsigned long   bi_sramsize;/* size  of SRAM
> memory */
>  #if defined(TARGET_8xx) || defined(TARGET_CPM2) || defined(TARGET_85xx) ||\
> - defined(TARGET_83xx)
> + defined(TARGET_83xx) || defined(TARGET_MVME7100)
>   unsigned long   bi_immr_base;   /* base of IMMR register
> */
>  #endif

TARGET_86xx would match the U-Boot definition better.

> +/*
> + * Called very early, device-tree isn't unflattened
> + */
> +static int __init mvme7100_probe(void)
> +{
> + unsigned long root = of_get_flat_dt_root();
> +
> + if (!of_flat_dt_is_compatible(root, "artesyn,MVME7100"))
> + return 0;
> +
> + _set_L2CR(_get_L2CR() | L2CR_L2E);
> + return 1;
> +}

U-Boot doesn't enable L2 cache?

-Scott



[PATCH] pinctrl-exynos5440: Use off-stack memory for pinctrl_gpio_range

2016-04-18 Thread Andrew Jeffery
The range is registered into a linked list which can be referenced
throughout the lifetime of the driver. Ensure the range's memory is useful
for the same lifetime by adding it to the driver's private data structure.

The bug was introduced in the driver's initial commit, which was present in
v3.10.

Signed-off-by: Andrew Jeffery 
Fixes: f0b9a7e521fa ("pinctrl: exynos5440: add pinctrl driver for Samsung 
EXYNOS5440 SoC")
Cc: sta...@vger.kernel.org
---
This is my first contribution to the kernel, so hopefully I've followed all the
relevant documentation. If not, please let me know and point me in the right
direction!

I don't have the means to test the patch, but it compiles. Someone with
appropriate hardware should probably give it a spin.

 drivers/pinctrl/samsung/pinctrl-exynos5440.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/pinctrl/samsung/pinctrl-exynos5440.c 
b/drivers/pinctrl/samsung/pinctrl-exynos5440.c
index 00ab63abf1d9..d45028a75c0f 100644
--- a/drivers/pinctrl/samsung/pinctrl-exynos5440.c
+++ b/drivers/pinctrl/samsung/pinctrl-exynos5440.c
@@ -117,6 +117,7 @@ struct exynos5440_pinctrl_priv_data {
unsigned intnr_groups;
const struct exynos5440_pmx_func*pmx_functions;
unsigned intnr_functions;
+   struct pinctrl_gpio_range   range;
 };
 
 /**
@@ -742,7 +743,6 @@ static int exynos5440_pinctrl_register(struct 
platform_device *pdev,
struct pinctrl_desc *ctrldesc;
struct pinctrl_dev *pctl_dev;
struct pinctrl_pin_desc *pindesc, *pdesc;
-   struct pinctrl_gpio_range grange;
char *pin_names;
int pin, ret;
 
@@ -794,12 +794,12 @@ static int exynos5440_pinctrl_register(struct 
platform_device *pdev,
return PTR_ERR(pctl_dev);
}
 
-   grange.name = "exynos5440-pctrl-gpio-range";
-   grange.id = 0;
-   grange.base = 0;
-   grange.npins = EXYNOS5440_MAX_PINS;
-   grange.gc = priv->gc;
-   pinctrl_add_gpio_range(pctl_dev, );
+   priv->range.name = "exynos5440-pctrl-gpio-range";
+   priv->range.id = 0;
+   priv->range.base = 0;
+   priv->range.npins = EXYNOS5440_MAX_PINS;
+   priv->range.gc = priv->gc;
+   pinctrl_add_gpio_range(pctl_dev, >range);
return 0;
 }
 
-- 
2.5.0



[PATCH] pinctrl-exynos5440: Use off-stack memory for pinctrl_gpio_range

2016-04-18 Thread Andrew Jeffery
The range is registered into a linked list which can be referenced
throughout the lifetime of the driver. Ensure the range's memory is useful
for the same lifetime by adding it to the driver's private data structure.

The bug was introduced in the driver's initial commit, which was present in
v3.10.

Signed-off-by: Andrew Jeffery 
Fixes: f0b9a7e521fa ("pinctrl: exynos5440: add pinctrl driver for Samsung 
EXYNOS5440 SoC")
Cc: sta...@vger.kernel.org
---
This is my first contribution to the kernel, so hopefully I've followed all the
relevant documentation. If not, please let me know and point me in the right
direction!

I don't have the means to test the patch, but it compiles. Someone with
appropriate hardware should probably give it a spin.

 drivers/pinctrl/samsung/pinctrl-exynos5440.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/pinctrl/samsung/pinctrl-exynos5440.c 
b/drivers/pinctrl/samsung/pinctrl-exynos5440.c
index 00ab63abf1d9..d45028a75c0f 100644
--- a/drivers/pinctrl/samsung/pinctrl-exynos5440.c
+++ b/drivers/pinctrl/samsung/pinctrl-exynos5440.c
@@ -117,6 +117,7 @@ struct exynos5440_pinctrl_priv_data {
unsigned intnr_groups;
const struct exynos5440_pmx_func*pmx_functions;
unsigned intnr_functions;
+   struct pinctrl_gpio_range   range;
 };
 
 /**
@@ -742,7 +743,6 @@ static int exynos5440_pinctrl_register(struct 
platform_device *pdev,
struct pinctrl_desc *ctrldesc;
struct pinctrl_dev *pctl_dev;
struct pinctrl_pin_desc *pindesc, *pdesc;
-   struct pinctrl_gpio_range grange;
char *pin_names;
int pin, ret;
 
@@ -794,12 +794,12 @@ static int exynos5440_pinctrl_register(struct 
platform_device *pdev,
return PTR_ERR(pctl_dev);
}
 
-   grange.name = "exynos5440-pctrl-gpio-range";
-   grange.id = 0;
-   grange.base = 0;
-   grange.npins = EXYNOS5440_MAX_PINS;
-   grange.gc = priv->gc;
-   pinctrl_add_gpio_range(pctl_dev, );
+   priv->range.name = "exynos5440-pctrl-gpio-range";
+   priv->range.id = 0;
+   priv->range.base = 0;
+   priv->range.npins = EXYNOS5440_MAX_PINS;
+   priv->range.gc = priv->gc;
+   pinctrl_add_gpio_range(pctl_dev, >range);
return 0;
 }
 
-- 
2.5.0



RE: rtc ds3232 call trace in kernel

2016-04-18 Thread Qianyu Gong
> -Original Message-
> From: Akinobu Mita [mailto:akinobu.m...@gmail.com]
> Sent: Tuesday, April 19, 2016 11:58 AM
> To: Qianyu Gong 
> Cc: alexandre.bell...@free-electrons.com; Mingkai Hu ;
> rtc-li...@googlegroups.com; linux-kernel@vger.kernel.org
> Subject: Re: rtc ds3232 call trace in kernel
> 
> 2016-04-19 11:36 GMT+09:00 Qianyu Gong :
> >
> >> -Original Message-
> >> From: Akinobu Mita [mailto:akinobu.m...@gmail.com]
> >> Sent: Monday, April 18, 2016 9:02 PM
> >> To: Qianyu Gong 
> >> Cc: alexandre.bell...@free-electrons.com; Mingkai Hu
> >> ; rtc-li...@googlegroups.com;
> >> linux-kernel@vger.kernel.org
> >> Subject: Re: rtc ds3232 call trace in kernel
> >>
> >> 2016-04-18 15:15 GMT+09:00 Qianyu Gong :
> >> > Hi Akinobu,
> >> >
> >> >
> >> >
> >> > I got an rtc call trace when booting 4.6 kernel on our board and I
> >> > found it
> >> >
> >> > was caused by this patch:
> >> >
> >> >
> >> >
> >> > commit fc1dcb0b39dbb10d3290f2fcd6e154670f699166
> >> >
> >> > Author: Akinobu Mita 
> >> >
> >> > Date:   Mon Mar 7 00:27:53 2016 +0900
> >> >
> >> >
> >> >
> >> > rtc: ds3232: use rtc->ops_lock to protect alarm operations
> >> >
> >> >
> >> >
> >> > ds3232->mutex is used to protect for alarm operations which
> >> >
> >> > need to access status and control registers.
> >> >
> >> >
> >> >
> >> > But we can use rtc->ops_lock instead.  rtc->ops_lock is held
> >> > when most
> >> >
> >> > of rtc_class_ops methods are called, so we only need to
> >> > explicitly
> >> >
> >> > acquire it from irq handler in order to protect form concurrent
> >> >
> >> > accesses.
> >> >
> >> >
> >> >
> >> > Signed-off-by: Akinobu Mita 
> >> >
> >> > Signed-off-by: Alexandre Belloni
> >> >  >> >
> >> >
> >> >
> >> > The problem is that rtc->ops_lock would be accessed in ds3232_irq()
> >> >
> >> > without being initialized as rtc_device_register() is called too late.
> >>
> >> You have already identified the root cause of this issue.
> >>
> >> > As I’m not familiar with rtc things, could I just revert the patch
> >> > or you already
> >> >
> >> > have a solution to this problem? Thanks in advance.
> >>
> >> Could you check if the problem is resolved by moving the call of
> >> devm_rtc_device_register() from the end of ds3232_probe() to just
> >> before registering irq handler?
> >
> > Yes. It works(no call trace now).
> 
> Thanks for testing.  Do you mind submitting your patch to rtc-
> li...@googlegroups.com ?

No problem.:)

Regards,
Qianyu



RE: rtc ds3232 call trace in kernel

2016-04-18 Thread Qianyu Gong
> -Original Message-
> From: Akinobu Mita [mailto:akinobu.m...@gmail.com]
> Sent: Tuesday, April 19, 2016 11:58 AM
> To: Qianyu Gong 
> Cc: alexandre.bell...@free-electrons.com; Mingkai Hu ;
> rtc-li...@googlegroups.com; linux-kernel@vger.kernel.org
> Subject: Re: rtc ds3232 call trace in kernel
> 
> 2016-04-19 11:36 GMT+09:00 Qianyu Gong :
> >
> >> -Original Message-
> >> From: Akinobu Mita [mailto:akinobu.m...@gmail.com]
> >> Sent: Monday, April 18, 2016 9:02 PM
> >> To: Qianyu Gong 
> >> Cc: alexandre.bell...@free-electrons.com; Mingkai Hu
> >> ; rtc-li...@googlegroups.com;
> >> linux-kernel@vger.kernel.org
> >> Subject: Re: rtc ds3232 call trace in kernel
> >>
> >> 2016-04-18 15:15 GMT+09:00 Qianyu Gong :
> >> > Hi Akinobu,
> >> >
> >> >
> >> >
> >> > I got an rtc call trace when booting 4.6 kernel on our board and I
> >> > found it
> >> >
> >> > was caused by this patch:
> >> >
> >> >
> >> >
> >> > commit fc1dcb0b39dbb10d3290f2fcd6e154670f699166
> >> >
> >> > Author: Akinobu Mita 
> >> >
> >> > Date:   Mon Mar 7 00:27:53 2016 +0900
> >> >
> >> >
> >> >
> >> > rtc: ds3232: use rtc->ops_lock to protect alarm operations
> >> >
> >> >
> >> >
> >> > ds3232->mutex is used to protect for alarm operations which
> >> >
> >> > need to access status and control registers.
> >> >
> >> >
> >> >
> >> > But we can use rtc->ops_lock instead.  rtc->ops_lock is held
> >> > when most
> >> >
> >> > of rtc_class_ops methods are called, so we only need to
> >> > explicitly
> >> >
> >> > acquire it from irq handler in order to protect form concurrent
> >> >
> >> > accesses.
> >> >
> >> >
> >> >
> >> > Signed-off-by: Akinobu Mita 
> >> >
> >> > Signed-off-by: Alexandre Belloni
> >> >  >> >
> >> >
> >> >
> >> > The problem is that rtc->ops_lock would be accessed in ds3232_irq()
> >> >
> >> > without being initialized as rtc_device_register() is called too late.
> >>
> >> You have already identified the root cause of this issue.
> >>
> >> > As I’m not familiar with rtc things, could I just revert the patch
> >> > or you already
> >> >
> >> > have a solution to this problem? Thanks in advance.
> >>
> >> Could you check if the problem is resolved by moving the call of
> >> devm_rtc_device_register() from the end of ds3232_probe() to just
> >> before registering irq handler?
> >
> > Yes. It works(no call trace now).
> 
> Thanks for testing.  Do you mind submitting your patch to rtc-
> li...@googlegroups.com ?

No problem.:)

Regards,
Qianyu



Re: [PATCH 2/2] mountinfo: implement show_path for kernfs and cgroup

2016-04-18 Thread Serge E. Hallyn
Quoting Serge E. Hallyn (se...@hallyn.com):
> Quoting Eric W. Biederman (ebied...@xmission.com):
> > "Serge E. Hallyn"  writes:
> > 
> > >> diff --git a/kernel/cgroup.c b/kernel/cgroup.c
> > >> index 671dc05..9a0d7b3 100644
> > >> --- a/kernel/cgroup.c
> > >> +++ b/kernel/cgroup.c
> > >> @@ -1593,6 +1593,40 @@ static int rebind_subsystems(struct cgroup_root 
> > >> *dst_root, u16 ss_mask)
> > >>  return 0;
> > >>  }
> > >>  
> > >> +static int cgroup_show_path(struct seq_file *sf, struct kernfs_node 
> > >> *kf_node,
> > >> +struct kernfs_root *kf_root)
> > >> +{
> > >> +int len = 0, ret = 0;
> > >> +char *buf = NULL;
> > >> +struct cgroup_namespace *ns = current->nsproxy->cgroup_ns;
> > >> +struct cgroup_root *kf_cgroot = cgroup_root_from_kf(kf_root);
> > >> +struct cgroup *ns_cgroup;
> > >> +
> > >> +mutex_lock(_mutex);
> > >
> > > Hm, I can't grab the cgroup mutex here because I already have the
> > > namespace_sem.  But that's required by cset_cgroup_from_root().  Can
> > > I just call that under rcu_read_lock() instead?  (Not without
> > > changing the lockdep_assert_help()).  Is there another way to get the
> > > info needed here?
> > 
> > Do we need the current cgroup namespace information at all?
> > 
> > Could we not get the relevant cgroup namespace from the mount of
> > cgroupfs?
> 
> I don't think so.  That was my first inclination.  But at show_path()
> all we have is the vfsmunt->mnt_root.  Since all cgroup namespaces
> for a hierarchy share the same dentry tree and superblock, there's
> no way to tell where the mount's namespace root is supposed to be.
> 
> whether we did
> 
> # enter new cgroup namespace rooted at cgroup /user.slice/user-1000.slice
> mount -t cgroup -o freezer freezer /mnt
> 
> or
> 
> mount --bind /sys/fs/cgroup/freezer/user.slice/user-1000.slice /mnt
> 
> the mountinfo entry will be the same.
> 
> > In general the better path is not to have the contents of files depend on
> > who is reading the file.

And actually, while as i said above this was my first inclination, I now
think that's wrong.  /proc/$$/cgroup is virtualized per the reader.  The
point of this patch is to make mountinfo virtualized analogously to
/proc/$$/cgroup, so that we can be certain how a particular cgroup dentry
relates to a task's actual cgroup.  So the mountinfo dentry root path
should in fact depend on the reader.

Looking at it another way...  The value we're talking about shows us
the path of the root dentry of a cgroup mount.  If a task in cgns2
rooted at /a/b/c mounts a cgroupfs, it will see '/' as the root dentry.
If a task in cgns1 rooted at /a/b looks at that mountinfo, '/' would
be misleading.  It really should be '/c'.

If there were security implications those might override this.  But there
is no security benefit to this.  (The usual security argument is about
the opener vs the reader, not the mounter verses the reader, but in either
case I maintain there is no security benefit to virtualizing these paths)


Re: [PATCH 2/2] mountinfo: implement show_path for kernfs and cgroup

2016-04-18 Thread Serge E. Hallyn
Quoting Serge E. Hallyn (se...@hallyn.com):
> Quoting Eric W. Biederman (ebied...@xmission.com):
> > "Serge E. Hallyn"  writes:
> > 
> > >> diff --git a/kernel/cgroup.c b/kernel/cgroup.c
> > >> index 671dc05..9a0d7b3 100644
> > >> --- a/kernel/cgroup.c
> > >> +++ b/kernel/cgroup.c
> > >> @@ -1593,6 +1593,40 @@ static int rebind_subsystems(struct cgroup_root 
> > >> *dst_root, u16 ss_mask)
> > >>  return 0;
> > >>  }
> > >>  
> > >> +static int cgroup_show_path(struct seq_file *sf, struct kernfs_node 
> > >> *kf_node,
> > >> +struct kernfs_root *kf_root)
> > >> +{
> > >> +int len = 0, ret = 0;
> > >> +char *buf = NULL;
> > >> +struct cgroup_namespace *ns = current->nsproxy->cgroup_ns;
> > >> +struct cgroup_root *kf_cgroot = cgroup_root_from_kf(kf_root);
> > >> +struct cgroup *ns_cgroup;
> > >> +
> > >> +mutex_lock(_mutex);
> > >
> > > Hm, I can't grab the cgroup mutex here because I already have the
> > > namespace_sem.  But that's required by cset_cgroup_from_root().  Can
> > > I just call that under rcu_read_lock() instead?  (Not without
> > > changing the lockdep_assert_help()).  Is there another way to get the
> > > info needed here?
> > 
> > Do we need the current cgroup namespace information at all?
> > 
> > Could we not get the relevant cgroup namespace from the mount of
> > cgroupfs?
> 
> I don't think so.  That was my first inclination.  But at show_path()
> all we have is the vfsmunt->mnt_root.  Since all cgroup namespaces
> for a hierarchy share the same dentry tree and superblock, there's
> no way to tell where the mount's namespace root is supposed to be.
> 
> whether we did
> 
> # enter new cgroup namespace rooted at cgroup /user.slice/user-1000.slice
> mount -t cgroup -o freezer freezer /mnt
> 
> or
> 
> mount --bind /sys/fs/cgroup/freezer/user.slice/user-1000.slice /mnt
> 
> the mountinfo entry will be the same.
> 
> > In general the better path is not to have the contents of files depend on
> > who is reading the file.

And actually, while as i said above this was my first inclination, I now
think that's wrong.  /proc/$$/cgroup is virtualized per the reader.  The
point of this patch is to make mountinfo virtualized analogously to
/proc/$$/cgroup, so that we can be certain how a particular cgroup dentry
relates to a task's actual cgroup.  So the mountinfo dentry root path
should in fact depend on the reader.

Looking at it another way...  The value we're talking about shows us
the path of the root dentry of a cgroup mount.  If a task in cgns2
rooted at /a/b/c mounts a cgroupfs, it will see '/' as the root dentry.
If a task in cgns1 rooted at /a/b looks at that mountinfo, '/' would
be misleading.  It really should be '/c'.

If there were security implications those might override this.  But there
is no security benefit to this.  (The usual security argument is about
the opener vs the reader, not the mounter verses the reader, but in either
case I maintain there is no security benefit to virtualizing these paths)


Re: linux-next: build warning after merge of the ipvs-next tree

2016-04-18 Thread Simon Horman
On Mon, Apr 18, 2016 at 11:09:21AM +0200, Pablo Neira Ayuso wrote:
> On Fri, Apr 15, 2016 at 10:38:14PM +1000, Simon Horman wrote:
> > On Fri, Apr 15, 2016 at 11:56:07AM +0200, Pablo Neira Ayuso wrote:
> > > On Fri, Apr 15, 2016 at 10:57:48AM +1000, Stephen Rothwell wrote:
> > > > Hi Simon,
> > > > 
> > > > After merging the ipvs-next tree, today's linux-next build (powerpc
> > > > ppc64_defconfig) produced this warning:
> > > > 
> > > > net/netfilter/nf_conntrack_netlink.c:529:15: warning: 
> > > > 'ctnetlink_proto_size' defined but not used [-Wunused-function]
> > > >  static size_t ctnetlink_proto_size(const struct nf_conn *ct)
> > > >^
> > > > net/netfilter/nf_conntrack_netlink.c:546:15: warning: 
> > > > 'ctnetlink_acct_size' defined but not used [-Wunused-function]
> > > >  static size_t ctnetlink_acct_size(const struct nf_conn *ct)
> > > >^
> > > > net/netfilter/nf_conntrack_netlink.c:556:12: warning: 
> > > > 'ctnetlink_secctx_size' defined but not used [-Wunused-function]
> > > >  static int ctnetlink_secctx_size(const struct nf_conn *ct)
> > > > ^
> > > > net/netfilter/nf_conntrack_netlink.c:572:15: warning: 
> > > > 'ctnetlink_timestamp_size' defined but not used [-Wunused-function]
> > > >  static size_t ctnetlink_timestamp_size(const struct nf_conn *ct)
> > > >^
> > > > Introduced by commit
> > > > 
> > > >   4054ff45454a ("netfilter: ctnetlink: remove unnecessary inlining")
> > > > 
> > > > This build does not set CONFIG_NF_CONNTRACK_EVENTS or
> > > > CONFIG_NETFILTER_NETLINK_GLUE_CT.
> > > 
> > > This is my fault, will fix this asap. Thanks for reporting.
> > 
> > Pablo,
> > 
> > can you let me know when it is fixed in nf-next so I can rebase ipvs-next
> > accordingly?
> 
> No need to rebase, will push an incremental fix for this.

Thanks, understood.


Re: linux-next: build warning after merge of the ipvs-next tree

2016-04-18 Thread Simon Horman
On Mon, Apr 18, 2016 at 11:09:21AM +0200, Pablo Neira Ayuso wrote:
> On Fri, Apr 15, 2016 at 10:38:14PM +1000, Simon Horman wrote:
> > On Fri, Apr 15, 2016 at 11:56:07AM +0200, Pablo Neira Ayuso wrote:
> > > On Fri, Apr 15, 2016 at 10:57:48AM +1000, Stephen Rothwell wrote:
> > > > Hi Simon,
> > > > 
> > > > After merging the ipvs-next tree, today's linux-next build (powerpc
> > > > ppc64_defconfig) produced this warning:
> > > > 
> > > > net/netfilter/nf_conntrack_netlink.c:529:15: warning: 
> > > > 'ctnetlink_proto_size' defined but not used [-Wunused-function]
> > > >  static size_t ctnetlink_proto_size(const struct nf_conn *ct)
> > > >^
> > > > net/netfilter/nf_conntrack_netlink.c:546:15: warning: 
> > > > 'ctnetlink_acct_size' defined but not used [-Wunused-function]
> > > >  static size_t ctnetlink_acct_size(const struct nf_conn *ct)
> > > >^
> > > > net/netfilter/nf_conntrack_netlink.c:556:12: warning: 
> > > > 'ctnetlink_secctx_size' defined but not used [-Wunused-function]
> > > >  static int ctnetlink_secctx_size(const struct nf_conn *ct)
> > > > ^
> > > > net/netfilter/nf_conntrack_netlink.c:572:15: warning: 
> > > > 'ctnetlink_timestamp_size' defined but not used [-Wunused-function]
> > > >  static size_t ctnetlink_timestamp_size(const struct nf_conn *ct)
> > > >^
> > > > Introduced by commit
> > > > 
> > > >   4054ff45454a ("netfilter: ctnetlink: remove unnecessary inlining")
> > > > 
> > > > This build does not set CONFIG_NF_CONNTRACK_EVENTS or
> > > > CONFIG_NETFILTER_NETLINK_GLUE_CT.
> > > 
> > > This is my fault, will fix this asap. Thanks for reporting.
> > 
> > Pablo,
> > 
> > can you let me know when it is fixed in nf-next so I can rebase ipvs-next
> > accordingly?
> 
> No need to rebase, will push an incremental fix for this.

Thanks, understood.


Re: rtc ds3232 call trace in kernel

2016-04-18 Thread Akinobu Mita
2016-04-19 11:36 GMT+09:00 Qianyu Gong :
>
>> -Original Message-
>> From: Akinobu Mita [mailto:akinobu.m...@gmail.com]
>> Sent: Monday, April 18, 2016 9:02 PM
>> To: Qianyu Gong 
>> Cc: alexandre.bell...@free-electrons.com; Mingkai Hu ;
>> rtc-li...@googlegroups.com; linux-kernel@vger.kernel.org
>> Subject: Re: rtc ds3232 call trace in kernel
>>
>> 2016-04-18 15:15 GMT+09:00 Qianyu Gong :
>> > Hi Akinobu,
>> >
>> >
>> >
>> > I got an rtc call trace when booting 4.6 kernel on our board and I
>> > found it
>> >
>> > was caused by this patch:
>> >
>> >
>> >
>> > commit fc1dcb0b39dbb10d3290f2fcd6e154670f699166
>> >
>> > Author: Akinobu Mita 
>> >
>> > Date:   Mon Mar 7 00:27:53 2016 +0900
>> >
>> >
>> >
>> > rtc: ds3232: use rtc->ops_lock to protect alarm operations
>> >
>> >
>> >
>> > ds3232->mutex is used to protect for alarm operations which
>> >
>> > need to access status and control registers.
>> >
>> >
>> >
>> > But we can use rtc->ops_lock instead.  rtc->ops_lock is held when
>> > most
>> >
>> > of rtc_class_ops methods are called, so we only need to explicitly
>> >
>> > acquire it from irq handler in order to protect form concurrent
>> >
>> > accesses.
>> >
>> >
>> >
>> > Signed-off-by: Akinobu Mita 
>> >
>> > Signed-off-by: Alexandre Belloni > >
>> >
>> >
>> > The problem is that rtc->ops_lock would be accessed in ds3232_irq()
>> >
>> > without being initialized as rtc_device_register() is called too late.
>>
>> You have already identified the root cause of this issue.
>>
>> > As I’m not familiar with rtc things, could I just revert the patch or
>> > you already
>> >
>> > have a solution to this problem? Thanks in advance.
>>
>> Could you check if the problem is resolved by moving the call of
>> devm_rtc_device_register() from the end of ds3232_probe() to just before
>> registering irq handler?
>
> Yes. It works(no call trace now).

Thanks for testing.  Do you mind submitting your patch to
rtc-li...@googlegroups.com ?


Re: rtc ds3232 call trace in kernel

2016-04-18 Thread Akinobu Mita
2016-04-19 11:36 GMT+09:00 Qianyu Gong :
>
>> -Original Message-
>> From: Akinobu Mita [mailto:akinobu.m...@gmail.com]
>> Sent: Monday, April 18, 2016 9:02 PM
>> To: Qianyu Gong 
>> Cc: alexandre.bell...@free-electrons.com; Mingkai Hu ;
>> rtc-li...@googlegroups.com; linux-kernel@vger.kernel.org
>> Subject: Re: rtc ds3232 call trace in kernel
>>
>> 2016-04-18 15:15 GMT+09:00 Qianyu Gong :
>> > Hi Akinobu,
>> >
>> >
>> >
>> > I got an rtc call trace when booting 4.6 kernel on our board and I
>> > found it
>> >
>> > was caused by this patch:
>> >
>> >
>> >
>> > commit fc1dcb0b39dbb10d3290f2fcd6e154670f699166
>> >
>> > Author: Akinobu Mita 
>> >
>> > Date:   Mon Mar 7 00:27:53 2016 +0900
>> >
>> >
>> >
>> > rtc: ds3232: use rtc->ops_lock to protect alarm operations
>> >
>> >
>> >
>> > ds3232->mutex is used to protect for alarm operations which
>> >
>> > need to access status and control registers.
>> >
>> >
>> >
>> > But we can use rtc->ops_lock instead.  rtc->ops_lock is held when
>> > most
>> >
>> > of rtc_class_ops methods are called, so we only need to explicitly
>> >
>> > acquire it from irq handler in order to protect form concurrent
>> >
>> > accesses.
>> >
>> >
>> >
>> > Signed-off-by: Akinobu Mita 
>> >
>> > Signed-off-by: Alexandre Belloni > >
>> >
>> >
>> > The problem is that rtc->ops_lock would be accessed in ds3232_irq()
>> >
>> > without being initialized as rtc_device_register() is called too late.
>>
>> You have already identified the root cause of this issue.
>>
>> > As I’m not familiar with rtc things, could I just revert the patch or
>> > you already
>> >
>> > have a solution to this problem? Thanks in advance.
>>
>> Could you check if the problem is resolved by moving the call of
>> devm_rtc_device_register() from the end of ds3232_probe() to just before
>> registering irq handler?
>
> Yes. It works(no call trace now).

Thanks for testing.  Do you mind submitting your patch to
rtc-li...@googlegroups.com ?


[PATCH][v3] cpufreq: governor: Fix overflow when calculating idle time

2016-04-18 Thread Chen Yu
It was reported that after Commit 0df35026c6a5 ("cpufreq: governor:
Fix negative idle_time when configured with CONFIG_HZ_PERIODIC"),
cpufreq ondemand governor started to act oddly. Without any load,
with freshly booted system, it pumped cpu frequency up to maximum
at some point of time and stayed there. The problem is caused by
jiffies overflow in get_cpu_idle_time:

After booting up 5 minutes, the jiffies will round up to zero.
As a result, the following condition in cpu governor will always be
true:
if (cur_idle_time <= j_cdbs->prev_cpu_idle)
idle_time = 0;

which caused problems.

For example, once cur_idle_time has rounded up to zero, meanwhile
prev_cpu_idle still remains negative(because of jiffies initial value
of -300HZ, which is very big after converted to unsigned), thus above
condition is met, thus we get a zero of idle running time during
this sample, which causes a high busy time, thus governor always
requests for the highest freq.

This patch fixes this problem by updating prev_cpu_idle for
each sample period, even if prev_cpu_idle is bigger than
cur_idle_time, thus to prevent the scenario of 'prev_cpu_idle always
bigger than cur_idle_time' from happening.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=115261
Reported-by: Timo Valtoaho 
Signed-off-by: Chen Yu 
---
v3:
 - Do not use INITIAL_JIFFIES because it should be transparent
   to user, meanwhile keep original semanteme to use delta
   of time slice.
---
v2:
 - Send this patch to a wider scope, including timing-system maintainers,
   as well as some modifications in the commit message to make it more clear.
---
 drivers/cpufreq/cpufreq.c  | 4 
 drivers/cpufreq/cpufreq_governor.c | 8 +++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index b87596b..b0479b3 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -132,6 +132,10 @@ struct cpufreq_frequency_table 
*cpufreq_frequency_get_table(unsigned int cpu)
 }
 EXPORT_SYMBOL_GPL(cpufreq_frequency_get_table);
 
+/**
+ * The wall time and idle time are both possible to round up,
+ * people should use delta rather than the value itself.
+ */
 static inline u64 get_cpu_idle_time_jiffy(unsigned int cpu, u64 *wall)
 {
u64 idle_time;
diff --git a/drivers/cpufreq/cpufreq_governor.c 
b/drivers/cpufreq/cpufreq_governor.c
index 10a5cfe..8de3fba 100644
--- a/drivers/cpufreq/cpufreq_governor.c
+++ b/drivers/cpufreq/cpufreq_governor.c
@@ -197,8 +197,14 @@ unsigned int dbs_update(struct cpufreq_policy *policy)
idle_time = 0;
} else {
idle_time = cur_idle_time - j_cdbs->prev_cpu_idle;
-   j_cdbs->prev_cpu_idle = cur_idle_time;
}
+   /*
+* It is possible prev_cpu_idle being bigger than cur_idle_time,
+* when 32bit rounds up if !CONFIG_VIRT_CPU_ACCOUNTING,
+* thus get a 0% idle estimation. So update prev_cpu_idle during
+* each sample period to avoid this situation lasting too long.
+*/
+   j_cdbs->prev_cpu_idle = cur_idle_time;
 
if (ignore_nice) {
u64 cur_nice = kcpustat_cpu(j).cpustat[CPUTIME_NICE];
-- 
1.8.4.2



[PATCH][v3] cpufreq: governor: Fix overflow when calculating idle time

2016-04-18 Thread Chen Yu
It was reported that after Commit 0df35026c6a5 ("cpufreq: governor:
Fix negative idle_time when configured with CONFIG_HZ_PERIODIC"),
cpufreq ondemand governor started to act oddly. Without any load,
with freshly booted system, it pumped cpu frequency up to maximum
at some point of time and stayed there. The problem is caused by
jiffies overflow in get_cpu_idle_time:

After booting up 5 minutes, the jiffies will round up to zero.
As a result, the following condition in cpu governor will always be
true:
if (cur_idle_time <= j_cdbs->prev_cpu_idle)
idle_time = 0;

which caused problems.

For example, once cur_idle_time has rounded up to zero, meanwhile
prev_cpu_idle still remains negative(because of jiffies initial value
of -300HZ, which is very big after converted to unsigned), thus above
condition is met, thus we get a zero of idle running time during
this sample, which causes a high busy time, thus governor always
requests for the highest freq.

This patch fixes this problem by updating prev_cpu_idle for
each sample period, even if prev_cpu_idle is bigger than
cur_idle_time, thus to prevent the scenario of 'prev_cpu_idle always
bigger than cur_idle_time' from happening.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=115261
Reported-by: Timo Valtoaho 
Signed-off-by: Chen Yu 
---
v3:
 - Do not use INITIAL_JIFFIES because it should be transparent
   to user, meanwhile keep original semanteme to use delta
   of time slice.
---
v2:
 - Send this patch to a wider scope, including timing-system maintainers,
   as well as some modifications in the commit message to make it more clear.
---
 drivers/cpufreq/cpufreq.c  | 4 
 drivers/cpufreq/cpufreq_governor.c | 8 +++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index b87596b..b0479b3 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -132,6 +132,10 @@ struct cpufreq_frequency_table 
*cpufreq_frequency_get_table(unsigned int cpu)
 }
 EXPORT_SYMBOL_GPL(cpufreq_frequency_get_table);
 
+/**
+ * The wall time and idle time are both possible to round up,
+ * people should use delta rather than the value itself.
+ */
 static inline u64 get_cpu_idle_time_jiffy(unsigned int cpu, u64 *wall)
 {
u64 idle_time;
diff --git a/drivers/cpufreq/cpufreq_governor.c 
b/drivers/cpufreq/cpufreq_governor.c
index 10a5cfe..8de3fba 100644
--- a/drivers/cpufreq/cpufreq_governor.c
+++ b/drivers/cpufreq/cpufreq_governor.c
@@ -197,8 +197,14 @@ unsigned int dbs_update(struct cpufreq_policy *policy)
idle_time = 0;
} else {
idle_time = cur_idle_time - j_cdbs->prev_cpu_idle;
-   j_cdbs->prev_cpu_idle = cur_idle_time;
}
+   /*
+* It is possible prev_cpu_idle being bigger than cur_idle_time,
+* when 32bit rounds up if !CONFIG_VIRT_CPU_ACCOUNTING,
+* thus get a 0% idle estimation. So update prev_cpu_idle during
+* each sample period to avoid this situation lasting too long.
+*/
+   j_cdbs->prev_cpu_idle = cur_idle_time;
 
if (ignore_nice) {
u64 cur_nice = kcpustat_cpu(j).cpustat[CPUTIME_NICE];
-- 
1.8.4.2



Re: [PATCH 0/7] IB/hfi1: Remove write() and use ioctl() for user access

2016-04-18 Thread Ira Weiny
On Mon, Apr 18, 2016 at 11:24:11AM -0700, Christoph Hellwig wrote:
> On Mon, Apr 18, 2016 at 11:40:47AM -0600, Jason Gunthorpe wrote:
> > I wasn't arguing this should integrate into verbs in some way, only
> > that the way to access the driver-specific uAPI of a RDMA device should
> > be through the RDMA common uAPI and not through a random char dev.
> 
> Well, it's stuff not related to our RDMA userspace API (which _is_
> Verbs, not counting for the complete crackpot abuse in usnic), but
> very device specific. 
> 
> The stuff the intel driver are doing isn't pretty, but unfortunately
> not unusual either - lots of SCSI or network driver have ioctls
> like that.  Now we could argue if the ioctls should be one the
> main node (uverbs) or the a driver private chardev, or not exist
> at all and people will have to patch the driver with some vendor
> version if they really need it.  Examples for either of these
> choices exist in the tree.

I'm a bit confused by what you are suggesting that "people will have to patch
the driver with some vendor version if they really need it."?

Could you elaborate?

PSM is the primary performant path for this device.  Without it this device is
severely limited in its intended functionality.

We are strongly motivated to have all of our functionality included in the
mainstream kernel.  So for eprom/snoop we would really like to find a way to
include all this functionality.

Ira

> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/7] IB/hfi1: Remove write() and use ioctl() for user access

2016-04-18 Thread Ira Weiny
On Mon, Apr 18, 2016 at 11:24:11AM -0700, Christoph Hellwig wrote:
> On Mon, Apr 18, 2016 at 11:40:47AM -0600, Jason Gunthorpe wrote:
> > I wasn't arguing this should integrate into verbs in some way, only
> > that the way to access the driver-specific uAPI of a RDMA device should
> > be through the RDMA common uAPI and not through a random char dev.
> 
> Well, it's stuff not related to our RDMA userspace API (which _is_
> Verbs, not counting for the complete crackpot abuse in usnic), but
> very device specific. 
> 
> The stuff the intel driver are doing isn't pretty, but unfortunately
> not unusual either - lots of SCSI or network driver have ioctls
> like that.  Now we could argue if the ioctls should be one the
> main node (uverbs) or the a driver private chardev, or not exist
> at all and people will have to patch the driver with some vendor
> version if they really need it.  Examples for either of these
> choices exist in the tree.

I'm a bit confused by what you are suggesting that "people will have to patch
the driver with some vendor version if they really need it."?

Could you elaborate?

PSM is the primary performant path for this device.  Without it this device is
severely limited in its intended functionality.

We are strongly motivated to have all of our functionality included in the
mainstream kernel.  So for eprom/snoop we would really like to find a way to
include all this functionality.

Ira

> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v7 0/8]/[PULL REQUEST] Trim unused exported kernel symbols

2016-04-18 Thread Nicolas Pitre
Ping !

/me only hears back empty cave echoes ...


On Wed, 6 Apr 2016, Nicolas Pitre wrote:

> 
> Gentle ping...
> 
> If possible, I'd like for those patches to be sorted out before the 
> opening of the merge window gets too close like last time.
> 
> 
> On Tue, 29 Mar 2016, Nicolas Pitre wrote:
> 
> > This patch series provides the option to omit exported symbols from
> > the kernel and modules that are never referenced by any of the selected
> > modules in the current kernel configuration. this allows for optimizing
> > the compiled code and reducing final binaries' size. When using LTO the
> > binary size reduction is even more effective. It could also be argued
> > that this could bring some security advantages.
> > 
> > The original cover letter with lots of test results can be found here:
> > 
> > https://lkml.org/lkml/2016/2/8/813
> > 
> > Please consider for merging into your tree.
> > 
> > Alternately, the following branch can be pulled:
> > 
> > http://git.linaro.org/people/nicolas.pitre/linux.git autoksyms
> > 
> > Thanks.
> > 
> > Changes from v6:
> > 
> > - Rebased on v4.6-rc1, including adjustments to the recently introduced
> >   rule_as_o_S.
> > 
> > - Explicitly ignored more if_changed_dep callers for which no EXPORT_SYMBOL
> >   can be parsed.
> > 
> > Changes from v5:
> > 
> > - Disable automatic dependency file generation during the preprocessor
> >   pass when gathering exported symbol names.  Not only it is redundant
> >   but in some conditions this crashes fixdep that might be reading the
> >   previous dependency file at the same time. Reported by Michal Marek.
> > 
> > - Redirect error messages to stderr rather than pass it as a symbol name
> >   dependency.
> > 
> > Changes from v4:
> > 
> > - Correctness changes plus small cleanup to adjust_autoksyms.sh as
> >   suggested by Michal Marek.
> > 
> > - Changed ksym build dependency generation by re-running the preprocessor
> >   rather than collecting those dependencies as warnings through stderr
> >   which was too fragile.
> > 
> > Changes from v3:
> > 
> > - Shell portability changes to adjust_autoksyms.sh, partly from
> >   suggestions by Zev Weiss.
> > 
> > - Fix sample modules by building them before adjust_autoksyms.sh is run.
> > 
> > Changes from v2:
> > 
> > - Generating the build dependencies by parsing the source with fixdep
> >   turned out to be unreliable due to all the EXPORT_SYMBOL() variants,
> >   and especially their use within macros where the actual symbol name
> >   is known only after running the preprocessor. This list of symbol names
> >   is now obtained from the preprocessor directly, fixing allmodconfig
> >   builds.
> > 
> > Changes from v1:
> > 
> > - Replaced "exp" that doesn't convey the right meaning as noted by
> >   Sam Ravnborg. The "ksym" identifier is actually what the kernel
> >   already uses for this. Therefore:
> >   - CONFIG_TRIM_UNUSED_EXPSYMS --> CONFIG_TRIM_UNUSED_KSYMS
> >   - include/generated/expsyms.h --> include/generated/autoksyms.h
> >   - #define __EXPSYM_* --> #define __KSYM_*
> > 
> > - Some sed regexp improvements as suggested by Al Viro.
> > 
> > - Renamed vmlinux_recursive target to autoksyms_recursive.
> > 
> > - Accept EXPORT_SYMBOL variants with a prefix, e.g. ACPI_EXPORT_SYMBOL.
> > 
> > - Minor commit log clarifications.
> > 
> > - Added Rusty's ACK.
> > 
> > diffstat:
> > 
> >  Makefile|  23 +++--
> >  include/linux/export.h  |  33 -
> >  init/Kconfig|  16 ++
> >  scripts/Kbuild.include  |  32 +++-
> >  scripts/Makefile.build  |  32 ++--
> >  scripts/adjust_autoksyms.sh | 101 ++
> >  scripts/basic/fixdep.c  |  61 +--
> >  7 files changed, 261 insertions(+), 37 deletions(-)
> > 
> > 
> 
> 


Re: [PATCH v7 0/8]/[PULL REQUEST] Trim unused exported kernel symbols

2016-04-18 Thread Nicolas Pitre
Ping !

/me only hears back empty cave echoes ...


On Wed, 6 Apr 2016, Nicolas Pitre wrote:

> 
> Gentle ping...
> 
> If possible, I'd like for those patches to be sorted out before the 
> opening of the merge window gets too close like last time.
> 
> 
> On Tue, 29 Mar 2016, Nicolas Pitre wrote:
> 
> > This patch series provides the option to omit exported symbols from
> > the kernel and modules that are never referenced by any of the selected
> > modules in the current kernel configuration. this allows for optimizing
> > the compiled code and reducing final binaries' size. When using LTO the
> > binary size reduction is even more effective. It could also be argued
> > that this could bring some security advantages.
> > 
> > The original cover letter with lots of test results can be found here:
> > 
> > https://lkml.org/lkml/2016/2/8/813
> > 
> > Please consider for merging into your tree.
> > 
> > Alternately, the following branch can be pulled:
> > 
> > http://git.linaro.org/people/nicolas.pitre/linux.git autoksyms
> > 
> > Thanks.
> > 
> > Changes from v6:
> > 
> > - Rebased on v4.6-rc1, including adjustments to the recently introduced
> >   rule_as_o_S.
> > 
> > - Explicitly ignored more if_changed_dep callers for which no EXPORT_SYMBOL
> >   can be parsed.
> > 
> > Changes from v5:
> > 
> > - Disable automatic dependency file generation during the preprocessor
> >   pass when gathering exported symbol names.  Not only it is redundant
> >   but in some conditions this crashes fixdep that might be reading the
> >   previous dependency file at the same time. Reported by Michal Marek.
> > 
> > - Redirect error messages to stderr rather than pass it as a symbol name
> >   dependency.
> > 
> > Changes from v4:
> > 
> > - Correctness changes plus small cleanup to adjust_autoksyms.sh as
> >   suggested by Michal Marek.
> > 
> > - Changed ksym build dependency generation by re-running the preprocessor
> >   rather than collecting those dependencies as warnings through stderr
> >   which was too fragile.
> > 
> > Changes from v3:
> > 
> > - Shell portability changes to adjust_autoksyms.sh, partly from
> >   suggestions by Zev Weiss.
> > 
> > - Fix sample modules by building them before adjust_autoksyms.sh is run.
> > 
> > Changes from v2:
> > 
> > - Generating the build dependencies by parsing the source with fixdep
> >   turned out to be unreliable due to all the EXPORT_SYMBOL() variants,
> >   and especially their use within macros where the actual symbol name
> >   is known only after running the preprocessor. This list of symbol names
> >   is now obtained from the preprocessor directly, fixing allmodconfig
> >   builds.
> > 
> > Changes from v1:
> > 
> > - Replaced "exp" that doesn't convey the right meaning as noted by
> >   Sam Ravnborg. The "ksym" identifier is actually what the kernel
> >   already uses for this. Therefore:
> >   - CONFIG_TRIM_UNUSED_EXPSYMS --> CONFIG_TRIM_UNUSED_KSYMS
> >   - include/generated/expsyms.h --> include/generated/autoksyms.h
> >   - #define __EXPSYM_* --> #define __KSYM_*
> > 
> > - Some sed regexp improvements as suggested by Al Viro.
> > 
> > - Renamed vmlinux_recursive target to autoksyms_recursive.
> > 
> > - Accept EXPORT_SYMBOL variants with a prefix, e.g. ACPI_EXPORT_SYMBOL.
> > 
> > - Minor commit log clarifications.
> > 
> > - Added Rusty's ACK.
> > 
> > diffstat:
> > 
> >  Makefile|  23 +++--
> >  include/linux/export.h  |  33 -
> >  init/Kconfig|  16 ++
> >  scripts/Kbuild.include  |  32 +++-
> >  scripts/Makefile.build  |  32 ++--
> >  scripts/adjust_autoksyms.sh | 101 ++
> >  scripts/basic/fixdep.c  |  61 +--
> >  7 files changed, 261 insertions(+), 37 deletions(-)
> > 
> > 
> 
> 


  1   2   3   4   5   6   7   8   9   10   >