Re: [PATCH AUTOSEL for-4.4 39/39] MIPS: Use Makefile.postlink to insert relocations into vmlinux

2017-11-09 Thread Levin, Alexander (Sasha Levin)
On Thu, Nov 09, 2017 at 09:16:44AM +, Matt Redfearn wrote:
>
>
>On 08/11/17 20:50, Levin, Alexander (Sasha Levin) wrote:
>>From: Matt Redfearn <matt.redfe...@imgtec.com>
>>
>>[ Upstream commit 44079d3509aee89c58f3e4fd929fa53ab2299019 ]
>>
>>When relocatable support for MIPS was merged, there was no support for
>>an architecture to add a postlink step for vmlinux. This meant that only
>>invoking a target within the boot directory, such as uImage, caused the
>>relocations to be inserted into vmlinux. Building just the vmlinux
>>target would result in a relocatable kernel with no relocation
>>information present.
>>
>>Commit fbe6e37dab97 ("kbuild: add arch specific post-link Makefile")
>
>Hi,
>
>This patch depends on upstream commit fbe6e37dab97 ("kbuild: add arch 
>specific post-link Makefile") which was introduced in v4.9.
>
>This patch is an improvement to the build flow and I would not 
>consider it for backporting - certainly not to v4.8 or earlier which 
>is missing the dependency. Applying it will not break anything, 
>however, it will perform no function either without the supporting 
>dependency.

I'll just drop it from 4.9 and 4.4 then, Thanks Matt.

-- 

Thanks,
Sasha

Re: [PATCH AUTOSEL for-4.4 39/39] MIPS: Use Makefile.postlink to insert relocations into vmlinux

2017-11-09 Thread Levin, Alexander (Sasha Levin)
On Thu, Nov 09, 2017 at 09:16:44AM +, Matt Redfearn wrote:
>
>
>On 08/11/17 20:50, Levin, Alexander (Sasha Levin) wrote:
>>From: Matt Redfearn 
>>
>>[ Upstream commit 44079d3509aee89c58f3e4fd929fa53ab2299019 ]
>>
>>When relocatable support for MIPS was merged, there was no support for
>>an architecture to add a postlink step for vmlinux. This meant that only
>>invoking a target within the boot directory, such as uImage, caused the
>>relocations to be inserted into vmlinux. Building just the vmlinux
>>target would result in a relocatable kernel with no relocation
>>information present.
>>
>>Commit fbe6e37dab97 ("kbuild: add arch specific post-link Makefile")
>
>Hi,
>
>This patch depends on upstream commit fbe6e37dab97 ("kbuild: add arch 
>specific post-link Makefile") which was introduced in v4.9.
>
>This patch is an improvement to the build flow and I would not 
>consider it for backporting - certainly not to v4.8 or earlier which 
>is missing the dependency. Applying it will not break anything, 
>however, it will perform no function either without the supporting 
>dependency.

I'll just drop it from 4.9 and 4.4 then, Thanks Matt.

-- 

Thanks,
Sasha

Re: [PATCH AUTOSEL for-4.9 04/53] spi: imx: adjust watermark level according to transfer length

2017-11-08 Thread Levin, Alexander (Sasha Levin)
On Wed, Nov 08, 2017 at 11:11:11PM +, Mark Brown wrote:
>On Wed, Nov 08, 2017 at 10:48:14PM +0000, Levin, Alexander (Sasha Levin) wrote:
>> On Wed, Nov 08, 2017 at 10:11:02PM +, Mark Brown wrote:
>
>> >expose problems if we start using it.  If you look at the history of the
>> >driver there's some quirks were added later on for example, and I didn't
>> >check the DMA controller drivers or anything and obviously can't see any
>> >out of tree code users may have.
>
>> I'm considering these commits to be on the safer side because they're
>> much older than the ones Greg usually grabs. There were no upstream
>> fixes to this commit for 10 months now, and given the code changes
>> upstream in that subsystem, this patch seemed to be safe to backport.
>
>Like I say I'm seeing some potentially relevant variant handling added
>later and you also have to consider the DMA drivers it might be used
>with (imx-dma looks safe but perhaps there's other things, never mind
>out of tree code).  It just doesn't feel good.
>
>We have also had problems in the past with SPI performance enhancements
>exposing exising problems elsewhere though not so much with this sort of
>area so I'm less worried about that.

Sure, I'll drop it. Thanks!

-- 

Thanks,
Sasha

Re: [PATCH AUTOSEL for-4.9 04/53] spi: imx: adjust watermark level according to transfer length

2017-11-08 Thread Levin, Alexander (Sasha Levin)
On Wed, Nov 08, 2017 at 11:11:11PM +, Mark Brown wrote:
>On Wed, Nov 08, 2017 at 10:48:14PM +0000, Levin, Alexander (Sasha Levin) wrote:
>> On Wed, Nov 08, 2017 at 10:11:02PM +, Mark Brown wrote:
>
>> >expose problems if we start using it.  If you look at the history of the
>> >driver there's some quirks were added later on for example, and I didn't
>> >check the DMA controller drivers or anything and obviously can't see any
>> >out of tree code users may have.
>
>> I'm considering these commits to be on the safer side because they're
>> much older than the ones Greg usually grabs. There were no upstream
>> fixes to this commit for 10 months now, and given the code changes
>> upstream in that subsystem, this patch seemed to be safe to backport.
>
>Like I say I'm seeing some potentially relevant variant handling added
>later and you also have to consider the DMA drivers it might be used
>with (imx-dma looks safe but perhaps there's other things, never mind
>out of tree code).  It just doesn't feel good.
>
>We have also had problems in the past with SPI performance enhancements
>exposing exising problems elsewhere though not so much with this sort of
>area so I'm less worried about that.

Sure, I'll drop it. Thanks!

-- 

Thanks,
Sasha

Re: [PATCH AUTOSEL for-4.9 04/53] spi: imx: adjust watermark level according to transfer length

2017-11-08 Thread Levin, Alexander (Sasha Levin)
On Wed, Nov 08, 2017 at 10:11:02PM +, Mark Brown wrote:
>On Wed, Nov 08, 2017 at 09:39:11PM +0000, Levin, Alexander (Sasha Levin) wrote:
>> >On Wed, Nov 08, 2017 at 08:49:55PM +0000, Levin, Alexander (Sasha Levin) 
>> >wrote:
>> >This seems like an optimization not a bug fix...
>
>> Hm, is it? I read it as "DMA is not being used at all even though we
>> thought we're using it".
>
>Yes, that's how I read it too.
>
>> Yes, the impact is "just" performance, but doesn't it result in quite
>> a significat impact?
>
>Only about double according to the initial commit adding DMA support
>which is frankly a bit disappointing although yeah, it's a big win.  My
>worry is that if there's a problem with DMA on some device for which a
>fix wasn't backported (or where we're using a fallback) this could
>expose problems if we start using it.  If you look at the history of the
>driver there's some quirks were added later on for example, and I didn't
>check the DMA controller drivers or anything and obviously can't see any
>out of tree code users may have.
>
>*Probably* it doesn't break anything but since it's not fixing anything
>and the risk is data corruption I'd be much more comfortable with a more
>thorough risk analysis.

I'm considering these commits to be on the safer side because they're
much older than the ones Greg usually grabs. There were no upstream
fixes to this commit for 10 months now, and given the code changes
upstream in that subsystem, this patch seemed to be safe to backport.

-- 

Thanks,
Sasha

Re: [PATCH AUTOSEL for-4.9 04/53] spi: imx: adjust watermark level according to transfer length

2017-11-08 Thread Levin, Alexander (Sasha Levin)
On Wed, Nov 08, 2017 at 10:11:02PM +, Mark Brown wrote:
>On Wed, Nov 08, 2017 at 09:39:11PM +0000, Levin, Alexander (Sasha Levin) wrote:
>> >On Wed, Nov 08, 2017 at 08:49:55PM +0000, Levin, Alexander (Sasha Levin) 
>> >wrote:
>> >This seems like an optimization not a bug fix...
>
>> Hm, is it? I read it as "DMA is not being used at all even though we
>> thought we're using it".
>
>Yes, that's how I read it too.
>
>> Yes, the impact is "just" performance, but doesn't it result in quite
>> a significat impact?
>
>Only about double according to the initial commit adding DMA support
>which is frankly a bit disappointing although yeah, it's a big win.  My
>worry is that if there's a problem with DMA on some device for which a
>fix wasn't backported (or where we're using a fallback) this could
>expose problems if we start using it.  If you look at the history of the
>driver there's some quirks were added later on for example, and I didn't
>check the DMA controller drivers or anything and obviously can't see any
>out of tree code users may have.
>
>*Probably* it doesn't break anything but since it's not fixing anything
>and the risk is data corruption I'd be much more comfortable with a more
>thorough risk analysis.

I'm considering these commits to be on the safer side because they're
much older than the ones Greg usually grabs. There were no upstream
fixes to this commit for 10 months now, and given the code changes
upstream in that subsystem, this patch seemed to be safe to backport.

-- 

Thanks,
Sasha

Re: [PATCH AUTOSEL for-4.9 04/53] spi: imx: adjust watermark level according to transfer length

2017-11-08 Thread Levin, Alexander (Sasha Levin)
On Wed, Nov 08, 2017 at 08:57:52PM +, Mark Brown wrote:
>On Wed, Nov 08, 2017 at 08:49:55PM +0000, Levin, Alexander (Sasha Levin) wrote:
>> From: Jiada Wang <jiada_w...@mentor.com>
>>
>> [ Upstream commit 66459c5a50a787c474b734b586328f7111ab6df0 ]
>>
>> Previously DMA watermark level is configured to fifosize/2,
>> DMA mode can be used only when transfer length can be divided
>> by 'watermark level * bpw', which makes DMA mode not pratical.
>>
>> This patch adjusts watermark level to largest number (no bigger
>> than fifosize/2) which can divide 'tranfer length / bpw' for
>> each transfer.
>
>This seems like an optimization not a bug fix...

Hm, is it? I read it as "DMA is not being used at all even though we
thought we're using it".

Yes, the impact is "just" performance, but doesn't it result in quite
a significat impact?

-- 

Thanks,
Sasha

Re: [PATCH AUTOSEL for-4.9 04/53] spi: imx: adjust watermark level according to transfer length

2017-11-08 Thread Levin, Alexander (Sasha Levin)
On Wed, Nov 08, 2017 at 08:57:52PM +, Mark Brown wrote:
>On Wed, Nov 08, 2017 at 08:49:55PM +0000, Levin, Alexander (Sasha Levin) wrote:
>> From: Jiada Wang 
>>
>> [ Upstream commit 66459c5a50a787c474b734b586328f7111ab6df0 ]
>>
>> Previously DMA watermark level is configured to fifosize/2,
>> DMA mode can be used only when transfer length can be divided
>> by 'watermark level * bpw', which makes DMA mode not pratical.
>>
>> This patch adjusts watermark level to largest number (no bigger
>> than fifosize/2) which can divide 'tranfer length / bpw' for
>> each transfer.
>
>This seems like an optimization not a bug fix...

Hm, is it? I read it as "DMA is not being used at all even though we
thought we're using it".

Yes, the impact is "just" performance, but doesn't it result in quite
a significat impact?

-- 

Thanks,
Sasha

[PATCH AUTOSEL for-4.4 17/39] scsi: lpfc: Add missing memory barrier

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: James Smart 

[ Upstream commit 6b3b3bdb83b4ad51252d21bb13596db879e51850 ]

On loosely ordered memory systems (PPC for example), the WQE elements
were being updated in memory, but not necessarily flushed before the
separate doorbell was written to hw which would cause hw to dma the
WQE element. Thus, the hardware occasionally received partially
updated WQE data.

Add the memory barrier after updating the WQE memory.

Signed-off-by: Dick Kennedy 
Signed-off-by: James Smart 
Reviewed-by: Hannes Reinecke 
Signed-off-by: Martin K. Petersen 
Signed-off-by: Sasha Levin 
---
 drivers/scsi/lpfc/lpfc_sli.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index 38e90d9c2ced..abba562cf145 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -118,6 +118,8 @@ lpfc_sli4_wq_put(struct lpfc_queue *q, union lpfc_wqe *wqe)
if (q->phba->sli3_options & LPFC_SLI4_PHWQ_ENABLED)
bf_set(wqe_wqid, >generic.wqe_com, q->queue_id);
lpfc_sli_pcimem_bcopy(wqe, temp_wqe, q->entry_size);
+   /* ensure WQE bcopy flushed before doorbell write */
+   wmb();
 
/* Update the host index before invoking device */
host_index = q->host_index;
-- 
2.11.0


[PATCH AUTOSEL for-4.4 17/39] scsi: lpfc: Add missing memory barrier

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: James Smart 

[ Upstream commit 6b3b3bdb83b4ad51252d21bb13596db879e51850 ]

On loosely ordered memory systems (PPC for example), the WQE elements
were being updated in memory, but not necessarily flushed before the
separate doorbell was written to hw which would cause hw to dma the
WQE element. Thus, the hardware occasionally received partially
updated WQE data.

Add the memory barrier after updating the WQE memory.

Signed-off-by: Dick Kennedy 
Signed-off-by: James Smart 
Reviewed-by: Hannes Reinecke 
Signed-off-by: Martin K. Petersen 
Signed-off-by: Sasha Levin 
---
 drivers/scsi/lpfc/lpfc_sli.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index 38e90d9c2ced..abba562cf145 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -118,6 +118,8 @@ lpfc_sli4_wq_put(struct lpfc_queue *q, union lpfc_wqe *wqe)
if (q->phba->sli3_options & LPFC_SLI4_PHWQ_ENABLED)
bf_set(wqe_wqid, >generic.wqe_com, q->queue_id);
lpfc_sli_pcimem_bcopy(wqe, temp_wqe, q->entry_size);
+   /* ensure WQE bcopy flushed before doorbell write */
+   wmb();
 
/* Update the host index before invoking device */
host_index = q->host_index;
-- 
2.11.0


[PATCH AUTOSEL for-4.4 18/39] scsi: lpfc: FCoE VPort enable-disable does not bring up the VPort

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: James Smart 

[ Upstream commit 104450eb08ca662e6b1d02da11aca9598e978f3e ]

FCoE VPort enable-disable does not bring up the VPort.
VPI structure needed to be initialized before being re-registered.

Signed-off-by: Dick Kennedy 
Signed-off-by: James Smart 
Reviewed-by: Hannes Reinecke 
Signed-off-by: Martin K. Petersen 
Signed-off-by: Sasha Levin 
---
 drivers/scsi/lpfc/lpfc_vport.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/scsi/lpfc/lpfc_vport.c b/drivers/scsi/lpfc/lpfc_vport.c
index 769012663a8f..861c57bc4520 100644
--- a/drivers/scsi/lpfc/lpfc_vport.c
+++ b/drivers/scsi/lpfc/lpfc_vport.c
@@ -528,6 +528,12 @@ enable_vport(struct fc_vport *fc_vport)
 
spin_lock_irq(shost->host_lock);
vport->load_flag |= FC_LOADING;
+   if (vport->fc_flag & FC_VPORT_NEEDS_INIT_VPI) {
+   spin_unlock_irq(shost->host_lock);
+   lpfc_issue_init_vpi(vport);
+   goto out;
+   }
+
vport->fc_flag |= FC_VPORT_NEEDS_REG_VPI;
spin_unlock_irq(shost->host_lock);
 
@@ -548,6 +554,8 @@ enable_vport(struct fc_vport *fc_vport)
} else {
lpfc_vport_set_state(vport, FC_VPORT_FAILED);
}
+
+out:
lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT,
 "1827 Vport Enabled.\n");
return VPORT_OK;
-- 
2.11.0


[PATCH AUTOSEL for-4.4 18/39] scsi: lpfc: FCoE VPort enable-disable does not bring up the VPort

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: James Smart 

[ Upstream commit 104450eb08ca662e6b1d02da11aca9598e978f3e ]

FCoE VPort enable-disable does not bring up the VPort.
VPI structure needed to be initialized before being re-registered.

Signed-off-by: Dick Kennedy 
Signed-off-by: James Smart 
Reviewed-by: Hannes Reinecke 
Signed-off-by: Martin K. Petersen 
Signed-off-by: Sasha Levin 
---
 drivers/scsi/lpfc/lpfc_vport.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/scsi/lpfc/lpfc_vport.c b/drivers/scsi/lpfc/lpfc_vport.c
index 769012663a8f..861c57bc4520 100644
--- a/drivers/scsi/lpfc/lpfc_vport.c
+++ b/drivers/scsi/lpfc/lpfc_vport.c
@@ -528,6 +528,12 @@ enable_vport(struct fc_vport *fc_vport)
 
spin_lock_irq(shost->host_lock);
vport->load_flag |= FC_LOADING;
+   if (vport->fc_flag & FC_VPORT_NEEDS_INIT_VPI) {
+   spin_unlock_irq(shost->host_lock);
+   lpfc_issue_init_vpi(vport);
+   goto out;
+   }
+
vport->fc_flag |= FC_VPORT_NEEDS_REG_VPI;
spin_unlock_irq(shost->host_lock);
 
@@ -548,6 +554,8 @@ enable_vport(struct fc_vport *fc_vport)
} else {
lpfc_vport_set_state(vport, FC_VPORT_FAILED);
}
+
+out:
lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT,
 "1827 Vport Enabled.\n");
return VPORT_OK;
-- 
2.11.0


[PATCH AUTOSEL for-4.4 16/39] staging: rtl8188eu: fix incorrect ERROR tags from logs

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Galo Navarro 

[ Upstream commit 401579c22ccbcb54244494069973e64b1fe980d2 ]

Several lifecycle events in the rtl8188eu driver are logged using the
DBG_88E_LEVEL macro from rtw_debug.h, which is tagged as ERROR
regardless of the actual level.  Below are dmesg excerpts after loading
and unloading the module, the messages are misleading as there was no
error.

[517434.916239] usbcore: registered new interface driver r8188eu
[517435.680653] R8188EU: ERROR indicate disassoc
[517437.122606] R8188EU: ERROR assoc success
[517797.735611] usbcore: deregistering interface driver r8188eu
[517797.736069] R8188EU: ERROR indicate disassoc

Remove the ERROR prefix from the logs.  After the patch, logs are:

[517949.873976] usbcore: registered new interface driver r8188eu
[517950.592845] R8188EU: indicate disassoc
[517951.993973] R8188EU: assoc success
[521778.784448] usbcore: deregistering interface driver r8188eu
[521778.784838] R8188EU: indicate disassoc

Signed-off-by: Galo Navarro 
Signed-off-by: Greg Kroah-Hartman 
Signed-off-by: Sasha Levin 
---
 drivers/staging/rtl8188eu/include/rtw_debug.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8188eu/include/rtw_debug.h 
b/drivers/staging/rtl8188eu/include/rtw_debug.h
index 971bf457f32d..e75a386344e4 100644
--- a/drivers/staging/rtl8188eu/include/rtw_debug.h
+++ b/drivers/staging/rtl8188eu/include/rtw_debug.h
@@ -75,7 +75,7 @@ extern u32 GlobalDebugLevel;
 #define DBG_88E_LEVEL(_level, fmt, arg...) \
do {\
if (_level <= GlobalDebugLevel) \
-   pr_info(DRIVER_PREFIX"ERROR " fmt, ##arg);  \
+   pr_info(DRIVER_PREFIX fmt, ##arg);  \
} while (0)
 
 #define DBG_88E(...)   \
-- 
2.11.0


[PATCH AUTOSEL for-4.4 16/39] staging: rtl8188eu: fix incorrect ERROR tags from logs

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Galo Navarro 

[ Upstream commit 401579c22ccbcb54244494069973e64b1fe980d2 ]

Several lifecycle events in the rtl8188eu driver are logged using the
DBG_88E_LEVEL macro from rtw_debug.h, which is tagged as ERROR
regardless of the actual level.  Below are dmesg excerpts after loading
and unloading the module, the messages are misleading as there was no
error.

[517434.916239] usbcore: registered new interface driver r8188eu
[517435.680653] R8188EU: ERROR indicate disassoc
[517437.122606] R8188EU: ERROR assoc success
[517797.735611] usbcore: deregistering interface driver r8188eu
[517797.736069] R8188EU: ERROR indicate disassoc

Remove the ERROR prefix from the logs.  After the patch, logs are:

[517949.873976] usbcore: registered new interface driver r8188eu
[517950.592845] R8188EU: indicate disassoc
[517951.993973] R8188EU: assoc success
[521778.784448] usbcore: deregistering interface driver r8188eu
[521778.784838] R8188EU: indicate disassoc

Signed-off-by: Galo Navarro 
Signed-off-by: Greg Kroah-Hartman 
Signed-off-by: Sasha Levin 
---
 drivers/staging/rtl8188eu/include/rtw_debug.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8188eu/include/rtw_debug.h 
b/drivers/staging/rtl8188eu/include/rtw_debug.h
index 971bf457f32d..e75a386344e4 100644
--- a/drivers/staging/rtl8188eu/include/rtw_debug.h
+++ b/drivers/staging/rtl8188eu/include/rtw_debug.h
@@ -75,7 +75,7 @@ extern u32 GlobalDebugLevel;
 #define DBG_88E_LEVEL(_level, fmt, arg...) \
do {\
if (_level <= GlobalDebugLevel) \
-   pr_info(DRIVER_PREFIX"ERROR " fmt, ##arg);  \
+   pr_info(DRIVER_PREFIX fmt, ##arg);  \
} while (0)
 
 #define DBG_88E(...)   \
-- 
2.11.0


[PATCH AUTOSEL for-4.4 08/39] ata: SATA_HIGHBANK should depend on HAS_DMA

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Geert Uytterhoeven 

[ Upstream commit 2a736e0585e585c2566b5119af8381910a170e44 ]

If NO_DMA=y:

ERROR: "bad_dma_ops" [drivers/ata/sata_highbank.ko] undefined!

Add a dependency on HAS_DMA to fix this.

Signed-off-by: Geert Uytterhoeven 
Signed-off-by: Tejun Heo 
Signed-off-by: Sasha Levin 
---
 drivers/ata/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index fd19d180f640..c1e40ebaf5e2 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -319,6 +319,7 @@ config SATA_DWC_VDEBUG
 
 config SATA_HIGHBANK
tristate "Calxeda Highbank SATA support"
+   depends on HAS_DMA
depends on ARCH_HIGHBANK || COMPILE_TEST
help
  This option enables support for the Calxeda Highbank SoC's
-- 
2.11.0


[PATCH AUTOSEL for-4.4 08/39] ata: SATA_HIGHBANK should depend on HAS_DMA

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Geert Uytterhoeven 

[ Upstream commit 2a736e0585e585c2566b5119af8381910a170e44 ]

If NO_DMA=y:

ERROR: "bad_dma_ops" [drivers/ata/sata_highbank.ko] undefined!

Add a dependency on HAS_DMA to fix this.

Signed-off-by: Geert Uytterhoeven 
Signed-off-by: Tejun Heo 
Signed-off-by: Sasha Levin 
---
 drivers/ata/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index fd19d180f640..c1e40ebaf5e2 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -319,6 +319,7 @@ config SATA_DWC_VDEBUG
 
 config SATA_HIGHBANK
tristate "Calxeda Highbank SATA support"
+   depends on HAS_DMA
depends on ARCH_HIGHBANK || COMPILE_TEST
help
  This option enables support for the Calxeda Highbank SoC's
-- 
2.11.0


[PATCH AUTOSEL for-4.4 11/39] igb: reset the PHY before reading the PHY ID

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Aaron Sierra 

[ Upstream commit 182785335447957409282ca745aa5bc3968facee ]

Several people have reported firmware leaving the I210/I211 PHY's page
select register set to something other than the default of zero. This
causes the first accesses, PHY_IDx register reads, to access something
else, resulting in device probe failure:

igb: Intel(R) Gigabit Ethernet Network Driver - version 5.4.0-k
igb: Copyright (c) 2007-2014 Intel Corporation.
igb: probe of :01:00.0 failed with error -2

This problem began for them after a previous patch I submitted was
applied:

commit 2a3cdead8b408351fa1e3079b220fa331480ffbc
Author: Aaron Sierra 
Date:   Tue Nov 3 12:37:09 2015 -0600

igb: Remove GS40G specific defines/functions

I personally experienced this problem after attempting to PXE boot from
I210 devices using this firmware:

Intel(R) Boot Agent GE v1.5.78
Copyright (C) 1997-2014, Intel Corporation

Resetting the PHY before reading from it, ensures the page select
register is in its default state and doesn't make assumptions about
the PHY's register set before the PHY has been probed.

Cc: Matwey V. Kornilov 
Cc: Chris Arges 
Cc: Jochen Henneberg 
Signed-off-by: Aaron Sierra 
Tested-by: Matwey V. Kornilov 
Tested-by: Chris J Arges 
Tested-by: Aaron Brown 
Signed-off-by: Jeff Kirsher 
Signed-off-by: Sasha Levin 
---
 drivers/net/ethernet/intel/igb/e1000_82575.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/drivers/net/ethernet/intel/igb/e1000_82575.c 
b/drivers/net/ethernet/intel/igb/e1000_82575.c
index 97bf0c3d5c69..f3f3b95d5512 100644
--- a/drivers/net/ethernet/intel/igb/e1000_82575.c
+++ b/drivers/net/ethernet/intel/igb/e1000_82575.c
@@ -223,6 +223,17 @@ static s32 igb_init_phy_params_82575(struct e1000_hw *hw)
hw->bus.func = (rd32(E1000_STATUS) & E1000_STATUS_FUNC_MASK) >>
E1000_STATUS_FUNC_SHIFT;
 
+   /* Make sure the PHY is in a good state. Several people have reported
+* firmware leaving the PHY's page select register set to something
+* other than the default of zero, which causes the PHY ID read to
+* access something other than the intended register.
+*/
+   ret_val = hw->phy.ops.reset(hw);
+   if (ret_val) {
+   hw_dbg("Error resetting the PHY.\n");
+   goto out;
+   }
+
/* Set phy->phy_addr and phy->id. */
ret_val = igb_get_phy_id_82575(hw);
if (ret_val)
-- 
2.11.0


[PATCH AUTOSEL for-4.4 23/39] ALSA: vx: Fix possible transfer overflow

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Takashi Iwai 

[ Upstream commit 874e1f6fad9a5184b67f4cee37c1335cd2cc5677 ]

The pseudo DMA transfer codes in VX222 and VX-pocket driver have a
slight bug where they check the buffer boundary wrongly, and may
overflow.  Also, the zero sample count might be handled badly for the
playback (although it shouldn't happen in theory).  This patch
addresses these issues.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=141541
Signed-off-by: Takashi Iwai 
Signed-off-by: Sasha Levin 
---
 sound/drivers/vx/vx_pcm.c   |  6 --
 sound/pci/vx222/vx222_ops.c | 12 ++--
 sound/pcmcia/vx/vxp_ops.c   | 12 ++--
 3 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/sound/drivers/vx/vx_pcm.c b/sound/drivers/vx/vx_pcm.c
index 69f252585780..ea7b377f0378 100644
--- a/sound/drivers/vx/vx_pcm.c
+++ b/sound/drivers/vx/vx_pcm.c
@@ -1048,8 +1048,10 @@ static void vx_pcm_capture_update(struct vx_core *chip, 
struct snd_pcm_substream
/* ok, let's accelerate! */
int align = pipe->align * 3;
space = (count / align) * align;
-   vx_pseudo_dma_read(chip, runtime, pipe, space);
-   count -= space;
+   if (space > 0) {
+   vx_pseudo_dma_read(chip, runtime, pipe, space);
+   count -= space;
+   }
}
/* read the rest of bytes */
while (count > 0) {
diff --git a/sound/pci/vx222/vx222_ops.c b/sound/pci/vx222/vx222_ops.c
index af83b3b38052..8e457ea27f89 100644
--- a/sound/pci/vx222/vx222_ops.c
+++ b/sound/pci/vx222/vx222_ops.c
@@ -269,12 +269,12 @@ static void vx2_dma_write(struct vx_core *chip, struct 
snd_pcm_runtime *runtime,
 
/* Transfer using pseudo-dma.
 */
-   if (offset + count > pipe->buffer_bytes) {
+   if (offset + count >= pipe->buffer_bytes) {
int length = pipe->buffer_bytes - offset;
count -= length;
length >>= 2; /* in 32bit words */
/* Transfer using pseudo-dma. */
-   while (length-- > 0) {
+   for (; length > 0; length--) {
outl(cpu_to_le32(*addr), port);
addr++;
}
@@ -284,7 +284,7 @@ static void vx2_dma_write(struct vx_core *chip, struct 
snd_pcm_runtime *runtime,
pipe->hw_ptr += count;
count >>= 2; /* in 32bit words */
/* Transfer using pseudo-dma. */
-   while (count-- > 0) {
+   for (; count > 0; count--) {
outl(cpu_to_le32(*addr), port);
addr++;
}
@@ -307,12 +307,12 @@ static void vx2_dma_read(struct vx_core *chip, struct 
snd_pcm_runtime *runtime,
vx2_setup_pseudo_dma(chip, 0);
/* Transfer using pseudo-dma.
 */
-   if (offset + count > pipe->buffer_bytes) {
+   if (offset + count >= pipe->buffer_bytes) {
int length = pipe->buffer_bytes - offset;
count -= length;
length >>= 2; /* in 32bit words */
/* Transfer using pseudo-dma. */
-   while (length-- > 0)
+   for (; length > 0; length--)
*addr++ = le32_to_cpu(inl(port));
addr = (u32 *)runtime->dma_area;
pipe->hw_ptr = 0;
@@ -320,7 +320,7 @@ static void vx2_dma_read(struct vx_core *chip, struct 
snd_pcm_runtime *runtime,
pipe->hw_ptr += count;
count >>= 2; /* in 32bit words */
/* Transfer using pseudo-dma. */
-   while (count-- > 0)
+   for (; count > 0; count--)
*addr++ = le32_to_cpu(inl(port));
 
vx2_release_pseudo_dma(chip);
diff --git a/sound/pcmcia/vx/vxp_ops.c b/sound/pcmcia/vx/vxp_ops.c
index 281972913c32..56aa1ba73ccc 100644
--- a/sound/pcmcia/vx/vxp_ops.c
+++ b/sound/pcmcia/vx/vxp_ops.c
@@ -369,12 +369,12 @@ static void vxp_dma_write(struct vx_core *chip, struct 
snd_pcm_runtime *runtime,
unsigned short *addr = (unsigned short *)(runtime->dma_area + offset);
 
vx_setup_pseudo_dma(chip, 1);
-   if (offset + count > pipe->buffer_bytes) {
+   if (offset + count >= pipe->buffer_bytes) {
int length = pipe->buffer_bytes - offset;
count -= length;
length >>= 1; /* in 16bit words */
/* Transfer using pseudo-dma. */
-   while (length-- > 0) {
+   for (; length > 0; length--) {
outw(cpu_to_le16(*addr), port);
addr++;
}
@@ -384,7 +384,7 @@ static void vxp_dma_write(struct vx_core *chip, struct 
snd_pcm_runtime *runtime,
pipe->hw_ptr += count;
count >>= 1; /* in 16bit words */
/* Transfer using pseudo-dma. */
-   while (count-- > 0) {
+   for (; count > 0; count--) {
outw(cpu_to_le16(*addr), port);
addr++;
}

[PATCH AUTOSEL for-4.4 11/39] igb: reset the PHY before reading the PHY ID

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Aaron Sierra 

[ Upstream commit 182785335447957409282ca745aa5bc3968facee ]

Several people have reported firmware leaving the I210/I211 PHY's page
select register set to something other than the default of zero. This
causes the first accesses, PHY_IDx register reads, to access something
else, resulting in device probe failure:

igb: Intel(R) Gigabit Ethernet Network Driver - version 5.4.0-k
igb: Copyright (c) 2007-2014 Intel Corporation.
igb: probe of :01:00.0 failed with error -2

This problem began for them after a previous patch I submitted was
applied:

commit 2a3cdead8b408351fa1e3079b220fa331480ffbc
Author: Aaron Sierra 
Date:   Tue Nov 3 12:37:09 2015 -0600

igb: Remove GS40G specific defines/functions

I personally experienced this problem after attempting to PXE boot from
I210 devices using this firmware:

Intel(R) Boot Agent GE v1.5.78
Copyright (C) 1997-2014, Intel Corporation

Resetting the PHY before reading from it, ensures the page select
register is in its default state and doesn't make assumptions about
the PHY's register set before the PHY has been probed.

Cc: Matwey V. Kornilov 
Cc: Chris Arges 
Cc: Jochen Henneberg 
Signed-off-by: Aaron Sierra 
Tested-by: Matwey V. Kornilov 
Tested-by: Chris J Arges 
Tested-by: Aaron Brown 
Signed-off-by: Jeff Kirsher 
Signed-off-by: Sasha Levin 
---
 drivers/net/ethernet/intel/igb/e1000_82575.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/drivers/net/ethernet/intel/igb/e1000_82575.c 
b/drivers/net/ethernet/intel/igb/e1000_82575.c
index 97bf0c3d5c69..f3f3b95d5512 100644
--- a/drivers/net/ethernet/intel/igb/e1000_82575.c
+++ b/drivers/net/ethernet/intel/igb/e1000_82575.c
@@ -223,6 +223,17 @@ static s32 igb_init_phy_params_82575(struct e1000_hw *hw)
hw->bus.func = (rd32(E1000_STATUS) & E1000_STATUS_FUNC_MASK) >>
E1000_STATUS_FUNC_SHIFT;
 
+   /* Make sure the PHY is in a good state. Several people have reported
+* firmware leaving the PHY's page select register set to something
+* other than the default of zero, which causes the PHY ID read to
+* access something other than the intended register.
+*/
+   ret_val = hw->phy.ops.reset(hw);
+   if (ret_val) {
+   hw_dbg("Error resetting the PHY.\n");
+   goto out;
+   }
+
/* Set phy->phy_addr and phy->id. */
ret_val = igb_get_phy_id_82575(hw);
if (ret_val)
-- 
2.11.0


[PATCH AUTOSEL for-4.4 23/39] ALSA: vx: Fix possible transfer overflow

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Takashi Iwai 

[ Upstream commit 874e1f6fad9a5184b67f4cee37c1335cd2cc5677 ]

The pseudo DMA transfer codes in VX222 and VX-pocket driver have a
slight bug where they check the buffer boundary wrongly, and may
overflow.  Also, the zero sample count might be handled badly for the
playback (although it shouldn't happen in theory).  This patch
addresses these issues.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=141541
Signed-off-by: Takashi Iwai 
Signed-off-by: Sasha Levin 
---
 sound/drivers/vx/vx_pcm.c   |  6 --
 sound/pci/vx222/vx222_ops.c | 12 ++--
 sound/pcmcia/vx/vxp_ops.c   | 12 ++--
 3 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/sound/drivers/vx/vx_pcm.c b/sound/drivers/vx/vx_pcm.c
index 69f252585780..ea7b377f0378 100644
--- a/sound/drivers/vx/vx_pcm.c
+++ b/sound/drivers/vx/vx_pcm.c
@@ -1048,8 +1048,10 @@ static void vx_pcm_capture_update(struct vx_core *chip, 
struct snd_pcm_substream
/* ok, let's accelerate! */
int align = pipe->align * 3;
space = (count / align) * align;
-   vx_pseudo_dma_read(chip, runtime, pipe, space);
-   count -= space;
+   if (space > 0) {
+   vx_pseudo_dma_read(chip, runtime, pipe, space);
+   count -= space;
+   }
}
/* read the rest of bytes */
while (count > 0) {
diff --git a/sound/pci/vx222/vx222_ops.c b/sound/pci/vx222/vx222_ops.c
index af83b3b38052..8e457ea27f89 100644
--- a/sound/pci/vx222/vx222_ops.c
+++ b/sound/pci/vx222/vx222_ops.c
@@ -269,12 +269,12 @@ static void vx2_dma_write(struct vx_core *chip, struct 
snd_pcm_runtime *runtime,
 
/* Transfer using pseudo-dma.
 */
-   if (offset + count > pipe->buffer_bytes) {
+   if (offset + count >= pipe->buffer_bytes) {
int length = pipe->buffer_bytes - offset;
count -= length;
length >>= 2; /* in 32bit words */
/* Transfer using pseudo-dma. */
-   while (length-- > 0) {
+   for (; length > 0; length--) {
outl(cpu_to_le32(*addr), port);
addr++;
}
@@ -284,7 +284,7 @@ static void vx2_dma_write(struct vx_core *chip, struct 
snd_pcm_runtime *runtime,
pipe->hw_ptr += count;
count >>= 2; /* in 32bit words */
/* Transfer using pseudo-dma. */
-   while (count-- > 0) {
+   for (; count > 0; count--) {
outl(cpu_to_le32(*addr), port);
addr++;
}
@@ -307,12 +307,12 @@ static void vx2_dma_read(struct vx_core *chip, struct 
snd_pcm_runtime *runtime,
vx2_setup_pseudo_dma(chip, 0);
/* Transfer using pseudo-dma.
 */
-   if (offset + count > pipe->buffer_bytes) {
+   if (offset + count >= pipe->buffer_bytes) {
int length = pipe->buffer_bytes - offset;
count -= length;
length >>= 2; /* in 32bit words */
/* Transfer using pseudo-dma. */
-   while (length-- > 0)
+   for (; length > 0; length--)
*addr++ = le32_to_cpu(inl(port));
addr = (u32 *)runtime->dma_area;
pipe->hw_ptr = 0;
@@ -320,7 +320,7 @@ static void vx2_dma_read(struct vx_core *chip, struct 
snd_pcm_runtime *runtime,
pipe->hw_ptr += count;
count >>= 2; /* in 32bit words */
/* Transfer using pseudo-dma. */
-   while (count-- > 0)
+   for (; count > 0; count--)
*addr++ = le32_to_cpu(inl(port));
 
vx2_release_pseudo_dma(chip);
diff --git a/sound/pcmcia/vx/vxp_ops.c b/sound/pcmcia/vx/vxp_ops.c
index 281972913c32..56aa1ba73ccc 100644
--- a/sound/pcmcia/vx/vxp_ops.c
+++ b/sound/pcmcia/vx/vxp_ops.c
@@ -369,12 +369,12 @@ static void vxp_dma_write(struct vx_core *chip, struct 
snd_pcm_runtime *runtime,
unsigned short *addr = (unsigned short *)(runtime->dma_area + offset);
 
vx_setup_pseudo_dma(chip, 1);
-   if (offset + count > pipe->buffer_bytes) {
+   if (offset + count >= pipe->buffer_bytes) {
int length = pipe->buffer_bytes - offset;
count -= length;
length >>= 1; /* in 16bit words */
/* Transfer using pseudo-dma. */
-   while (length-- > 0) {
+   for (; length > 0; length--) {
outw(cpu_to_le16(*addr), port);
addr++;
}
@@ -384,7 +384,7 @@ static void vxp_dma_write(struct vx_core *chip, struct 
snd_pcm_runtime *runtime,
pipe->hw_ptr += count;
count >>= 1; /* in 16bit words */
/* Transfer using pseudo-dma. */
-   while (count-- > 0) {
+   for (; count > 0; count--) {
outw(cpu_to_le16(*addr), port);
addr++;
}
@@ -411,12 +411,12 @@ static void vxp_dma_read(struct 

[PATCH AUTOSEL for-4.4 30/39] ixgbe: handle close/suspend race with netif_device_detach/present

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Emil Tantilov 

[ Upstream commit f7f37e7ff2b9b7eff7fbd035569cab35896869a3 ]

When an interface is part of a namespace it is possible that
ixgbe_close() may be called while __ixgbe_shutdown() is running
which ends up in a double free WARN and/or a BUG in free_msi_irqs().

To handle this situation we extend the rtnl_lock() to protect the
call to netif_device_detach() and ixgbe_clear_interrupt_scheme()
in __ixgbe_shutdown() and check for netif_device_present()
to avoid clearing the interrupts second time in ixgbe_close();

Also extend the rtnl lock in ixgbe_resume() to netif_device_attach().

Signed-off-by: Emil Tantilov 
Tested-by: Andrew Bowers 
Signed-off-by: Jeff Kirsher 
Signed-off-by: Sasha Levin 
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 17 -
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c 
b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 13723fa32efc..83645d8503d4 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -5878,7 +5878,8 @@ static int ixgbe_close(struct net_device *netdev)
 
ixgbe_ptp_stop(adapter);
 
-   ixgbe_close_suspend(adapter);
+   if (netif_device_present(netdev))
+   ixgbe_close_suspend(adapter);
 
ixgbe_fdir_filter_exit(adapter);
 
@@ -5923,14 +5924,12 @@ static int ixgbe_resume(struct pci_dev *pdev)
if (!err && netif_running(netdev))
err = ixgbe_open(netdev);
 
-   rtnl_unlock();
 
-   if (err)
-   return err;
-
-   netif_device_attach(netdev);
+   if (!err)
+   netif_device_attach(netdev);
+   rtnl_unlock();
 
-   return 0;
+   return err;
 }
 #endif /* CONFIG_PM */
 
@@ -5945,14 +5944,14 @@ static int __ixgbe_shutdown(struct pci_dev *pdev, bool 
*enable_wake)
int retval = 0;
 #endif
 
+   rtnl_lock();
netif_device_detach(netdev);
 
-   rtnl_lock();
if (netif_running(netdev))
ixgbe_close_suspend(adapter);
-   rtnl_unlock();
 
ixgbe_clear_interrupt_scheme(adapter);
+   rtnl_unlock();
 
 #ifdef CONFIG_PM
retval = pci_save_state(pdev);
-- 
2.11.0


[PATCH AUTOSEL for-4.4 30/39] ixgbe: handle close/suspend race with netif_device_detach/present

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Emil Tantilov 

[ Upstream commit f7f37e7ff2b9b7eff7fbd035569cab35896869a3 ]

When an interface is part of a namespace it is possible that
ixgbe_close() may be called while __ixgbe_shutdown() is running
which ends up in a double free WARN and/or a BUG in free_msi_irqs().

To handle this situation we extend the rtnl_lock() to protect the
call to netif_device_detach() and ixgbe_clear_interrupt_scheme()
in __ixgbe_shutdown() and check for netif_device_present()
to avoid clearing the interrupts second time in ixgbe_close();

Also extend the rtnl lock in ixgbe_resume() to netif_device_attach().

Signed-off-by: Emil Tantilov 
Tested-by: Andrew Bowers 
Signed-off-by: Jeff Kirsher 
Signed-off-by: Sasha Levin 
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 17 -
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c 
b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 13723fa32efc..83645d8503d4 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -5878,7 +5878,8 @@ static int ixgbe_close(struct net_device *netdev)
 
ixgbe_ptp_stop(adapter);
 
-   ixgbe_close_suspend(adapter);
+   if (netif_device_present(netdev))
+   ixgbe_close_suspend(adapter);
 
ixgbe_fdir_filter_exit(adapter);
 
@@ -5923,14 +5924,12 @@ static int ixgbe_resume(struct pci_dev *pdev)
if (!err && netif_running(netdev))
err = ixgbe_open(netdev);
 
-   rtnl_unlock();
 
-   if (err)
-   return err;
-
-   netif_device_attach(netdev);
+   if (!err)
+   netif_device_attach(netdev);
+   rtnl_unlock();
 
-   return 0;
+   return err;
 }
 #endif /* CONFIG_PM */
 
@@ -5945,14 +5944,14 @@ static int __ixgbe_shutdown(struct pci_dev *pdev, bool 
*enable_wake)
int retval = 0;
 #endif
 
+   rtnl_lock();
netif_device_detach(netdev);
 
-   rtnl_lock();
if (netif_running(netdev))
ixgbe_close_suspend(adapter);
-   rtnl_unlock();
 
ixgbe_clear_interrupt_scheme(adapter);
+   rtnl_unlock();
 
 #ifdef CONFIG_PM
retval = pci_save_state(pdev);
-- 
2.11.0


[PATCH AUTOSEL for-4.4 29/39] ixgbe: fix AER error handling

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Emil Tantilov 

[ Upstream commit 126db13fa0e6d05c9f94e0125f61e773bd5ab079 ]

Make sure that we free the IRQs in ixgbe_io_error_detected() when
responding to an PCIe AER error and also restore them when the
interface recovers from it.

Previously it was possible to trigger BUG_ON() check in free_msix_irqs()
in the case where we call ixgbe_remove() after a failed recovery from
AER error because the interrupts were not freed.

Signed-off-by: Emil Tantilov 
Tested-by: Andrew Bowers 
Signed-off-by: Jeff Kirsher 
Signed-off-by: Sasha Levin 
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c 
b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index cd9b284bc83b..13723fa32efc 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -9221,7 +9221,7 @@ skip_bad_vf_detection:
}
 
if (netif_running(netdev))
-   ixgbe_down(adapter);
+   ixgbe_close_suspend(adapter);
 
if (!test_and_set_bit(__IXGBE_DISABLED, >state))
pci_disable_device(pdev);
@@ -9291,10 +9291,12 @@ static void ixgbe_io_resume(struct pci_dev *pdev)
}
 
 #endif
+   rtnl_lock();
if (netif_running(netdev))
-   ixgbe_up(adapter);
+   ixgbe_open(netdev);
 
netif_device_attach(netdev);
+   rtnl_unlock();
 }
 
 static const struct pci_error_handlers ixgbe_err_handler = {
-- 
2.11.0


[PATCH AUTOSEL for-4.4 29/39] ixgbe: fix AER error handling

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Emil Tantilov 

[ Upstream commit 126db13fa0e6d05c9f94e0125f61e773bd5ab079 ]

Make sure that we free the IRQs in ixgbe_io_error_detected() when
responding to an PCIe AER error and also restore them when the
interface recovers from it.

Previously it was possible to trigger BUG_ON() check in free_msix_irqs()
in the case where we call ixgbe_remove() after a failed recovery from
AER error because the interrupts were not freed.

Signed-off-by: Emil Tantilov 
Tested-by: Andrew Bowers 
Signed-off-by: Jeff Kirsher 
Signed-off-by: Sasha Levin 
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c 
b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index cd9b284bc83b..13723fa32efc 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -9221,7 +9221,7 @@ skip_bad_vf_detection:
}
 
if (netif_running(netdev))
-   ixgbe_down(adapter);
+   ixgbe_close_suspend(adapter);
 
if (!test_and_set_bit(__IXGBE_DISABLED, >state))
pci_disable_device(pdev);
@@ -9291,10 +9291,12 @@ static void ixgbe_io_resume(struct pci_dev *pdev)
}
 
 #endif
+   rtnl_lock();
if (netif_running(netdev))
-   ixgbe_up(adapter);
+   ixgbe_open(netdev);
 
netif_device_attach(netdev);
+   rtnl_unlock();
 }
 
 static const struct pci_error_handlers ixgbe_err_handler = {
-- 
2.11.0


[PATCH AUTOSEL for-4.4 24/39] backlight: lcd: Fix race condition during register

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Uwe Kleine-König 

[ Upstream commit cc21942bce652d1a92dae85b785378256e1df1f7 ]

Once device_register is called for a device its attributes might be
accessed. As the callbacks of a lcd device's attributes make use of the
lcd_ops, the respective member must be setup before calling
device_register.

Signed-off-by: Uwe Kleine-König 
Signed-off-by: Lee Jones 
Signed-off-by: Sasha Levin 
---
 drivers/video/backlight/lcd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/video/backlight/lcd.c b/drivers/video/backlight/lcd.c
index 7de847df224f..4b40c6a4d441 100644
--- a/drivers/video/backlight/lcd.c
+++ b/drivers/video/backlight/lcd.c
@@ -226,6 +226,8 @@ struct lcd_device *lcd_device_register(const char *name, 
struct device *parent,
dev_set_name(_ld->dev, "%s", name);
dev_set_drvdata(_ld->dev, devdata);
 
+   new_ld->ops = ops;
+
rc = device_register(_ld->dev);
if (rc) {
put_device(_ld->dev);
@@ -238,8 +240,6 @@ struct lcd_device *lcd_device_register(const char *name, 
struct device *parent,
return ERR_PTR(rc);
}
 
-   new_ld->ops = ops;
-
return new_ld;
 }
 EXPORT_SYMBOL(lcd_device_register);
-- 
2.11.0


[PATCH AUTOSEL for-4.4 24/39] backlight: lcd: Fix race condition during register

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Uwe Kleine-König 

[ Upstream commit cc21942bce652d1a92dae85b785378256e1df1f7 ]

Once device_register is called for a device its attributes might be
accessed. As the callbacks of a lcd device's attributes make use of the
lcd_ops, the respective member must be setup before calling
device_register.

Signed-off-by: Uwe Kleine-König 
Signed-off-by: Lee Jones 
Signed-off-by: Sasha Levin 
---
 drivers/video/backlight/lcd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/video/backlight/lcd.c b/drivers/video/backlight/lcd.c
index 7de847df224f..4b40c6a4d441 100644
--- a/drivers/video/backlight/lcd.c
+++ b/drivers/video/backlight/lcd.c
@@ -226,6 +226,8 @@ struct lcd_device *lcd_device_register(const char *name, 
struct device *parent,
dev_set_name(_ld->dev, "%s", name);
dev_set_drvdata(_ld->dev, devdata);
 
+   new_ld->ops = ops;
+
rc = device_register(_ld->dev);
if (rc) {
put_device(_ld->dev);
@@ -238,8 +240,6 @@ struct lcd_device *lcd_device_register(const char *name, 
struct device *parent,
return ERR_PTR(rc);
}
 
-   new_ld->ops = ops;
-
return new_ld;
 }
 EXPORT_SYMBOL(lcd_device_register);
-- 
2.11.0


[PATCH AUTOSEL for-4.4 21/39] scsi: lpfc: Clear the VendorVersion in the PLOGI/PLOGI ACC payload

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: James Smart 

[ Upstream commit e0165f20447c8ca1d367725ee94d8ec9f38ca275 ]

Clear the VendorVersion in the PLOGI/PLOGI ACC payload

Vendor version info may have been set on fabric login. Before sending
PLOGI payloads, ensure that it's cleared.

Signed-off-by: Dick Kennedy 
Signed-off-by: James Smart 
Reviewed-by: Hannes Reinecke 
Signed-off-by: Martin K. Petersen 
Signed-off-by: Sasha Levin 
---
 drivers/scsi/lpfc/lpfc_els.c | 6 ++
 drivers/scsi/lpfc/lpfc_hw.h  | 6 ++
 2 files changed, 12 insertions(+)

diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index c74f74ab981c..d278362448ca 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -1982,6 +1982,9 @@ lpfc_issue_els_plogi(struct lpfc_vport *vport, uint32_t 
did, uint8_t retry)
if (sp->cmn.fcphHigh < FC_PH3)
sp->cmn.fcphHigh = FC_PH3;
 
+   sp->cmn.valid_vendor_ver_level = 0;
+   memset(sp->vendorVersion, 0, sizeof(sp->vendorVersion));
+
lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_CMD,
"Issue PLOGI: did:x%x",
did, 0, 0);
@@ -3966,6 +3969,9 @@ lpfc_els_rsp_acc(struct lpfc_vport *vport, uint32_t flag,
} else {
memcpy(pcmd, >fc_sparam,
   sizeof(struct serv_parm));
+
+   sp->cmn.valid_vendor_ver_level = 0;
+   memset(sp->vendorVersion, 0, sizeof(sp->vendorVersion));
}
 
lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_RSP,
diff --git a/drivers/scsi/lpfc/lpfc_hw.h b/drivers/scsi/lpfc/lpfc_hw.h
index 2cce88e967ce..a8ad97300177 100644
--- a/drivers/scsi/lpfc/lpfc_hw.h
+++ b/drivers/scsi/lpfc/lpfc_hw.h
@@ -360,6 +360,12 @@ struct csp {
  * Word 1 Bit 30 in PLOGI request is random offset
  */
 #define virtual_fabric_support randomOffset /* Word 1, bit 30 */
+/*
+ * Word 1 Bit 29 in common service parameter is overloaded.
+ * Word 1 Bit 29 in FLOGI response is multiple NPort assignment
+ * Word 1 Bit 29 in FLOGI/PLOGI request is Valid Vendor Version Level
+ */
+#define valid_vendor_ver_level response_multiple_NPort /* Word 1, bit 29 */
 #ifdef __BIG_ENDIAN_BITFIELD
uint16_t request_multiple_Nport:1;  /* FC Word 1, bit 31 */
uint16_t randomOffset:1;/* FC Word 1, bit 30 */
-- 
2.11.0


[PATCH AUTOSEL for-4.4 21/39] scsi: lpfc: Clear the VendorVersion in the PLOGI/PLOGI ACC payload

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: James Smart 

[ Upstream commit e0165f20447c8ca1d367725ee94d8ec9f38ca275 ]

Clear the VendorVersion in the PLOGI/PLOGI ACC payload

Vendor version info may have been set on fabric login. Before sending
PLOGI payloads, ensure that it's cleared.

Signed-off-by: Dick Kennedy 
Signed-off-by: James Smart 
Reviewed-by: Hannes Reinecke 
Signed-off-by: Martin K. Petersen 
Signed-off-by: Sasha Levin 
---
 drivers/scsi/lpfc/lpfc_els.c | 6 ++
 drivers/scsi/lpfc/lpfc_hw.h  | 6 ++
 2 files changed, 12 insertions(+)

diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index c74f74ab981c..d278362448ca 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -1982,6 +1982,9 @@ lpfc_issue_els_plogi(struct lpfc_vport *vport, uint32_t 
did, uint8_t retry)
if (sp->cmn.fcphHigh < FC_PH3)
sp->cmn.fcphHigh = FC_PH3;
 
+   sp->cmn.valid_vendor_ver_level = 0;
+   memset(sp->vendorVersion, 0, sizeof(sp->vendorVersion));
+
lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_CMD,
"Issue PLOGI: did:x%x",
did, 0, 0);
@@ -3966,6 +3969,9 @@ lpfc_els_rsp_acc(struct lpfc_vport *vport, uint32_t flag,
} else {
memcpy(pcmd, >fc_sparam,
   sizeof(struct serv_parm));
+
+   sp->cmn.valid_vendor_ver_level = 0;
+   memset(sp->vendorVersion, 0, sizeof(sp->vendorVersion));
}
 
lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_RSP,
diff --git a/drivers/scsi/lpfc/lpfc_hw.h b/drivers/scsi/lpfc/lpfc_hw.h
index 2cce88e967ce..a8ad97300177 100644
--- a/drivers/scsi/lpfc/lpfc_hw.h
+++ b/drivers/scsi/lpfc/lpfc_hw.h
@@ -360,6 +360,12 @@ struct csp {
  * Word 1 Bit 30 in PLOGI request is random offset
  */
 #define virtual_fabric_support randomOffset /* Word 1, bit 30 */
+/*
+ * Word 1 Bit 29 in common service parameter is overloaded.
+ * Word 1 Bit 29 in FLOGI response is multiple NPort assignment
+ * Word 1 Bit 29 in FLOGI/PLOGI request is Valid Vendor Version Level
+ */
+#define valid_vendor_ver_level response_multiple_NPort /* Word 1, bit 29 */
 #ifdef __BIG_ENDIAN_BITFIELD
uint16_t request_multiple_Nport:1;  /* FC Word 1, bit 31 */
uint16_t randomOffset:1;/* FC Word 1, bit 30 */
-- 
2.11.0


[PATCH AUTOSEL for-4.4 05/39] ARM: OMAP2+: Fix init for multiple quirks for the same SoC

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Tony Lindgren 

[ Upstream commit 6e613ebf4405fc09e2a8c16ed193b47f80a3cbed ]

It's possible that there are multiple quirks that need to be initialized
for the same SoC. Fix the issue by not returning on the first match.

Signed-off-by: Tony Lindgren 
Signed-off-by: Sasha Levin 
---
 arch/arm/mach-omap2/pdata-quirks.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm/mach-omap2/pdata-quirks.c 
b/arch/arm/mach-omap2/pdata-quirks.c
index 58144779dec4..1e6e09841707 100644
--- a/arch/arm/mach-omap2/pdata-quirks.c
+++ b/arch/arm/mach-omap2/pdata-quirks.c
@@ -522,7 +522,6 @@ static void pdata_quirks_check(struct pdata_init *quirks)
if (of_machine_is_compatible(quirks->compatible)) {
if (quirks->fn)
quirks->fn();
-   break;
}
quirks++;
}
-- 
2.11.0


[PATCH AUTOSEL for-4.4 05/39] ARM: OMAP2+: Fix init for multiple quirks for the same SoC

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Tony Lindgren 

[ Upstream commit 6e613ebf4405fc09e2a8c16ed193b47f80a3cbed ]

It's possible that there are multiple quirks that need to be initialized
for the same SoC. Fix the issue by not returning on the first match.

Signed-off-by: Tony Lindgren 
Signed-off-by: Sasha Levin 
---
 arch/arm/mach-omap2/pdata-quirks.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm/mach-omap2/pdata-quirks.c 
b/arch/arm/mach-omap2/pdata-quirks.c
index 58144779dec4..1e6e09841707 100644
--- a/arch/arm/mach-omap2/pdata-quirks.c
+++ b/arch/arm/mach-omap2/pdata-quirks.c
@@ -522,7 +522,6 @@ static void pdata_quirks_check(struct pdata_init *quirks)
if (of_machine_is_compatible(quirks->compatible)) {
if (quirks->fn)
quirks->fn();
-   break;
}
quirks++;
}
-- 
2.11.0


[PATCH AUTOSEL for-4.4 04/39] ARM: dts: Fix am335x and dm814x scm syscon to probe children

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Tony Lindgren 

[ Upstream commit 1aa09df0854efe16b7a80358a18f0a0bebafd246 ]

Without these changes children of the scn syscon
won't probe.

Signed-off-by: Tony Lindgren 
Signed-off-by: Sasha Levin 
---
 arch/arm/boot/dts/am33xx.dtsi | 3 ++-
 arch/arm/boot/dts/dm814x.dtsi | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
index d23e2524d694..be9c37e89be1 100644
--- a/arch/arm/boot/dts/am33xx.dtsi
+++ b/arch/arm/boot/dts/am33xx.dtsi
@@ -142,10 +142,11 @@
};
 
scm_conf: scm_conf@0 {
-   compatible = "syscon";
+   compatible = "syscon", "simple-bus";
reg = <0x0 0x800>;
#address-cells = <1>;
#size-cells = <1>;
+   ranges = <0 0 0x800>;
 
scm_clocks: clocks {
#address-cells = <1>;
diff --git a/arch/arm/boot/dts/dm814x.dtsi b/arch/arm/boot/dts/dm814x.dtsi
index 509437839541..c226c3d952d8 100644
--- a/arch/arm/boot/dts/dm814x.dtsi
+++ b/arch/arm/boot/dts/dm814x.dtsi
@@ -189,10 +189,11 @@
ranges = <0 0x16 0x16d000>;
 
scm_conf: scm_conf@0 {
-   compatible = "syscon";
+   compatible = "syscon", "simple-bus";
reg = <0x0 0x800>;
#address-cells = <1>;
#size-cells = <1>;
+   ranges = <0 0 0x800>;
 
scm_clocks: clocks {
#address-cells = <1>;
-- 
2.11.0


[PATCH AUTOSEL for-4.4 07/39] ata: ATA_BMDMA should depend on HAS_DMA

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Geert Uytterhoeven 

[ Upstream commit 7bc7ab1e63dfe004931502f90ce7020e375623da ]

If NO_DMA=y:

ERROR: "dmam_alloc_coherent" [drivers/ata/libata.ko] undefined!

Add a dependency on HAS_DMA to fix this.

Signed-off-by: Geert Uytterhoeven 
Signed-off-by: Tejun Heo 
Signed-off-by: Sasha Levin 
---
 drivers/ata/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index 6aaa3f81755b..fd19d180f640 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -272,6 +272,7 @@ config SATA_SX4
 
 config ATA_BMDMA
bool "ATA BMDMA support"
+   depends on HAS_DMA
default y
help
  This option adds support for SFF ATA controllers with BMDMA
-- 
2.11.0


[PATCH AUTOSEL for-4.4 04/39] ARM: dts: Fix am335x and dm814x scm syscon to probe children

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Tony Lindgren 

[ Upstream commit 1aa09df0854efe16b7a80358a18f0a0bebafd246 ]

Without these changes children of the scn syscon
won't probe.

Signed-off-by: Tony Lindgren 
Signed-off-by: Sasha Levin 
---
 arch/arm/boot/dts/am33xx.dtsi | 3 ++-
 arch/arm/boot/dts/dm814x.dtsi | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
index d23e2524d694..be9c37e89be1 100644
--- a/arch/arm/boot/dts/am33xx.dtsi
+++ b/arch/arm/boot/dts/am33xx.dtsi
@@ -142,10 +142,11 @@
};
 
scm_conf: scm_conf@0 {
-   compatible = "syscon";
+   compatible = "syscon", "simple-bus";
reg = <0x0 0x800>;
#address-cells = <1>;
#size-cells = <1>;
+   ranges = <0 0 0x800>;
 
scm_clocks: clocks {
#address-cells = <1>;
diff --git a/arch/arm/boot/dts/dm814x.dtsi b/arch/arm/boot/dts/dm814x.dtsi
index 509437839541..c226c3d952d8 100644
--- a/arch/arm/boot/dts/dm814x.dtsi
+++ b/arch/arm/boot/dts/dm814x.dtsi
@@ -189,10 +189,11 @@
ranges = <0 0x16 0x16d000>;
 
scm_conf: scm_conf@0 {
-   compatible = "syscon";
+   compatible = "syscon", "simple-bus";
reg = <0x0 0x800>;
#address-cells = <1>;
#size-cells = <1>;
+   ranges = <0 0 0x800>;
 
scm_clocks: clocks {
#address-cells = <1>;
-- 
2.11.0


[PATCH AUTOSEL for-4.4 07/39] ata: ATA_BMDMA should depend on HAS_DMA

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Geert Uytterhoeven 

[ Upstream commit 7bc7ab1e63dfe004931502f90ce7020e375623da ]

If NO_DMA=y:

ERROR: "dmam_alloc_coherent" [drivers/ata/libata.ko] undefined!

Add a dependency on HAS_DMA to fix this.

Signed-off-by: Geert Uytterhoeven 
Signed-off-by: Tejun Heo 
Signed-off-by: Sasha Levin 
---
 drivers/ata/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index 6aaa3f81755b..fd19d180f640 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -272,6 +272,7 @@ config SATA_SX4
 
 config ATA_BMDMA
bool "ATA BMDMA support"
+   depends on HAS_DMA
default y
help
  This option adds support for SFF ATA controllers with BMDMA
-- 
2.11.0


[PATCH AUTOSEL for-4.4 22/39] ALSA: vx: Don't try to update capture stream before running

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Takashi Iwai 

[ Upstream commit ed3c177d960bb5881b945ca6f784868126bb90db ]

The update of stream costs significantly, and we should avoid it
unless the stream really has started.  Check pipe->running flag
instead of pipe->prepared.

Signed-off-by: Takashi Iwai 
Signed-off-by: Sasha Levin 
---
 sound/drivers/vx/vx_pcm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/drivers/vx/vx_pcm.c b/sound/drivers/vx/vx_pcm.c
index 11467272089e..69f252585780 100644
--- a/sound/drivers/vx/vx_pcm.c
+++ b/sound/drivers/vx/vx_pcm.c
@@ -1015,7 +1015,7 @@ static void vx_pcm_capture_update(struct vx_core *chip, 
struct snd_pcm_substream
int size, space, count;
struct snd_pcm_runtime *runtime = subs->runtime;
 
-   if (! pipe->prepared || (chip->chip_status & VX_STAT_IS_STALE))
+   if (!pipe->running || (chip->chip_status & VX_STAT_IS_STALE))
return;
 
size = runtime->buffer_size - snd_pcm_capture_avail(runtime);
-- 
2.11.0


[PATCH AUTOSEL for-4.4 22/39] ALSA: vx: Don't try to update capture stream before running

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Takashi Iwai 

[ Upstream commit ed3c177d960bb5881b945ca6f784868126bb90db ]

The update of stream costs significantly, and we should avoid it
unless the stream really has started.  Check pipe->running flag
instead of pipe->prepared.

Signed-off-by: Takashi Iwai 
Signed-off-by: Sasha Levin 
---
 sound/drivers/vx/vx_pcm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/drivers/vx/vx_pcm.c b/sound/drivers/vx/vx_pcm.c
index 11467272089e..69f252585780 100644
--- a/sound/drivers/vx/vx_pcm.c
+++ b/sound/drivers/vx/vx_pcm.c
@@ -1015,7 +1015,7 @@ static void vx_pcm_capture_update(struct vx_core *chip, 
struct snd_pcm_substream
int size, space, count;
struct snd_pcm_runtime *runtime = subs->runtime;
 
-   if (! pipe->prepared || (chip->chip_status & VX_STAT_IS_STALE))
+   if (!pipe->running || (chip->chip_status & VX_STAT_IS_STALE))
return;
 
size = runtime->buffer_size - snd_pcm_capture_avail(runtime);
-- 
2.11.0


[PATCH AUTOSEL for-3.18 13/27] scsi: lpfc: FCoE VPort enable-disable does not bring up the VPort

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: James Smart 

[ Upstream commit 104450eb08ca662e6b1d02da11aca9598e978f3e ]

FCoE VPort enable-disable does not bring up the VPort.
VPI structure needed to be initialized before being re-registered.

Signed-off-by: Dick Kennedy 
Signed-off-by: James Smart 
Reviewed-by: Hannes Reinecke 
Signed-off-by: Martin K. Petersen 
Signed-off-by: Sasha Levin 
---
 drivers/scsi/lpfc/lpfc_vport.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/scsi/lpfc/lpfc_vport.c b/drivers/scsi/lpfc/lpfc_vport.c
index a87ee33f4f2a..1ea4702da5bb 100644
--- a/drivers/scsi/lpfc/lpfc_vport.c
+++ b/drivers/scsi/lpfc/lpfc_vport.c
@@ -528,6 +528,12 @@ enable_vport(struct fc_vport *fc_vport)
 
spin_lock_irq(shost->host_lock);
vport->load_flag |= FC_LOADING;
+   if (vport->fc_flag & FC_VPORT_NEEDS_INIT_VPI) {
+   spin_unlock_irq(shost->host_lock);
+   lpfc_issue_init_vpi(vport);
+   goto out;
+   }
+
vport->fc_flag |= FC_VPORT_NEEDS_REG_VPI;
spin_unlock_irq(shost->host_lock);
 
@@ -548,6 +554,8 @@ enable_vport(struct fc_vport *fc_vport)
} else {
lpfc_vport_set_state(vport, FC_VPORT_FAILED);
}
+
+out:
lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT,
 "1827 Vport Enabled.\n");
return VPORT_OK;
-- 
2.11.0


[PATCH AUTOSEL for-3.18 13/27] scsi: lpfc: FCoE VPort enable-disable does not bring up the VPort

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: James Smart 

[ Upstream commit 104450eb08ca662e6b1d02da11aca9598e978f3e ]

FCoE VPort enable-disable does not bring up the VPort.
VPI structure needed to be initialized before being re-registered.

Signed-off-by: Dick Kennedy 
Signed-off-by: James Smart 
Reviewed-by: Hannes Reinecke 
Signed-off-by: Martin K. Petersen 
Signed-off-by: Sasha Levin 
---
 drivers/scsi/lpfc/lpfc_vport.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/scsi/lpfc/lpfc_vport.c b/drivers/scsi/lpfc/lpfc_vport.c
index a87ee33f4f2a..1ea4702da5bb 100644
--- a/drivers/scsi/lpfc/lpfc_vport.c
+++ b/drivers/scsi/lpfc/lpfc_vport.c
@@ -528,6 +528,12 @@ enable_vport(struct fc_vport *fc_vport)
 
spin_lock_irq(shost->host_lock);
vport->load_flag |= FC_LOADING;
+   if (vport->fc_flag & FC_VPORT_NEEDS_INIT_VPI) {
+   spin_unlock_irq(shost->host_lock);
+   lpfc_issue_init_vpi(vport);
+   goto out;
+   }
+
vport->fc_flag |= FC_VPORT_NEEDS_REG_VPI;
spin_unlock_irq(shost->host_lock);
 
@@ -548,6 +554,8 @@ enable_vport(struct fc_vport *fc_vport)
} else {
lpfc_vport_set_state(vport, FC_VPORT_FAILED);
}
+
+out:
lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT,
 "1827 Vport Enabled.\n");
return VPORT_OK;
-- 
2.11.0


[PATCH AUTOSEL for-3.18 04/27] ata: ATA_BMDMA should depend on HAS_DMA

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Geert Uytterhoeven 

[ Upstream commit 7bc7ab1e63dfe004931502f90ce7020e375623da ]

If NO_DMA=y:

ERROR: "dmam_alloc_coherent" [drivers/ata/libata.ko] undefined!

Add a dependency on HAS_DMA to fix this.

Signed-off-by: Geert Uytterhoeven 
Signed-off-by: Tejun Heo 
Signed-off-by: Sasha Levin 
---
 drivers/ata/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index cd4cccbfd2ab..0cfce7a81544 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -245,6 +245,7 @@ config SATA_SX4
 
 config ATA_BMDMA
bool "ATA BMDMA support"
+   depends on HAS_DMA
default y
help
  This option adds support for SFF ATA controllers with BMDMA
-- 
2.11.0


[PATCH AUTOSEL for-3.18 04/27] ata: ATA_BMDMA should depend on HAS_DMA

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Geert Uytterhoeven 

[ Upstream commit 7bc7ab1e63dfe004931502f90ce7020e375623da ]

If NO_DMA=y:

ERROR: "dmam_alloc_coherent" [drivers/ata/libata.ko] undefined!

Add a dependency on HAS_DMA to fix this.

Signed-off-by: Geert Uytterhoeven 
Signed-off-by: Tejun Heo 
Signed-off-by: Sasha Levin 
---
 drivers/ata/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index cd4cccbfd2ab..0cfce7a81544 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -245,6 +245,7 @@ config SATA_SX4
 
 config ATA_BMDMA
bool "ATA BMDMA support"
+   depends on HAS_DMA
default y
help
  This option adds support for SFF ATA controllers with BMDMA
-- 
2.11.0


[PATCH AUTOSEL for-3.18 05/27] ata: SATA_HIGHBANK should depend on HAS_DMA

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Geert Uytterhoeven 

[ Upstream commit 2a736e0585e585c2566b5119af8381910a170e44 ]

If NO_DMA=y:

ERROR: "bad_dma_ops" [drivers/ata/sata_highbank.ko] undefined!

Add a dependency on HAS_DMA to fix this.

Signed-off-by: Geert Uytterhoeven 
Signed-off-by: Tejun Heo 
Signed-off-by: Sasha Levin 
---
 drivers/ata/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index 0cfce7a81544..98076d5d417b 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -291,6 +291,7 @@ config SATA_DWC_VDEBUG
 
 config SATA_HIGHBANK
tristate "Calxeda Highbank SATA support"
+   depends on HAS_DMA
depends on ARCH_HIGHBANK || COMPILE_TEST
help
  This option enables support for the Calxeda Highbank SoC's
-- 
2.11.0


[PATCH AUTOSEL for-3.18 05/27] ata: SATA_HIGHBANK should depend on HAS_DMA

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Geert Uytterhoeven 

[ Upstream commit 2a736e0585e585c2566b5119af8381910a170e44 ]

If NO_DMA=y:

ERROR: "bad_dma_ops" [drivers/ata/sata_highbank.ko] undefined!

Add a dependency on HAS_DMA to fix this.

Signed-off-by: Geert Uytterhoeven 
Signed-off-by: Tejun Heo 
Signed-off-by: Sasha Levin 
---
 drivers/ata/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index 0cfce7a81544..98076d5d417b 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -291,6 +291,7 @@ config SATA_DWC_VDEBUG
 
 config SATA_HIGHBANK
tristate "Calxeda Highbank SATA support"
+   depends on HAS_DMA
depends on ARCH_HIGHBANK || COMPILE_TEST
help
  This option enables support for the Calxeda Highbank SoC's
-- 
2.11.0


[PATCH AUTOSEL for-3.18 01/27] extcon: palmas: Check the parent instance to prevent the NULL

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Roger Quadros 

[ Upstream commit 9fe172b9be532acc23e35ba693700383ab775e66 ]

extcon-palmas must be child of palmas and expects parent's
drvdata to be valid. Check for non NULL parent drvdata and
fail if it is NULL. Not doing so will result in a NULL
pointer dereference later in the probe() parent drvdata
is NULL (e.g. misplaced extcon-palmas node in device tree).

Signed-off-by: Roger Quadros 
Signed-off-by: Chanwoo Choi 
Signed-off-by: Sasha Levin 
---
 drivers/extcon/extcon-palmas.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/extcon/extcon-palmas.c b/drivers/extcon/extcon-palmas.c
index 230e1220ce48..1cee9f4909db 100644
--- a/drivers/extcon/extcon-palmas.c
+++ b/drivers/extcon/extcon-palmas.c
@@ -150,6 +150,11 @@ static int palmas_usb_probe(struct platform_device *pdev)
struct palmas_usb *palmas_usb;
int status;
 
+   if (!palmas) {
+   dev_err(>dev, "failed to get valid parent\n");
+   return -EINVAL;
+   }
+
palmas_usb = devm_kzalloc(>dev, sizeof(*palmas_usb), GFP_KERNEL);
if (!palmas_usb)
return -ENOMEM;
-- 
2.11.0


[PATCH AUTOSEL for-3.18 01/27] extcon: palmas: Check the parent instance to prevent the NULL

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Roger Quadros 

[ Upstream commit 9fe172b9be532acc23e35ba693700383ab775e66 ]

extcon-palmas must be child of palmas and expects parent's
drvdata to be valid. Check for non NULL parent drvdata and
fail if it is NULL. Not doing so will result in a NULL
pointer dereference later in the probe() parent drvdata
is NULL (e.g. misplaced extcon-palmas node in device tree).

Signed-off-by: Roger Quadros 
Signed-off-by: Chanwoo Choi 
Signed-off-by: Sasha Levin 
---
 drivers/extcon/extcon-palmas.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/extcon/extcon-palmas.c b/drivers/extcon/extcon-palmas.c
index 230e1220ce48..1cee9f4909db 100644
--- a/drivers/extcon/extcon-palmas.c
+++ b/drivers/extcon/extcon-palmas.c
@@ -150,6 +150,11 @@ static int palmas_usb_probe(struct platform_device *pdev)
struct palmas_usb *palmas_usb;
int status;
 
+   if (!palmas) {
+   dev_err(>dev, "failed to get valid parent\n");
+   return -EINVAL;
+   }
+
palmas_usb = devm_kzalloc(>dev, sizeof(*palmas_usb), GFP_KERNEL);
if (!palmas_usb)
return -ENOMEM;
-- 
2.11.0


[PATCH AUTOSEL for-3.18 14/27] scsi: lpfc: Correct host name in symbolic_name field

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: James Smart 

[ Upstream commit 6c9231f604c2575be24c96d38deb70f145172f92 ]

Correct host name in symbolic_name field of nameserver registrations

Signed-off-by: Dick Kennedy 
Signed-off-by: James Smart 
Reviewed-by: Hannes Reinecke 
Signed-off-by: Martin K. Petersen 
Signed-off-by: Sasha Levin 
---
 drivers/scsi/lpfc/lpfc_attr.c | 17 +
 1 file changed, 17 insertions(+)

diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index 2f9b96826ac0..a53dc1c71fd2 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -5137,6 +5137,19 @@ lpfc_free_sysfs_attr(struct lpfc_vport *vport)
  */
 
 /**
+ * lpfc_get_host_symbolic_name - Copy symbolic name into the scsi host
+ * @shost: kernel scsi host pointer.
+ **/
+static void
+lpfc_get_host_symbolic_name(struct Scsi_Host *shost)
+{
+   struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata;
+
+   lpfc_vport_symbolic_node_name(vport, fc_host_symbolic_name(shost),
+ sizeof fc_host_symbolic_name(shost));
+}
+
+/**
  * lpfc_get_host_port_id - Copy the vport DID into the scsi host port id
  * @shost: kernel scsi host pointer.
  **/
@@ -5670,6 +5683,8 @@ struct fc_function_template lpfc_transport_functions = {
.show_host_supported_fc4s = 1,
.show_host_supported_speeds = 1,
.show_host_maxframe_size = 1,
+
+   .get_host_symbolic_name = lpfc_get_host_symbolic_name,
.show_host_symbolic_name = 1,
 
/* dynamic attributes the driver supports */
@@ -5737,6 +5752,8 @@ struct fc_function_template 
lpfc_vport_transport_functions = {
.show_host_supported_fc4s = 1,
.show_host_supported_speeds = 1,
.show_host_maxframe_size = 1,
+
+   .get_host_symbolic_name = lpfc_get_host_symbolic_name,
.show_host_symbolic_name = 1,
 
/* dynamic attributes the driver supports */
-- 
2.11.0


[PATCH AUTOSEL for-3.18 14/27] scsi: lpfc: Correct host name in symbolic_name field

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: James Smart 

[ Upstream commit 6c9231f604c2575be24c96d38deb70f145172f92 ]

Correct host name in symbolic_name field of nameserver registrations

Signed-off-by: Dick Kennedy 
Signed-off-by: James Smart 
Reviewed-by: Hannes Reinecke 
Signed-off-by: Martin K. Petersen 
Signed-off-by: Sasha Levin 
---
 drivers/scsi/lpfc/lpfc_attr.c | 17 +
 1 file changed, 17 insertions(+)

diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index 2f9b96826ac0..a53dc1c71fd2 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -5137,6 +5137,19 @@ lpfc_free_sysfs_attr(struct lpfc_vport *vport)
  */
 
 /**
+ * lpfc_get_host_symbolic_name - Copy symbolic name into the scsi host
+ * @shost: kernel scsi host pointer.
+ **/
+static void
+lpfc_get_host_symbolic_name(struct Scsi_Host *shost)
+{
+   struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata;
+
+   lpfc_vport_symbolic_node_name(vport, fc_host_symbolic_name(shost),
+ sizeof fc_host_symbolic_name(shost));
+}
+
+/**
  * lpfc_get_host_port_id - Copy the vport DID into the scsi host port id
  * @shost: kernel scsi host pointer.
  **/
@@ -5670,6 +5683,8 @@ struct fc_function_template lpfc_transport_functions = {
.show_host_supported_fc4s = 1,
.show_host_supported_speeds = 1,
.show_host_maxframe_size = 1,
+
+   .get_host_symbolic_name = lpfc_get_host_symbolic_name,
.show_host_symbolic_name = 1,
 
/* dynamic attributes the driver supports */
@@ -5737,6 +5752,8 @@ struct fc_function_template 
lpfc_vport_transport_functions = {
.show_host_supported_fc4s = 1,
.show_host_supported_speeds = 1,
.show_host_maxframe_size = 1,
+
+   .get_host_symbolic_name = lpfc_get_host_symbolic_name,
.show_host_symbolic_name = 1,
 
/* dynamic attributes the driver supports */
-- 
2.11.0


[PATCH AUTOSEL for-4.4 09/39] ata: SATA_MV should depend on HAS_DMA

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Geert Uytterhoeven 

[ Upstream commit 62989cebd367a1aae1e009e1a5b1ec046a4c8fdc ]

If NO_DMA=y:

ERROR: "dma_pool_alloc" [drivers/ata/sata_mv.ko] undefined!
ERROR: "dmam_pool_create" [drivers/ata/sata_mv.ko] undefined!
ERROR: "dma_pool_free" [drivers/ata/sata_mv.ko] undefined!

Add a dependency on HAS_DMA to fix this.

Signed-off-by: Geert Uytterhoeven 
Signed-off-by: Tejun Heo 
Signed-off-by: Sasha Levin 
---
 drivers/ata/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index c1e40ebaf5e2..c2ba811993d4 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -329,6 +329,7 @@ config SATA_HIGHBANK
 
 config SATA_MV
tristate "Marvell SATA support"
+   depends on HAS_DMA
depends on PCI || ARCH_DOVE || ARCH_MV78XX0 || \
   ARCH_MVEBU || ARCH_ORION5X || COMPILE_TEST
select GENERIC_PHY
-- 
2.11.0


[PATCH AUTOSEL for-3.18 17/27] ALSA: vx: Fix possible transfer overflow

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Takashi Iwai 

[ Upstream commit 874e1f6fad9a5184b67f4cee37c1335cd2cc5677 ]

The pseudo DMA transfer codes in VX222 and VX-pocket driver have a
slight bug where they check the buffer boundary wrongly, and may
overflow.  Also, the zero sample count might be handled badly for the
playback (although it shouldn't happen in theory).  This patch
addresses these issues.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=141541
Signed-off-by: Takashi Iwai 
Signed-off-by: Sasha Levin 
---
 sound/drivers/vx/vx_pcm.c   |  6 --
 sound/pci/vx222/vx222_ops.c | 12 ++--
 sound/pcmcia/vx/vxp_ops.c   | 12 ++--
 3 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/sound/drivers/vx/vx_pcm.c b/sound/drivers/vx/vx_pcm.c
index 69f252585780..ea7b377f0378 100644
--- a/sound/drivers/vx/vx_pcm.c
+++ b/sound/drivers/vx/vx_pcm.c
@@ -1048,8 +1048,10 @@ static void vx_pcm_capture_update(struct vx_core *chip, 
struct snd_pcm_substream
/* ok, let's accelerate! */
int align = pipe->align * 3;
space = (count / align) * align;
-   vx_pseudo_dma_read(chip, runtime, pipe, space);
-   count -= space;
+   if (space > 0) {
+   vx_pseudo_dma_read(chip, runtime, pipe, space);
+   count -= space;
+   }
}
/* read the rest of bytes */
while (count > 0) {
diff --git a/sound/pci/vx222/vx222_ops.c b/sound/pci/vx222/vx222_ops.c
index 2d1570273e99..5c541ed723dd 100644
--- a/sound/pci/vx222/vx222_ops.c
+++ b/sound/pci/vx222/vx222_ops.c
@@ -264,12 +264,12 @@ static void vx2_dma_write(struct vx_core *chip, struct 
snd_pcm_runtime *runtime,
 
/* Transfer using pseudo-dma.
 */
-   if (offset + count > pipe->buffer_bytes) {
+   if (offset + count >= pipe->buffer_bytes) {
int length = pipe->buffer_bytes - offset;
count -= length;
length >>= 2; /* in 32bit words */
/* Transfer using pseudo-dma. */
-   while (length-- > 0) {
+   for (; length > 0; length--) {
outl(cpu_to_le32(*addr), port);
addr++;
}
@@ -279,7 +279,7 @@ static void vx2_dma_write(struct vx_core *chip, struct 
snd_pcm_runtime *runtime,
pipe->hw_ptr += count;
count >>= 2; /* in 32bit words */
/* Transfer using pseudo-dma. */
-   while (count-- > 0) {
+   for (; count > 0; count--) {
outl(cpu_to_le32(*addr), port);
addr++;
}
@@ -302,12 +302,12 @@ static void vx2_dma_read(struct vx_core *chip, struct 
snd_pcm_runtime *runtime,
vx2_setup_pseudo_dma(chip, 0);
/* Transfer using pseudo-dma.
 */
-   if (offset + count > pipe->buffer_bytes) {
+   if (offset + count >= pipe->buffer_bytes) {
int length = pipe->buffer_bytes - offset;
count -= length;
length >>= 2; /* in 32bit words */
/* Transfer using pseudo-dma. */
-   while (length-- > 0)
+   for (; length > 0; length--)
*addr++ = le32_to_cpu(inl(port));
addr = (u32 *)runtime->dma_area;
pipe->hw_ptr = 0;
@@ -315,7 +315,7 @@ static void vx2_dma_read(struct vx_core *chip, struct 
snd_pcm_runtime *runtime,
pipe->hw_ptr += count;
count >>= 2; /* in 32bit words */
/* Transfer using pseudo-dma. */
-   while (count-- > 0)
+   for (; count > 0; count--)
*addr++ = le32_to_cpu(inl(port));
 
vx2_release_pseudo_dma(chip);
diff --git a/sound/pcmcia/vx/vxp_ops.c b/sound/pcmcia/vx/vxp_ops.c
index 281972913c32..56aa1ba73ccc 100644
--- a/sound/pcmcia/vx/vxp_ops.c
+++ b/sound/pcmcia/vx/vxp_ops.c
@@ -369,12 +369,12 @@ static void vxp_dma_write(struct vx_core *chip, struct 
snd_pcm_runtime *runtime,
unsigned short *addr = (unsigned short *)(runtime->dma_area + offset);
 
vx_setup_pseudo_dma(chip, 1);
-   if (offset + count > pipe->buffer_bytes) {
+   if (offset + count >= pipe->buffer_bytes) {
int length = pipe->buffer_bytes - offset;
count -= length;
length >>= 1; /* in 16bit words */
/* Transfer using pseudo-dma. */
-   while (length-- > 0) {
+   for (; length > 0; length--) {
outw(cpu_to_le16(*addr), port);
addr++;
}
@@ -384,7 +384,7 @@ static void vxp_dma_write(struct vx_core *chip, struct 
snd_pcm_runtime *runtime,
pipe->hw_ptr += count;
count >>= 1; /* in 16bit words */
/* Transfer using pseudo-dma. */
-   while (count-- > 0) {
+   for (; count > 0; count--) {
outw(cpu_to_le16(*addr), port);
addr++;
}

[PATCH AUTOSEL for-4.4 09/39] ata: SATA_MV should depend on HAS_DMA

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Geert Uytterhoeven 

[ Upstream commit 62989cebd367a1aae1e009e1a5b1ec046a4c8fdc ]

If NO_DMA=y:

ERROR: "dma_pool_alloc" [drivers/ata/sata_mv.ko] undefined!
ERROR: "dmam_pool_create" [drivers/ata/sata_mv.ko] undefined!
ERROR: "dma_pool_free" [drivers/ata/sata_mv.ko] undefined!

Add a dependency on HAS_DMA to fix this.

Signed-off-by: Geert Uytterhoeven 
Signed-off-by: Tejun Heo 
Signed-off-by: Sasha Levin 
---
 drivers/ata/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index c1e40ebaf5e2..c2ba811993d4 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -329,6 +329,7 @@ config SATA_HIGHBANK
 
 config SATA_MV
tristate "Marvell SATA support"
+   depends on HAS_DMA
depends on PCI || ARCH_DOVE || ARCH_MV78XX0 || \
   ARCH_MVEBU || ARCH_ORION5X || COMPILE_TEST
select GENERIC_PHY
-- 
2.11.0


[PATCH AUTOSEL for-3.18 17/27] ALSA: vx: Fix possible transfer overflow

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Takashi Iwai 

[ Upstream commit 874e1f6fad9a5184b67f4cee37c1335cd2cc5677 ]

The pseudo DMA transfer codes in VX222 and VX-pocket driver have a
slight bug where they check the buffer boundary wrongly, and may
overflow.  Also, the zero sample count might be handled badly for the
playback (although it shouldn't happen in theory).  This patch
addresses these issues.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=141541
Signed-off-by: Takashi Iwai 
Signed-off-by: Sasha Levin 
---
 sound/drivers/vx/vx_pcm.c   |  6 --
 sound/pci/vx222/vx222_ops.c | 12 ++--
 sound/pcmcia/vx/vxp_ops.c   | 12 ++--
 3 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/sound/drivers/vx/vx_pcm.c b/sound/drivers/vx/vx_pcm.c
index 69f252585780..ea7b377f0378 100644
--- a/sound/drivers/vx/vx_pcm.c
+++ b/sound/drivers/vx/vx_pcm.c
@@ -1048,8 +1048,10 @@ static void vx_pcm_capture_update(struct vx_core *chip, 
struct snd_pcm_substream
/* ok, let's accelerate! */
int align = pipe->align * 3;
space = (count / align) * align;
-   vx_pseudo_dma_read(chip, runtime, pipe, space);
-   count -= space;
+   if (space > 0) {
+   vx_pseudo_dma_read(chip, runtime, pipe, space);
+   count -= space;
+   }
}
/* read the rest of bytes */
while (count > 0) {
diff --git a/sound/pci/vx222/vx222_ops.c b/sound/pci/vx222/vx222_ops.c
index 2d1570273e99..5c541ed723dd 100644
--- a/sound/pci/vx222/vx222_ops.c
+++ b/sound/pci/vx222/vx222_ops.c
@@ -264,12 +264,12 @@ static void vx2_dma_write(struct vx_core *chip, struct 
snd_pcm_runtime *runtime,
 
/* Transfer using pseudo-dma.
 */
-   if (offset + count > pipe->buffer_bytes) {
+   if (offset + count >= pipe->buffer_bytes) {
int length = pipe->buffer_bytes - offset;
count -= length;
length >>= 2; /* in 32bit words */
/* Transfer using pseudo-dma. */
-   while (length-- > 0) {
+   for (; length > 0; length--) {
outl(cpu_to_le32(*addr), port);
addr++;
}
@@ -279,7 +279,7 @@ static void vx2_dma_write(struct vx_core *chip, struct 
snd_pcm_runtime *runtime,
pipe->hw_ptr += count;
count >>= 2; /* in 32bit words */
/* Transfer using pseudo-dma. */
-   while (count-- > 0) {
+   for (; count > 0; count--) {
outl(cpu_to_le32(*addr), port);
addr++;
}
@@ -302,12 +302,12 @@ static void vx2_dma_read(struct vx_core *chip, struct 
snd_pcm_runtime *runtime,
vx2_setup_pseudo_dma(chip, 0);
/* Transfer using pseudo-dma.
 */
-   if (offset + count > pipe->buffer_bytes) {
+   if (offset + count >= pipe->buffer_bytes) {
int length = pipe->buffer_bytes - offset;
count -= length;
length >>= 2; /* in 32bit words */
/* Transfer using pseudo-dma. */
-   while (length-- > 0)
+   for (; length > 0; length--)
*addr++ = le32_to_cpu(inl(port));
addr = (u32 *)runtime->dma_area;
pipe->hw_ptr = 0;
@@ -315,7 +315,7 @@ static void vx2_dma_read(struct vx_core *chip, struct 
snd_pcm_runtime *runtime,
pipe->hw_ptr += count;
count >>= 2; /* in 32bit words */
/* Transfer using pseudo-dma. */
-   while (count-- > 0)
+   for (; count > 0; count--)
*addr++ = le32_to_cpu(inl(port));
 
vx2_release_pseudo_dma(chip);
diff --git a/sound/pcmcia/vx/vxp_ops.c b/sound/pcmcia/vx/vxp_ops.c
index 281972913c32..56aa1ba73ccc 100644
--- a/sound/pcmcia/vx/vxp_ops.c
+++ b/sound/pcmcia/vx/vxp_ops.c
@@ -369,12 +369,12 @@ static void vxp_dma_write(struct vx_core *chip, struct 
snd_pcm_runtime *runtime,
unsigned short *addr = (unsigned short *)(runtime->dma_area + offset);
 
vx_setup_pseudo_dma(chip, 1);
-   if (offset + count > pipe->buffer_bytes) {
+   if (offset + count >= pipe->buffer_bytes) {
int length = pipe->buffer_bytes - offset;
count -= length;
length >>= 1; /* in 16bit words */
/* Transfer using pseudo-dma. */
-   while (length-- > 0) {
+   for (; length > 0; length--) {
outw(cpu_to_le16(*addr), port);
addr++;
}
@@ -384,7 +384,7 @@ static void vxp_dma_write(struct vx_core *chip, struct 
snd_pcm_runtime *runtime,
pipe->hw_ptr += count;
count >>= 1; /* in 16bit words */
/* Transfer using pseudo-dma. */
-   while (count-- > 0) {
+   for (; count > 0; count--) {
outw(cpu_to_le16(*addr), port);
addr++;
}
@@ -411,12 +411,12 @@ static void vxp_dma_read(struct 

[PATCH AUTOSEL for-4.4 12/39] igb: close/suspend race in netif_device_detach

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Todd Fujinaka 

[ Upstream commit 9474933caf21a4cb5147223dca1551f527aaac36 ]

Similar to ixgbe, when an interface is part of a namespace it is
possible that igb_close() may be called while __igb_shutdown() is
running which ends up in a double free WARN and/or a BUG in
free_msi_irqs().

Extend the rtnl_lock() to protect the call to netif_device_detach() and
igb_clear_interrupt_scheme() in __igb_shutdown() and check for
netif_device_present() to avoid calling igb_clear_interrupt_scheme() a
second time in igb_close().

Also extend the rtnl lock in igb_resume() to netif_device_attach().

Signed-off-by: Todd Fujinaka 
Acked-by: Alexander Duyck 
Tested-by: Aaron Brown 
Signed-off-by: Jeff Kirsher 
Signed-off-by: Sasha Levin 
---
 drivers/net/ethernet/intel/igb/igb_main.c | 21 -
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/intel/igb/igb_main.c 
b/drivers/net/ethernet/intel/igb/igb_main.c
index a481ea64e287..ff6e57d788eb 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -3172,7 +3172,9 @@ static int __igb_close(struct net_device *netdev, bool 
suspending)
 
 static int igb_close(struct net_device *netdev)
 {
-   return __igb_close(netdev, false);
+   if (netif_device_present(netdev))
+   return __igb_close(netdev, false);
+   return 0;
 }
 
 /**
@@ -7325,12 +7327,14 @@ static int __igb_shutdown(struct pci_dev *pdev, bool 
*enable_wake,
int retval = 0;
 #endif
 
+   rtnl_lock();
netif_device_detach(netdev);
 
if (netif_running(netdev))
__igb_close(netdev, true);
 
igb_clear_interrupt_scheme(adapter);
+   rtnl_unlock();
 
 #ifdef CONFIG_PM
retval = pci_save_state(pdev);
@@ -7450,16 +7454,15 @@ static int igb_resume(struct device *dev)
 
wr32(E1000_WUS, ~0);
 
-   if (netdev->flags & IFF_UP) {
-   rtnl_lock();
+   rtnl_lock();
+   if (!err && netif_running(netdev))
err = __igb_open(netdev, true);
-   rtnl_unlock();
-   if (err)
-   return err;
-   }
 
-   netif_device_attach(netdev);
-   return 0;
+   if (!err)
+   netif_device_attach(netdev);
+   rtnl_unlock();
+
+   return err;
 }
 
 static int igb_runtime_idle(struct device *dev)
-- 
2.11.0


[PATCH AUTOSEL for-4.4 12/39] igb: close/suspend race in netif_device_detach

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Todd Fujinaka 

[ Upstream commit 9474933caf21a4cb5147223dca1551f527aaac36 ]

Similar to ixgbe, when an interface is part of a namespace it is
possible that igb_close() may be called while __igb_shutdown() is
running which ends up in a double free WARN and/or a BUG in
free_msi_irqs().

Extend the rtnl_lock() to protect the call to netif_device_detach() and
igb_clear_interrupt_scheme() in __igb_shutdown() and check for
netif_device_present() to avoid calling igb_clear_interrupt_scheme() a
second time in igb_close().

Also extend the rtnl lock in igb_resume() to netif_device_attach().

Signed-off-by: Todd Fujinaka 
Acked-by: Alexander Duyck 
Tested-by: Aaron Brown 
Signed-off-by: Jeff Kirsher 
Signed-off-by: Sasha Levin 
---
 drivers/net/ethernet/intel/igb/igb_main.c | 21 -
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/intel/igb/igb_main.c 
b/drivers/net/ethernet/intel/igb/igb_main.c
index a481ea64e287..ff6e57d788eb 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -3172,7 +3172,9 @@ static int __igb_close(struct net_device *netdev, bool 
suspending)
 
 static int igb_close(struct net_device *netdev)
 {
-   return __igb_close(netdev, false);
+   if (netif_device_present(netdev))
+   return __igb_close(netdev, false);
+   return 0;
 }
 
 /**
@@ -7325,12 +7327,14 @@ static int __igb_shutdown(struct pci_dev *pdev, bool 
*enable_wake,
int retval = 0;
 #endif
 
+   rtnl_lock();
netif_device_detach(netdev);
 
if (netif_running(netdev))
__igb_close(netdev, true);
 
igb_clear_interrupt_scheme(adapter);
+   rtnl_unlock();
 
 #ifdef CONFIG_PM
retval = pci_save_state(pdev);
@@ -7450,16 +7454,15 @@ static int igb_resume(struct device *dev)
 
wr32(E1000_WUS, ~0);
 
-   if (netdev->flags & IFF_UP) {
-   rtnl_lock();
+   rtnl_lock();
+   if (!err && netif_running(netdev))
err = __igb_open(netdev, true);
-   rtnl_unlock();
-   if (err)
-   return err;
-   }
 
-   netif_device_attach(netdev);
-   return 0;
+   if (!err)
+   netif_device_attach(netdev);
+   rtnl_unlock();
+
+   return err;
 }
 
 static int igb_runtime_idle(struct device *dev)
-- 
2.11.0


[PATCH AUTOSEL for-4.4 13/39] igb: Fix hw_dbg logging in igb_update_flash_i210

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Hannu Lounento 

[ Upstream commit 76ed5a8f47476e4984cc8c0c1bc4cee62650f7fd ]

Fix an if statement with hw_dbg lines where the logic was inverted with
regards to the corresponding return value used in the if statement.

Signed-off-by: Hannu Lounento 
Signed-off-by: Peter Senna Tschudin 
Tested-by: Aaron Brown 
Signed-off-by: Jeff Kirsher 
Signed-off-by: Sasha Levin 
---
 drivers/net/ethernet/intel/igb/e1000_i210.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/igb/e1000_i210.c 
b/drivers/net/ethernet/intel/igb/e1000_i210.c
index 29f59c76878a..851225b5dc0f 100644
--- a/drivers/net/ethernet/intel/igb/e1000_i210.c
+++ b/drivers/net/ethernet/intel/igb/e1000_i210.c
@@ -699,9 +699,9 @@ static s32 igb_update_flash_i210(struct e1000_hw *hw)
 
ret_val = igb_pool_flash_update_done_i210(hw);
if (ret_val)
-   hw_dbg("Flash update complete\n");
-   else
hw_dbg("Flash update time out\n");
+   else
+   hw_dbg("Flash update complete\n");
 
 out:
return ret_val;
-- 
2.11.0


[PATCH AUTOSEL for-4.4 13/39] igb: Fix hw_dbg logging in igb_update_flash_i210

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Hannu Lounento 

[ Upstream commit 76ed5a8f47476e4984cc8c0c1bc4cee62650f7fd ]

Fix an if statement with hw_dbg lines where the logic was inverted with
regards to the corresponding return value used in the if statement.

Signed-off-by: Hannu Lounento 
Signed-off-by: Peter Senna Tschudin 
Tested-by: Aaron Brown 
Signed-off-by: Jeff Kirsher 
Signed-off-by: Sasha Levin 
---
 drivers/net/ethernet/intel/igb/e1000_i210.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/igb/e1000_i210.c 
b/drivers/net/ethernet/intel/igb/e1000_i210.c
index 29f59c76878a..851225b5dc0f 100644
--- a/drivers/net/ethernet/intel/igb/e1000_i210.c
+++ b/drivers/net/ethernet/intel/igb/e1000_i210.c
@@ -699,9 +699,9 @@ static s32 igb_update_flash_i210(struct e1000_hw *hw)
 
ret_val = igb_pool_flash_update_done_i210(hw);
if (ret_val)
-   hw_dbg("Flash update complete\n");
-   else
hw_dbg("Flash update time out\n");
+   else
+   hw_dbg("Flash update complete\n");
 
 out:
return ret_val;
-- 
2.11.0


[PATCH AUTOSEL for-4.4 01/39] extcon: palmas: Check the parent instance to prevent the NULL

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Roger Quadros 

[ Upstream commit 9fe172b9be532acc23e35ba693700383ab775e66 ]

extcon-palmas must be child of palmas and expects parent's
drvdata to be valid. Check for non NULL parent drvdata and
fail if it is NULL. Not doing so will result in a NULL
pointer dereference later in the probe() parent drvdata
is NULL (e.g. misplaced extcon-palmas node in device tree).

Signed-off-by: Roger Quadros 
Signed-off-by: Chanwoo Choi 
Signed-off-by: Sasha Levin 
---
 drivers/extcon/extcon-palmas.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/extcon/extcon-palmas.c b/drivers/extcon/extcon-palmas.c
index 93c30a885740..aa2f6bb82b32 100644
--- a/drivers/extcon/extcon-palmas.c
+++ b/drivers/extcon/extcon-palmas.c
@@ -190,6 +190,11 @@ static int palmas_usb_probe(struct platform_device *pdev)
struct palmas_usb *palmas_usb;
int status;
 
+   if (!palmas) {
+   dev_err(>dev, "failed to get valid parent\n");
+   return -EINVAL;
+   }
+
palmas_usb = devm_kzalloc(>dev, sizeof(*palmas_usb), GFP_KERNEL);
if (!palmas_usb)
return -ENOMEM;
-- 
2.11.0


[PATCH AUTOSEL for-4.4 01/39] extcon: palmas: Check the parent instance to prevent the NULL

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Roger Quadros 

[ Upstream commit 9fe172b9be532acc23e35ba693700383ab775e66 ]

extcon-palmas must be child of palmas and expects parent's
drvdata to be valid. Check for non NULL parent drvdata and
fail if it is NULL. Not doing so will result in a NULL
pointer dereference later in the probe() parent drvdata
is NULL (e.g. misplaced extcon-palmas node in device tree).

Signed-off-by: Roger Quadros 
Signed-off-by: Chanwoo Choi 
Signed-off-by: Sasha Levin 
---
 drivers/extcon/extcon-palmas.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/extcon/extcon-palmas.c b/drivers/extcon/extcon-palmas.c
index 93c30a885740..aa2f6bb82b32 100644
--- a/drivers/extcon/extcon-palmas.c
+++ b/drivers/extcon/extcon-palmas.c
@@ -190,6 +190,11 @@ static int palmas_usb_probe(struct platform_device *pdev)
struct palmas_usb *palmas_usb;
int status;
 
+   if (!palmas) {
+   dev_err(>dev, "failed to get valid parent\n");
+   return -EINVAL;
+   }
+
palmas_usb = devm_kzalloc(>dev, sizeof(*palmas_usb), GFP_KERNEL);
if (!palmas_usb)
return -ENOMEM;
-- 
2.11.0


[PATCH AUTOSEL for-4.4 32/39] ixgbe: add mask for 64 RSS queues

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Emil Tantilov 

[ Upstream commit 2bf1a87b903bd81b1448a1cef73de59fb6c4d340 ]

The indirection table was reported incorrectly for X550 and newer
where we can support up to 64 RSS queues.

Reported-by Krishneil Singh 
Signed-off-by: Emil Tantilov 
Tested-by: Andrew Bowers 
Signed-off-by: Jeff Kirsher 

Signed-off-by: Sasha Levin 
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c 
b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
index f3168bcc7d87..f0de09db8283 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
@@ -307,6 +307,7 @@ static void ixgbe_cache_ring_register(struct ixgbe_adapter 
*adapter)
ixgbe_cache_ring_rss(adapter);
 }
 
+#define IXGBE_RSS_64Q_MASK 0x3F
 #define IXGBE_RSS_16Q_MASK 0xF
 #define IXGBE_RSS_8Q_MASK  0x7
 #define IXGBE_RSS_4Q_MASK  0x3
@@ -602,6 +603,7 @@ static bool ixgbe_set_sriov_queues(struct ixgbe_adapter 
*adapter)
  **/
 static bool ixgbe_set_rss_queues(struct ixgbe_adapter *adapter)
 {
+   struct ixgbe_hw *hw = >hw;
struct ixgbe_ring_feature *f;
u16 rss_i;
 
@@ -610,7 +612,11 @@ static bool ixgbe_set_rss_queues(struct ixgbe_adapter 
*adapter)
rss_i = f->limit;
 
f->indices = rss_i;
-   f->mask = IXGBE_RSS_16Q_MASK;
+
+   if (hw->mac.type < ixgbe_mac_X550)
+   f->mask = IXGBE_RSS_16Q_MASK;
+   else
+   f->mask = IXGBE_RSS_64Q_MASK;
 
/* disable ATR by default, it will be configured below */
adapter->flags &= ~IXGBE_FLAG_FDIR_HASH_CAPABLE;
-- 
2.11.0


[PATCH AUTOSEL for-4.4 36/39] MIPS: init: Ensure bootmem does not corrupt reserved memory

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Marcin Nowakowski 

[ Upstream commit d9b5b658210f28ed9f70c757d553e679d76e2986 ]

Current init code initialises bootmem allocator with all of the low
memory that it assumes is available, but does not check for reserved
memory block, which can lead to corruption of data that may be stored
there.
Move bootmem's allocation map to a location that does not cross any
reserved regions

Signed-off-by: Marcin Nowakowski 
Cc: linux-m...@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/14609/
Signed-off-by: Ralf Baechle 
Signed-off-by: Sasha Levin 
---
 arch/mips/kernel/setup.c | 74 ++--
 1 file changed, 71 insertions(+), 3 deletions(-)

diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 8acae316f26b..1acaf0939cb5 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -152,6 +152,35 @@ void __init detect_memory_region(phys_addr_t start, 
phys_addr_t sz_min, phys_add
add_memory_region(start, size, BOOT_MEM_RAM);
 }
 
+bool __init memory_region_available(phys_addr_t start, phys_addr_t size)
+{
+   int i;
+   bool in_ram = false, free = true;
+
+   for (i = 0; i < boot_mem_map.nr_map; i++) {
+   phys_addr_t start_, end_;
+
+   start_ = boot_mem_map.map[i].addr;
+   end_ = boot_mem_map.map[i].addr + boot_mem_map.map[i].size;
+
+   switch (boot_mem_map.map[i].type) {
+   case BOOT_MEM_RAM:
+   if (start >= start_ && start + size <= end_)
+   in_ram = true;
+   break;
+   case BOOT_MEM_RESERVED:
+   if ((start >= start_ && start < end_) ||
+   (start < start_ && start + size >= start_))
+   free = false;
+   break;
+   default:
+   continue;
+   }
+   }
+
+   return in_ram && free;
+}
+
 static void __init print_memory_map(void)
 {
int i;
@@ -300,11 +329,19 @@ static void __init bootmem_init(void)
 
 #else  /* !CONFIG_SGI_IP27 */
 
+static unsigned long __init bootmap_bytes(unsigned long pages)
+{
+   unsigned long bytes = DIV_ROUND_UP(pages, 8);
+
+   return ALIGN(bytes, sizeof(long));
+}
+
 static void __init bootmem_init(void)
 {
unsigned long reserved_end;
unsigned long mapstart = ~0UL;
unsigned long bootmap_size;
+   bool bootmap_valid = false;
int i;
 
/*
@@ -385,11 +422,42 @@ static void __init bootmem_init(void)
 #endif
 
/*
-* Initialize the boot-time allocator with low memory only.
+* check that mapstart doesn't overlap with any of
+* memory regions that have been reserved through eg. DTB
 */
-   bootmap_size = init_bootmem_node(NODE_DATA(0), mapstart,
-min_low_pfn, max_low_pfn);
+   bootmap_size = bootmap_bytes(max_low_pfn - min_low_pfn);
+
+   bootmap_valid = memory_region_available(PFN_PHYS(mapstart),
+   bootmap_size);
+   for (i = 0; i < boot_mem_map.nr_map && !bootmap_valid; i++) {
+   unsigned long mapstart_addr;
+
+   switch (boot_mem_map.map[i].type) {
+   case BOOT_MEM_RESERVED:
+   mapstart_addr = PFN_ALIGN(boot_mem_map.map[i].addr +
+   boot_mem_map.map[i].size);
+   if (PHYS_PFN(mapstart_addr) < mapstart)
+   break;
+
+   bootmap_valid = memory_region_available(mapstart_addr,
+   bootmap_size);
+   if (bootmap_valid)
+   mapstart = PHYS_PFN(mapstart_addr);
+   break;
+   default:
+   break;
+   }
+   }
 
+   if (!bootmap_valid)
+   panic("No memory area to place a bootmap bitmap");
+
+   /*
+* Initialize the boot-time allocator with low memory only.
+*/
+   if (bootmap_size != init_bootmem_node(NODE_DATA(0), mapstart,
+min_low_pfn, max_low_pfn))
+   panic("Unexpected memory size required for bootmap");
 
for (i = 0; i < boot_mem_map.nr_map; i++) {
unsigned long start, end;
-- 
2.11.0


[PATCH AUTOSEL for-4.4 35/39] MIPS: End asm function prologue macros with .insn

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Paul Burton 

[ Upstream commit 08889582b8aa0bbc01a1e5a0033b9f98d2e11caa ]

When building a kernel targeting a microMIPS ISA, recent GNU linkers
will fail the link if they cannot determine that the target of a branch
or jump is microMIPS code, with errors such as the following:

mips-img-linux-gnu-ld: arch/mips/built-in.o: .text+0x542c:
Unsupported jump between ISA modes; consider recompiling with
interlinking enabled.
mips-img-linux-gnu-ld: final link failed: Bad value

or:

./arch/mips/include/asm/uaccess.h:1017: warning: JALX to a
non-word-aligned address

Placing anything other than an instruction at the start of a function
written in assembly appears to trigger such errors. In order to prepare
for allowing us to follow function prologue macros with an EXPORT_SYMBOL
invocation, end the prologue macros (LEAD, NESTED & FEXPORT) with a
.insn directive. This ensures that the start of the function is marked
as code, which always makes sense for functions & safely prevents us
from hitting the link errors described above.

Signed-off-by: Paul Burton 
Reviewed-by: Maciej W. Rozycki 
Cc: linux-m...@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/14508/
Signed-off-by: Ralf Baechle 
Signed-off-by: Sasha Levin 
---
 arch/mips/include/asm/asm.h | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/arch/mips/include/asm/asm.h b/arch/mips/include/asm/asm.h
index 7c26b28bf252..859cf7048347 100644
--- a/arch/mips/include/asm/asm.h
+++ b/arch/mips/include/asm/asm.h
@@ -54,7 +54,8 @@
.align  2;  \
.type   symbol, @function;  \
.entsymbol, 0;  \
-symbol:.frame  sp, 0, ra
+symbol:.frame  sp, 0, ra;  \
+   .insn
 
 /*
  * NESTED - declare nested routine entry point
@@ -63,8 +64,9 @@ symbol:   .frame  sp, 0, ra
.globl  symbol; \
.align  2;  \
.type   symbol, @function;  \
-   .entsymbol, 0;   \
-symbol:.frame  sp, framesize, rpc
+   .entsymbol, 0;  \
+symbol:.frame  sp, framesize, rpc; \
+   .insn
 
 /*
  * END - mark end of function
@@ -86,7 +88,7 @@ symbol:
 #define FEXPORT(symbol)\
.globl  symbol; \
.type   symbol, @function;  \
-symbol:
+symbol:.insn
 
 /*
  * ABS - export absolute symbol
-- 
2.11.0


[PATCH AUTOSEL for-4.4 32/39] ixgbe: add mask for 64 RSS queues

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Emil Tantilov 

[ Upstream commit 2bf1a87b903bd81b1448a1cef73de59fb6c4d340 ]

The indirection table was reported incorrectly for X550 and newer
where we can support up to 64 RSS queues.

Reported-by Krishneil Singh 
Signed-off-by: Emil Tantilov 
Tested-by: Andrew Bowers 
Signed-off-by: Jeff Kirsher 

Signed-off-by: Sasha Levin 
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c 
b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
index f3168bcc7d87..f0de09db8283 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
@@ -307,6 +307,7 @@ static void ixgbe_cache_ring_register(struct ixgbe_adapter 
*adapter)
ixgbe_cache_ring_rss(adapter);
 }
 
+#define IXGBE_RSS_64Q_MASK 0x3F
 #define IXGBE_RSS_16Q_MASK 0xF
 #define IXGBE_RSS_8Q_MASK  0x7
 #define IXGBE_RSS_4Q_MASK  0x3
@@ -602,6 +603,7 @@ static bool ixgbe_set_sriov_queues(struct ixgbe_adapter 
*adapter)
  **/
 static bool ixgbe_set_rss_queues(struct ixgbe_adapter *adapter)
 {
+   struct ixgbe_hw *hw = >hw;
struct ixgbe_ring_feature *f;
u16 rss_i;
 
@@ -610,7 +612,11 @@ static bool ixgbe_set_rss_queues(struct ixgbe_adapter 
*adapter)
rss_i = f->limit;
 
f->indices = rss_i;
-   f->mask = IXGBE_RSS_16Q_MASK;
+
+   if (hw->mac.type < ixgbe_mac_X550)
+   f->mask = IXGBE_RSS_16Q_MASK;
+   else
+   f->mask = IXGBE_RSS_64Q_MASK;
 
/* disable ATR by default, it will be configured below */
adapter->flags &= ~IXGBE_FLAG_FDIR_HASH_CAPABLE;
-- 
2.11.0


[PATCH AUTOSEL for-4.4 36/39] MIPS: init: Ensure bootmem does not corrupt reserved memory

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Marcin Nowakowski 

[ Upstream commit d9b5b658210f28ed9f70c757d553e679d76e2986 ]

Current init code initialises bootmem allocator with all of the low
memory that it assumes is available, but does not check for reserved
memory block, which can lead to corruption of data that may be stored
there.
Move bootmem's allocation map to a location that does not cross any
reserved regions

Signed-off-by: Marcin Nowakowski 
Cc: linux-m...@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/14609/
Signed-off-by: Ralf Baechle 
Signed-off-by: Sasha Levin 
---
 arch/mips/kernel/setup.c | 74 ++--
 1 file changed, 71 insertions(+), 3 deletions(-)

diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 8acae316f26b..1acaf0939cb5 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -152,6 +152,35 @@ void __init detect_memory_region(phys_addr_t start, 
phys_addr_t sz_min, phys_add
add_memory_region(start, size, BOOT_MEM_RAM);
 }
 
+bool __init memory_region_available(phys_addr_t start, phys_addr_t size)
+{
+   int i;
+   bool in_ram = false, free = true;
+
+   for (i = 0; i < boot_mem_map.nr_map; i++) {
+   phys_addr_t start_, end_;
+
+   start_ = boot_mem_map.map[i].addr;
+   end_ = boot_mem_map.map[i].addr + boot_mem_map.map[i].size;
+
+   switch (boot_mem_map.map[i].type) {
+   case BOOT_MEM_RAM:
+   if (start >= start_ && start + size <= end_)
+   in_ram = true;
+   break;
+   case BOOT_MEM_RESERVED:
+   if ((start >= start_ && start < end_) ||
+   (start < start_ && start + size >= start_))
+   free = false;
+   break;
+   default:
+   continue;
+   }
+   }
+
+   return in_ram && free;
+}
+
 static void __init print_memory_map(void)
 {
int i;
@@ -300,11 +329,19 @@ static void __init bootmem_init(void)
 
 #else  /* !CONFIG_SGI_IP27 */
 
+static unsigned long __init bootmap_bytes(unsigned long pages)
+{
+   unsigned long bytes = DIV_ROUND_UP(pages, 8);
+
+   return ALIGN(bytes, sizeof(long));
+}
+
 static void __init bootmem_init(void)
 {
unsigned long reserved_end;
unsigned long mapstart = ~0UL;
unsigned long bootmap_size;
+   bool bootmap_valid = false;
int i;
 
/*
@@ -385,11 +422,42 @@ static void __init bootmem_init(void)
 #endif
 
/*
-* Initialize the boot-time allocator with low memory only.
+* check that mapstart doesn't overlap with any of
+* memory regions that have been reserved through eg. DTB
 */
-   bootmap_size = init_bootmem_node(NODE_DATA(0), mapstart,
-min_low_pfn, max_low_pfn);
+   bootmap_size = bootmap_bytes(max_low_pfn - min_low_pfn);
+
+   bootmap_valid = memory_region_available(PFN_PHYS(mapstart),
+   bootmap_size);
+   for (i = 0; i < boot_mem_map.nr_map && !bootmap_valid; i++) {
+   unsigned long mapstart_addr;
+
+   switch (boot_mem_map.map[i].type) {
+   case BOOT_MEM_RESERVED:
+   mapstart_addr = PFN_ALIGN(boot_mem_map.map[i].addr +
+   boot_mem_map.map[i].size);
+   if (PHYS_PFN(mapstart_addr) < mapstart)
+   break;
+
+   bootmap_valid = memory_region_available(mapstart_addr,
+   bootmap_size);
+   if (bootmap_valid)
+   mapstart = PHYS_PFN(mapstart_addr);
+   break;
+   default:
+   break;
+   }
+   }
 
+   if (!bootmap_valid)
+   panic("No memory area to place a bootmap bitmap");
+
+   /*
+* Initialize the boot-time allocator with low memory only.
+*/
+   if (bootmap_size != init_bootmem_node(NODE_DATA(0), mapstart,
+min_low_pfn, max_low_pfn))
+   panic("Unexpected memory size required for bootmap");
 
for (i = 0; i < boot_mem_map.nr_map; i++) {
unsigned long start, end;
-- 
2.11.0


[PATCH AUTOSEL for-4.4 35/39] MIPS: End asm function prologue macros with .insn

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Paul Burton 

[ Upstream commit 08889582b8aa0bbc01a1e5a0033b9f98d2e11caa ]

When building a kernel targeting a microMIPS ISA, recent GNU linkers
will fail the link if they cannot determine that the target of a branch
or jump is microMIPS code, with errors such as the following:

mips-img-linux-gnu-ld: arch/mips/built-in.o: .text+0x542c:
Unsupported jump between ISA modes; consider recompiling with
interlinking enabled.
mips-img-linux-gnu-ld: final link failed: Bad value

or:

./arch/mips/include/asm/uaccess.h:1017: warning: JALX to a
non-word-aligned address

Placing anything other than an instruction at the start of a function
written in assembly appears to trigger such errors. In order to prepare
for allowing us to follow function prologue macros with an EXPORT_SYMBOL
invocation, end the prologue macros (LEAD, NESTED & FEXPORT) with a
.insn directive. This ensures that the start of the function is marked
as code, which always makes sense for functions & safely prevents us
from hitting the link errors described above.

Signed-off-by: Paul Burton 
Reviewed-by: Maciej W. Rozycki 
Cc: linux-m...@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/14508/
Signed-off-by: Ralf Baechle 
Signed-off-by: Sasha Levin 
---
 arch/mips/include/asm/asm.h | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/arch/mips/include/asm/asm.h b/arch/mips/include/asm/asm.h
index 7c26b28bf252..859cf7048347 100644
--- a/arch/mips/include/asm/asm.h
+++ b/arch/mips/include/asm/asm.h
@@ -54,7 +54,8 @@
.align  2;  \
.type   symbol, @function;  \
.entsymbol, 0;  \
-symbol:.frame  sp, 0, ra
+symbol:.frame  sp, 0, ra;  \
+   .insn
 
 /*
  * NESTED - declare nested routine entry point
@@ -63,8 +64,9 @@ symbol:   .frame  sp, 0, ra
.globl  symbol; \
.align  2;  \
.type   symbol, @function;  \
-   .entsymbol, 0;   \
-symbol:.frame  sp, framesize, rpc
+   .entsymbol, 0;  \
+symbol:.frame  sp, framesize, rpc; \
+   .insn
 
 /*
  * END - mark end of function
@@ -86,7 +88,7 @@ symbol:
 #define FEXPORT(symbol)\
.globl  symbol; \
.type   symbol, @function;  \
-symbol:
+symbol:.insn
 
 /*
  * ABS - export absolute symbol
-- 
2.11.0


[PATCH AUTOSEL for-4.4 33/39] ixgbe: do not disable FEC from the driver

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Emil Tantilov 

[ Upstream commit 1fe954b2097bb907b4578e6a74e4c1d23785a601 ]

FEC is configured by the NVM and the driver should not be
overriding it.

Signed-off-by: Emil Tantilov 
Tested-by: Krishneil Singh 
Signed-off-by: Jeff Kirsher 
Signed-off-by: Sasha Levin 
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c 
b/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c
index ebe0ac950b14..31f864fb30c1 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c
@@ -1643,8 +1643,6 @@ static s32 ixgbe_setup_kr_speed_x550em(struct ixgbe_hw 
*hw,
return status;
 
reg_val |= IXGBE_KRM_LINK_CTRL_1_TETH_AN_ENABLE;
-   reg_val &= ~(IXGBE_KRM_LINK_CTRL_1_TETH_AN_FEC_REQ |
-IXGBE_KRM_LINK_CTRL_1_TETH_AN_CAP_FEC);
reg_val &= ~(IXGBE_KRM_LINK_CTRL_1_TETH_AN_CAP_KR |
 IXGBE_KRM_LINK_CTRL_1_TETH_AN_CAP_KX);
 
-- 
2.11.0


[PATCH AUTOSEL for-4.4 33/39] ixgbe: do not disable FEC from the driver

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Emil Tantilov 

[ Upstream commit 1fe954b2097bb907b4578e6a74e4c1d23785a601 ]

FEC is configured by the NVM and the driver should not be
overriding it.

Signed-off-by: Emil Tantilov 
Tested-by: Krishneil Singh 
Signed-off-by: Jeff Kirsher 
Signed-off-by: Sasha Levin 
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c 
b/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c
index ebe0ac950b14..31f864fb30c1 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c
@@ -1643,8 +1643,6 @@ static s32 ixgbe_setup_kr_speed_x550em(struct ixgbe_hw 
*hw,
return status;
 
reg_val |= IXGBE_KRM_LINK_CTRL_1_TETH_AN_ENABLE;
-   reg_val &= ~(IXGBE_KRM_LINK_CTRL_1_TETH_AN_FEC_REQ |
-IXGBE_KRM_LINK_CTRL_1_TETH_AN_CAP_FEC);
reg_val &= ~(IXGBE_KRM_LINK_CTRL_1_TETH_AN_CAP_KR |
 IXGBE_KRM_LINK_CTRL_1_TETH_AN_CAP_KX);
 
-- 
2.11.0


[PATCH AUTOSEL for-3.18 23/27] MIPS: End asm function prologue macros with .insn

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Paul Burton 

[ Upstream commit 08889582b8aa0bbc01a1e5a0033b9f98d2e11caa ]

When building a kernel targeting a microMIPS ISA, recent GNU linkers
will fail the link if they cannot determine that the target of a branch
or jump is microMIPS code, with errors such as the following:

mips-img-linux-gnu-ld: arch/mips/built-in.o: .text+0x542c:
Unsupported jump between ISA modes; consider recompiling with
interlinking enabled.
mips-img-linux-gnu-ld: final link failed: Bad value

or:

./arch/mips/include/asm/uaccess.h:1017: warning: JALX to a
non-word-aligned address

Placing anything other than an instruction at the start of a function
written in assembly appears to trigger such errors. In order to prepare
for allowing us to follow function prologue macros with an EXPORT_SYMBOL
invocation, end the prologue macros (LEAD, NESTED & FEXPORT) with a
.insn directive. This ensures that the start of the function is marked
as code, which always makes sense for functions & safely prevents us
from hitting the link errors described above.

Signed-off-by: Paul Burton 
Reviewed-by: Maciej W. Rozycki 
Cc: linux-m...@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/14508/
Signed-off-by: Ralf Baechle 
Signed-off-by: Sasha Levin 
---
 arch/mips/include/asm/asm.h | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/arch/mips/include/asm/asm.h b/arch/mips/include/asm/asm.h
index 7c26b28bf252..859cf7048347 100644
--- a/arch/mips/include/asm/asm.h
+++ b/arch/mips/include/asm/asm.h
@@ -54,7 +54,8 @@
.align  2;  \
.type   symbol, @function;  \
.entsymbol, 0;  \
-symbol:.frame  sp, 0, ra
+symbol:.frame  sp, 0, ra;  \
+   .insn
 
 /*
  * NESTED - declare nested routine entry point
@@ -63,8 +64,9 @@ symbol:   .frame  sp, 0, ra
.globl  symbol; \
.align  2;  \
.type   symbol, @function;  \
-   .entsymbol, 0;   \
-symbol:.frame  sp, framesize, rpc
+   .entsymbol, 0;  \
+symbol:.frame  sp, framesize, rpc; \
+   .insn
 
 /*
  * END - mark end of function
@@ -86,7 +88,7 @@ symbol:
 #define FEXPORT(symbol)\
.globl  symbol; \
.type   symbol, @function;  \
-symbol:
+symbol:.insn
 
 /*
  * ABS - export absolute symbol
-- 
2.11.0


[PATCH AUTOSEL for-3.18 23/27] MIPS: End asm function prologue macros with .insn

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Paul Burton 

[ Upstream commit 08889582b8aa0bbc01a1e5a0033b9f98d2e11caa ]

When building a kernel targeting a microMIPS ISA, recent GNU linkers
will fail the link if they cannot determine that the target of a branch
or jump is microMIPS code, with errors such as the following:

mips-img-linux-gnu-ld: arch/mips/built-in.o: .text+0x542c:
Unsupported jump between ISA modes; consider recompiling with
interlinking enabled.
mips-img-linux-gnu-ld: final link failed: Bad value

or:

./arch/mips/include/asm/uaccess.h:1017: warning: JALX to a
non-word-aligned address

Placing anything other than an instruction at the start of a function
written in assembly appears to trigger such errors. In order to prepare
for allowing us to follow function prologue macros with an EXPORT_SYMBOL
invocation, end the prologue macros (LEAD, NESTED & FEXPORT) with a
.insn directive. This ensures that the start of the function is marked
as code, which always makes sense for functions & safely prevents us
from hitting the link errors described above.

Signed-off-by: Paul Burton 
Reviewed-by: Maciej W. Rozycki 
Cc: linux-m...@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/14508/
Signed-off-by: Ralf Baechle 
Signed-off-by: Sasha Levin 
---
 arch/mips/include/asm/asm.h | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/arch/mips/include/asm/asm.h b/arch/mips/include/asm/asm.h
index 7c26b28bf252..859cf7048347 100644
--- a/arch/mips/include/asm/asm.h
+++ b/arch/mips/include/asm/asm.h
@@ -54,7 +54,8 @@
.align  2;  \
.type   symbol, @function;  \
.entsymbol, 0;  \
-symbol:.frame  sp, 0, ra
+symbol:.frame  sp, 0, ra;  \
+   .insn
 
 /*
  * NESTED - declare nested routine entry point
@@ -63,8 +64,9 @@ symbol:   .frame  sp, 0, ra
.globl  symbol; \
.align  2;  \
.type   symbol, @function;  \
-   .entsymbol, 0;   \
-symbol:.frame  sp, framesize, rpc
+   .entsymbol, 0;  \
+symbol:.frame  sp, framesize, rpc; \
+   .insn
 
 /*
  * END - mark end of function
@@ -86,7 +88,7 @@ symbol:
 #define FEXPORT(symbol)\
.globl  symbol; \
.type   symbol, @function;  \
-symbol:
+symbol:.insn
 
 /*
  * ABS - export absolute symbol
-- 
2.11.0


[PATCH AUTOSEL for-4.4 19/39] scsi: lpfc: Correct host name in symbolic_name field

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: James Smart 

[ Upstream commit 6c9231f604c2575be24c96d38deb70f145172f92 ]

Correct host name in symbolic_name field of nameserver registrations

Signed-off-by: Dick Kennedy 
Signed-off-by: James Smart 
Reviewed-by: Hannes Reinecke 
Signed-off-by: Martin K. Petersen 
Signed-off-by: Sasha Levin 
---
 drivers/scsi/lpfc/lpfc_attr.c | 17 +
 1 file changed, 17 insertions(+)

diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index f6446d759d7f..4639dac64e7f 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -5148,6 +5148,19 @@ lpfc_free_sysfs_attr(struct lpfc_vport *vport)
  */
 
 /**
+ * lpfc_get_host_symbolic_name - Copy symbolic name into the scsi host
+ * @shost: kernel scsi host pointer.
+ **/
+static void
+lpfc_get_host_symbolic_name(struct Scsi_Host *shost)
+{
+   struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata;
+
+   lpfc_vport_symbolic_node_name(vport, fc_host_symbolic_name(shost),
+ sizeof fc_host_symbolic_name(shost));
+}
+
+/**
  * lpfc_get_host_port_id - Copy the vport DID into the scsi host port id
  * @shost: kernel scsi host pointer.
  **/
@@ -5684,6 +5697,8 @@ struct fc_function_template lpfc_transport_functions = {
.show_host_supported_fc4s = 1,
.show_host_supported_speeds = 1,
.show_host_maxframe_size = 1,
+
+   .get_host_symbolic_name = lpfc_get_host_symbolic_name,
.show_host_symbolic_name = 1,
 
/* dynamic attributes the driver supports */
@@ -5751,6 +5766,8 @@ struct fc_function_template 
lpfc_vport_transport_functions = {
.show_host_supported_fc4s = 1,
.show_host_supported_speeds = 1,
.show_host_maxframe_size = 1,
+
+   .get_host_symbolic_name = lpfc_get_host_symbolic_name,
.show_host_symbolic_name = 1,
 
/* dynamic attributes the driver supports */
-- 
2.11.0


[PATCH AUTOSEL for-4.4 19/39] scsi: lpfc: Correct host name in symbolic_name field

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: James Smart 

[ Upstream commit 6c9231f604c2575be24c96d38deb70f145172f92 ]

Correct host name in symbolic_name field of nameserver registrations

Signed-off-by: Dick Kennedy 
Signed-off-by: James Smart 
Reviewed-by: Hannes Reinecke 
Signed-off-by: Martin K. Petersen 
Signed-off-by: Sasha Levin 
---
 drivers/scsi/lpfc/lpfc_attr.c | 17 +
 1 file changed, 17 insertions(+)

diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index f6446d759d7f..4639dac64e7f 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -5148,6 +5148,19 @@ lpfc_free_sysfs_attr(struct lpfc_vport *vport)
  */
 
 /**
+ * lpfc_get_host_symbolic_name - Copy symbolic name into the scsi host
+ * @shost: kernel scsi host pointer.
+ **/
+static void
+lpfc_get_host_symbolic_name(struct Scsi_Host *shost)
+{
+   struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata;
+
+   lpfc_vport_symbolic_node_name(vport, fc_host_symbolic_name(shost),
+ sizeof fc_host_symbolic_name(shost));
+}
+
+/**
  * lpfc_get_host_port_id - Copy the vport DID into the scsi host port id
  * @shost: kernel scsi host pointer.
  **/
@@ -5684,6 +5697,8 @@ struct fc_function_template lpfc_transport_functions = {
.show_host_supported_fc4s = 1,
.show_host_supported_speeds = 1,
.show_host_maxframe_size = 1,
+
+   .get_host_symbolic_name = lpfc_get_host_symbolic_name,
.show_host_symbolic_name = 1,
 
/* dynamic attributes the driver supports */
@@ -5751,6 +5766,8 @@ struct fc_function_template 
lpfc_vport_transport_functions = {
.show_host_supported_fc4s = 1,
.show_host_supported_speeds = 1,
.show_host_maxframe_size = 1,
+
+   .get_host_symbolic_name = lpfc_get_host_symbolic_name,
.show_host_symbolic_name = 1,
 
/* dynamic attributes the driver supports */
-- 
2.11.0


[PATCH AUTOSEL for-4.4 38/39] MIPS: Netlogic: Exclude netlogic,xlp-pic code from XLR builds

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Paul Burton 

[ Upstream commit 9799270affc53414da96e77e454a5616b39cdab0 ]

Code in arch/mips/netlogic/common/irq.c which handles the XLP PIC fails
to build in XLR configurations due to cpu_is_xlp9xx not being defined,
leading to the following build failure:

arch/mips/netlogic/common/irq.c: In function ‘xlp_of_pic_init’:
arch/mips/netlogic/common/irq.c:298:2: error: implicit declaration
of function ‘cpu_is_xlp9xx’ [-Werror=implicit-function-declaration]
  if (cpu_is_xlp9xx()) {
  ^

Although the code was conditional upon CONFIG_OF which is indirectly
selected by CONFIG_NLM_XLP_BOARD but not CONFIG_NLM_XLR_BOARD, the
failing XLR with CONFIG_OF configuration can be configured manually or
by randconfig.

Fix the build failure by making the affected XLP PIC code conditional
upon CONFIG_CPU_XLP which is used to guard the inclusion of
asm/netlogic/xlp-hal/xlp.h that provides the required cpu_is_xlp9xx
function.

[r...@linux-mips.org: Fixed up as per Jayachandran's suggestion.]

Signed-off-by: Paul Burton 
Cc: Jayachandran C 
Cc: linux-m...@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/14524/
Signed-off-by: Ralf Baechle 
Signed-off-by: Sasha Levin 
---
 arch/mips/netlogic/common/irq.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/mips/netlogic/common/irq.c b/arch/mips/netlogic/common/irq.c
index 3660dc67d544..f4961bc9a61d 100644
--- a/arch/mips/netlogic/common/irq.c
+++ b/arch/mips/netlogic/common/irq.c
@@ -275,7 +275,7 @@ asmlinkage void plat_irq_dispatch(void)
do_IRQ(nlm_irq_to_xirq(node, i));
 }
 
-#ifdef CONFIG_OF
+#ifdef CONFIG_CPU_XLP
 static const struct irq_domain_ops xlp_pic_irq_domain_ops = {
.xlate = irq_domain_xlate_onetwocell,
 };
@@ -348,7 +348,7 @@ void __init arch_init_irq(void)
 #if defined(CONFIG_CPU_XLR)
nlm_setup_fmn_irq();
 #endif
-#if defined(CONFIG_OF)
+#ifdef CONFIG_CPU_XLP
of_irq_init(xlp_pic_irq_ids);
 #endif
 }
-- 
2.11.0


[PATCH AUTOSEL for-4.4 38/39] MIPS: Netlogic: Exclude netlogic,xlp-pic code from XLR builds

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Paul Burton 

[ Upstream commit 9799270affc53414da96e77e454a5616b39cdab0 ]

Code in arch/mips/netlogic/common/irq.c which handles the XLP PIC fails
to build in XLR configurations due to cpu_is_xlp9xx not being defined,
leading to the following build failure:

arch/mips/netlogic/common/irq.c: In function ‘xlp_of_pic_init’:
arch/mips/netlogic/common/irq.c:298:2: error: implicit declaration
of function ‘cpu_is_xlp9xx’ [-Werror=implicit-function-declaration]
  if (cpu_is_xlp9xx()) {
  ^

Although the code was conditional upon CONFIG_OF which is indirectly
selected by CONFIG_NLM_XLP_BOARD but not CONFIG_NLM_XLR_BOARD, the
failing XLR with CONFIG_OF configuration can be configured manually or
by randconfig.

Fix the build failure by making the affected XLP PIC code conditional
upon CONFIG_CPU_XLP which is used to guard the inclusion of
asm/netlogic/xlp-hal/xlp.h that provides the required cpu_is_xlp9xx
function.

[r...@linux-mips.org: Fixed up as per Jayachandran's suggestion.]

Signed-off-by: Paul Burton 
Cc: Jayachandran C 
Cc: linux-m...@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/14524/
Signed-off-by: Ralf Baechle 
Signed-off-by: Sasha Levin 
---
 arch/mips/netlogic/common/irq.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/mips/netlogic/common/irq.c b/arch/mips/netlogic/common/irq.c
index 3660dc67d544..f4961bc9a61d 100644
--- a/arch/mips/netlogic/common/irq.c
+++ b/arch/mips/netlogic/common/irq.c
@@ -275,7 +275,7 @@ asmlinkage void plat_irq_dispatch(void)
do_IRQ(nlm_irq_to_xirq(node, i));
 }
 
-#ifdef CONFIG_OF
+#ifdef CONFIG_CPU_XLP
 static const struct irq_domain_ops xlp_pic_irq_domain_ops = {
.xlate = irq_domain_xlate_onetwocell,
 };
@@ -348,7 +348,7 @@ void __init arch_init_irq(void)
 #if defined(CONFIG_CPU_XLR)
nlm_setup_fmn_irq();
 #endif
-#if defined(CONFIG_OF)
+#ifdef CONFIG_CPU_XLP
of_irq_init(xlp_pic_irq_ids);
 #endif
 }
-- 
2.11.0


[PATCH AUTOSEL for-3.18 06/27] ata: SATA_MV should depend on HAS_DMA

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Geert Uytterhoeven 

[ Upstream commit 62989cebd367a1aae1e009e1a5b1ec046a4c8fdc ]

If NO_DMA=y:

ERROR: "dma_pool_alloc" [drivers/ata/sata_mv.ko] undefined!
ERROR: "dmam_pool_create" [drivers/ata/sata_mv.ko] undefined!
ERROR: "dma_pool_free" [drivers/ata/sata_mv.ko] undefined!

Add a dependency on HAS_DMA to fix this.

Signed-off-by: Geert Uytterhoeven 
Signed-off-by: Tejun Heo 
Signed-off-by: Sasha Levin 
---
 drivers/ata/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index 98076d5d417b..aaf30674d223 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -301,6 +301,7 @@ config SATA_HIGHBANK
 
 config SATA_MV
tristate "Marvell SATA support"
+   depends on HAS_DMA
depends on PCI || ARCH_DOVE || ARCH_MV78XX0 || \
   ARCH_MVEBU || ARCH_ORION5X || COMPILE_TEST
select GENERIC_PHY
-- 
2.11.0


[PATCH AUTOSEL for-3.18 06/27] ata: SATA_MV should depend on HAS_DMA

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Geert Uytterhoeven 

[ Upstream commit 62989cebd367a1aae1e009e1a5b1ec046a4c8fdc ]

If NO_DMA=y:

ERROR: "dma_pool_alloc" [drivers/ata/sata_mv.ko] undefined!
ERROR: "dmam_pool_create" [drivers/ata/sata_mv.ko] undefined!
ERROR: "dma_pool_free" [drivers/ata/sata_mv.ko] undefined!

Add a dependency on HAS_DMA to fix this.

Signed-off-by: Geert Uytterhoeven 
Signed-off-by: Tejun Heo 
Signed-off-by: Sasha Levin 
---
 drivers/ata/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index 98076d5d417b..aaf30674d223 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -301,6 +301,7 @@ config SATA_HIGHBANK
 
 config SATA_MV
tristate "Marvell SATA support"
+   depends on HAS_DMA
depends on PCI || ARCH_DOVE || ARCH_MV78XX0 || \
   ARCH_MVEBU || ARCH_ORION5X || COMPILE_TEST
select GENERIC_PHY
-- 
2.11.0


[PATCH AUTOSEL for-3.18 10/27] igb: Fix hw_dbg logging in igb_update_flash_i210

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Hannu Lounento 

[ Upstream commit 76ed5a8f47476e4984cc8c0c1bc4cee62650f7fd ]

Fix an if statement with hw_dbg lines where the logic was inverted with
regards to the corresponding return value used in the if statement.

Signed-off-by: Hannu Lounento 
Signed-off-by: Peter Senna Tschudin 
Tested-by: Aaron Brown 
Signed-off-by: Jeff Kirsher 
Signed-off-by: Sasha Levin 
---
 drivers/net/ethernet/intel/igb/e1000_i210.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/igb/e1000_i210.c 
b/drivers/net/ethernet/intel/igb/e1000_i210.c
index 65d931669f81..89402fce7d79 100644
--- a/drivers/net/ethernet/intel/igb/e1000_i210.c
+++ b/drivers/net/ethernet/intel/igb/e1000_i210.c
@@ -699,9 +699,9 @@ static s32 igb_update_flash_i210(struct e1000_hw *hw)
 
ret_val = igb_pool_flash_update_done_i210(hw);
if (ret_val)
-   hw_dbg("Flash update complete\n");
-   else
hw_dbg("Flash update time out\n");
+   else
+   hw_dbg("Flash update complete\n");
 
 out:
return ret_val;
-- 
2.11.0


[PATCH AUTOSEL for-3.18 10/27] igb: Fix hw_dbg logging in igb_update_flash_i210

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Hannu Lounento 

[ Upstream commit 76ed5a8f47476e4984cc8c0c1bc4cee62650f7fd ]

Fix an if statement with hw_dbg lines where the logic was inverted with
regards to the corresponding return value used in the if statement.

Signed-off-by: Hannu Lounento 
Signed-off-by: Peter Senna Tschudin 
Tested-by: Aaron Brown 
Signed-off-by: Jeff Kirsher 
Signed-off-by: Sasha Levin 
---
 drivers/net/ethernet/intel/igb/e1000_i210.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/igb/e1000_i210.c 
b/drivers/net/ethernet/intel/igb/e1000_i210.c
index 65d931669f81..89402fce7d79 100644
--- a/drivers/net/ethernet/intel/igb/e1000_i210.c
+++ b/drivers/net/ethernet/intel/igb/e1000_i210.c
@@ -699,9 +699,9 @@ static s32 igb_update_flash_i210(struct e1000_hw *hw)
 
ret_val = igb_pool_flash_update_done_i210(hw);
if (ret_val)
-   hw_dbg("Flash update complete\n");
-   else
hw_dbg("Flash update time out\n");
+   else
+   hw_dbg("Flash update complete\n");
 
 out:
return ret_val;
-- 
2.11.0


[PATCH AUTOSEL for-4.9 01/53] extcon: Remove potential problem when calling extcon_register_notifier()

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Chanwoo Choi 

[ Upstream commit 01b4c9a1ae07a25d208cad0da7dd288007a22984 ]

This patch removes the potential problem of extcon_register_notifier()
when edev parameter is NULL. When edev is NULL, this function returns
the first extcon device which includes the sepecific external connector
of second paramter. But, it don't guarantee the same operation in all cases.
To remove this confusion and potential problem, this patch fixes it.

Signed-off-by: Chanwoo Choi 
Signed-off-by: Sasha Levin 
---
 drivers/extcon/extcon.c | 33 +++--
 1 file changed, 7 insertions(+), 26 deletions(-)

diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
index 7c1e3a7b14e0..d0e367959c91 100644
--- a/drivers/extcon/extcon.c
+++ b/drivers/extcon/extcon.c
@@ -906,35 +906,16 @@ int extcon_register_notifier(struct extcon_dev *edev, 
unsigned int id,
unsigned long flags;
int ret, idx = -EINVAL;
 
-   if (!nb)
+   if (!edev || !nb)
return -EINVAL;
 
-   if (edev) {
-   idx = find_cable_index_by_id(edev, id);
-   if (idx < 0)
-   return idx;
-
-   spin_lock_irqsave(>lock, flags);
-   ret = raw_notifier_chain_register(>nh[idx], nb);
-   spin_unlock_irqrestore(>lock, flags);
-   } else {
-   struct extcon_dev *extd;
-
-   mutex_lock(_dev_list_lock);
-   list_for_each_entry(extd, _dev_list, entry) {
-   idx = find_cable_index_by_id(extd, id);
-   if (idx >= 0)
-   break;
-   }
-   mutex_unlock(_dev_list_lock);
+   idx = find_cable_index_by_id(edev, id);
+   if (idx < 0)
+   return idx;
 
-   if (idx >= 0) {
-   edev = extd;
-   return extcon_register_notifier(extd, id, nb);
-   } else {
-   ret = -ENODEV;
-   }
-   }
+   spin_lock_irqsave(>lock, flags);
+   ret = raw_notifier_chain_register(>nh[idx], nb);
+   spin_unlock_irqrestore(>lock, flags);
 
return ret;
 }
-- 
2.11.0


[PATCH AUTOSEL for-4.9 01/53] extcon: Remove potential problem when calling extcon_register_notifier()

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Chanwoo Choi 

[ Upstream commit 01b4c9a1ae07a25d208cad0da7dd288007a22984 ]

This patch removes the potential problem of extcon_register_notifier()
when edev parameter is NULL. When edev is NULL, this function returns
the first extcon device which includes the sepecific external connector
of second paramter. But, it don't guarantee the same operation in all cases.
To remove this confusion and potential problem, this patch fixes it.

Signed-off-by: Chanwoo Choi 
Signed-off-by: Sasha Levin 
---
 drivers/extcon/extcon.c | 33 +++--
 1 file changed, 7 insertions(+), 26 deletions(-)

diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
index 7c1e3a7b14e0..d0e367959c91 100644
--- a/drivers/extcon/extcon.c
+++ b/drivers/extcon/extcon.c
@@ -906,35 +906,16 @@ int extcon_register_notifier(struct extcon_dev *edev, 
unsigned int id,
unsigned long flags;
int ret, idx = -EINVAL;
 
-   if (!nb)
+   if (!edev || !nb)
return -EINVAL;
 
-   if (edev) {
-   idx = find_cable_index_by_id(edev, id);
-   if (idx < 0)
-   return idx;
-
-   spin_lock_irqsave(>lock, flags);
-   ret = raw_notifier_chain_register(>nh[idx], nb);
-   spin_unlock_irqrestore(>lock, flags);
-   } else {
-   struct extcon_dev *extd;
-
-   mutex_lock(_dev_list_lock);
-   list_for_each_entry(extd, _dev_list, entry) {
-   idx = find_cable_index_by_id(extd, id);
-   if (idx >= 0)
-   break;
-   }
-   mutex_unlock(_dev_list_lock);
+   idx = find_cable_index_by_id(edev, id);
+   if (idx < 0)
+   return idx;
 
-   if (idx >= 0) {
-   edev = extd;
-   return extcon_register_notifier(extd, id, nb);
-   } else {
-   ret = -ENODEV;
-   }
-   }
+   spin_lock_irqsave(>lock, flags);
+   ret = raw_notifier_chain_register(>nh[idx], nb);
+   spin_unlock_irqrestore(>lock, flags);
 
return ret;
 }
-- 
2.11.0


[PATCH AUTOSEL for-4.9 05/53] ARM: dts: Fix compatible for ti81xx uarts for 8250

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Tony Lindgren 

[ Upstream commit f62280efe8934a1275fd148ef302d1afec8cd3df ]

When using 8250_omap driver, we need to specify the right
compatible value for the UART to work on dm814x and dm816x.

Signed-off-by: Tony Lindgren 
Signed-off-by: Sasha Levin 
---
 arch/arm/boot/dts/dm814x.dtsi | 6 +++---
 arch/arm/boot/dts/dm816x.dtsi | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/arm/boot/dts/dm814x.dtsi b/arch/arm/boot/dts/dm814x.dtsi
index d87efab24fa2..2f1de85bacd8 100644
--- a/arch/arm/boot/dts/dm814x.dtsi
+++ b/arch/arm/boot/dts/dm814x.dtsi
@@ -252,7 +252,7 @@
};
 
uart1: uart@2 {
-   compatible = "ti,omap3-uart";
+   compatible = "ti,am3352-uart", "ti,omap3-uart";
ti,hwmods = "uart1";
reg = <0x2 0x2000>;
clock-frequency = <4800>;
@@ -262,7 +262,7 @@
};
 
uart2: uart@22000 {
-   compatible = "ti,omap3-uart";
+   compatible = "ti,am3352-uart", "ti,omap3-uart";
ti,hwmods = "uart2";
reg = <0x22000 0x2000>;
clock-frequency = <4800>;
@@ -272,7 +272,7 @@
};
 
uart3: uart@24000 {
-   compatible = "ti,omap3-uart";
+   compatible = "ti,am3352-uart", "ti,omap3-uart";
ti,hwmods = "uart3";
reg = <0x24000 0x2000>;
clock-frequency = <4800>;
diff --git a/arch/arm/boot/dts/dm816x.dtsi b/arch/arm/boot/dts/dm816x.dtsi
index cbdfbc4e4a26..62c0a6155360 100644
--- a/arch/arm/boot/dts/dm816x.dtsi
+++ b/arch/arm/boot/dts/dm816x.dtsi
@@ -371,7 +371,7 @@
};
 
uart1: uart@4802 {
-   compatible = "ti,omap3-uart";
+   compatible = "ti,am3352-uart", "ti,omap3-uart";
ti,hwmods = "uart1";
reg = <0x4802 0x2000>;
clock-frequency = <4800>;
@@ -381,7 +381,7 @@
};
 
uart2: uart@48022000 {
-   compatible = "ti,omap3-uart";
+   compatible = "ti,am3352-uart", "ti,omap3-uart";
ti,hwmods = "uart2";
reg = <0x48022000 0x2000>;
clock-frequency = <4800>;
@@ -391,7 +391,7 @@
};
 
uart3: uart@48024000 {
-   compatible = "ti,omap3-uart";
+   compatible = "ti,am3352-uart", "ti,omap3-uart";
ti,hwmods = "uart3";
reg = <0x48024000 0x2000>;
clock-frequency = <4800>;
-- 
2.11.0


[PATCH AUTOSEL for-4.9 05/53] ARM: dts: Fix compatible for ti81xx uarts for 8250

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Tony Lindgren 

[ Upstream commit f62280efe8934a1275fd148ef302d1afec8cd3df ]

When using 8250_omap driver, we need to specify the right
compatible value for the UART to work on dm814x and dm816x.

Signed-off-by: Tony Lindgren 
Signed-off-by: Sasha Levin 
---
 arch/arm/boot/dts/dm814x.dtsi | 6 +++---
 arch/arm/boot/dts/dm816x.dtsi | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/arm/boot/dts/dm814x.dtsi b/arch/arm/boot/dts/dm814x.dtsi
index d87efab24fa2..2f1de85bacd8 100644
--- a/arch/arm/boot/dts/dm814x.dtsi
+++ b/arch/arm/boot/dts/dm814x.dtsi
@@ -252,7 +252,7 @@
};
 
uart1: uart@2 {
-   compatible = "ti,omap3-uart";
+   compatible = "ti,am3352-uart", "ti,omap3-uart";
ti,hwmods = "uart1";
reg = <0x2 0x2000>;
clock-frequency = <4800>;
@@ -262,7 +262,7 @@
};
 
uart2: uart@22000 {
-   compatible = "ti,omap3-uart";
+   compatible = "ti,am3352-uart", "ti,omap3-uart";
ti,hwmods = "uart2";
reg = <0x22000 0x2000>;
clock-frequency = <4800>;
@@ -272,7 +272,7 @@
};
 
uart3: uart@24000 {
-   compatible = "ti,omap3-uart";
+   compatible = "ti,am3352-uart", "ti,omap3-uart";
ti,hwmods = "uart3";
reg = <0x24000 0x2000>;
clock-frequency = <4800>;
diff --git a/arch/arm/boot/dts/dm816x.dtsi b/arch/arm/boot/dts/dm816x.dtsi
index cbdfbc4e4a26..62c0a6155360 100644
--- a/arch/arm/boot/dts/dm816x.dtsi
+++ b/arch/arm/boot/dts/dm816x.dtsi
@@ -371,7 +371,7 @@
};
 
uart1: uart@4802 {
-   compatible = "ti,omap3-uart";
+   compatible = "ti,am3352-uart", "ti,omap3-uart";
ti,hwmods = "uart1";
reg = <0x4802 0x2000>;
clock-frequency = <4800>;
@@ -381,7 +381,7 @@
};
 
uart2: uart@48022000 {
-   compatible = "ti,omap3-uart";
+   compatible = "ti,am3352-uart", "ti,omap3-uart";
ti,hwmods = "uart2";
reg = <0x48022000 0x2000>;
clock-frequency = <4800>;
@@ -391,7 +391,7 @@
};
 
uart3: uart@48024000 {
-   compatible = "ti,omap3-uart";
+   compatible = "ti,am3352-uart", "ti,omap3-uart";
ti,hwmods = "uart3";
reg = <0x48024000 0x2000>;
clock-frequency = <4800>;
-- 
2.11.0


[PATCH AUTOSEL for-4.9 03/53] fm10k: request reset when mbx->state changes

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Ngai-Mint Kwan 

[ Upstream commit 2f3fc1e6200309ccf87f61dea56e57e563c4f800 ]

Multiple IES API resets can cause a race condition where the mailbox
interrupt request bits can be cleared before being handled. This can
leave certain mailbox messages from the PF to be untreated and the PF
will enter in some inactive state. If this situation occurs, the IES API
will initiate a mailbox version reset which, then, trigger a mailbox
state change. Once this mailbox transition occurs (from OPEN to CONNECT
state), a request for reset will be returned.

This ensures that PF will undergo a reset whenever IES API encounters an
unknown global mailbox interrupt event or whenever the IES API
terminates.

Signed-off-by: Ngai-Mint Kwan 
Signed-off-by: Jacob Keller 
Tested-by: Krishneil Singh 
Signed-off-by: Jeff Kirsher 
Signed-off-by: Sasha Levin 
---
 drivers/net/ethernet/intel/fm10k/fm10k_mbx.c | 10 +++---
 drivers/net/ethernet/intel/fm10k/fm10k_pci.c |  6 +-
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_mbx.c 
b/drivers/net/ethernet/intel/fm10k/fm10k_mbx.c
index c9dfa6564fcf..334088a101c3 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_mbx.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_mbx.c
@@ -2011,9 +2011,10 @@ static void fm10k_sm_mbx_create_reply(struct fm10k_hw 
*hw,
  *  function can also be used to respond to an error as the connection
  *  resetting would also be a means of dealing with errors.
  **/
-static void fm10k_sm_mbx_process_reset(struct fm10k_hw *hw,
-  struct fm10k_mbx_info *mbx)
+static s32 fm10k_sm_mbx_process_reset(struct fm10k_hw *hw,
+ struct fm10k_mbx_info *mbx)
 {
+   s32 err = 0;
const enum fm10k_mbx_state state = mbx->state;
 
switch (state) {
@@ -2026,6 +2027,7 @@ static void fm10k_sm_mbx_process_reset(struct fm10k_hw 
*hw,
case FM10K_STATE_OPEN:
/* flush any incomplete work */
fm10k_sm_mbx_connect_reset(mbx);
+   err = FM10K_ERR_RESET_REQUESTED;
break;
case FM10K_STATE_CONNECT:
/* Update remote value to match local value */
@@ -2035,6 +2037,8 @@ static void fm10k_sm_mbx_process_reset(struct fm10k_hw 
*hw,
}
 
fm10k_sm_mbx_create_reply(hw, mbx, mbx->tail);
+
+   return err;
 }
 
 /**
@@ -2115,7 +2119,7 @@ static s32 fm10k_sm_mbx_process(struct fm10k_hw *hw,
 
switch (FM10K_MSG_HDR_FIELD_GET(mbx->mbx_hdr, SM_VER)) {
case 0:
-   fm10k_sm_mbx_process_reset(hw, mbx);
+   err = fm10k_sm_mbx_process_reset(hw, mbx);
break;
case FM10K_SM_MBX_VERSION:
err = fm10k_sm_mbx_process_version_1(hw, mbx);
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c 
b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
index b1a2f8437d59..e372a5823480 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
@@ -1144,6 +1144,7 @@ static irqreturn_t fm10k_msix_mbx_pf(int __always_unused 
irq, void *data)
struct fm10k_hw *hw = >hw;
struct fm10k_mbx_info *mbx = >mbx;
u32 eicr;
+   s32 err = 0;
 
/* unmask any set bits related to this interrupt */
eicr = fm10k_read_reg(hw, FM10K_EICR);
@@ -1159,12 +1160,15 @@ static irqreturn_t fm10k_msix_mbx_pf(int 
__always_unused irq, void *data)
 
/* service mailboxes */
if (fm10k_mbx_trylock(interface)) {
-   mbx->ops.process(hw, mbx);
+   err = mbx->ops.process(hw, mbx);
/* handle VFLRE events */
fm10k_iov_event(interface);
fm10k_mbx_unlock(interface);
}
 
+   if (err == FM10K_ERR_RESET_REQUESTED)
+   interface->flags |= FM10K_FLAG_RESET_REQUESTED;
+
/* if switch toggled state we should reset GLORTs */
if (eicr & FM10K_EICR_SWITCHNOTREADY) {
/* force link down for at least 4 seconds */
-- 
2.11.0


[PATCH AUTOSEL for-4.9 03/53] fm10k: request reset when mbx->state changes

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Ngai-Mint Kwan 

[ Upstream commit 2f3fc1e6200309ccf87f61dea56e57e563c4f800 ]

Multiple IES API resets can cause a race condition where the mailbox
interrupt request bits can be cleared before being handled. This can
leave certain mailbox messages from the PF to be untreated and the PF
will enter in some inactive state. If this situation occurs, the IES API
will initiate a mailbox version reset which, then, trigger a mailbox
state change. Once this mailbox transition occurs (from OPEN to CONNECT
state), a request for reset will be returned.

This ensures that PF will undergo a reset whenever IES API encounters an
unknown global mailbox interrupt event or whenever the IES API
terminates.

Signed-off-by: Ngai-Mint Kwan 
Signed-off-by: Jacob Keller 
Tested-by: Krishneil Singh 
Signed-off-by: Jeff Kirsher 
Signed-off-by: Sasha Levin 
---
 drivers/net/ethernet/intel/fm10k/fm10k_mbx.c | 10 +++---
 drivers/net/ethernet/intel/fm10k/fm10k_pci.c |  6 +-
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_mbx.c 
b/drivers/net/ethernet/intel/fm10k/fm10k_mbx.c
index c9dfa6564fcf..334088a101c3 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_mbx.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_mbx.c
@@ -2011,9 +2011,10 @@ static void fm10k_sm_mbx_create_reply(struct fm10k_hw 
*hw,
  *  function can also be used to respond to an error as the connection
  *  resetting would also be a means of dealing with errors.
  **/
-static void fm10k_sm_mbx_process_reset(struct fm10k_hw *hw,
-  struct fm10k_mbx_info *mbx)
+static s32 fm10k_sm_mbx_process_reset(struct fm10k_hw *hw,
+ struct fm10k_mbx_info *mbx)
 {
+   s32 err = 0;
const enum fm10k_mbx_state state = mbx->state;
 
switch (state) {
@@ -2026,6 +2027,7 @@ static void fm10k_sm_mbx_process_reset(struct fm10k_hw 
*hw,
case FM10K_STATE_OPEN:
/* flush any incomplete work */
fm10k_sm_mbx_connect_reset(mbx);
+   err = FM10K_ERR_RESET_REQUESTED;
break;
case FM10K_STATE_CONNECT:
/* Update remote value to match local value */
@@ -2035,6 +2037,8 @@ static void fm10k_sm_mbx_process_reset(struct fm10k_hw 
*hw,
}
 
fm10k_sm_mbx_create_reply(hw, mbx, mbx->tail);
+
+   return err;
 }
 
 /**
@@ -2115,7 +2119,7 @@ static s32 fm10k_sm_mbx_process(struct fm10k_hw *hw,
 
switch (FM10K_MSG_HDR_FIELD_GET(mbx->mbx_hdr, SM_VER)) {
case 0:
-   fm10k_sm_mbx_process_reset(hw, mbx);
+   err = fm10k_sm_mbx_process_reset(hw, mbx);
break;
case FM10K_SM_MBX_VERSION:
err = fm10k_sm_mbx_process_version_1(hw, mbx);
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c 
b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
index b1a2f8437d59..e372a5823480 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
@@ -1144,6 +1144,7 @@ static irqreturn_t fm10k_msix_mbx_pf(int __always_unused 
irq, void *data)
struct fm10k_hw *hw = >hw;
struct fm10k_mbx_info *mbx = >mbx;
u32 eicr;
+   s32 err = 0;
 
/* unmask any set bits related to this interrupt */
eicr = fm10k_read_reg(hw, FM10K_EICR);
@@ -1159,12 +1160,15 @@ static irqreturn_t fm10k_msix_mbx_pf(int 
__always_unused irq, void *data)
 
/* service mailboxes */
if (fm10k_mbx_trylock(interface)) {
-   mbx->ops.process(hw, mbx);
+   err = mbx->ops.process(hw, mbx);
/* handle VFLRE events */
fm10k_iov_event(interface);
fm10k_mbx_unlock(interface);
}
 
+   if (err == FM10K_ERR_RESET_REQUESTED)
+   interface->flags |= FM10K_FLAG_RESET_REQUESTED;
+
/* if switch toggled state we should reset GLORTs */
if (eicr & FM10K_EICR_SWITCHNOTREADY) {
/* force link down for at least 4 seconds */
-- 
2.11.0


[PATCH AUTOSEL for-4.9 02/53] extcon: palmas: Check the parent instance to prevent the NULL

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Roger Quadros 

[ Upstream commit 9fe172b9be532acc23e35ba693700383ab775e66 ]

extcon-palmas must be child of palmas and expects parent's
drvdata to be valid. Check for non NULL parent drvdata and
fail if it is NULL. Not doing so will result in a NULL
pointer dereference later in the probe() parent drvdata
is NULL (e.g. misplaced extcon-palmas node in device tree).

Signed-off-by: Roger Quadros 
Signed-off-by: Chanwoo Choi 
Signed-off-by: Sasha Levin 
---
 drivers/extcon/extcon-palmas.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/extcon/extcon-palmas.c b/drivers/extcon/extcon-palmas.c
index 634ba70782de..a128fd2eb187 100644
--- a/drivers/extcon/extcon-palmas.c
+++ b/drivers/extcon/extcon-palmas.c
@@ -190,6 +190,11 @@ static int palmas_usb_probe(struct platform_device *pdev)
struct palmas_usb *palmas_usb;
int status;
 
+   if (!palmas) {
+   dev_err(>dev, "failed to get valid parent\n");
+   return -EINVAL;
+   }
+
palmas_usb = devm_kzalloc(>dev, sizeof(*palmas_usb), GFP_KERNEL);
if (!palmas_usb)
return -ENOMEM;
-- 
2.11.0


[PATCH AUTOSEL for-4.9 02/53] extcon: palmas: Check the parent instance to prevent the NULL

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Roger Quadros 

[ Upstream commit 9fe172b9be532acc23e35ba693700383ab775e66 ]

extcon-palmas must be child of palmas and expects parent's
drvdata to be valid. Check for non NULL parent drvdata and
fail if it is NULL. Not doing so will result in a NULL
pointer dereference later in the probe() parent drvdata
is NULL (e.g. misplaced extcon-palmas node in device tree).

Signed-off-by: Roger Quadros 
Signed-off-by: Chanwoo Choi 
Signed-off-by: Sasha Levin 
---
 drivers/extcon/extcon-palmas.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/extcon/extcon-palmas.c b/drivers/extcon/extcon-palmas.c
index 634ba70782de..a128fd2eb187 100644
--- a/drivers/extcon/extcon-palmas.c
+++ b/drivers/extcon/extcon-palmas.c
@@ -190,6 +190,11 @@ static int palmas_usb_probe(struct platform_device *pdev)
struct palmas_usb *palmas_usb;
int status;
 
+   if (!palmas) {
+   dev_err(>dev, "failed to get valid parent\n");
+   return -EINVAL;
+   }
+
palmas_usb = devm_kzalloc(>dev, sizeof(*palmas_usb), GFP_KERNEL);
if (!palmas_usb)
return -ENOMEM;
-- 
2.11.0


[PATCH AUTOSEL for-4.9 12/53] ata: SATA_MV should depend on HAS_DMA

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Geert Uytterhoeven 

[ Upstream commit 62989cebd367a1aae1e009e1a5b1ec046a4c8fdc ]

If NO_DMA=y:

ERROR: "dma_pool_alloc" [drivers/ata/sata_mv.ko] undefined!
ERROR: "dmam_pool_create" [drivers/ata/sata_mv.ko] undefined!
ERROR: "dma_pool_free" [drivers/ata/sata_mv.ko] undefined!

Add a dependency on HAS_DMA to fix this.

Signed-off-by: Geert Uytterhoeven 
Signed-off-by: Tejun Heo 
Signed-off-by: Sasha Levin 
---
 drivers/ata/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index c694ff90a5eb..5d16fc4fa46c 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -355,6 +355,7 @@ config SATA_HIGHBANK
 
 config SATA_MV
tristate "Marvell SATA support"
+   depends on HAS_DMA
depends on PCI || ARCH_DOVE || ARCH_MV78XX0 || \
   ARCH_MVEBU || ARCH_ORION5X || COMPILE_TEST
select GENERIC_PHY
-- 
2.11.0


[PATCH AUTOSEL for-4.9 12/53] ata: SATA_MV should depend on HAS_DMA

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Geert Uytterhoeven 

[ Upstream commit 62989cebd367a1aae1e009e1a5b1ec046a4c8fdc ]

If NO_DMA=y:

ERROR: "dma_pool_alloc" [drivers/ata/sata_mv.ko] undefined!
ERROR: "dmam_pool_create" [drivers/ata/sata_mv.ko] undefined!
ERROR: "dma_pool_free" [drivers/ata/sata_mv.ko] undefined!

Add a dependency on HAS_DMA to fix this.

Signed-off-by: Geert Uytterhoeven 
Signed-off-by: Tejun Heo 
Signed-off-by: Sasha Levin 
---
 drivers/ata/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index c694ff90a5eb..5d16fc4fa46c 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -355,6 +355,7 @@ config SATA_HIGHBANK
 
 config SATA_MV
tristate "Marvell SATA support"
+   depends on HAS_DMA
depends on PCI || ARCH_DOVE || ARCH_MV78XX0 || \
   ARCH_MVEBU || ARCH_ORION5X || COMPILE_TEST
select GENERIC_PHY
-- 
2.11.0


[PATCH AUTOSEL for-4.9 18/53] scsi: ufs: add capability to keep auto bkops always enabled

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: "subha...@codeaurora.org" 

[ Upstream commit 4e768e7645ec4ffa92ee163643777b261ae97142 ]

UFS device requires to perform bkops (back ground operations) periodically
but host can control (via auto-bkops parameter of device) when device can
perform bkops based on its performance requirements. In general, host
would like to enable the device's auto-bkops only when it's not doing any
regular data transfer but sometimes device may not behave properly if host
keeps the auto-bkops disabled. This change adds the capability to let the
device auto-bkops always enabled except suspend.

Reviewed-by: Sahitya Tummala 
Signed-off-by: Subhash Jadavani 
Signed-off-by: Martin K. Petersen 
Signed-off-by: Sasha Levin 
---
 drivers/scsi/ufs/ufshcd.c | 33 ++---
 drivers/scsi/ufs/ufshcd.h | 13 +
 2 files changed, 35 insertions(+), 11 deletions(-)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index edb06e466224..530034bc2d13 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -3781,18 +3781,25 @@ out:
 }
 
 /**
- * ufshcd_force_reset_auto_bkops - force enable of auto bkops
+ * ufshcd_force_reset_auto_bkops - force reset auto bkops state
  * @hba: per adapter instance
  *
  * After a device reset the device may toggle the BKOPS_EN flag
  * to default value. The s/w tracking variables should be updated
- * as well. Do this by forcing enable of auto bkops.
+ * as well. This function would change the auto-bkops state based on
+ * UFSHCD_CAP_KEEP_AUTO_BKOPS_ENABLED_EXCEPT_SUSPEND.
  */
-static void  ufshcd_force_reset_auto_bkops(struct ufs_hba *hba)
+static void ufshcd_force_reset_auto_bkops(struct ufs_hba *hba)
 {
-   hba->auto_bkops_enabled = false;
-   hba->ee_ctrl_mask |= MASK_EE_URGENT_BKOPS;
-   ufshcd_enable_auto_bkops(hba);
+   if (ufshcd_keep_autobkops_enabled_except_suspend(hba)) {
+   hba->auto_bkops_enabled = false;
+   hba->ee_ctrl_mask |= MASK_EE_URGENT_BKOPS;
+   ufshcd_enable_auto_bkops(hba);
+   } else {
+   hba->auto_bkops_enabled = true;
+   hba->ee_ctrl_mask &= ~MASK_EE_URGENT_BKOPS;
+   ufshcd_disable_auto_bkops(hba);
+   }
 }
 
 static inline int ufshcd_get_bkops_status(struct ufs_hba *hba, u32 *status)
@@ -6138,11 +6145,15 @@ static int ufshcd_resume(struct ufs_hba *hba, enum 
ufs_pm_op pm_op)
goto set_old_link_state;
}
 
-   /*
-* If BKOPs operations are urgently needed at this moment then
-* keep auto-bkops enabled or else disable it.
-*/
-   ufshcd_urgent_bkops(hba);
+   if (ufshcd_keep_autobkops_enabled_except_suspend(hba))
+   ufshcd_enable_auto_bkops(hba);
+   else
+   /*
+* If BKOPs operations are urgently needed at this moment then
+* keep auto-bkops enabled or else disable it.
+*/
+   ufshcd_urgent_bkops(hba);
+
hba->clk_gating.is_suspended = false;
 
if (ufshcd_is_clkscaling_enabled(hba))
diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h
index 04509827fe64..f2170d5058a8 100644
--- a/drivers/scsi/ufs/ufshcd.h
+++ b/drivers/scsi/ufs/ufshcd.h
@@ -548,6 +548,14 @@ struct ufs_hba {
 * CAUTION: Enabling this might reduce overall UFS throughput.
 */
 #define UFSHCD_CAP_INTR_AGGR (1 << 4)
+   /*
+* This capability allows the device auto-bkops to be always enabled
+* except during suspend (both runtime and suspend).
+* Enabling this capability means that device will always be allowed
+* to do background operation when it's active but it might degrade
+* the performance of ongoing read/write operations.
+*/
+#define UFSHCD_CAP_KEEP_AUTO_BKOPS_ENABLED_EXCEPT_SUSPEND (1 << 5)
 
struct devfreq *devfreq;
struct ufs_clk_scaling clk_scaling;
@@ -645,6 +653,11 @@ static inline void *ufshcd_get_variant(struct ufs_hba *hba)
BUG_ON(!hba);
return hba->priv;
 }
+static inline bool ufshcd_keep_autobkops_enabled_except_suspend(
+   struct ufs_hba *hba)
+{
+   return hba->caps & UFSHCD_CAP_KEEP_AUTO_BKOPS_ENABLED_EXCEPT_SUSPEND;
+}
 
 extern int ufshcd_runtime_suspend(struct ufs_hba *hba);
 extern int ufshcd_runtime_resume(struct ufs_hba *hba);
-- 
2.11.0


[PATCH AUTOSEL for-4.9 18/53] scsi: ufs: add capability to keep auto bkops always enabled

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: "subha...@codeaurora.org" 

[ Upstream commit 4e768e7645ec4ffa92ee163643777b261ae97142 ]

UFS device requires to perform bkops (back ground operations) periodically
but host can control (via auto-bkops parameter of device) when device can
perform bkops based on its performance requirements. In general, host
would like to enable the device's auto-bkops only when it's not doing any
regular data transfer but sometimes device may not behave properly if host
keeps the auto-bkops disabled. This change adds the capability to let the
device auto-bkops always enabled except suspend.

Reviewed-by: Sahitya Tummala 
Signed-off-by: Subhash Jadavani 
Signed-off-by: Martin K. Petersen 
Signed-off-by: Sasha Levin 
---
 drivers/scsi/ufs/ufshcd.c | 33 ++---
 drivers/scsi/ufs/ufshcd.h | 13 +
 2 files changed, 35 insertions(+), 11 deletions(-)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index edb06e466224..530034bc2d13 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -3781,18 +3781,25 @@ out:
 }
 
 /**
- * ufshcd_force_reset_auto_bkops - force enable of auto bkops
+ * ufshcd_force_reset_auto_bkops - force reset auto bkops state
  * @hba: per adapter instance
  *
  * After a device reset the device may toggle the BKOPS_EN flag
  * to default value. The s/w tracking variables should be updated
- * as well. Do this by forcing enable of auto bkops.
+ * as well. This function would change the auto-bkops state based on
+ * UFSHCD_CAP_KEEP_AUTO_BKOPS_ENABLED_EXCEPT_SUSPEND.
  */
-static void  ufshcd_force_reset_auto_bkops(struct ufs_hba *hba)
+static void ufshcd_force_reset_auto_bkops(struct ufs_hba *hba)
 {
-   hba->auto_bkops_enabled = false;
-   hba->ee_ctrl_mask |= MASK_EE_URGENT_BKOPS;
-   ufshcd_enable_auto_bkops(hba);
+   if (ufshcd_keep_autobkops_enabled_except_suspend(hba)) {
+   hba->auto_bkops_enabled = false;
+   hba->ee_ctrl_mask |= MASK_EE_URGENT_BKOPS;
+   ufshcd_enable_auto_bkops(hba);
+   } else {
+   hba->auto_bkops_enabled = true;
+   hba->ee_ctrl_mask &= ~MASK_EE_URGENT_BKOPS;
+   ufshcd_disable_auto_bkops(hba);
+   }
 }
 
 static inline int ufshcd_get_bkops_status(struct ufs_hba *hba, u32 *status)
@@ -6138,11 +6145,15 @@ static int ufshcd_resume(struct ufs_hba *hba, enum 
ufs_pm_op pm_op)
goto set_old_link_state;
}
 
-   /*
-* If BKOPs operations are urgently needed at this moment then
-* keep auto-bkops enabled or else disable it.
-*/
-   ufshcd_urgent_bkops(hba);
+   if (ufshcd_keep_autobkops_enabled_except_suspend(hba))
+   ufshcd_enable_auto_bkops(hba);
+   else
+   /*
+* If BKOPs operations are urgently needed at this moment then
+* keep auto-bkops enabled or else disable it.
+*/
+   ufshcd_urgent_bkops(hba);
+
hba->clk_gating.is_suspended = false;
 
if (ufshcd_is_clkscaling_enabled(hba))
diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h
index 04509827fe64..f2170d5058a8 100644
--- a/drivers/scsi/ufs/ufshcd.h
+++ b/drivers/scsi/ufs/ufshcd.h
@@ -548,6 +548,14 @@ struct ufs_hba {
 * CAUTION: Enabling this might reduce overall UFS throughput.
 */
 #define UFSHCD_CAP_INTR_AGGR (1 << 4)
+   /*
+* This capability allows the device auto-bkops to be always enabled
+* except during suspend (both runtime and suspend).
+* Enabling this capability means that device will always be allowed
+* to do background operation when it's active but it might degrade
+* the performance of ongoing read/write operations.
+*/
+#define UFSHCD_CAP_KEEP_AUTO_BKOPS_ENABLED_EXCEPT_SUSPEND (1 << 5)
 
struct devfreq *devfreq;
struct ufs_clk_scaling clk_scaling;
@@ -645,6 +653,11 @@ static inline void *ufshcd_get_variant(struct ufs_hba *hba)
BUG_ON(!hba);
return hba->priv;
 }
+static inline bool ufshcd_keep_autobkops_enabled_except_suspend(
+   struct ufs_hba *hba)
+{
+   return hba->caps & UFSHCD_CAP_KEEP_AUTO_BKOPS_ENABLED_EXCEPT_SUSPEND;
+}
 
 extern int ufshcd_runtime_suspend(struct ufs_hba *hba);
 extern int ufshcd_runtime_resume(struct ufs_hba *hba);
-- 
2.11.0


[PATCH AUTOSEL for-4.9 04/53] spi: imx: adjust watermark level according to transfer length

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Jiada Wang 

[ Upstream commit 66459c5a50a787c474b734b586328f7111ab6df0 ]

Previously DMA watermark level is configured to fifosize/2,
DMA mode can be used only when transfer length can be divided
by 'watermark level * bpw', which makes DMA mode not pratical.

This patch adjusts watermark level to largest number (no bigger
than fifosize/2) which can divide 'tranfer length / bpw' for
each transfer.

Signed-off-by: Jiada Wang 
Signed-off-by: Mark Brown 
Signed-off-by: Sasha Levin 
---
 drivers/spi/spi-imx.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
index deb782f6556c..84a2b152be55 100644
--- a/drivers/spi/spi-imx.c
+++ b/drivers/spi/spi-imx.c
@@ -210,7 +210,7 @@ static bool spi_imx_can_dma(struct spi_master *master, 
struct spi_device *spi,
 struct spi_transfer *transfer)
 {
struct spi_imx_data *spi_imx = spi_master_get_devdata(master);
-   unsigned int bpw;
+   unsigned int bpw, i;
 
if (!master->dma_rx)
return false;
@@ -227,12 +227,16 @@ static bool spi_imx_can_dma(struct spi_master *master, 
struct spi_device *spi,
if (bpw != 1 && bpw != 2 && bpw != 4)
return false;
 
-   if (transfer->len < spi_imx->wml * bpw)
-   return false;
+   for (i = spi_imx_get_fifosize(spi_imx) / 2; i > 0; i--) {
+   if (!(transfer->len % (i * bpw)))
+   break;
+   }
 
-   if (transfer->len % (spi_imx->wml * bpw))
+   if (i == 0)
return false;
 
+   spi_imx->wml = i;
+
return true;
 }
 
@@ -818,10 +822,6 @@ static int spi_imx_dma_configure(struct spi_master *master,
struct dma_slave_config rx = {}, tx = {};
struct spi_imx_data *spi_imx = spi_master_get_devdata(master);
 
-   if (bytes_per_word == spi_imx->bytes_per_word)
-   /* Same as last time */
-   return 0;
-
switch (bytes_per_word) {
case 4:
buswidth = DMA_SLAVE_BUSWIDTH_4_BYTES;
-- 
2.11.0


[PATCH AUTOSEL for-4.9 04/53] spi: imx: adjust watermark level according to transfer length

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Jiada Wang 

[ Upstream commit 66459c5a50a787c474b734b586328f7111ab6df0 ]

Previously DMA watermark level is configured to fifosize/2,
DMA mode can be used only when transfer length can be divided
by 'watermark level * bpw', which makes DMA mode not pratical.

This patch adjusts watermark level to largest number (no bigger
than fifosize/2) which can divide 'tranfer length / bpw' for
each transfer.

Signed-off-by: Jiada Wang 
Signed-off-by: Mark Brown 
Signed-off-by: Sasha Levin 
---
 drivers/spi/spi-imx.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
index deb782f6556c..84a2b152be55 100644
--- a/drivers/spi/spi-imx.c
+++ b/drivers/spi/spi-imx.c
@@ -210,7 +210,7 @@ static bool spi_imx_can_dma(struct spi_master *master, 
struct spi_device *spi,
 struct spi_transfer *transfer)
 {
struct spi_imx_data *spi_imx = spi_master_get_devdata(master);
-   unsigned int bpw;
+   unsigned int bpw, i;
 
if (!master->dma_rx)
return false;
@@ -227,12 +227,16 @@ static bool spi_imx_can_dma(struct spi_master *master, 
struct spi_device *spi,
if (bpw != 1 && bpw != 2 && bpw != 4)
return false;
 
-   if (transfer->len < spi_imx->wml * bpw)
-   return false;
+   for (i = spi_imx_get_fifosize(spi_imx) / 2; i > 0; i--) {
+   if (!(transfer->len % (i * bpw)))
+   break;
+   }
 
-   if (transfer->len % (spi_imx->wml * bpw))
+   if (i == 0)
return false;
 
+   spi_imx->wml = i;
+
return true;
 }
 
@@ -818,10 +822,6 @@ static int spi_imx_dma_configure(struct spi_master *master,
struct dma_slave_config rx = {}, tx = {};
struct spi_imx_data *spi_imx = spi_master_get_devdata(master);
 
-   if (bytes_per_word == spi_imx->bytes_per_word)
-   /* Same as last time */
-   return 0;
-
switch (bytes_per_word) {
case 4:
buswidth = DMA_SLAVE_BUSWIDTH_4_BYTES;
-- 
2.11.0


[PATCH AUTOSEL for-4.9 39/53] ixgbe: fix AER error handling

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Emil Tantilov 

[ Upstream commit 126db13fa0e6d05c9f94e0125f61e773bd5ab079 ]

Make sure that we free the IRQs in ixgbe_io_error_detected() when
responding to an PCIe AER error and also restore them when the
interface recovers from it.

Previously it was possible to trigger BUG_ON() check in free_msix_irqs()
in the case where we call ixgbe_remove() after a failed recovery from
AER error because the interrupts were not freed.

Signed-off-by: Emil Tantilov 
Tested-by: Andrew Bowers 
Signed-off-by: Jeff Kirsher 
Signed-off-by: Sasha Levin 
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c 
b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index fee1f2918ead..78173ca89ada 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -10027,7 +10027,7 @@ skip_bad_vf_detection:
}
 
if (netif_running(netdev))
-   ixgbe_down(adapter);
+   ixgbe_close_suspend(adapter);
 
if (!test_and_set_bit(__IXGBE_DISABLED, >state))
pci_disable_device(pdev);
@@ -10097,10 +10097,12 @@ static void ixgbe_io_resume(struct pci_dev *pdev)
}
 
 #endif
+   rtnl_lock();
if (netif_running(netdev))
-   ixgbe_up(adapter);
+   ixgbe_open(netdev);
 
netif_device_attach(netdev);
+   rtnl_unlock();
 }
 
 static const struct pci_error_handlers ixgbe_err_handler = {
-- 
2.11.0


[PATCH AUTOSEL for-4.9 39/53] ixgbe: fix AER error handling

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Emil Tantilov 

[ Upstream commit 126db13fa0e6d05c9f94e0125f61e773bd5ab079 ]

Make sure that we free the IRQs in ixgbe_io_error_detected() when
responding to an PCIe AER error and also restore them when the
interface recovers from it.

Previously it was possible to trigger BUG_ON() check in free_msix_irqs()
in the case where we call ixgbe_remove() after a failed recovery from
AER error because the interrupts were not freed.

Signed-off-by: Emil Tantilov 
Tested-by: Andrew Bowers 
Signed-off-by: Jeff Kirsher 
Signed-off-by: Sasha Levin 
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c 
b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index fee1f2918ead..78173ca89ada 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -10027,7 +10027,7 @@ skip_bad_vf_detection:
}
 
if (netif_running(netdev))
-   ixgbe_down(adapter);
+   ixgbe_close_suspend(adapter);
 
if (!test_and_set_bit(__IXGBE_DISABLED, >state))
pci_disable_device(pdev);
@@ -10097,10 +10097,12 @@ static void ixgbe_io_resume(struct pci_dev *pdev)
}
 
 #endif
+   rtnl_lock();
if (netif_running(netdev))
-   ixgbe_up(adapter);
+   ixgbe_open(netdev);
 
netif_device_attach(netdev);
+   rtnl_unlock();
 }
 
 static const struct pci_error_handlers ixgbe_err_handler = {
-- 
2.11.0


[PATCH AUTOSEL for-4.9 06/53] ARM: dts: Fix am335x and dm814x scm syscon to probe children

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Tony Lindgren 

[ Upstream commit 1aa09df0854efe16b7a80358a18f0a0bebafd246 ]

Without these changes children of the scn syscon
won't probe.

Signed-off-by: Tony Lindgren 
Signed-off-by: Sasha Levin 
---
 arch/arm/boot/dts/am33xx.dtsi | 3 ++-
 arch/arm/boot/dts/dm814x.dtsi | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
index 795c1467fa50..a3277e6436d5 100644
--- a/arch/arm/boot/dts/am33xx.dtsi
+++ b/arch/arm/boot/dts/am33xx.dtsi
@@ -143,10 +143,11 @@
};
 
scm_conf: scm_conf@0 {
-   compatible = "syscon";
+   compatible = "syscon", "simple-bus";
reg = <0x0 0x800>;
#address-cells = <1>;
#size-cells = <1>;
+   ranges = <0 0 0x800>;
 
scm_clocks: clocks {
#address-cells = <1>;
diff --git a/arch/arm/boot/dts/dm814x.dtsi b/arch/arm/boot/dts/dm814x.dtsi
index 2f1de85bacd8..ff57a20af9cd 100644
--- a/arch/arm/boot/dts/dm814x.dtsi
+++ b/arch/arm/boot/dts/dm814x.dtsi
@@ -332,10 +332,11 @@
ranges = <0 0x14 0x2>;
 
scm_conf: scm_conf@0 {
-   compatible = "syscon";
+   compatible = "syscon", "simple-bus";
reg = <0x0 0x800>;
#address-cells = <1>;
#size-cells = <1>;
+   ranges = <0 0 0x800>;
 
scm_clocks: clocks {
#address-cells = <1>;
-- 
2.11.0


[PATCH AUTOSEL for-4.9 06/53] ARM: dts: Fix am335x and dm814x scm syscon to probe children

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Tony Lindgren 

[ Upstream commit 1aa09df0854efe16b7a80358a18f0a0bebafd246 ]

Without these changes children of the scn syscon
won't probe.

Signed-off-by: Tony Lindgren 
Signed-off-by: Sasha Levin 
---
 arch/arm/boot/dts/am33xx.dtsi | 3 ++-
 arch/arm/boot/dts/dm814x.dtsi | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
index 795c1467fa50..a3277e6436d5 100644
--- a/arch/arm/boot/dts/am33xx.dtsi
+++ b/arch/arm/boot/dts/am33xx.dtsi
@@ -143,10 +143,11 @@
};
 
scm_conf: scm_conf@0 {
-   compatible = "syscon";
+   compatible = "syscon", "simple-bus";
reg = <0x0 0x800>;
#address-cells = <1>;
#size-cells = <1>;
+   ranges = <0 0 0x800>;
 
scm_clocks: clocks {
#address-cells = <1>;
diff --git a/arch/arm/boot/dts/dm814x.dtsi b/arch/arm/boot/dts/dm814x.dtsi
index 2f1de85bacd8..ff57a20af9cd 100644
--- a/arch/arm/boot/dts/dm814x.dtsi
+++ b/arch/arm/boot/dts/dm814x.dtsi
@@ -332,10 +332,11 @@
ranges = <0 0x14 0x2>;
 
scm_conf: scm_conf@0 {
-   compatible = "syscon";
+   compatible = "syscon", "simple-bus";
reg = <0x0 0x800>;
#address-cells = <1>;
#size-cells = <1>;
+   ranges = <0 0 0x800>;
 
scm_clocks: clocks {
#address-cells = <1>;
-- 
2.11.0


[PATCH AUTOSEL for-4.9 11/53] ata: SATA_HIGHBANK should depend on HAS_DMA

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Geert Uytterhoeven 

[ Upstream commit 2a736e0585e585c2566b5119af8381910a170e44 ]

If NO_DMA=y:

ERROR: "bad_dma_ops" [drivers/ata/sata_highbank.ko] undefined!

Add a dependency on HAS_DMA to fix this.

Signed-off-by: Geert Uytterhoeven 
Signed-off-by: Tejun Heo 
Signed-off-by: Sasha Levin 
---
 drivers/ata/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index 4504ec542097..c694ff90a5eb 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -345,6 +345,7 @@ config SATA_DWC_VDEBUG
 
 config SATA_HIGHBANK
tristate "Calxeda Highbank SATA support"
+   depends on HAS_DMA
depends on ARCH_HIGHBANK || COMPILE_TEST
help
  This option enables support for the Calxeda Highbank SoC's
-- 
2.11.0


[PATCH AUTOSEL for-4.9 11/53] ata: SATA_HIGHBANK should depend on HAS_DMA

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Geert Uytterhoeven 

[ Upstream commit 2a736e0585e585c2566b5119af8381910a170e44 ]

If NO_DMA=y:

ERROR: "bad_dma_ops" [drivers/ata/sata_highbank.ko] undefined!

Add a dependency on HAS_DMA to fix this.

Signed-off-by: Geert Uytterhoeven 
Signed-off-by: Tejun Heo 
Signed-off-by: Sasha Levin 
---
 drivers/ata/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index 4504ec542097..c694ff90a5eb 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -345,6 +345,7 @@ config SATA_DWC_VDEBUG
 
 config SATA_HIGHBANK
tristate "Calxeda Highbank SATA support"
+   depends on HAS_DMA
depends on ARCH_HIGHBANK || COMPILE_TEST
help
  This option enables support for the Calxeda Highbank SoC's
-- 
2.11.0


[PATCH AUTOSEL for-4.9 41/53] ixgbe: Fix reporting of 100Mb capability

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Tony Nguyen 

[ Upstream commit f215266470dfe86196a31fe0725a86cea77f9a18 ]

BaseT adapters that are capable of supporting 100Mb are not reporting this
capability.  This patch corrects the reporting so that 100Mb is shown as
supported on those adapters.

Signed-off-by: Tony Nguyen 
Tested-by: Andrew Bowers 
Signed-off-by: Jeff Kirsher 
Signed-off-by: Sasha Levin 
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c 
b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
index f49f80380aa5..a137e060c185 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
@@ -199,7 +199,7 @@ static int ixgbe_get_settings(struct net_device *netdev,
if (supported_link & IXGBE_LINK_SPEED_100_FULL)
ecmd->supported |= ixgbe_isbackplane(hw->phy.media_type) ?
   SUPPORTED_1000baseKX_Full :
-  SUPPORTED_1000baseT_Full;
+  SUPPORTED_100baseT_Full;
 
/* default advertised speed if phy.autoneg_advertised isn't set */
ecmd->advertising = ecmd->supported;
-- 
2.11.0


[PATCH AUTOSEL for-4.9 41/53] ixgbe: Fix reporting of 100Mb capability

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Tony Nguyen 

[ Upstream commit f215266470dfe86196a31fe0725a86cea77f9a18 ]

BaseT adapters that are capable of supporting 100Mb are not reporting this
capability.  This patch corrects the reporting so that 100Mb is shown as
supported on those adapters.

Signed-off-by: Tony Nguyen 
Tested-by: Andrew Bowers 
Signed-off-by: Jeff Kirsher 
Signed-off-by: Sasha Levin 
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c 
b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
index f49f80380aa5..a137e060c185 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
@@ -199,7 +199,7 @@ static int ixgbe_get_settings(struct net_device *netdev,
if (supported_link & IXGBE_LINK_SPEED_100_FULL)
ecmd->supported |= ixgbe_isbackplane(hw->phy.media_type) ?
   SUPPORTED_1000baseKX_Full :
-  SUPPORTED_1000baseT_Full;
+  SUPPORTED_100baseT_Full;
 
/* default advertised speed if phy.autoneg_advertised isn't set */
ecmd->advertising = ecmd->supported;
-- 
2.11.0


[PATCH AUTOSEL for-4.9 40/53] ixgbe: handle close/suspend race with netif_device_detach/present

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Emil Tantilov 

[ Upstream commit f7f37e7ff2b9b7eff7fbd035569cab35896869a3 ]

When an interface is part of a namespace it is possible that
ixgbe_close() may be called while __ixgbe_shutdown() is running
which ends up in a double free WARN and/or a BUG in free_msi_irqs().

To handle this situation we extend the rtnl_lock() to protect the
call to netif_device_detach() and ixgbe_clear_interrupt_scheme()
in __ixgbe_shutdown() and check for netif_device_present()
to avoid clearing the interrupts second time in ixgbe_close();

Also extend the rtnl lock in ixgbe_resume() to netif_device_attach().

Signed-off-by: Emil Tantilov 
Tested-by: Andrew Bowers 
Signed-off-by: Jeff Kirsher 
Signed-off-by: Sasha Levin 
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 17 -
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c 
b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 78173ca89ada..334eb96ecda3 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -6194,7 +6194,8 @@ int ixgbe_close(struct net_device *netdev)
 
ixgbe_ptp_stop(adapter);
 
-   ixgbe_close_suspend(adapter);
+   if (netif_device_present(netdev))
+   ixgbe_close_suspend(adapter);
 
ixgbe_fdir_filter_exit(adapter);
 
@@ -6239,14 +6240,12 @@ static int ixgbe_resume(struct pci_dev *pdev)
if (!err && netif_running(netdev))
err = ixgbe_open(netdev);
 
-   rtnl_unlock();
 
-   if (err)
-   return err;
-
-   netif_device_attach(netdev);
+   if (!err)
+   netif_device_attach(netdev);
+   rtnl_unlock();
 
-   return 0;
+   return err;
 }
 #endif /* CONFIG_PM */
 
@@ -6261,14 +6260,14 @@ static int __ixgbe_shutdown(struct pci_dev *pdev, bool 
*enable_wake)
int retval = 0;
 #endif
 
+   rtnl_lock();
netif_device_detach(netdev);
 
-   rtnl_lock();
if (netif_running(netdev))
ixgbe_close_suspend(adapter);
-   rtnl_unlock();
 
ixgbe_clear_interrupt_scheme(adapter);
+   rtnl_unlock();
 
 #ifdef CONFIG_PM
retval = pci_save_state(pdev);
-- 
2.11.0


[PATCH AUTOSEL for-4.9 40/53] ixgbe: handle close/suspend race with netif_device_detach/present

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Emil Tantilov 

[ Upstream commit f7f37e7ff2b9b7eff7fbd035569cab35896869a3 ]

When an interface is part of a namespace it is possible that
ixgbe_close() may be called while __ixgbe_shutdown() is running
which ends up in a double free WARN and/or a BUG in free_msi_irqs().

To handle this situation we extend the rtnl_lock() to protect the
call to netif_device_detach() and ixgbe_clear_interrupt_scheme()
in __ixgbe_shutdown() and check for netif_device_present()
to avoid clearing the interrupts second time in ixgbe_close();

Also extend the rtnl lock in ixgbe_resume() to netif_device_attach().

Signed-off-by: Emil Tantilov 
Tested-by: Andrew Bowers 
Signed-off-by: Jeff Kirsher 
Signed-off-by: Sasha Levin 
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 17 -
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c 
b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 78173ca89ada..334eb96ecda3 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -6194,7 +6194,8 @@ int ixgbe_close(struct net_device *netdev)
 
ixgbe_ptp_stop(adapter);
 
-   ixgbe_close_suspend(adapter);
+   if (netif_device_present(netdev))
+   ixgbe_close_suspend(adapter);
 
ixgbe_fdir_filter_exit(adapter);
 
@@ -6239,14 +6240,12 @@ static int ixgbe_resume(struct pci_dev *pdev)
if (!err && netif_running(netdev))
err = ixgbe_open(netdev);
 
-   rtnl_unlock();
 
-   if (err)
-   return err;
-
-   netif_device_attach(netdev);
+   if (!err)
+   netif_device_attach(netdev);
+   rtnl_unlock();
 
-   return 0;
+   return err;
 }
 #endif /* CONFIG_PM */
 
@@ -6261,14 +6260,14 @@ static int __ixgbe_shutdown(struct pci_dev *pdev, bool 
*enable_wake)
int retval = 0;
 #endif
 
+   rtnl_lock();
netif_device_detach(netdev);
 
-   rtnl_lock();
if (netif_running(netdev))
ixgbe_close_suspend(adapter);
-   rtnl_unlock();
 
ixgbe_clear_interrupt_scheme(adapter);
+   rtnl_unlock();
 
 #ifdef CONFIG_PM
retval = pci_save_state(pdev);
-- 
2.11.0


[PATCH AUTOSEL for-4.9 08/53] ARM: dts: Fix omap3 off mode pull defines

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Tony Lindgren 

[ Upstream commit d97556c8012015901a3ce77f46960078139cd79d ]

We need to also have OFFPULLUDENABLE bit set to use the off mode pull values.
Otherwise the line is pulled down internally if no external pull exists.

This is has some documentation at:

http://processors.wiki.ti.com/index.php/Optimizing_OMAP35x_and_AM/DM37x_OFF_mode_PAD_configuration

Note that the value is still glitchy during off mode transitions as documented
in spz319f.pdf "Advisory 1.45". It's best to use external pulls instead of
relying on the internal ones for off mode and even then anything pulled up
will get driven down momentarily on off mode restore for GPIO banks other
than bank1.

Signed-off-by: Tony Lindgren 
Signed-off-by: Sasha Levin 
---
 include/dt-bindings/pinctrl/omap.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/dt-bindings/pinctrl/omap.h 
b/include/dt-bindings/pinctrl/omap.h
index effadd05695b..fbd6f7202476 100644
--- a/include/dt-bindings/pinctrl/omap.h
+++ b/include/dt-bindings/pinctrl/omap.h
@@ -45,8 +45,8 @@
 #define PIN_OFF_NONE   0
 #define PIN_OFF_OUTPUT_HIGH(OFF_EN | OFFOUT_EN | OFFOUT_VAL)
 #define PIN_OFF_OUTPUT_LOW (OFF_EN | OFFOUT_EN)
-#define PIN_OFF_INPUT_PULLUP   (OFF_EN | OFF_PULL_EN | OFF_PULL_UP)
-#define PIN_OFF_INPUT_PULLDOWN (OFF_EN | OFF_PULL_EN)
+#define PIN_OFF_INPUT_PULLUP   (OFF_EN | OFFOUT_EN | OFF_PULL_EN | OFF_PULL_UP)
+#define PIN_OFF_INPUT_PULLDOWN (OFF_EN | OFFOUT_EN | OFF_PULL_EN)
 #define PIN_OFF_WAKEUPENABLE   WAKEUP_EN
 
 /*
-- 
2.11.0


[PATCH AUTOSEL for-4.9 08/53] ARM: dts: Fix omap3 off mode pull defines

2017-11-08 Thread Levin, Alexander (Sasha Levin)
From: Tony Lindgren 

[ Upstream commit d97556c8012015901a3ce77f46960078139cd79d ]

We need to also have OFFPULLUDENABLE bit set to use the off mode pull values.
Otherwise the line is pulled down internally if no external pull exists.

This is has some documentation at:

http://processors.wiki.ti.com/index.php/Optimizing_OMAP35x_and_AM/DM37x_OFF_mode_PAD_configuration

Note that the value is still glitchy during off mode transitions as documented
in spz319f.pdf "Advisory 1.45". It's best to use external pulls instead of
relying on the internal ones for off mode and even then anything pulled up
will get driven down momentarily on off mode restore for GPIO banks other
than bank1.

Signed-off-by: Tony Lindgren 
Signed-off-by: Sasha Levin 
---
 include/dt-bindings/pinctrl/omap.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/dt-bindings/pinctrl/omap.h 
b/include/dt-bindings/pinctrl/omap.h
index effadd05695b..fbd6f7202476 100644
--- a/include/dt-bindings/pinctrl/omap.h
+++ b/include/dt-bindings/pinctrl/omap.h
@@ -45,8 +45,8 @@
 #define PIN_OFF_NONE   0
 #define PIN_OFF_OUTPUT_HIGH(OFF_EN | OFFOUT_EN | OFFOUT_VAL)
 #define PIN_OFF_OUTPUT_LOW (OFF_EN | OFFOUT_EN)
-#define PIN_OFF_INPUT_PULLUP   (OFF_EN | OFF_PULL_EN | OFF_PULL_UP)
-#define PIN_OFF_INPUT_PULLDOWN (OFF_EN | OFF_PULL_EN)
+#define PIN_OFF_INPUT_PULLUP   (OFF_EN | OFFOUT_EN | OFF_PULL_EN | OFF_PULL_UP)
+#define PIN_OFF_INPUT_PULLDOWN (OFF_EN | OFFOUT_EN | OFF_PULL_EN)
 #define PIN_OFF_WAKEUPENABLE   WAKEUP_EN
 
 /*
-- 
2.11.0


  1   2   3   4   5   6   7   8   9   10   >