--- /dev/null
+From d885bac42d18a6f5f5aed24ce393d663dfae3a75 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 13 Oct 2019 23:00:16 +0100
+Subject: 8250-men-mcb: fix error checking when get_num_ports returns -ENODEV
+
+From: Colin Ian King <colin.king@canonical.com>
+
+[ Upstream commit f50b6805dbb993152025ec04dea094c40cc93a0c ]
+
+The current checking for failure on the number of ports fails when
+-ENODEV is returned from the call to get_num_ports. Fix this by making
+num_ports and loop counter i signed rather than unsigned ints. Also
+add check for num_ports being less than zero to check for -ve error
+returns.
+
+Addresses-Coverity: ("Unsigned compared against 0")
+Fixes: e2fea54e4592 ("8250-men-mcb: add support for 16z025 and 16z057")
+Signed-off-by: Colin Ian King <colin.king@canonical.com>
+Reviewed-by: Michael Moese <mmoese@suse.de>
+Link: https://lore.kernel.org/r/20191013220016.9369-1-colin.king@canonical.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/tty/serial/8250/8250_men_mcb.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/tty/serial/8250/8250_men_mcb.c b/drivers/tty/serial/8250/8250_men_mcb.c
+index 02c5aff58a740..8df89e9cd2542 100644
+--- a/drivers/tty/serial/8250/8250_men_mcb.c
++++ b/drivers/tty/serial/8250/8250_men_mcb.c
+@@ -72,8 +72,8 @@ static int serial_8250_men_mcb_probe(struct mcb_device *mdev,
+ {
+ struct serial_8250_men_mcb_data *data;
+ struct resource *mem;
+- unsigned int num_ports;
+- unsigned int i;
++ int num_ports;
++ int i;
+ void __iomem *membase;
+
+ mem = mcb_get_resource(mdev, IORESOURCE_MEM);
+@@ -88,7 +88,7 @@ static int serial_8250_men_mcb_probe(struct mcb_device *mdev,
+ dev_dbg(&mdev->dev, "found a 16z%03u with %u ports\n",
+ mdev->id, num_ports);
+
+- if (num_ports == 0 || num_ports > 4) {
++ if (num_ports <= 0 || num_ports > 4) {
+ dev_err(&mdev->dev, "unexpected number of ports: %u\n",
+ num_ports);
+ return -ENODEV;
+@@ -133,7 +133,7 @@ static int serial_8250_men_mcb_probe(struct mcb_device *mdev,
+
+ static void serial_8250_men_mcb_remove(struct mcb_device *mdev)
+ {
+- unsigned int num_ports, i;
++ int num_ports, i;
+ struct serial_8250_men_mcb_data *data = mcb_get_drvdata(mdev);
+
+ if (!data)
+--
+2.20.1
+
--- /dev/null
+From 3aef8889647d7d30731d724eb9ae66a9843ecc04 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 22 Oct 2019 14:44:02 -0500
+Subject: ALSA: hda: Add Tigerlake/Jasperlake PCI ID
+
+From: Pan Xiuli <xiuli.pan@linux.intel.com>
+
+[ Upstream commit 4750c212174892d26645cdf5ad73fb0e9d594ed3 ]
+
+Add HD Audio Device PCI ID for the Intel Tigerlake and Jasperlake
+platform.
+
+Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191022194402.23178-1-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/pci/hda/hda_intel.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
+index b0de3e3b33e5c..e1791d01ccc01 100644
+--- a/sound/pci/hda/hda_intel.c
++++ b/sound/pci/hda/hda_intel.c
+@@ -2431,6 +2431,12 @@ static const struct pci_device_id azx_ids[] = {
+ /* Icelake */
+ { PCI_DEVICE(0x8086, 0x34c8),
+ .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE},
++ /* Jasperlake */
++ { PCI_DEVICE(0x8086, 0x38c8),
++ .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE},
++ /* Tigerlake */
++ { PCI_DEVICE(0x8086, 0xa0c8),
++ .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE},
+ /* Elkhart Lake */
+ { PCI_DEVICE(0x8086, 0x4b55),
+ .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE},
+--
+2.20.1
+
--- /dev/null
+From 0745cdadd9f11da0370f2b5516be4074d9918ec0 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 2 Oct 2019 11:28:02 +0100
+Subject: ARM: 8908/1: add __always_inline to functions called from
+ __get_user_check()
+
+From: Masahiro Yamada <yamada.masahiro@socionext.com>
+
+[ Upstream commit 851140ab0d083c78e5723a8b1cbd258f567a7aff ]
+
+KernelCI reports that bcm2835_defconfig is no longer booting since
+commit ac7c3e4ff401 ("compiler: enable CONFIG_OPTIMIZE_INLINING
+forcibly") (https://lkml.org/lkml/2019/9/26/825).
+
+I also received a regression report from Nicolas Saenz Julienne
+(https://lkml.org/lkml/2019/9/27/263).
+
+This problem has cropped up on bcm2835_defconfig because it enables
+CONFIG_CC_OPTIMIZE_FOR_SIZE. The compiler tends to prefer not inlining
+functions with -Os. I was able to reproduce it with other boards and
+defconfig files by manually enabling CONFIG_CC_OPTIMIZE_FOR_SIZE.
+
+The __get_user_check() specifically uses r0, r1, r2 registers.
+So, uaccess_save_and_enable() and uaccess_restore() must be inlined.
+Otherwise, those register assignments would be entirely dropped,
+according to my analysis of the disassembly.
+
+Prior to commit 9012d011660e ("compiler: allow all arches to enable
+CONFIG_OPTIMIZE_INLINING"), the 'inline' marker was always enough for
+inlining functions, except on x86.
+
+Since that commit, all architectures can enable CONFIG_OPTIMIZE_INLINING.
+So, __always_inline is now the only guaranteed way of forcible inlining.
+
+I added __always_inline to 4 functions in the call-graph from the
+__get_user_check() macro.
+
+Fixes: 9012d011660e ("compiler: allow all arches to enable CONFIG_OPTIMIZE_INLINING")
+Reported-by: "kernelci.org bot" <bot@kernelci.org>
+Reported-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
+Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
+Tested-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
+Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm/include/asm/domain.h | 8 ++++----
+ arch/arm/include/asm/uaccess.h | 4 ++--
+ 2 files changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/arch/arm/include/asm/domain.h b/arch/arm/include/asm/domain.h
+index 567dbede4785c..f1d0a7807cd0e 100644
+--- a/arch/arm/include/asm/domain.h
++++ b/arch/arm/include/asm/domain.h
+@@ -82,7 +82,7 @@
+ #ifndef __ASSEMBLY__
+
+ #ifdef CONFIG_CPU_CP15_MMU
+-static inline unsigned int get_domain(void)
++static __always_inline unsigned int get_domain(void)
+ {
+ unsigned int domain;
+
+@@ -94,7 +94,7 @@ static inline unsigned int get_domain(void)
+ return domain;
+ }
+
+-static inline void set_domain(unsigned val)
++static __always_inline void set_domain(unsigned int val)
+ {
+ asm volatile(
+ "mcr p15, 0, %0, c3, c0 @ set domain"
+@@ -102,12 +102,12 @@ static inline void set_domain(unsigned val)
+ isb();
+ }
+ #else
+-static inline unsigned int get_domain(void)
++static __always_inline unsigned int get_domain(void)
+ {
+ return 0;
+ }
+
+-static inline void set_domain(unsigned val)
++static __always_inline void set_domain(unsigned int val)
+ {
+ }
+ #endif
+diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h
+index 303248e5b990f..98c6b91be4a8a 100644
+--- a/arch/arm/include/asm/uaccess.h
++++ b/arch/arm/include/asm/uaccess.h
+@@ -22,7 +22,7 @@
+ * perform such accesses (eg, via list poison values) which could then
+ * be exploited for priviledge escalation.
+ */
+-static inline unsigned int uaccess_save_and_enable(void)
++static __always_inline unsigned int uaccess_save_and_enable(void)
+ {
+ #ifdef CONFIG_CPU_SW_DOMAIN_PAN
+ unsigned int old_domain = get_domain();
+@@ -37,7 +37,7 @@ static inline unsigned int uaccess_save_and_enable(void)
+ #endif
+ }
+
+-static inline void uaccess_restore(unsigned int flags)
++static __always_inline void uaccess_restore(unsigned int flags)
+ {
+ #ifdef CONFIG_CPU_SW_DOMAIN_PAN
+ /* Restore the user access mask */
+--
+2.20.1
+
--- /dev/null
+From 41839764e12c6cee4756bacbf9ce3a8775ebb3d4 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 10 Oct 2019 10:12:20 +0100
+Subject: ARM: 8914/1: NOMMU: Fix exc_ret for XIP
+
+From: Vladimir Murzin <vladimir.murzin@arm.com>
+
+[ Upstream commit 4c0742f65b4ee466546fd24b71b56516cacd4613 ]
+
+It was reported that 72cd4064fcca "NOMMU: Toggle only bits in
+EXC_RETURN we are really care of" breaks NOMMU+XIP combination.
+It happens because saved EXC_RETURN gets overwritten when data
+section is relocated.
+
+The fix is to propagate EXC_RETURN via register and let relocation
+code to commit that value into memory.
+
+Fixes: 72cd4064fcca ("ARM: 8830/1: NOMMU: Toggle only bits in EXC_RETURN we are really care of")
+Reported-by: afzal mohammed <afzal.mohd.ma@gmail.com>
+Tested-by: afzal mohammed <afzal.mohd.ma@gmail.com>
+Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
+Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm/kernel/head-common.S | 5 +++--
+ arch/arm/kernel/head-nommu.S | 2 ++
+ arch/arm/mm/proc-v7m.S | 5 ++---
+ 3 files changed, 7 insertions(+), 5 deletions(-)
+
+diff --git a/arch/arm/kernel/head-common.S b/arch/arm/kernel/head-common.S
+index a7810be07da1c..4a3982812a401 100644
+--- a/arch/arm/kernel/head-common.S
++++ b/arch/arm/kernel/head-common.S
+@@ -68,7 +68,7 @@ ENDPROC(__vet_atags)
+ * The following fragment of code is executed with the MMU on in MMU mode,
+ * and uses absolute addresses; this is not position independent.
+ *
+- * r0 = cp#15 control register
++ * r0 = cp#15 control register (exc_ret for M-class)
+ * r1 = machine ID
+ * r2 = atags/dtb pointer
+ * r9 = processor ID
+@@ -137,7 +137,8 @@ __mmap_switched_data:
+ #ifdef CONFIG_CPU_CP15
+ .long cr_alignment @ r3
+ #else
+- .long 0 @ r3
++M_CLASS(.long exc_ret) @ r3
++AR_CLASS(.long 0) @ r3
+ #endif
+ .size __mmap_switched_data, . - __mmap_switched_data
+
+diff --git a/arch/arm/kernel/head-nommu.S b/arch/arm/kernel/head-nommu.S
+index afa350f44dea3..0fc814bbc34b1 100644
+--- a/arch/arm/kernel/head-nommu.S
++++ b/arch/arm/kernel/head-nommu.S
+@@ -201,6 +201,8 @@ M_CLASS(streq r3, [r12, #PMSAv8_MAIR1])
+ bic r0, r0, #V7M_SCB_CCR_IC
+ #endif
+ str r0, [r12, V7M_SCB_CCR]
++ /* Pass exc_ret to __mmap_switched */
++ mov r0, r10
+ #endif /* CONFIG_CPU_CP15 elif CONFIG_CPU_V7M */
+ ret lr
+ ENDPROC(__after_proc_init)
+diff --git a/arch/arm/mm/proc-v7m.S b/arch/arm/mm/proc-v7m.S
+index 1448f144e7fb9..efebf4120a0c4 100644
+--- a/arch/arm/mm/proc-v7m.S
++++ b/arch/arm/mm/proc-v7m.S
+@@ -136,9 +136,8 @@ __v7m_setup_cont:
+ cpsie i
+ svc #0
+ 1: cpsid i
+- ldr r0, =exc_ret
+- orr lr, lr, #EXC_RET_THREADMODE_PROCESSSTACK
+- str lr, [r0]
++ /* Calculate exc_ret */
++ orr r10, lr, #EXC_RET_THREADMODE_PROCESSSTACK
+ ldmia sp, {r0-r3, r12}
+ str r5, [r12, #11 * 4] @ restore the original SVC vector entry
+ mov lr, r6 @ restore LR
+--
+2.20.1
+
--- /dev/null
+From 553a3db4c703e144d532fcd55fe108fe544122d1 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 21 Oct 2019 06:06:14 +0100
+Subject: ARM: 8926/1: v7m: remove register save to stack before svc
+
+From: afzal mohammed <afzal.mohd.ma@gmail.com>
+
+[ Upstream commit 2ecb287998a47cc0a766f6071f63bc185f338540 ]
+
+r0-r3 & r12 registers are saved & restored, before & after svc
+respectively. Intention was to preserve those registers across thread to
+handler mode switch.
+
+On v7-M, hardware saves the register context upon exception in AAPCS
+complaint way. Restoring r0-r3 & r12 is done from stack location where
+hardware saves it, not from the location on stack where these registers
+were saved.
+
+To clarify, on stm32f429 discovery board:
+
+1. before svc, sp - 0x90009ff8
+2. r0-r3,r12 saved to 0x90009ff8 - 0x9000a00b
+3. upon svc, h/w decrements sp by 32 & pushes registers onto stack
+4. after svc, sp - 0x90009fd8
+5. r0-r3,r12 restored from 0x90009fd8 - 0x90009feb
+
+Above means r0-r3,r12 is not restored from the location where they are
+saved, but since hardware pushes the registers onto stack, the registers
+are restored correctly.
+
+Note that during register saving to stack (step 2), it goes past
+0x9000a000. And it seems, based on objdump, there are global symbols
+residing there, and it perhaps can cause issues on a non-XIP Kernel
+(on XIP, data section is setup later).
+
+Based on the analysis above, manually saving registers onto stack is at
+best no-op and at worst can cause data section corruption. Hence remove
+storing of registers onto stack before svc.
+
+Fixes: b70cd406d7fe ("ARM: 8671/1: V7M: Preserve registers across switch from Thread to Handler mode")
+Signed-off-by: afzal mohammed <afzal.mohd.ma@gmail.com>
+Acked-by: Vladimir Murzin <vladimir.murzin@arm.com>
+Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm/mm/proc-v7m.S | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/arch/arm/mm/proc-v7m.S b/arch/arm/mm/proc-v7m.S
+index efebf4120a0c4..1a49d503eafc8 100644
+--- a/arch/arm/mm/proc-v7m.S
++++ b/arch/arm/mm/proc-v7m.S
+@@ -132,7 +132,6 @@ __v7m_setup_cont:
+ dsb
+ mov r6, lr @ save LR
+ ldr sp, =init_thread_union + THREAD_START_SP
+- stmia sp, {r0-r3, r12}
+ cpsie i
+ svc #0
+ 1: cpsid i
+--
+2.20.1
+
--- /dev/null
+From 681e60045eaf6c638064f39589b9ec243e7d7cd5 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 30 Aug 2019 13:22:02 +0300
+Subject: ARM: davinci: dm365: Fix McBSP dma_slave_map entry
+
+From: Peter Ujfalusi <peter.ujfalusi@ti.com>
+
+[ Upstream commit 564b6bb9d42d31fc80c006658cf38940a9b99616 ]
+
+dm365 have only single McBSP, so the device name is without .0
+
+Fixes: 0c750e1fe481d ("ARM: davinci: dm365: Add dma_slave_map to edma")
+Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
+Signed-off-by: Sekhar Nori <nsekhar@ti.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm/mach-davinci/dm365.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c
+index 2f9ae6431bf54..cebab6af31a2d 100644
+--- a/arch/arm/mach-davinci/dm365.c
++++ b/arch/arm/mach-davinci/dm365.c
+@@ -462,8 +462,8 @@ static s8 dm365_queue_priority_mapping[][2] = {
+ };
+
+ static const struct dma_slave_map dm365_edma_map[] = {
+- { "davinci-mcbsp.0", "tx", EDMA_FILTER_PARAM(0, 2) },
+- { "davinci-mcbsp.0", "rx", EDMA_FILTER_PARAM(0, 3) },
++ { "davinci-mcbsp", "tx", EDMA_FILTER_PARAM(0, 2) },
++ { "davinci-mcbsp", "rx", EDMA_FILTER_PARAM(0, 3) },
+ { "davinci_voicecodec", "tx", EDMA_FILTER_PARAM(0, 2) },
+ { "davinci_voicecodec", "rx", EDMA_FILTER_PARAM(0, 3) },
+ { "spi_davinci.2", "tx", EDMA_FILTER_PARAM(0, 10) },
+--
+2.20.1
+
--- /dev/null
+From 4aeda3e646c0a43f20d0814df9a5b31f599aaeaf Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 3 Oct 2019 18:45:48 -0700
+Subject: ARM: dts: am3874-iceboard: Fix 'i2c-mux-idle-disconnect' usage
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Andrey Smirnov <andrew.smirnov@gmail.com>
+
+[ Upstream commit 647c8977e111c0a62c93a489ebc4b045c833fdb4 ]
+
+According to
+Documentation/devicetree/bindings/i2c/i2c-mux-pca954x.txt,
+i2c-mux-idle-disconnect is a property of a parent node since it
+pertains to the mux/switch as a whole, so move it there and drop all
+of the concurrences in child nodes.
+
+Fixes: d031773169df ("ARM: dts: Adds device tree file for McGill's IceBoard, based on TI AM3874")
+Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
+Cc: Benoît Cousson <bcousson@baylibre.com>
+Cc: Tony Lindgren <tony@atomide.com>
+Cc: Graeme Smecher <gsmecher@threespeedlogic.com>
+Cc: linux-omap@vger.kernel.org
+Cc: devicetree@vger.kernel.org
+Cc: linux-kernel@vger.kernel.org
+Tested-by: Graeme Smecher <gsmecher@threespeedlogic.com>
+Signed-off-by: Tony Lindgren <tony@atomide.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm/boot/dts/am3874-iceboard.dts | 9 +--------
+ 1 file changed, 1 insertion(+), 8 deletions(-)
+
+diff --git a/arch/arm/boot/dts/am3874-iceboard.dts b/arch/arm/boot/dts/am3874-iceboard.dts
+index 883fb85135d46..1b4b2b0500e4c 100644
+--- a/arch/arm/boot/dts/am3874-iceboard.dts
++++ b/arch/arm/boot/dts/am3874-iceboard.dts
+@@ -111,13 +111,13 @@
+ reg = <0x70>;
+ #address-cells = <1>;
+ #size-cells = <0>;
++ i2c-mux-idle-disconnect;
+
+ i2c@0 {
+ /* FMC A */
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <0>;
+- i2c-mux-idle-disconnect;
+ };
+
+ i2c@1 {
+@@ -125,7 +125,6 @@
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <1>;
+- i2c-mux-idle-disconnect;
+ };
+
+ i2c@2 {
+@@ -133,7 +132,6 @@
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <2>;
+- i2c-mux-idle-disconnect;
+ };
+
+ i2c@3 {
+@@ -141,7 +139,6 @@
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <3>;
+- i2c-mux-idle-disconnect;
+ };
+
+ i2c@4 {
+@@ -149,14 +146,12 @@
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <4>;
+- i2c-mux-idle-disconnect;
+ };
+
+ i2c@5 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <5>;
+- i2c-mux-idle-disconnect;
+
+ ina230@40 { compatible = "ti,ina230"; reg = <0x40>; shunt-resistor = <5000>; };
+ ina230@41 { compatible = "ti,ina230"; reg = <0x41>; shunt-resistor = <5000>; };
+@@ -182,14 +177,12 @@
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <6>;
+- i2c-mux-idle-disconnect;
+ };
+
+ i2c@7 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <7>;
+- i2c-mux-idle-disconnect;
+
+ u41: pca9575@20 {
+ compatible = "nxp,pca9575";
+--
+2.20.1
+
--- /dev/null
+From 31a990a4330957b0ecbfea50a3ad3d8f8cb0cf87 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 13 Oct 2019 12:53:23 +0200
+Subject: ARM: dts: bcm2837-rpi-cm3: Avoid leds-gpio probing issue
+
+From: Stefan Wahren <wahrenst@gmx.net>
+
+[ Upstream commit 626c45d223e22090511acbfb481e0ece1de1356d ]
+
+bcm2835-rpi.dtsi defines the behavior of the ACT LED, which is available
+on all Raspberry Pi boards. But there is no driver for this particual
+GPIO on CM3 in mainline yet, so this node was left incomplete without
+the actual GPIO definition. Since commit 025bf37725f1 ("gpio: Fix return
+value mismatch of function gpiod_get_from_of_node()") this causing probe
+issues of the leds-gpio driver for users of the CM3 dtsi file.
+
+ leds-gpio: probe of leds failed with error -2
+
+Until we have the necessary GPIO driver hide the ACT node for CM3
+to avoid this.
+
+Reported-by: Fredrik Yhlen <fredrik.yhlen@endian.se>
+Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
+Fixes: a54fe8a6cf66 ("ARM: dts: add Raspberry Pi Compute Module 3 and IO board")
+Cc: Linus Walleij <linus.walleij@linaro.org>
+Cc: Krzysztof Kozlowski <krzk@kernel.org>
+Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm/boot/dts/bcm2837-rpi-cm3.dtsi | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/arch/arm/boot/dts/bcm2837-rpi-cm3.dtsi b/arch/arm/boot/dts/bcm2837-rpi-cm3.dtsi
+index 81399b2c5af9e..d4f0e455612d4 100644
+--- a/arch/arm/boot/dts/bcm2837-rpi-cm3.dtsi
++++ b/arch/arm/boot/dts/bcm2837-rpi-cm3.dtsi
+@@ -8,6 +8,14 @@
+ reg = <0 0x40000000>;
+ };
+
++ leds {
++ /*
++ * Since there is no upstream GPIO driver yet,
++ * remove the incomplete node.
++ */
++ /delete-node/ act;
++ };
++
+ reg_3v3: fixed-regulator {
+ compatible = "regulator-fixed";
+ regulator-name = "3V3";
+--
+2.20.1
+
--- /dev/null
+From 877769af4267edfc99c03bdf828dbdcc56c1bad9 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 1 Oct 2019 19:20:29 -0500
+Subject: ARM: dts: imx6q-logicpd: Re-Enable SNVS power key
+
+From: Adam Ford <aford173@gmail.com>
+
+[ Upstream commit 52f4d4043d1edc4e9e66ec79cae3e32cfe0e44d6 ]
+
+A previous patch disabled the SNVS power key by default which
+breaks the ability for the imx6q-logicpd board to wake from sleep.
+This patch re-enables this feature for this board.
+
+Fixes: 770856f0da5d ("ARM: dts: imx6qdl: Enable SNVS power key according to board design")
+Signed-off-by: Adam Ford <aford173@gmail.com>
+Signed-off-by: Shawn Guo <shawnguo@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm/boot/dts/imx6-logicpd-som.dtsi | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/arch/arm/boot/dts/imx6-logicpd-som.dtsi b/arch/arm/boot/dts/imx6-logicpd-som.dtsi
+index 7ceae35732486..547fb141ec0c9 100644
+--- a/arch/arm/boot/dts/imx6-logicpd-som.dtsi
++++ b/arch/arm/boot/dts/imx6-logicpd-som.dtsi
+@@ -207,6 +207,10 @@
+ vin-supply = <&sw1c_reg>;
+ };
+
++&snvs_poweroff {
++ status = "okay";
++};
++
+ &iomuxc {
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_hog>;
+--
+2.20.1
+
--- /dev/null
+From 4d63faa10b178e706d54a481c6204798c315afd8 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 7 Oct 2019 08:43:42 +0800
+Subject: ARM: dts: imx7s: Correct GPT's ipg clock source
+
+From: Anson Huang <Anson.Huang@nxp.com>
+
+[ Upstream commit 252b9e21bcf46b0d16f733f2e42b21fdc60addee ]
+
+i.MX7S/D's GPT ipg clock should be from GPT clock root and
+controlled by CCM's GPT CCGR, using correct clock source for
+GPT ipg clock instead of IMX7D_CLK_DUMMY.
+
+Fixes: 3ef79ca6bd1d ("ARM: dts: imx7d: use imx7s.dtsi as base device tree")
+Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
+Signed-off-by: Shawn Guo <shawnguo@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm/boot/dts/imx7s.dtsi | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/arch/arm/boot/dts/imx7s.dtsi b/arch/arm/boot/dts/imx7s.dtsi
+index c1a4fff5ceda9..6323a9462afa9 100644
+--- a/arch/arm/boot/dts/imx7s.dtsi
++++ b/arch/arm/boot/dts/imx7s.dtsi
+@@ -448,7 +448,7 @@
+ compatible = "fsl,imx7d-gpt", "fsl,imx6sx-gpt";
+ reg = <0x302d0000 0x10000>;
+ interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>;
+- clocks = <&clks IMX7D_CLK_DUMMY>,
++ clocks = <&clks IMX7D_GPT1_ROOT_CLK>,
+ <&clks IMX7D_GPT1_ROOT_CLK>;
+ clock-names = "ipg", "per";
+ };
+@@ -457,7 +457,7 @@
+ compatible = "fsl,imx7d-gpt", "fsl,imx6sx-gpt";
+ reg = <0x302e0000 0x10000>;
+ interrupts = <GIC_SPI 54 IRQ_TYPE_LEVEL_HIGH>;
+- clocks = <&clks IMX7D_CLK_DUMMY>,
++ clocks = <&clks IMX7D_GPT2_ROOT_CLK>,
+ <&clks IMX7D_GPT2_ROOT_CLK>;
+ clock-names = "ipg", "per";
+ status = "disabled";
+@@ -467,7 +467,7 @@
+ compatible = "fsl,imx7d-gpt", "fsl,imx6sx-gpt";
+ reg = <0x302f0000 0x10000>;
+ interrupts = <GIC_SPI 53 IRQ_TYPE_LEVEL_HIGH>;
+- clocks = <&clks IMX7D_CLK_DUMMY>,
++ clocks = <&clks IMX7D_GPT3_ROOT_CLK>,
+ <&clks IMX7D_GPT3_ROOT_CLK>;
+ clock-names = "ipg", "per";
+ status = "disabled";
+@@ -477,7 +477,7 @@
+ compatible = "fsl,imx7d-gpt", "fsl,imx6sx-gpt";
+ reg = <0x30300000 0x10000>;
+ interrupts = <GIC_SPI 52 IRQ_TYPE_LEVEL_HIGH>;
+- clocks = <&clks IMX7D_CLK_DUMMY>,
++ clocks = <&clks IMX7D_GPT4_ROOT_CLK>,
+ <&clks IMX7D_GPT4_ROOT_CLK>;
+ clock-names = "ipg", "per";
+ status = "disabled";
+--
+2.20.1
+
--- /dev/null
+From 9263e32025793a78a09dba4591ae0c8b6534c78a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 16 Aug 2019 17:58:12 -0500
+Subject: ARM: dts: logicpd-torpedo-som: Remove twl_keypad
+
+From: Adam Ford <aford173@gmail.com>
+
+[ Upstream commit 6b512b0ee091edcb8e46218894e4c917d919d3dc ]
+
+The TWL4030 used on the Logit PD Torpedo SOM does not have the
+keypad pins routed. This patch disables the twl_keypad driver
+to remove some splat during boot:
+
+twl4030_keypad 48070000.i2c:twl@48:keypad: missing or malformed property linux,keymap: -22
+twl4030_keypad 48070000.i2c:twl@48:keypad: Failed to build keymap
+twl4030_keypad: probe of 48070000.i2c:twl@48:keypad failed with error -22
+
+Signed-off-by: Adam Ford <aford173@gmail.com>
+[tony@atomide.com: removed error time stamps]
+Signed-off-by: Tony Lindgren <tony@atomide.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm/boot/dts/logicpd-torpedo-som.dtsi | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/arch/arm/boot/dts/logicpd-torpedo-som.dtsi b/arch/arm/boot/dts/logicpd-torpedo-som.dtsi
+index 3fdd0a72f87f7..506b118e511a6 100644
+--- a/arch/arm/boot/dts/logicpd-torpedo-som.dtsi
++++ b/arch/arm/boot/dts/logicpd-torpedo-som.dtsi
+@@ -192,3 +192,7 @@
+ &twl_gpio {
+ ti,use-leds;
+ };
++
++&twl_keypad {
++ status = "disabled";
++};
+--
+2.20.1
+
--- /dev/null
+From 3953a0b2fc6ba2037b1fea35de48e06b8142f901 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 9 Oct 2019 15:11:27 -0700
+Subject: ARM: dts: Use level interrupt for omap4 & 5 wlcore
+
+From: Tony Lindgren <tony@atomide.com>
+
+[ Upstream commit 087a2b7ec973f6f30f6e7b72cb50b6f7734ffdd2 ]
+
+Commit 572cf7d7b07d ("ARM: dts: Improve omap l4per idling with wlcore edge
+sensitive interrupt") changed wlcore interrupts to use edge interrupt based
+on what's specified in the wl1835mod.pdf data sheet.
+
+However, there are still cases where we can have lost interrupts as
+described in omap_gpio_unidle(). And using a level interrupt instead of edge
+interrupt helps as we avoid the check for untriggered GPIO interrupts in
+omap_gpio_unidle().
+
+And with commit e6818d29ea15 ("gpio: gpio-omap: configure edge detection
+for level IRQs for idle wakeup") GPIOs idle just fine with level interrupts.
+
+Let's change omap4 and 5 wlcore users back to using level interrupt
+instead of edge interrupt. Let's not change the others as I've only seen
+this on omap4 and 5, probably because the other SoCs don't have l4per idle
+independent of the CPUs.
+
+Fixes: 572cf7d7b07d ("ARM: dts: Improve omap l4per idling with wlcore edge sensitive interrupt")
+Depends-on: e6818d29ea15 ("gpio: gpio-omap: configure edge detection for level IRQs for idle wakeup")
+Cc: Anders Roxell <anders.roxell@linaro.org>
+Cc: Eyal Reizer <eyalr@ti.com>
+Cc: Guy Mishol <guym@ti.com>
+Cc: John Stultz <john.stultz@linaro.org>
+Cc: Ulf Hansson <ulf.hansson@linaro.org>
+Signed-off-by: Tony Lindgren <tony@atomide.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm/boot/dts/omap4-droid4-xt894.dts | 2 +-
+ arch/arm/boot/dts/omap4-panda-common.dtsi | 2 +-
+ arch/arm/boot/dts/omap4-sdp.dts | 2 +-
+ arch/arm/boot/dts/omap4-var-som-om44-wlan.dtsi | 2 +-
+ arch/arm/boot/dts/omap5-board-common.dtsi | 2 +-
+ 5 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/arch/arm/boot/dts/omap4-droid4-xt894.dts b/arch/arm/boot/dts/omap4-droid4-xt894.dts
+index 4454449de00c0..a40fe8d49da64 100644
+--- a/arch/arm/boot/dts/omap4-droid4-xt894.dts
++++ b/arch/arm/boot/dts/omap4-droid4-xt894.dts
+@@ -369,7 +369,7 @@
+ compatible = "ti,wl1285", "ti,wl1283";
+ reg = <2>;
+ /* gpio_100 with gpmc_wait2 pad as wakeirq */
+- interrupts-extended = <&gpio4 4 IRQ_TYPE_EDGE_RISING>,
++ interrupts-extended = <&gpio4 4 IRQ_TYPE_LEVEL_HIGH>,
+ <&omap4_pmx_core 0x4e>;
+ interrupt-names = "irq", "wakeup";
+ ref-clock-frequency = <26000000>;
+diff --git a/arch/arm/boot/dts/omap4-panda-common.dtsi b/arch/arm/boot/dts/omap4-panda-common.dtsi
+index 14be2ecb62b1f..55ea8b6189af5 100644
+--- a/arch/arm/boot/dts/omap4-panda-common.dtsi
++++ b/arch/arm/boot/dts/omap4-panda-common.dtsi
+@@ -474,7 +474,7 @@
+ compatible = "ti,wl1271";
+ reg = <2>;
+ /* gpio_53 with gpmc_ncs3 pad as wakeup */
+- interrupts-extended = <&gpio2 21 IRQ_TYPE_EDGE_RISING>,
++ interrupts-extended = <&gpio2 21 IRQ_TYPE_LEVEL_HIGH>,
+ <&omap4_pmx_core 0x3a>;
+ interrupt-names = "irq", "wakeup";
+ ref-clock-frequency = <38400000>;
+diff --git a/arch/arm/boot/dts/omap4-sdp.dts b/arch/arm/boot/dts/omap4-sdp.dts
+index 3c274965ff40a..91480ac1f3286 100644
+--- a/arch/arm/boot/dts/omap4-sdp.dts
++++ b/arch/arm/boot/dts/omap4-sdp.dts
+@@ -512,7 +512,7 @@
+ compatible = "ti,wl1281";
+ reg = <2>;
+ interrupt-parent = <&gpio1>;
+- interrupts = <21 IRQ_TYPE_EDGE_RISING>; /* gpio 53 */
++ interrupts = <21 IRQ_TYPE_LEVEL_HIGH>; /* gpio 53 */
+ ref-clock-frequency = <26000000>;
+ tcxo-clock-frequency = <26000000>;
+ };
+diff --git a/arch/arm/boot/dts/omap4-var-som-om44-wlan.dtsi b/arch/arm/boot/dts/omap4-var-som-om44-wlan.dtsi
+index 6dbbc9b3229cc..d0032213101e6 100644
+--- a/arch/arm/boot/dts/omap4-var-som-om44-wlan.dtsi
++++ b/arch/arm/boot/dts/omap4-var-som-om44-wlan.dtsi
+@@ -69,7 +69,7 @@
+ compatible = "ti,wl1271";
+ reg = <2>;
+ interrupt-parent = <&gpio2>;
+- interrupts = <9 IRQ_TYPE_EDGE_RISING>; /* gpio 41 */
++ interrupts = <9 IRQ_TYPE_LEVEL_HIGH>; /* gpio 41 */
+ ref-clock-frequency = <38400000>;
+ };
+ };
+diff --git a/arch/arm/boot/dts/omap5-board-common.dtsi b/arch/arm/boot/dts/omap5-board-common.dtsi
+index 7fff555ee3943..68ac04641bdb1 100644
+--- a/arch/arm/boot/dts/omap5-board-common.dtsi
++++ b/arch/arm/boot/dts/omap5-board-common.dtsi
+@@ -362,7 +362,7 @@
+ pinctrl-names = "default";
+ pinctrl-0 = <&wlcore_irq_pin>;
+ interrupt-parent = <&gpio1>;
+- interrupts = <14 IRQ_TYPE_EDGE_RISING>; /* gpio 14 */
++ interrupts = <14 IRQ_TYPE_LEVEL_HIGH>; /* gpio 14 */
+ ref-clock-frequency = <26000000>;
+ };
+ };
+--
+2.20.1
+
--- /dev/null
+From b33a79eeef31b0a773edeb562249bb2ec44bb034 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 3 Oct 2019 22:41:15 -0700
+Subject: ARM: dts: vf610-zii-scu4-aib: Specify 'i2c-mux-idle-disconnect'
+
+From: Andrey Smirnov <andrew.smirnov@gmail.com>
+
+[ Upstream commit 71936a6d18c33c63b4e9e0359fb987306cbe9fae ]
+
+Specify 'i2c-mux-idle-disconnect' for both I2C switches present on the
+board, since both are connected to the same parent bus and all of
+their children have the same I2C address.
+
+Fixes: ca4b4d373fcc ("ARM: dts: vf610: Add ZII SCU4 AIB board")
+Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
+Cc: Shawn Guo <shawnguo@kernel.org>
+Cc: Chris Healy <cphealy@gmail.com>
+Cc: Cory Tusar <cory.tusar@zii.aero>
+Cc: Jeff White <jeff.white@zii.aero>
+Cc: Rick Ramstetter <rick@anteaterllc.com>
+Cc: Lucas Stach <l.stach@pengutronix.de>
+Cc: Fabio Estevam <festevam@gmail.com>
+Cc: linux-arm-kernel@lists.infradead.org
+Cc: devicetree@vger.kernel.org
+Cc: linux-kernel@vger.kernel.org
+Tested-by: Chris Healy <cphealy@gmail.com>
+Signed-off-by: Shawn Guo <shawnguo@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm/boot/dts/vf610-zii-scu4-aib.dts | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/arch/arm/boot/dts/vf610-zii-scu4-aib.dts b/arch/arm/boot/dts/vf610-zii-scu4-aib.dts
+index d7019e89f5887..8136e0ca10d54 100644
+--- a/arch/arm/boot/dts/vf610-zii-scu4-aib.dts
++++ b/arch/arm/boot/dts/vf610-zii-scu4-aib.dts
+@@ -600,6 +600,7 @@
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <0x70>;
++ i2c-mux-idle-disconnect;
+
+ sff0_i2c: i2c@1 {
+ #address-cells = <1>;
+@@ -638,6 +639,7 @@
+ reg = <0x71>;
+ #address-cells = <1>;
+ #size-cells = <0>;
++ i2c-mux-idle-disconnect;
+
+ sff5_i2c: i2c@1 {
+ #address-cells = <1>;
+--
+2.20.1
+
--- /dev/null
+From d2ad6b9d845bd80ad1b59155deee3a20094a11a1 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 31 Aug 2019 17:01:58 +0100
+Subject: ARM: mm: fix alignment handler faults under memory pressure
+
+From: Russell King <rmk+kernel@armlinux.org.uk>
+
+[ Upstream commit 67e15fa5b487adb9b78a92789eeff2d6ec8f5cee ]
+
+When the system has high memory pressure, the page containing the
+instruction may be paged out. Using probe_kernel_address() means that
+if the page is swapped out, the resulting page fault will not be
+handled because page faults are disabled by this function.
+
+Use get_user() to read the instruction instead.
+
+Reported-by: Jing Xiangfeng <jingxiangfeng@huawei.com>
+Fixes: b255188f90e2 ("ARM: fix scheduling while atomic warning in alignment handling code")
+Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm/mm/alignment.c | 44 +++++++++++++++++++++++++++++++++--------
+ 1 file changed, 36 insertions(+), 8 deletions(-)
+
+diff --git a/arch/arm/mm/alignment.c b/arch/arm/mm/alignment.c
+index 04b36436cbc04..6587432faf057 100644
+--- a/arch/arm/mm/alignment.c
++++ b/arch/arm/mm/alignment.c
+@@ -767,6 +767,36 @@ do_alignment_t32_to_handler(unsigned long *pinstr, struct pt_regs *regs,
+ return NULL;
+ }
+
++static int alignment_get_arm(struct pt_regs *regs, u32 *ip, unsigned long *inst)
++{
++ u32 instr = 0;
++ int fault;
++
++ if (user_mode(regs))
++ fault = get_user(instr, ip);
++ else
++ fault = probe_kernel_address(ip, instr);
++
++ *inst = __mem_to_opcode_arm(instr);
++
++ return fault;
++}
++
++static int alignment_get_thumb(struct pt_regs *regs, u16 *ip, u16 *inst)
++{
++ u16 instr = 0;
++ int fault;
++
++ if (user_mode(regs))
++ fault = get_user(instr, ip);
++ else
++ fault = probe_kernel_address(ip, instr);
++
++ *inst = __mem_to_opcode_thumb16(instr);
++
++ return fault;
++}
++
+ static int
+ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
+ {
+@@ -774,10 +804,10 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
+ unsigned long instr = 0, instrptr;
+ int (*handler)(unsigned long addr, unsigned long instr, struct pt_regs *regs);
+ unsigned int type;
+- unsigned int fault;
+ u16 tinstr = 0;
+ int isize = 4;
+ int thumb2_32b = 0;
++ int fault;
+
+ if (interrupts_enabled(regs))
+ local_irq_enable();
+@@ -786,15 +816,14 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
+
+ if (thumb_mode(regs)) {
+ u16 *ptr = (u16 *)(instrptr & ~1);
+- fault = probe_kernel_address(ptr, tinstr);
+- tinstr = __mem_to_opcode_thumb16(tinstr);
++
++ fault = alignment_get_thumb(regs, ptr, &tinstr);
+ if (!fault) {
+ if (cpu_architecture() >= CPU_ARCH_ARMv7 &&
+ IS_T32(tinstr)) {
+ /* Thumb-2 32-bit */
+- u16 tinst2 = 0;
+- fault = probe_kernel_address(ptr + 1, tinst2);
+- tinst2 = __mem_to_opcode_thumb16(tinst2);
++ u16 tinst2;
++ fault = alignment_get_thumb(regs, ptr + 1, &tinst2);
+ instr = __opcode_thumb32_compose(tinstr, tinst2);
+ thumb2_32b = 1;
+ } else {
+@@ -803,8 +832,7 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
+ }
+ }
+ } else {
+- fault = probe_kernel_address((void *)instrptr, instr);
+- instr = __mem_to_opcode_arm(instr);
++ fault = alignment_get_arm(regs, (void *)instrptr, &instr);
+ }
+
+ if (fault) {
+--
+2.20.1
+
--- /dev/null
+From 13c546522e0f5dd4b7fbd8db5143d2b0dcddd47c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 6 Aug 2019 07:01:35 -0700
+Subject: arm64: dts: allwinner: a64: Drop PMU node
+
+From: Vasily Khoruzhick <anarsoul@gmail.com>
+
+[ Upstream commit ed3e9406bcbc32f84dc4aa4cb4767852e5ab086c ]
+
+Looks like PMU in A64 is broken, it generates no interrupts at all and
+as result 'perf top' shows no events.
+
+Tested on Pine64-LTS.
+
+Fixes: 34a97fcc71c2 ("arm64: dts: allwinner: a64: Add PMU node")
+Cc: Harald Geyer <harald@ccbib.org>
+Cc: Jared D. McNeill <jmcneill@NetBSD.org>
+Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
+Reviewed-by: Emmanuel Vadot <manu@FreeBSD.org>
+Signed-off-by: Maxime Ripard <mripard@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 9 ---------
+ 1 file changed, 9 deletions(-)
+
+diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
+index 9cc9bdde81ac2..cd92f546c4838 100644
+--- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
++++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
+@@ -142,15 +142,6 @@
+ clock-output-names = "ext-osc32k";
+ };
+
+- pmu {
+- compatible = "arm,cortex-a53-pmu";
+- interrupts = <GIC_SPI 152 IRQ_TYPE_LEVEL_HIGH>,
+- <GIC_SPI 153 IRQ_TYPE_LEVEL_HIGH>,
+- <GIC_SPI 154 IRQ_TYPE_LEVEL_HIGH>,
+- <GIC_SPI 155 IRQ_TYPE_LEVEL_HIGH>;
+- interrupt-affinity = <&cpu0>, <&cpu1>, <&cpu2>, <&cpu3>;
+- };
+-
+ psci {
+ compatible = "arm,psci-0.2";
+ method = "smc";
+--
+2.20.1
+
--- /dev/null
+From c664f913ed267c48353c674aceefebc4b5f96309 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 9 Sep 2019 20:42:35 +0200
+Subject: arm64: dts: allwinner: a64: pine64-plus: Add PHY regulator delay
+
+From: Jernej Skrabec <jernej.skrabec@siol.net>
+
+[ Upstream commit 2511366797fa6ab4a404b4b000ef7cd262aaafe8 ]
+
+Depending on kernel and bootloader configuration, it's possible that
+Realtek ethernet PHY isn't powered on properly. According to the
+datasheet, it needs 30ms to power up and then some more time before it
+can be used.
+
+Fix that by adding 100ms ramp delay to regulator responsible for
+powering PHY.
+
+Fixes: 94dcfdc77fc5 ("arm64: allwinner: pine64-plus: Enable dwmac-sun8i")
+Suggested-by: Ondrej Jirman <megous@megous.com>
+Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
+Signed-off-by: Maxime Ripard <mripard@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts
+index 24f1aac366d64..d5b6e8159a335 100644
+--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts
++++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts
+@@ -63,3 +63,12 @@
+ reg = <1>;
+ };
+ };
++
++®_dc1sw {
++ /*
++ * Ethernet PHY needs 30ms to properly power up and some more
++ * to initialize. 100ms should be plenty of time to finish
++ * whole process.
++ */
++ regulator-enable-ramp-delay = <100000>;
++};
+--
+2.20.1
+
--- /dev/null
+From 5c6368e3961a8834aa44a551baf7d333767f77a1 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 29 Sep 2019 10:52:59 +0200
+Subject: arm64: dts: allwinner: a64: sopine-baseboard: Add PHY regulator delay
+
+From: Jernej Skrabec <jernej.skrabec@siol.net>
+
+[ Upstream commit ccdf3aaa27ded6db9a93eed3ca7468bb2353b8fe ]
+
+It turns out that sopine-baseboard needs same fix as pine64-plus
+for ethernet PHY. Here too Realtek ethernet PHY chip needs additional
+power on delay to properly initialize. Datasheet mentions that chip
+needs 30 ms to be properly powered on and that it needs some more time
+to be initialized.
+
+Fix that by adding 100ms ramp delay to regulator responsible for
+powering PHY.
+
+Note that issue was found out and fix tested on pine64-lts, but it's
+basically the same as sopine-baseboard, only layout and connectors
+differ.
+
+Fixes: bdfe4cebea11 ("arm64: allwinner: a64: add Ethernet PHY regulator for several boards")
+Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
+Signed-off-by: Maxime Ripard <mripard@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ .../boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts
+index e6fb9683f2135..25099202c52c9 100644
+--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts
++++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts
+@@ -159,6 +159,12 @@
+ };
+
+ ®_dc1sw {
++ /*
++ * Ethernet PHY needs 30ms to properly power up and some more
++ * to initialize. 100ms should be plenty of time to finish
++ * whole process.
++ */
++ regulator-enable-ramp-delay = <100000>;
+ regulator-name = "vcc-phy";
+ };
+
+--
+2.20.1
+
--- /dev/null
+From b55754f3a7b7b73e2c5f89f2e9e84d7de8176e3d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 9 Sep 2019 14:05:27 +0530
+Subject: arm64: dts: Fix gpio to pinmux mapping
+
+From: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com>
+
+[ Upstream commit 965f6603e3335a953f4f876792074cb36bf65f7f ]
+
+There are total of 151 non-secure gpio (0-150) and four
+pins of pinmux (91, 92, 93 and 94) are not mapped to any
+gpio pin, hence update same in DT.
+
+Fixes: 8aa428cc1e2e ("arm64: dts: Add pinctrl DT nodes for Stingray SOC")
+Signed-off-by: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com>
+Reviewed-by: Ray Jui <ray.jui@broadcom.com>
+Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm64/boot/dts/broadcom/stingray/stingray-pinctrl.dtsi | 5 +++--
+ arch/arm64/boot/dts/broadcom/stingray/stingray.dtsi | 3 +--
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/arch/arm64/boot/dts/broadcom/stingray/stingray-pinctrl.dtsi b/arch/arm64/boot/dts/broadcom/stingray/stingray-pinctrl.dtsi
+index 8a3a770e8f2ce..56789ccf94545 100644
+--- a/arch/arm64/boot/dts/broadcom/stingray/stingray-pinctrl.dtsi
++++ b/arch/arm64/boot/dts/broadcom/stingray/stingray-pinctrl.dtsi
+@@ -42,13 +42,14 @@
+
+ pinmux: pinmux@14029c {
+ compatible = "pinctrl-single";
+- reg = <0x0014029c 0x250>;
++ reg = <0x0014029c 0x26c>;
+ #address-cells = <1>;
+ #size-cells = <1>;
+ pinctrl-single,register-width = <32>;
+ pinctrl-single,function-mask = <0xf>;
+ pinctrl-single,gpio-range = <
+- &range 0 154 MODE_GPIO
++ &range 0 91 MODE_GPIO
++ &range 95 60 MODE_GPIO
+ >;
+ range: gpio-range {
+ #pinctrl-single,gpio-range-cells = <3>;
+diff --git a/arch/arm64/boot/dts/broadcom/stingray/stingray.dtsi b/arch/arm64/boot/dts/broadcom/stingray/stingray.dtsi
+index 71e2e34400d40..0098dfdef96c0 100644
+--- a/arch/arm64/boot/dts/broadcom/stingray/stingray.dtsi
++++ b/arch/arm64/boot/dts/broadcom/stingray/stingray.dtsi
+@@ -464,8 +464,7 @@
+ <&pinmux 108 16 27>,
+ <&pinmux 135 77 6>,
+ <&pinmux 141 67 4>,
+- <&pinmux 145 149 6>,
+- <&pinmux 151 91 4>;
++ <&pinmux 145 149 6>;
+ };
+
+ i2c1: i2c@e0000 {
+--
+2.20.1
+
--- /dev/null
+From 9073e188bd0f8a703089fbcfd08bb209e14c575c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 8 Oct 2019 08:55:44 +0800
+Subject: arm64: dts: imx8mm: Use correct clock for usdhc's ipg clk
+
+From: Anson Huang <Anson.Huang@nxp.com>
+
+[ Upstream commit a6a40d5688f2264afd40574ee1c92e5f824b34ba ]
+
+On i.MX8MM, usdhc's ipg clock is from IMX8MM_CLK_IPG_ROOT,
+assign it explicitly instead of using IMX8MM_CLK_DUMMY.
+
+Fixes: a05ea40eb384 ("arm64: dts: imx: Add i.mx8mm dtsi support")
+Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
+Signed-off-by: Shawn Guo <shawnguo@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm64/boot/dts/freescale/imx8mm.dtsi | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/arch/arm64/boot/dts/freescale/imx8mm.dtsi b/arch/arm64/boot/dts/freescale/imx8mm.dtsi
+index 232a7412755a9..0d0a6543e5db2 100644
+--- a/arch/arm64/boot/dts/freescale/imx8mm.dtsi
++++ b/arch/arm64/boot/dts/freescale/imx8mm.dtsi
+@@ -650,7 +650,7 @@
+ compatible = "fsl,imx8mm-usdhc", "fsl,imx7d-usdhc";
+ reg = <0x30b40000 0x10000>;
+ interrupts = <GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>;
+- clocks = <&clk IMX8MM_CLK_DUMMY>,
++ clocks = <&clk IMX8MM_CLK_IPG_ROOT>,
+ <&clk IMX8MM_CLK_NAND_USDHC_BUS>,
+ <&clk IMX8MM_CLK_USDHC1_ROOT>;
+ clock-names = "ipg", "ahb", "per";
+@@ -666,7 +666,7 @@
+ compatible = "fsl,imx8mm-usdhc", "fsl,imx7d-usdhc";
+ reg = <0x30b50000 0x10000>;
+ interrupts = <GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>;
+- clocks = <&clk IMX8MM_CLK_DUMMY>,
++ clocks = <&clk IMX8MM_CLK_IPG_ROOT>,
+ <&clk IMX8MM_CLK_NAND_USDHC_BUS>,
+ <&clk IMX8MM_CLK_USDHC2_ROOT>;
+ clock-names = "ipg", "ahb", "per";
+@@ -680,7 +680,7 @@
+ compatible = "fsl,imx8mm-usdhc", "fsl,imx7d-usdhc";
+ reg = <0x30b60000 0x10000>;
+ interrupts = <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>;
+- clocks = <&clk IMX8MM_CLK_DUMMY>,
++ clocks = <&clk IMX8MM_CLK_IPG_ROOT>,
+ <&clk IMX8MM_CLK_NAND_USDHC_BUS>,
+ <&clk IMX8MM_CLK_USDHC3_ROOT>;
+ clock-names = "ipg", "ahb", "per";
+--
+2.20.1
+
--- /dev/null
+From 1e5af2925e3dc7a4817f872caa4fefb6e03cd08e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 8 Oct 2019 08:55:43 +0800
+Subject: arm64: dts: imx8mq: Use correct clock for usdhc's ipg clk
+
+From: Anson Huang <Anson.Huang@nxp.com>
+
+[ Upstream commit b0759297f2c8dda455ff78a1d1ac95e261300ae3 ]
+
+On i.MX8MQ, usdhc's ipg clock is from IMX8MQ_CLK_IPG_ROOT,
+assign it explicitly instead of using IMX8MQ_CLK_DUMMY.
+
+Fixes: 748f908cc882 ("arm64: add basic DTS for i.MX8MQ")
+Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
+Signed-off-by: Shawn Guo <shawnguo@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm64/boot/dts/freescale/imx8mq.dtsi | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/arch/arm64/boot/dts/freescale/imx8mq.dtsi b/arch/arm64/boot/dts/freescale/imx8mq.dtsi
+index d1f4eb197af26..32c270c4c22b8 100644
+--- a/arch/arm64/boot/dts/freescale/imx8mq.dtsi
++++ b/arch/arm64/boot/dts/freescale/imx8mq.dtsi
+@@ -782,7 +782,7 @@
+ "fsl,imx7d-usdhc";
+ reg = <0x30b40000 0x10000>;
+ interrupts = <GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>;
+- clocks = <&clk IMX8MQ_CLK_DUMMY>,
++ clocks = <&clk IMX8MQ_CLK_IPG_ROOT>,
+ <&clk IMX8MQ_CLK_NAND_USDHC_BUS>,
+ <&clk IMX8MQ_CLK_USDHC1_ROOT>;
+ clock-names = "ipg", "ahb", "per";
+@@ -799,7 +799,7 @@
+ "fsl,imx7d-usdhc";
+ reg = <0x30b50000 0x10000>;
+ interrupts = <GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>;
+- clocks = <&clk IMX8MQ_CLK_DUMMY>,
++ clocks = <&clk IMX8MQ_CLK_IPG_ROOT>,
+ <&clk IMX8MQ_CLK_NAND_USDHC_BUS>,
+ <&clk IMX8MQ_CLK_USDHC2_ROOT>;
+ clock-names = "ipg", "ahb", "per";
+--
+2.20.1
+
--- /dev/null
+From f7dd57d3dad12fd2f0b4efd788fabef70cb08f87 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 17 Sep 2019 15:33:56 +0800
+Subject: arm64: dts: lx2160a: Correct CPU core idle state name
+
+From: Ran Wang <ran.wang_1@nxp.com>
+
+[ Upstream commit 07159f67c77134dfdfdbdf3d8f657f5890de5b7f ]
+
+lx2160a support PW15 but not PW20, correct name to avoid confusing.
+
+Signed-off-by: Ran Wang <ran.wang_1@nxp.com>
+Fixes: 00c5ce8ac023 ("arm64: dts: lx2160a: add cpu idle support")
+Acked-by: Li Yang <leoyang.li@nxp.com>
+Signed-off-by: Shawn Guo <shawnguo@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ .../arm64/boot/dts/freescale/fsl-lx2160a.dtsi | 36 +++++++++----------
+ 1 file changed, 18 insertions(+), 18 deletions(-)
+
+diff --git a/arch/arm64/boot/dts/freescale/fsl-lx2160a.dtsi b/arch/arm64/boot/dts/freescale/fsl-lx2160a.dtsi
+index e6fdba39453c3..228ab83037d0e 100644
+--- a/arch/arm64/boot/dts/freescale/fsl-lx2160a.dtsi
++++ b/arch/arm64/boot/dts/freescale/fsl-lx2160a.dtsi
+@@ -33,7 +33,7 @@
+ i-cache-line-size = <64>;
+ i-cache-sets = <192>;
+ next-level-cache = <&cluster0_l2>;
+- cpu-idle-states = <&cpu_pw20>;
++ cpu-idle-states = <&cpu_pw15>;
+ };
+
+ cpu@1 {
+@@ -49,7 +49,7 @@
+ i-cache-line-size = <64>;
+ i-cache-sets = <192>;
+ next-level-cache = <&cluster0_l2>;
+- cpu-idle-states = <&cpu_pw20>;
++ cpu-idle-states = <&cpu_pw15>;
+ };
+
+ cpu@100 {
+@@ -65,7 +65,7 @@
+ i-cache-line-size = <64>;
+ i-cache-sets = <192>;
+ next-level-cache = <&cluster1_l2>;
+- cpu-idle-states = <&cpu_pw20>;
++ cpu-idle-states = <&cpu_pw15>;
+ };
+
+ cpu@101 {
+@@ -81,7 +81,7 @@
+ i-cache-line-size = <64>;
+ i-cache-sets = <192>;
+ next-level-cache = <&cluster1_l2>;
+- cpu-idle-states = <&cpu_pw20>;
++ cpu-idle-states = <&cpu_pw15>;
+ };
+
+ cpu@200 {
+@@ -97,7 +97,7 @@
+ i-cache-line-size = <64>;
+ i-cache-sets = <192>;
+ next-level-cache = <&cluster2_l2>;
+- cpu-idle-states = <&cpu_pw20>;
++ cpu-idle-states = <&cpu_pw15>;
+ };
+
+ cpu@201 {
+@@ -113,7 +113,7 @@
+ i-cache-line-size = <64>;
+ i-cache-sets = <192>;
+ next-level-cache = <&cluster2_l2>;
+- cpu-idle-states = <&cpu_pw20>;
++ cpu-idle-states = <&cpu_pw15>;
+ };
+
+ cpu@300 {
+@@ -129,7 +129,7 @@
+ i-cache-line-size = <64>;
+ i-cache-sets = <192>;
+ next-level-cache = <&cluster3_l2>;
+- cpu-idle-states = <&cpu_pw20>;
++ cpu-idle-states = <&cpu_pw15>;
+ };
+
+ cpu@301 {
+@@ -145,7 +145,7 @@
+ i-cache-line-size = <64>;
+ i-cache-sets = <192>;
+ next-level-cache = <&cluster3_l2>;
+- cpu-idle-states = <&cpu_pw20>;
++ cpu-idle-states = <&cpu_pw15>;
+ };
+
+ cpu@400 {
+@@ -161,7 +161,7 @@
+ i-cache-line-size = <64>;
+ i-cache-sets = <192>;
+ next-level-cache = <&cluster4_l2>;
+- cpu-idle-states = <&cpu_pw20>;
++ cpu-idle-states = <&cpu_pw15>;
+ };
+
+ cpu@401 {
+@@ -177,7 +177,7 @@
+ i-cache-line-size = <64>;
+ i-cache-sets = <192>;
+ next-level-cache = <&cluster4_l2>;
+- cpu-idle-states = <&cpu_pw20>;
++ cpu-idle-states = <&cpu_pw15>;
+ };
+
+ cpu@500 {
+@@ -193,7 +193,7 @@
+ i-cache-line-size = <64>;
+ i-cache-sets = <192>;
+ next-level-cache = <&cluster5_l2>;
+- cpu-idle-states = <&cpu_pw20>;
++ cpu-idle-states = <&cpu_pw15>;
+ };
+
+ cpu@501 {
+@@ -209,7 +209,7 @@
+ i-cache-line-size = <64>;
+ i-cache-sets = <192>;
+ next-level-cache = <&cluster5_l2>;
+- cpu-idle-states = <&cpu_pw20>;
++ cpu-idle-states = <&cpu_pw15>;
+ };
+
+ cpu@600 {
+@@ -225,7 +225,7 @@
+ i-cache-line-size = <64>;
+ i-cache-sets = <192>;
+ next-level-cache = <&cluster6_l2>;
+- cpu-idle-states = <&cpu_pw20>;
++ cpu-idle-states = <&cpu_pw15>;
+ };
+
+ cpu@601 {
+@@ -241,7 +241,7 @@
+ i-cache-line-size = <64>;
+ i-cache-sets = <192>;
+ next-level-cache = <&cluster6_l2>;
+- cpu-idle-states = <&cpu_pw20>;
++ cpu-idle-states = <&cpu_pw15>;
+ };
+
+ cpu@700 {
+@@ -257,7 +257,7 @@
+ i-cache-line-size = <64>;
+ i-cache-sets = <192>;
+ next-level-cache = <&cluster7_l2>;
+- cpu-idle-states = <&cpu_pw20>;
++ cpu-idle-states = <&cpu_pw15>;
+ };
+
+ cpu@701 {
+@@ -273,7 +273,7 @@
+ i-cache-line-size = <64>;
+ i-cache-sets = <192>;
+ next-level-cache = <&cluster7_l2>;
+- cpu-idle-states = <&cpu_pw20>;
++ cpu-idle-states = <&cpu_pw15>;
+ };
+
+ cluster0_l2: l2-cache0 {
+@@ -340,9 +340,9 @@
+ cache-level = <2>;
+ };
+
+- cpu_pw20: cpu-pw20 {
++ cpu_pw15: cpu-pw15 {
+ compatible = "arm,idle-state";
+- idle-state-name = "PW20";
++ idle-state-name = "PW15";
+ arm,psci-suspend-param = <0x0>;
+ entry-latency-us = <2000>;
+ exit-latency-us = <2000>;
+--
+2.20.1
+
--- /dev/null
+From 19a9bde342f777e4f186ace9b7f54ba477035be4 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 21 Sep 2019 14:14:57 +0100
+Subject: arm64: dts: rockchip: fix Rockpro64 RK808 interrupt line
+
+From: Hugh Cole-Baker <sigmaris@gmail.com>
+
+[ Upstream commit deea9f5fc32040fd6f6132f2260ba410fb5cf98c ]
+
+Fix the pinctrl and interrupt specifier for RK808 to use GPIO3_B2. On the
+Rockpro64 schematic [1] page 16, it shows GPIO3_B2 used for the interrupt
+line PMIC_INT_L from the RK808, and there's a note which translates as:
+"PMU termination GPIO1_C5 changed to this".
+
+Tested by setting an RTC wakealarm and checking /proc/interrupts counters.
+Without this patch, neither the rockchip_gpio_irq counter for the RK808,
+nor the RTC alarm counter increment when the alarm time is reached.
+With this patch, both interrupt counters increment by 1 as expected.
+
+[1] http://files.pine64.org/doc/rockpro64/rockpro64_v21-SCH.pdf
+
+Fixes: e4f3fb490967 ("arm64: dts: rockchip: add initial dts support for Rockpro64")
+Signed-off-by: Hugh Cole-Baker <sigmaris@gmail.com>
+Link: https://lore.kernel.org/r/20190921131457.36258-1-sigmaris@gmail.com
+Signed-off-by: Heiko Stuebner <heiko@sntech.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts
+index eb55940620060..5818b85255123 100644
+--- a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts
++++ b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts
+@@ -240,8 +240,8 @@
+ rk808: pmic@1b {
+ compatible = "rockchip,rk808";
+ reg = <0x1b>;
+- interrupt-parent = <&gpio1>;
+- interrupts = <21 IRQ_TYPE_LEVEL_LOW>;
++ interrupt-parent = <&gpio3>;
++ interrupts = <10 IRQ_TYPE_LEVEL_LOW>;
+ #clock-cells = <1>;
+ clock-output-names = "xin32k", "rk808-clkout2";
+ pinctrl-names = "default";
+@@ -567,7 +567,7 @@
+
+ pmic {
+ pmic_int_l: pmic-int-l {
+- rockchip,pins = <1 RK_PC5 RK_FUNC_GPIO &pcfg_pull_up>;
++ rockchip,pins = <3 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>;
+ };
+
+ vsel1_gpio: vsel1-gpio {
+--
+2.20.1
+
--- /dev/null
+From fcbd8bc72054c7d773951e80ff3d5bdfef59dcc6 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 3 Oct 2019 23:50:35 +0200
+Subject: arm64: dts: rockchip: fix RockPro64 sdhci settings
+
+From: Soeren Moch <smoch@web.de>
+
+[ Upstream commit 2558b3b1b11a1b32b336be2dd0aabfa6d35ddcb5 ]
+
+The RockPro64 schematics [1], [2] show that the rk3399 EMMC_STRB pin is
+connected to the RESET pin instead of the DATA_STROBE pin of the eMMC module.
+So the data strobe cannot be used for its intended purpose on this board,
+and so the HS400 eMMC mode is not functional. Limit the controller to HS200.
+
+[1] http://files.pine64.org/doc/rockpro64/rockpro64_v21-SCH.pdf
+[2] http://files.pine64.org/doc/rock64/PINE64_eMMC_Module_20170719.pdf
+
+Fixes: e4f3fb490967 ("arm64: dts: rockchip: add initial dts support for Rockpro64")
+Signed-off-by: Soeren Moch <smoch@web.de>
+Link: https://lore.kernel.org/r/20191003215036.15023-2-smoch@web.de
+Signed-off-by: Heiko Stuebner <heiko@sntech.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts
+index cad314f708300..1ff617230f6c4 100644
+--- a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts
++++ b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts
+@@ -625,8 +625,7 @@
+
+ &sdhci {
+ bus-width = <8>;
+- mmc-hs400-1_8v;
+- mmc-hs400-enhanced-strobe;
++ mmc-hs200-1_8v;
+ non-removable;
+ status = "okay";
+ };
+--
+2.20.1
+
--- /dev/null
+From abb050bfa41ace48e30f5e7c684cf6c9ba87cb3f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 4 Oct 2019 22:32:13 +0200
+Subject: arm64: dts: rockchip: fix RockPro64 sdmmc settings
+
+From: Soeren Moch <smoch@web.de>
+
+[ Upstream commit 5234c14531152702a9f3e575cb552b7e9cea9f94 ]
+
+According to the RockPro64 schematic [1] the rk3399 sdmmc controller is
+connected to a microSD (TF card) slot. Remove the cap-mmc-highspeed
+property of the sdmmc controller, since no mmc card can be connected here.
+
+[1] http://files.pine64.org/doc/rockpro64/rockpro64_v21-SCH.pdf
+
+Fixes: e4f3fb490967 ("arm64: dts: rockchip: add initial dts support for Rockpro64")
+Signed-off-by: Soeren Moch <smoch@web.de>
+Link: https://lore.kernel.org/r/20191004203213.4995-1-smoch@web.de
+Signed-off-by: Heiko Stuebner <heiko@sntech.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts
+index 1ff617230f6c4..99d65d2fca5e1 100644
+--- a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts
++++ b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts
+@@ -613,7 +613,6 @@
+
+ &sdmmc {
+ bus-width = <4>;
+- cap-mmc-highspeed;
+ cap-sd-highspeed;
+ cd-gpios = <&gpio0 7 GPIO_ACTIVE_LOW>;
+ disable-wp;
+--
+2.20.1
+
--- /dev/null
+From 9ec9acd3047f74cad909574649119445d154077f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 3 Oct 2019 23:50:34 +0200
+Subject: arm64: dts: rockchip: fix RockPro64 vdd-log regulator settings
+
+From: Soeren Moch <smoch@web.de>
+
+[ Upstream commit 0990c5e7573098117c69651821647c228483e31b ]
+
+The RockPro64 schematic [1] page 18 states a min voltage of 0.8V and a
+max voltage of 1.4V for the VDD_LOG pwm regulator. However, there is an
+additional note that the pwm parameter needs to be modified.
+From the schematics a voltage range of 0.8V to 1.7V can be calculated.
+Additional voltage measurements on the board show that this fix indeed
+leads to the correct voltage, while without this fix the voltage was set
+too high.
+
+[1] http://files.pine64.org/doc/rockpro64/rockpro64_v21-SCH.pdf
+
+Fixes: e4f3fb490967 ("arm64: dts: rockchip: add initial dts support for Rockpro64")
+Signed-off-by: Soeren Moch <smoch@web.de>
+Link: https://lore.kernel.org/r/20191003215036.15023-1-smoch@web.de
+Signed-off-by: Heiko Stuebner <heiko@sntech.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts
+index 5818b85255123..cad314f708300 100644
+--- a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts
++++ b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts
+@@ -166,7 +166,7 @@
+ regulator-always-on;
+ regulator-boot-on;
+ regulator-min-microvolt = <800000>;
+- regulator-max-microvolt = <1400000>;
++ regulator-max-microvolt = <1700000>;
+ vin-supply = <&vcc5v0_sys>;
+ };
+ };
+--
+2.20.1
+
--- /dev/null
+From 4f89949a20951d8f2ee3561d98e5156e14405ed0 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 28 Sep 2019 23:22:30 -0400
+Subject: arm64: dts: rockchip: Fix usb-c on Hugsun X99 TV Box
+
+From: Vivek Unune <npcomplete13@gmail.com>
+
+[ Upstream commit 389206e806d892d36de0df6e7b07721432957801 ]
+
+Fix usb-c on X99 TV Box. Tested with armbian w/ kernel 5.3
+
+Signed-off-by: Vivek Unune <npcomplete13@gmail.com>
+Link: https://lore.kernel.org/r/20190929032230.24628-1-npcomplete13@gmail.com
+Signed-off-by: Heiko Stuebner <heiko@sntech.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm64/boot/dts/rockchip/rk3399-hugsun-x99.dts | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/arch/arm64/boot/dts/rockchip/rk3399-hugsun-x99.dts b/arch/arm64/boot/dts/rockchip/rk3399-hugsun-x99.dts
+index 0d1f5f9a0de95..c133e8d64b2a3 100644
+--- a/arch/arm64/boot/dts/rockchip/rk3399-hugsun-x99.dts
++++ b/arch/arm64/boot/dts/rockchip/rk3399-hugsun-x99.dts
+@@ -644,7 +644,7 @@
+ status = "okay";
+
+ u2phy0_host: host-port {
+- phy-supply = <&vcc5v0_host>;
++ phy-supply = <&vcc5v0_typec>;
+ status = "okay";
+ };
+
+@@ -712,7 +712,7 @@
+
+ &usbdrd_dwc3_0 {
+ status = "okay";
+- dr_mode = "otg";
++ dr_mode = "host";
+ };
+
+ &usbdrd3_1 {
+--
+2.20.1
+
--- /dev/null
+From a2961e503f2fc496a87e72675ceb3d6ee9c16e84 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 6 Sep 2019 19:06:01 +0200
+Subject: arm64: dts: zii-ultra: fix ARM regulator states
+
+From: Lucas Stach <l.stach@pengutronix.de>
+
+[ Upstream commit 21094ba5c1f4b15df096e8f6247a50b6ab57c869 ]
+
+The GPIO controlled regulator for the ARM power supply is supplying
+the higher voltage when the GPIO is driven high. This is opposite to
+the similar regulator setup on the EVK board and is impacting stability
+of the board as the ARM domain has been supplied with a too low voltage
+when to faster OPPs are in use.
+
+Fixes: 4a13b3bec3b4 (arm64: dts: imx: add Zii Ultra board support)
+Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
+Signed-off-by: Shawn Guo <shawnguo@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm64/boot/dts/freescale/imx8mq-zii-ultra.dtsi | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/arch/arm64/boot/dts/freescale/imx8mq-zii-ultra.dtsi b/arch/arm64/boot/dts/freescale/imx8mq-zii-ultra.dtsi
+index 7a1706f969f09..3faa652fdf20d 100644
+--- a/arch/arm64/boot/dts/freescale/imx8mq-zii-ultra.dtsi
++++ b/arch/arm64/boot/dts/freescale/imx8mq-zii-ultra.dtsi
+@@ -101,8 +101,8 @@
+ regulator-min-microvolt = <900000>;
+ regulator-max-microvolt = <1000000>;
+ gpios = <&gpio3 19 GPIO_ACTIVE_HIGH>;
+- states = <1000000 0x0
+- 900000 0x1>;
++ states = <1000000 0x1
++ 900000 0x0>;
+ regulator-always-on;
+ };
+ };
+--
+2.20.1
+
--- /dev/null
+From 854d3a41d806e8ca1ee5e4230edf343bde9ab618 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 27 Sep 2019 15:14:05 -0500
+Subject: ASoC: intel: bytcr_rt5651: add null check to support_button_press
+
+From: Jaska Uimonen <jaska.uimonen@intel.com>
+
+[ Upstream commit 2bdf194e2030fce4f2e91300817338353414ab3b ]
+
+When removing sof module the support_button_press function will oops
+because hp_jack pointer is not checked for NULL. So add a check to fix
+this.
+
+Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20190927201408.925-2-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/codecs/rt5651.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/sound/soc/codecs/rt5651.c b/sound/soc/codecs/rt5651.c
+index 762595de956c1..c506c9305043e 100644
+--- a/sound/soc/codecs/rt5651.c
++++ b/sound/soc/codecs/rt5651.c
+@@ -1770,6 +1770,9 @@ static int rt5651_detect_headset(struct snd_soc_component *component)
+
+ static bool rt5651_support_button_press(struct rt5651_priv *rt5651)
+ {
++ if (!rt5651->hp_jack)
++ return false;
++
+ /* Button press support only works with internal jack-detection */
+ return (rt5651->hp_jack->status & SND_JACK_MICROPHONE) &&
+ rt5651->gpiod_hp_det == NULL;
+--
+2.20.1
+
--- /dev/null
+From c68822d703132fe31b33a8eac272cc9ce7671930 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 17 Oct 2019 10:50:44 +0800
+Subject: ASoC: Intel: sof-rt5682: add a check for devm_clk_get
+
+From: Chuhong Yuan <hslester96@gmail.com>
+
+[ Upstream commit e5f0d490fb718254a884453e47fcd48493cd67ea ]
+
+sof_audio_probe misses a check for devm_clk_get and may cause problems.
+Add a check for it to fix the bug.
+
+Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
+Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191017025044.31474-1-hslester96@gmail.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/intel/boards/sof_rt5682.c | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/sound/soc/intel/boards/sof_rt5682.c b/sound/soc/intel/boards/sof_rt5682.c
+index 239eef128c2b7..9e59586e03bac 100644
+--- a/sound/soc/intel/boards/sof_rt5682.c
++++ b/sound/soc/intel/boards/sof_rt5682.c
+@@ -573,6 +573,15 @@ static int sof_audio_probe(struct platform_device *pdev)
+ /* need to get main clock from pmc */
+ if (sof_rt5682_quirk & SOF_RT5682_MCLK_BYTCHT_EN) {
+ ctx->mclk = devm_clk_get(&pdev->dev, "pmc_plt_clk_3");
++ if (IS_ERR(ctx->mclk)) {
++ ret = PTR_ERR(ctx->mclk);
++
++ dev_err(&pdev->dev,
++ "Failed to get MCLK from pmc_plt_clk_3: %d\n",
++ ret);
++ return ret;
++ }
++
+ ret = clk_prepare_enable(ctx->mclk);
+ if (ret < 0) {
+ dev_err(&pdev->dev,
+--
+2.20.1
+
--- /dev/null
+From 292be58c65913c01d9f71a8a707e8ebcc9700d55 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 27 Sep 2019 15:14:08 -0500
+Subject: ASoC: intel: sof_rt5682: add remove function to disable jack
+
+From: Jaska Uimonen <jaska.uimonen@intel.com>
+
+[ Upstream commit 6ba5041c23c1062d4e8287b2b76a1181538c6df1 ]
+
+When removing sof module the rt5682 jack handler will oops
+if jack detection is not disabled. So add remove function,
+which disables the jack detection.
+
+Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20190927201408.925-5-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/intel/boards/sof_rt5682.c | 16 ++++++++++++++++
+ 1 file changed, 16 insertions(+)
+
+diff --git a/sound/soc/intel/boards/sof_rt5682.c b/sound/soc/intel/boards/sof_rt5682.c
+index daeaa396d9281..239eef128c2b7 100644
+--- a/sound/soc/intel/boards/sof_rt5682.c
++++ b/sound/soc/intel/boards/sof_rt5682.c
+@@ -618,8 +618,24 @@ static int sof_audio_probe(struct platform_device *pdev)
+ &sof_audio_card_rt5682);
+ }
+
++static int sof_rt5682_remove(struct platform_device *pdev)
++{
++ struct snd_soc_card *card = platform_get_drvdata(pdev);
++ struct snd_soc_component *component = NULL;
++
++ for_each_card_components(card, component) {
++ if (!strcmp(component->name, rt5682_component[0].name)) {
++ snd_soc_component_set_jack(component, NULL, NULL);
++ break;
++ }
++ }
++
++ return 0;
++}
++
+ static struct platform_driver sof_audio = {
+ .probe = sof_audio_probe,
++ .remove = sof_rt5682_remove,
+ .driver = {
+ .name = "sof_rt5682",
+ .pm = &snd_soc_pm_ops,
+--
+2.20.1
+
--- /dev/null
+From f45f5bb3f0ad2bb914b0ce0f303a871f5c72f8cf Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 9 Oct 2019 12:19:44 +0100
+Subject: ASoC: msm8916-wcd-digital: add missing MIX2 path for RX1/2
+
+From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
+
+[ Upstream commit bcab05880f9306e94531b0009c627421db110a74 ]
+
+This patch adds missing MIX2 path on RX1/2 which take IIR1 and
+IIR2 as inputs.
+
+Without this patch sound card fails to intialize with below warning:
+
+ ASoC: no sink widget found for RX1 MIX2 INP1
+ ASoC: Failed to add route IIR1 -> IIR1 -> RX1 MIX2 INP1
+ ASoC: no sink widget found for RX2 MIX2 INP1
+ ASoC: Failed to add route IIR1 -> IIR1 -> RX2 MIX2 INP1
+ ASoC: no sink widget found for RX1 MIX2 INP1
+ ASoC: Failed to add route IIR2 -> IIR2 -> RX1 MIX2 INP1
+ ASoC: no sink widget found for RX2 MIX2 INP1
+ ASoC: Failed to add route IIR2 -> IIR2 -> RX2 MIX2 INP1
+
+Reported-by: Stephan Gerhold <stephan@gerhold.net>
+Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
+Tested-by: Stephan Gerhold <stephan@gerhold.net>
+Link: https://lore.kernel.org/r/20191009111944.28069-1-srinivas.kandagatla@linaro.org
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/codecs/msm8916-wcd-digital.c | 22 ++++++++++++++++++++++
+ 1 file changed, 22 insertions(+)
+
+diff --git a/sound/soc/codecs/msm8916-wcd-digital.c b/sound/soc/codecs/msm8916-wcd-digital.c
+index 1db7e43ec203e..5963d170df432 100644
+--- a/sound/soc/codecs/msm8916-wcd-digital.c
++++ b/sound/soc/codecs/msm8916-wcd-digital.c
+@@ -243,6 +243,10 @@ static const char *const rx_mix1_text[] = {
+ "ZERO", "IIR1", "IIR2", "RX1", "RX2", "RX3"
+ };
+
++static const char * const rx_mix2_text[] = {
++ "ZERO", "IIR1", "IIR2"
++};
++
+ static const char *const dec_mux_text[] = {
+ "ZERO", "ADC1", "ADC2", "ADC3", "DMIC1", "DMIC2"
+ };
+@@ -270,6 +274,16 @@ static const struct soc_enum rx3_mix1_inp_enum[] = {
+ SOC_ENUM_SINGLE(LPASS_CDC_CONN_RX3_B2_CTL, 0, 6, rx_mix1_text),
+ };
+
++/* RX1 MIX2 */
++static const struct soc_enum rx_mix2_inp1_chain_enum =
++ SOC_ENUM_SINGLE(LPASS_CDC_CONN_RX1_B3_CTL,
++ 0, 3, rx_mix2_text);
++
++/* RX2 MIX2 */
++static const struct soc_enum rx2_mix2_inp1_chain_enum =
++ SOC_ENUM_SINGLE(LPASS_CDC_CONN_RX2_B3_CTL,
++ 0, 3, rx_mix2_text);
++
+ /* DEC */
+ static const struct soc_enum dec1_mux_enum = SOC_ENUM_SINGLE(
+ LPASS_CDC_CONN_TX_B1_CTL, 0, 6, dec_mux_text);
+@@ -309,6 +323,10 @@ static const struct snd_kcontrol_new rx3_mix1_inp2_mux = SOC_DAPM_ENUM(
+ "RX3 MIX1 INP2 Mux", rx3_mix1_inp_enum[1]);
+ static const struct snd_kcontrol_new rx3_mix1_inp3_mux = SOC_DAPM_ENUM(
+ "RX3 MIX1 INP3 Mux", rx3_mix1_inp_enum[2]);
++static const struct snd_kcontrol_new rx1_mix2_inp1_mux = SOC_DAPM_ENUM(
++ "RX1 MIX2 INP1 Mux", rx_mix2_inp1_chain_enum);
++static const struct snd_kcontrol_new rx2_mix2_inp1_mux = SOC_DAPM_ENUM(
++ "RX2 MIX2 INP1 Mux", rx2_mix2_inp1_chain_enum);
+
+ /* Digital Gain control -38.4 dB to +38.4 dB in 0.3 dB steps */
+ static const DECLARE_TLV_DB_SCALE(digital_gain, -3840, 30, 0);
+@@ -740,6 +758,10 @@ static const struct snd_soc_dapm_widget msm8916_wcd_digital_dapm_widgets[] = {
+ &rx3_mix1_inp2_mux),
+ SND_SOC_DAPM_MUX("RX3 MIX1 INP3", SND_SOC_NOPM, 0, 0,
+ &rx3_mix1_inp3_mux),
++ SND_SOC_DAPM_MUX("RX1 MIX2 INP1", SND_SOC_NOPM, 0, 0,
++ &rx1_mix2_inp1_mux),
++ SND_SOC_DAPM_MUX("RX2 MIX2 INP1", SND_SOC_NOPM, 0, 0,
++ &rx2_mix2_inp1_mux),
+
+ SND_SOC_DAPM_MUX("CIC1 MUX", SND_SOC_NOPM, 0, 0, &cic1_mux),
+ SND_SOC_DAPM_MUX("CIC2 MUX", SND_SOC_NOPM, 0, 0, &cic2_mux),
+--
+2.20.1
+
--- /dev/null
+From 82a8fa06232f8efe10dfec76510fa8204e314694 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 2 Oct 2019 16:30:37 +0100
+Subject: ASoc: rockchip: i2s: Fix RPM imbalance
+
+From: Robin Murphy <robin.murphy@arm.com>
+
+[ Upstream commit b1e620e7d32f5aad5353cc3cfc13ed99fea65d3a ]
+
+If rockchip_pcm_platform_register() fails, e.g. upon deferring to wait
+for an absent DMA channel, we return without disabling RPM, which makes
+subsequent re-probe attempts scream with errors about the unbalanced
+enable. Don't do that.
+
+Fixes: ebb75c0bdba2 ("ASoC: rockchip: i2s: Adjust devm usage")
+Signed-off-by: Robin Murphy <robin.murphy@arm.com>
+Link: https://lore.kernel.org/r/bcb12a849a05437fb18372bc7536c649b94bdf07.1570029862.git.robin.murphy@arm.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/rockchip/rockchip_i2s.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c
+index 88ebaf6e1880a..a0506e554c98b 100644
+--- a/sound/soc/rockchip/rockchip_i2s.c
++++ b/sound/soc/rockchip/rockchip_i2s.c
+@@ -674,7 +674,7 @@ static int rockchip_i2s_probe(struct platform_device *pdev)
+ ret = rockchip_pcm_platform_register(&pdev->dev);
+ if (ret) {
+ dev_err(&pdev->dev, "Could not register PCM\n");
+- return ret;
++ goto err_suspend;
+ }
+
+ return 0;
+--
+2.20.1
+
--- /dev/null
+From 83e22c13afffc983ca125ef85fadeb81caf998c5 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 27 Sep 2019 15:14:07 -0500
+Subject: ASoC: rt5682: add NULL handler to set_jack function
+
+From: Jaska Uimonen <jaska.uimonen@intel.com>
+
+[ Upstream commit a315e76fc544f09daf619530a7b2f85865e6b25e ]
+
+Implement NULL handler in set_jack function to disable
+irq's.
+
+Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20190927201408.925-4-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/codecs/rt5682.c | 12 ++++++++++--
+ 1 file changed, 10 insertions(+), 2 deletions(-)
+
+diff --git a/sound/soc/codecs/rt5682.c b/sound/soc/codecs/rt5682.c
+index 1ef470700ed5f..c50b75ce82e0b 100644
+--- a/sound/soc/codecs/rt5682.c
++++ b/sound/soc/codecs/rt5682.c
+@@ -995,6 +995,16 @@ static int rt5682_set_jack_detect(struct snd_soc_component *component,
+ {
+ struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component);
+
++ rt5682->hs_jack = hs_jack;
++
++ if (!hs_jack) {
++ regmap_update_bits(rt5682->regmap, RT5682_IRQ_CTRL_2,
++ RT5682_JD1_EN_MASK, RT5682_JD1_DIS);
++ regmap_update_bits(rt5682->regmap, RT5682_RC_CLK_CTRL,
++ RT5682_POW_JDH | RT5682_POW_JDL, 0);
++ return 0;
++ }
++
+ switch (rt5682->pdata.jd_src) {
+ case RT5682_JD1:
+ snd_soc_component_update_bits(component, RT5682_CBJ_CTRL_2,
+@@ -1032,8 +1042,6 @@ static int rt5682_set_jack_detect(struct snd_soc_component *component,
+ break;
+ }
+
+- rt5682->hs_jack = hs_jack;
+-
+ return 0;
+ }
+
+--
+2.20.1
+
--- /dev/null
+From 53aace82892ed73a628f4e0fa3fcb10f22c80b25 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 20 Sep 2019 15:02:11 +0200
+Subject: ASoC: samsung: arndale: Add missing OF node dereferencing
+
+From: Sylwester Nawrocki <s.nawrocki@samsung.com>
+
+[ Upstream commit fb629fa2587d0c150792d87e3053664bfc8dc78c ]
+
+Ensure there is no OF node references kept when the driver
+is removed/unbound.
+
+Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
+Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
+Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
+Link: https://lore.kernel.org/r/20190920130218.32690-3-s.nawrocki@samsung.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/samsung/arndale_rt5631.c | 34 ++++++++++++++++++++++++++----
+ 1 file changed, 30 insertions(+), 4 deletions(-)
+
+diff --git a/sound/soc/samsung/arndale_rt5631.c b/sound/soc/samsung/arndale_rt5631.c
+index c213913eb9848..fd8c6642fb0df 100644
+--- a/sound/soc/samsung/arndale_rt5631.c
++++ b/sound/soc/samsung/arndale_rt5631.c
+@@ -5,6 +5,7 @@
+ // Author: Claude <claude@insginal.co.kr>
+
+ #include <linux/module.h>
++#include <linux/of_device.h>
+ #include <linux/platform_device.h>
+ #include <linux/clk.h>
+
+@@ -74,6 +75,17 @@ static struct snd_soc_card arndale_rt5631 = {
+ .num_links = ARRAY_SIZE(arndale_rt5631_dai),
+ };
+
++static void arndale_put_of_nodes(struct snd_soc_card *card)
++{
++ struct snd_soc_dai_link *dai_link;
++ int i;
++
++ for_each_card_prelinks(card, i, dai_link) {
++ of_node_put(dai_link->cpus->of_node);
++ of_node_put(dai_link->codecs->of_node);
++ }
++}
++
+ static int arndale_audio_probe(struct platform_device *pdev)
+ {
+ int n, ret;
+@@ -103,18 +115,31 @@ static int arndale_audio_probe(struct platform_device *pdev)
+ if (!arndale_rt5631_dai[0].codecs->of_node) {
+ dev_err(&pdev->dev,
+ "Property 'samsung,audio-codec' missing or invalid\n");
+- return -EINVAL;
++ ret = -EINVAL;
++ goto err_put_of_nodes;
+ }
+ }
+
+ ret = devm_snd_soc_register_card(card->dev, card);
++ if (ret) {
++ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret);
++ goto err_put_of_nodes;
++ }
++ return 0;
+
+- if (ret)
+- dev_err(&pdev->dev, "snd_soc_register_card() failed:%d\n", ret);
+-
++err_put_of_nodes:
++ arndale_put_of_nodes(card);
+ return ret;
+ }
+
++static int arndale_audio_remove(struct platform_device *pdev)
++{
++ struct snd_soc_card *card = platform_get_drvdata(pdev);
++
++ arndale_put_of_nodes(card);
++ return 0;
++}
++
+ static const struct of_device_id samsung_arndale_rt5631_of_match[] __maybe_unused = {
+ { .compatible = "samsung,arndale-rt5631", },
+ { .compatible = "samsung,arndale-alc5631", },
+@@ -129,6 +154,7 @@ static struct platform_driver arndale_audio_driver = {
+ .of_match_table = of_match_ptr(samsung_arndale_rt5631_of_match),
+ },
+ .probe = arndale_audio_probe,
++ .remove = arndale_audio_remove,
+ };
+
+ module_platform_driver(arndale_audio_driver);
+--
+2.20.1
+
--- /dev/null
+From 9a8e8de9239ceeffa3f69adcda97c7e653c5a4f2 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 9 Oct 2019 18:36:15 +0300
+Subject: ASoC: simple_card_utils.h: Fix potential multiple redefinition error
+
+From: Daniel Baluta <daniel.baluta@nxp.com>
+
+[ Upstream commit af6219590b541418d3192e9bfa03989834ca0e78 ]
+
+asoc_simple_debug_info and asoc_simple_debug_dai must be static
+otherwise we might a compilation error if the compiler decides
+not to inline the given function.
+
+Fixes: 0580dde59438686d ("ASoC: simple-card-utils: add asoc_simple_debug_info()")
+Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
+Link: https://lore.kernel.org/r/20191009153615.32105-3-daniel.baluta@nxp.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/sound/simple_card_utils.h | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/include/sound/simple_card_utils.h b/include/sound/simple_card_utils.h
+index 985a5f583de4c..31f76b6abf712 100644
+--- a/include/sound/simple_card_utils.h
++++ b/include/sound/simple_card_utils.h
+@@ -135,9 +135,9 @@ int asoc_simple_init_priv(struct asoc_simple_priv *priv,
+ struct link_info *li);
+
+ #ifdef DEBUG
+-inline void asoc_simple_debug_dai(struct asoc_simple_priv *priv,
+- char *name,
+- struct asoc_simple_dai *dai)
++static inline void asoc_simple_debug_dai(struct asoc_simple_priv *priv,
++ char *name,
++ struct asoc_simple_dai *dai)
+ {
+ struct device *dev = simple_priv_to_dev(priv);
+
+@@ -167,7 +167,7 @@ inline void asoc_simple_debug_dai(struct asoc_simple_priv *priv,
+ dev_dbg(dev, "%s clk %luHz\n", name, clk_get_rate(dai->clk));
+ }
+
+-inline void asoc_simple_debug_info(struct asoc_simple_priv *priv)
++static inline void asoc_simple_debug_info(struct asoc_simple_priv *priv)
+ {
+ struct snd_soc_card *card = simple_priv_to_card(priv);
+ struct device *dev = simple_priv_to_dev(priv);
+--
+2.20.1
+
--- /dev/null
+From b82936b83abe76fc8c939a884b67795f48c8a4ec Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 18 Oct 2019 07:38:06 -0500
+Subject: ASoC: SOF: control: return true when kcontrol values change
+
+From: Dragos Tarcatu <dragos_tarcatu@mentor.com>
+
+[ Upstream commit 95a32c98055f664f9b3f34c41e153d4dcedd0eff ]
+
+All the kcontrol put() functions are currently returning 0 when
+successful. This does not go well with alsamixer as it does
+not seem to get notified on SND_CTL_EVENT_MASK_VALUE callbacks
+when values change for (some of) the sof kcontrols.
+This patch fixes that by returning true for volume, switch
+and enum type kcontrols when values do change in put().
+
+Signed-off-by: Dragos Tarcatu <dragos_tarcatu@mentor.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191018123806.18063-1-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/sof/control.c | 26 ++++++++++++++++++--------
+ 1 file changed, 18 insertions(+), 8 deletions(-)
+
+diff --git a/sound/soc/sof/control.c b/sound/soc/sof/control.c
+index a4983f90ff5b3..2b8711eda362b 100644
+--- a/sound/soc/sof/control.c
++++ b/sound/soc/sof/control.c
+@@ -60,13 +60,16 @@ int snd_sof_volume_put(struct snd_kcontrol *kcontrol,
+ struct snd_sof_dev *sdev = scontrol->sdev;
+ struct sof_ipc_ctrl_data *cdata = scontrol->control_data;
+ unsigned int i, channels = scontrol->num_channels;
++ bool change = false;
++ u32 value;
+
+ /* update each channel */
+ for (i = 0; i < channels; i++) {
+- cdata->chanv[i].value =
+- mixer_to_ipc(ucontrol->value.integer.value[i],
++ value = mixer_to_ipc(ucontrol->value.integer.value[i],
+ scontrol->volume_table, sm->max + 1);
++ change = change || (value != cdata->chanv[i].value);
+ cdata->chanv[i].channel = i;
++ cdata->chanv[i].value = value;
+ }
+
+ /* notify DSP of mixer updates */
+@@ -76,8 +79,7 @@ int snd_sof_volume_put(struct snd_kcontrol *kcontrol,
+ SOF_CTRL_TYPE_VALUE_CHAN_GET,
+ SOF_CTRL_CMD_VOLUME,
+ true);
+-
+- return 0;
++ return change;
+ }
+
+ int snd_sof_switch_get(struct snd_kcontrol *kcontrol,
+@@ -105,11 +107,15 @@ int snd_sof_switch_put(struct snd_kcontrol *kcontrol,
+ struct snd_sof_dev *sdev = scontrol->sdev;
+ struct sof_ipc_ctrl_data *cdata = scontrol->control_data;
+ unsigned int i, channels = scontrol->num_channels;
++ bool change = false;
++ u32 value;
+
+ /* update each channel */
+ for (i = 0; i < channels; i++) {
+- cdata->chanv[i].value = ucontrol->value.integer.value[i];
++ value = ucontrol->value.integer.value[i];
++ change = change || (value != cdata->chanv[i].value);
+ cdata->chanv[i].channel = i;
++ cdata->chanv[i].value = value;
+ }
+
+ /* notify DSP of mixer updates */
+@@ -120,7 +126,7 @@ int snd_sof_switch_put(struct snd_kcontrol *kcontrol,
+ SOF_CTRL_CMD_SWITCH,
+ true);
+
+- return 0;
++ return change;
+ }
+
+ int snd_sof_enum_get(struct snd_kcontrol *kcontrol,
+@@ -148,11 +154,15 @@ int snd_sof_enum_put(struct snd_kcontrol *kcontrol,
+ struct snd_sof_dev *sdev = scontrol->sdev;
+ struct sof_ipc_ctrl_data *cdata = scontrol->control_data;
+ unsigned int i, channels = scontrol->num_channels;
++ bool change = false;
++ u32 value;
+
+ /* update each channel */
+ for (i = 0; i < channels; i++) {
+- cdata->chanv[i].value = ucontrol->value.enumerated.item[i];
++ value = ucontrol->value.enumerated.item[i];
++ change = change || (value != cdata->chanv[i].value);
+ cdata->chanv[i].channel = i;
++ cdata->chanv[i].value = value;
+ }
+
+ /* notify DSP of enum updates */
+@@ -163,7 +173,7 @@ int snd_sof_enum_put(struct snd_kcontrol *kcontrol,
+ SOF_CTRL_CMD_ENUM,
+ true);
+
+- return 0;
++ return change;
+ }
+
+ int snd_sof_bytes_get(struct snd_kcontrol *kcontrol,
+--
+2.20.1
+
--- /dev/null
+From f9be29b2bfdc47a5006e492b109fc82942da7e0b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 27 Sep 2019 15:05:38 -0500
+Subject: ASoC: SOF: Intel: hda: Disable DMI L1 entry during capture
+
+From: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
+
+[ Upstream commit 43b2ab9009b13bfff47fcc1893de9244b39bdd54 ]
+
+There is a known issue on some Intel platforms which causes
+pause/release to run into xrun's during capture usecases.
+The suggested workaround to address the issue is to
+disable the entry of lower power L1 state in the physical
+DMI link when there is a capture stream open.
+
+Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20190927200538.660-14-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/sof/intel/Kconfig | 10 +++++++
+ sound/soc/sof/intel/hda-ctrl.c | 12 +++------
+ sound/soc/sof/intel/hda-stream.c | 45 +++++++++++++++++++++++++++-----
+ sound/soc/sof/intel/hda.h | 5 +++-
+ 4 files changed, 56 insertions(+), 16 deletions(-)
+
+diff --git a/sound/soc/sof/intel/Kconfig b/sound/soc/sof/intel/Kconfig
+index dd14ce92fe102..a5fd356776ee9 100644
+--- a/sound/soc/sof/intel/Kconfig
++++ b/sound/soc/sof/intel/Kconfig
+@@ -241,6 +241,16 @@ config SND_SOC_SOF_HDA_AUDIO_CODEC
+ Say Y if you want to enable HDAudio codecs with SOF.
+ If unsure select "N".
+
++config SND_SOC_SOF_HDA_ALWAYS_ENABLE_DMI_L1
++ bool "SOF enable DMI Link L1"
++ help
++ This option enables DMI L1 for both playback and capture
++ and disables known workarounds for specific HDaudio platforms.
++ Only use to look into power optimizations on platforms not
++ affected by DMI L1 issues. This option is not recommended.
++ Say Y if you want to enable DMI Link L1
++ If unsure, select "N".
++
+ endif ## SND_SOC_SOF_HDA_COMMON
+
+ config SND_SOC_SOF_HDA_LINK_BASELINE
+diff --git a/sound/soc/sof/intel/hda-ctrl.c b/sound/soc/sof/intel/hda-ctrl.c
+index ea63f83a509bb..760094d49f18f 100644
+--- a/sound/soc/sof/intel/hda-ctrl.c
++++ b/sound/soc/sof/intel/hda-ctrl.c
+@@ -139,20 +139,16 @@ void hda_dsp_ctrl_misc_clock_gating(struct snd_sof_dev *sdev, bool enable)
+ */
+ int hda_dsp_ctrl_clock_power_gating(struct snd_sof_dev *sdev, bool enable)
+ {
+-#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA)
+- struct hdac_bus *bus = sof_to_bus(sdev);
+-#endif
+ u32 val;
+
+ /* enable/disable audio dsp clock gating */
+ val = enable ? PCI_CGCTL_ADSPDCGE : 0;
+ snd_sof_pci_update_bits(sdev, PCI_CGCTL, PCI_CGCTL_ADSPDCGE, val);
+
+-#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA)
+- /* enable/disable L1 support */
+- val = enable ? SOF_HDA_VS_EM2_L1SEN : 0;
+- snd_hdac_chip_updatel(bus, VS_EM2, SOF_HDA_VS_EM2_L1SEN, val);
+-#endif
++ /* enable/disable DMI Link L1 support */
++ val = enable ? HDA_VS_INTEL_EM2_L1SEN : 0;
++ snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR, HDA_VS_INTEL_EM2,
++ HDA_VS_INTEL_EM2_L1SEN, val);
+
+ /* enable/disable audio dsp power gating */
+ val = enable ? 0 : PCI_PGCTL_ADSPPGD;
+diff --git a/sound/soc/sof/intel/hda-stream.c b/sound/soc/sof/intel/hda-stream.c
+index ad8d41f22e92d..2c74471884025 100644
+--- a/sound/soc/sof/intel/hda-stream.c
++++ b/sound/soc/sof/intel/hda-stream.c
+@@ -185,6 +185,17 @@ hda_dsp_stream_get(struct snd_sof_dev *sdev, int direction)
+ direction == SNDRV_PCM_STREAM_PLAYBACK ?
+ "playback" : "capture");
+
++ /*
++ * Disable DMI Link L1 entry when capture stream is opened.
++ * Workaround to address a known issue with host DMA that results
++ * in xruns during pause/release in capture scenarios.
++ */
++ if (!IS_ENABLED(SND_SOC_SOF_HDA_ALWAYS_ENABLE_DMI_L1))
++ if (stream && direction == SNDRV_PCM_STREAM_CAPTURE)
++ snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR,
++ HDA_VS_INTEL_EM2,
++ HDA_VS_INTEL_EM2_L1SEN, 0);
++
+ return stream;
+ }
+
+@@ -193,23 +204,43 @@ int hda_dsp_stream_put(struct snd_sof_dev *sdev, int direction, int stream_tag)
+ {
+ struct hdac_bus *bus = sof_to_bus(sdev);
+ struct hdac_stream *s;
++ bool active_capture_stream = false;
++ bool found = false;
+
+ spin_lock_irq(&bus->reg_lock);
+
+- /* find used stream */
++ /*
++ * close stream matching the stream tag
++ * and check if there are any open capture streams.
++ */
+ list_for_each_entry(s, &bus->stream_list, list) {
+- if (s->direction == direction &&
+- s->opened && s->stream_tag == stream_tag) {
++ if (!s->opened)
++ continue;
++
++ if (s->direction == direction && s->stream_tag == stream_tag) {
+ s->opened = false;
+- spin_unlock_irq(&bus->reg_lock);
+- return 0;
++ found = true;
++ } else if (s->direction == SNDRV_PCM_STREAM_CAPTURE) {
++ active_capture_stream = true;
+ }
+ }
+
+ spin_unlock_irq(&bus->reg_lock);
+
+- dev_dbg(sdev->dev, "stream_tag %d not opened!\n", stream_tag);
+- return -ENODEV;
++ /* Enable DMI L1 entry if there are no capture streams open */
++ if (!IS_ENABLED(SND_SOC_SOF_HDA_ALWAYS_ENABLE_DMI_L1))
++ if (!active_capture_stream)
++ snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR,
++ HDA_VS_INTEL_EM2,
++ HDA_VS_INTEL_EM2_L1SEN,
++ HDA_VS_INTEL_EM2_L1SEN);
++
++ if (!found) {
++ dev_dbg(sdev->dev, "stream_tag %d not opened!\n", stream_tag);
++ return -ENODEV;
++ }
++
++ return 0;
+ }
+
+ int hda_dsp_stream_trigger(struct snd_sof_dev *sdev,
+diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h
+index d9c17146200b3..2cc789f0e83c4 100644
+--- a/sound/soc/sof/intel/hda.h
++++ b/sound/soc/sof/intel/hda.h
+@@ -39,7 +39,6 @@
+ #define SOF_HDA_WAKESTS 0x0E
+ #define SOF_HDA_WAKESTS_INT_MASK ((1 << 8) - 1)
+ #define SOF_HDA_RIRBSTS 0x5d
+-#define SOF_HDA_VS_EM2_L1SEN BIT(13)
+
+ /* SOF_HDA_GCTL register bist */
+ #define SOF_HDA_GCTL_RESET BIT(0)
+@@ -228,6 +227,10 @@
+ #define HDA_DSP_REG_HIPCIE (HDA_DSP_IPC_BASE + 0x0C)
+ #define HDA_DSP_REG_HIPCCTL (HDA_DSP_IPC_BASE + 0x10)
+
++/* Intel Vendor Specific Registers */
++#define HDA_VS_INTEL_EM2 0x1030
++#define HDA_VS_INTEL_EM2_L1SEN BIT(13)
++
+ /* HIPCI */
+ #define HDA_DSP_REG_HIPCI_BUSY BIT(31)
+ #define HDA_DSP_REG_HIPCI_MSG_MASK 0x7FFFFFFF
+--
+2.20.1
+
--- /dev/null
+From 81d9f3f0d593e6000d7068f6e204a893e2a612f4 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 27 Sep 2019 15:05:35 -0500
+Subject: ASoC: SOF: Intel: hda: fix warnings during FW load
+
+From: Kai Vehmanen <kai.vehmanen@linux.intel.com>
+
+[ Upstream commit 4ff5f6439fe69624e8f7d559915e9b54a6477684 ]
+
+The "snd_pcm_substream" handle was not initialized properly
+in hda-loader.c for firmware load.
+
+When the HDA DMAs were used to load the firmware,
+the interrupts related to firmware load also triggered
+calls to snd_sof_pcm_period_elapsed() on a non-existent ALSA
+PCM stream.
+
+This caused runtime kernel warnings from
+pcm_lib.c:snd_pcm_period_elapsed().
+
+Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20190927200538.660-11-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/sof/intel/hda-loader.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/sound/soc/sof/intel/hda-loader.c b/sound/soc/sof/intel/hda-loader.c
+index 6427f0b3a2f11..65c2af3fcaab7 100644
+--- a/sound/soc/sof/intel/hda-loader.c
++++ b/sound/soc/sof/intel/hda-loader.c
+@@ -44,6 +44,7 @@ static int cl_stream_prepare(struct snd_sof_dev *sdev, unsigned int format,
+ return -ENODEV;
+ }
+ hstream = &dsp_stream->hstream;
++ hstream->substream = NULL;
+
+ /* allocate DMA buffer */
+ ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV_SG, &pci->dev, size, dmab);
+--
+2.20.1
+
--- /dev/null
+From 9df6f2ec9a68eeeee98bfc79c8727022b59489a8 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 27 Sep 2019 15:05:36 -0500
+Subject: ASoC: SOF: Intel: initialise and verify FW crash dump data.
+
+From: Liam Girdwood <liam.r.girdwood@linux.intel.com>
+
+[ Upstream commit ff2be865633e6fa523cd2db3b73197d795dec991 ]
+
+FW mailbox offset was not set before use and HDR size was not validated.
+Fix this.
+
+Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20190927200538.660-12-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/sof/intel/bdw.c | 7 +++++++
+ sound/soc/sof/intel/byt.c | 6 ++++++
+ sound/soc/sof/intel/hda.c | 7 +++++++
+ 3 files changed, 20 insertions(+)
+
+diff --git a/sound/soc/sof/intel/bdw.c b/sound/soc/sof/intel/bdw.c
+index 70d524ef9bc07..0ca3c1b55eeb1 100644
+--- a/sound/soc/sof/intel/bdw.c
++++ b/sound/soc/sof/intel/bdw.c
+@@ -37,6 +37,7 @@
+ #define MBOX_SIZE 0x1000
+ #define MBOX_DUMP_SIZE 0x30
+ #define EXCEPT_OFFSET 0x800
++#define EXCEPT_MAX_HDR_SIZE 0x400
+
+ /* DSP peripherals */
+ #define DMAC0_OFFSET 0xFE000
+@@ -228,6 +229,11 @@ static void bdw_get_registers(struct snd_sof_dev *sdev,
+ /* note: variable AR register array is not read */
+
+ /* then get panic info */
++ if (xoops->arch_hdr.totalsize > EXCEPT_MAX_HDR_SIZE) {
++ dev_err(sdev->dev, "invalid header size 0x%x. FW oops is bogus\n",
++ xoops->arch_hdr.totalsize);
++ return;
++ }
+ offset += xoops->arch_hdr.totalsize;
+ sof_mailbox_read(sdev, offset, panic_info, sizeof(*panic_info));
+
+@@ -588,6 +594,7 @@ static int bdw_probe(struct snd_sof_dev *sdev)
+ /* TODO: add offsets */
+ sdev->mmio_bar = BDW_DSP_BAR;
+ sdev->mailbox_bar = BDW_DSP_BAR;
++ sdev->dsp_oops_offset = MBOX_OFFSET;
+
+ /* PCI base */
+ mmio = platform_get_resource(pdev, IORESOURCE_MEM,
+diff --git a/sound/soc/sof/intel/byt.c b/sound/soc/sof/intel/byt.c
+index 107d711efc3f0..96faaa8fa5a3a 100644
+--- a/sound/soc/sof/intel/byt.c
++++ b/sound/soc/sof/intel/byt.c
+@@ -28,6 +28,7 @@
+ #define MBOX_OFFSET 0x144000
+ #define MBOX_SIZE 0x1000
+ #define EXCEPT_OFFSET 0x800
++#define EXCEPT_MAX_HDR_SIZE 0x400
+
+ /* DSP peripherals */
+ #define DMAC0_OFFSET 0x098000
+@@ -273,6 +274,11 @@ static void byt_get_registers(struct snd_sof_dev *sdev,
+ /* note: variable AR register array is not read */
+
+ /* then get panic info */
++ if (xoops->arch_hdr.totalsize > EXCEPT_MAX_HDR_SIZE) {
++ dev_err(sdev->dev, "invalid header size 0x%x. FW oops is bogus\n",
++ xoops->arch_hdr.totalsize);
++ return;
++ }
+ offset += xoops->arch_hdr.totalsize;
+ sof_mailbox_read(sdev, offset, panic_info, sizeof(*panic_info));
+
+diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c
+index 7f665392618f6..f2d45d62dfa56 100644
+--- a/sound/soc/sof/intel/hda.c
++++ b/sound/soc/sof/intel/hda.c
+@@ -37,6 +37,8 @@
+ #define IS_CFL(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0xa348)
+ #define IS_CNL(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x9dc8)
+
++#define EXCEPT_MAX_HDR_SIZE 0x400
++
+ /*
+ * Debug
+ */
+@@ -121,6 +123,11 @@ static void hda_dsp_get_registers(struct snd_sof_dev *sdev,
+ /* note: variable AR register array is not read */
+
+ /* then get panic info */
++ if (xoops->arch_hdr.totalsize > EXCEPT_MAX_HDR_SIZE) {
++ dev_err(sdev->dev, "invalid header size 0x%x. FW oops is bogus\n",
++ xoops->arch_hdr.totalsize);
++ return;
++ }
+ offset += xoops->arch_hdr.totalsize;
+ sof_block_read(sdev, sdev->mmio_bar, offset,
+ panic_info, sizeof(*panic_info));
+--
+2.20.1
+
--- /dev/null
+From f59c003dcd9be4bbe1e7f8d29db5fa1ce01ec158 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 27 Sep 2019 15:05:26 -0500
+Subject: ASoC: SOF: loader: fix kernel oops on firmware boot failure
+
+From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+
+[ Upstream commit 798614885a0e1b867ceb0197c30c2d82575c73b0 ]
+
+When we fail to boot the firmware, we encounter a kernel oops in
+hda_dsp_get_registers(), which is called conditionally in
+hda_dsp_dump() when the sdev_>boot_complete flag is set.
+
+Setting this flag _after_ dumping the data fixes the issue and does
+not change the programming flow.
+
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20190927200538.660-2-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/sof/loader.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/sound/soc/sof/loader.c b/sound/soc/sof/loader.c
+index 952a19091c582..01775231f2b8d 100644
+--- a/sound/soc/sof/loader.c
++++ b/sound/soc/sof/loader.c
+@@ -370,10 +370,10 @@ int snd_sof_run_firmware(struct snd_sof_dev *sdev)
+ msecs_to_jiffies(sdev->boot_timeout));
+ if (ret == 0) {
+ dev_err(sdev->dev, "error: firmware boot failure\n");
+- /* after this point FW_READY msg should be ignored */
+- sdev->boot_complete = true;
+ snd_sof_dsp_dbg_dump(sdev, SOF_DBG_REGS | SOF_DBG_MBOX |
+ SOF_DBG_TEXT | SOF_DBG_PCI);
++ /* after this point FW_READY msg should be ignored */
++ sdev->boot_complete = true;
+ return -EIO;
+ }
+
+--
+2.20.1
+
--- /dev/null
+From 2dc99ef33a58412aaeb97afaa50db11e08577062 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 27 Sep 2019 15:05:27 -0500
+Subject: ASoC: SOF: topology: fix parse fail issue for byte/bool tuple types
+
+From: Keyon Jie <yang.jie@linux.intel.com>
+
+[ Upstream commit 2e305a074061121220a2828f97a57d315cf8efba ]
+
+We are using sof_parse_word_tokens() to parse tokens with
+bool/byte/short/word tuple types, here add the missing check, to fix the
+parsing failure at byte/bool tuple types.
+
+Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20190927200538.660-3-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/sof/topology.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c
+index 432ae343f9602..96230329e678f 100644
+--- a/sound/soc/sof/topology.c
++++ b/sound/soc/sof/topology.c
+@@ -907,7 +907,9 @@ static void sof_parse_word_tokens(struct snd_soc_component *scomp,
+ for (j = 0; j < count; j++) {
+ /* match token type */
+ if (!(tokens[j].type == SND_SOC_TPLG_TUPLE_TYPE_WORD ||
+- tokens[j].type == SND_SOC_TPLG_TUPLE_TYPE_SHORT))
++ tokens[j].type == SND_SOC_TPLG_TUPLE_TYPE_SHORT ||
++ tokens[j].type == SND_SOC_TPLG_TUPLE_TYPE_BYTE ||
++ tokens[j].type == SND_SOC_TPLG_TUPLE_TYPE_BOOL))
+ continue;
+
+ /* match token id */
+--
+2.20.1
+
--- /dev/null
+From 3d02b43a895f6b3d54bdf2656a83a7854bba214a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 25 Sep 2019 14:06:24 +0300
+Subject: ASoC: topology: Fix a signedness bug in soc_tplg_dapm_widget_create()
+
+From: Dan Carpenter <dan.carpenter@oracle.com>
+
+[ Upstream commit 752c938a5c14b8cbf0ed3ffbfa637fb166255c3f ]
+
+The "template.id" variable is an enum and in this context GCC will
+treat it as an unsigned int so it can never be less than zero.
+
+Fixes: 8a9782346dcc ("ASoC: topology: Add topology core")
+Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
+Link: https://lore.kernel.org/r/20190925110624.GR3264@mwanda
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/soc-topology.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
+index dc463f1a9e242..1cc5a07a2f5c7 100644
+--- a/sound/soc/soc-topology.c
++++ b/sound/soc/soc-topology.c
+@@ -1588,7 +1588,7 @@ static int soc_tplg_dapm_widget_create(struct soc_tplg *tplg,
+
+ /* map user to kernel widget ID */
+ template.id = get_widget_id(le32_to_cpu(w->id));
+- if (template.id < 0)
++ if ((int)template.id < 0)
+ return template.id;
+
+ /* strings are allocated here, but used and freed by the widget */
+--
+2.20.1
+
--- /dev/null
+From 603d04643df27a7fdebf2aa767a2c2ea0148ef29 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 20 Sep 2019 15:02:10 +0200
+Subject: ASoC: wm8994: Do not register inapplicable controls for WM1811
+
+From: Sylwester Nawrocki <s.nawrocki@samsung.com>
+
+[ Upstream commit ca2347190adb5e4eece73a2b16e96e651c46246b ]
+
+In case of WM1811 device there are currently being registered controls
+referring to registers not existing on that device.
+It has been noticed when getting values of "AIF1ADC2 Volume", "AIF1DAC2
+Volume" controls was failing during ALSA state restoring at boot time:
+ "amixer: Mixer hw:0 load error: Device or resource busy"
+
+Reading some registers through I2C was failing with EBUSY error and
+indeed these registers were not available according to the datasheet.
+
+To fix this controls not available on WM1811 are moved to a separate
+array and registered only for WM8994 and WM8958.
+
+There are some further differences between WM8994 and WM1811,
+e.g. registers 603h, 604h, 605h, which are not covered in this patch.
+
+Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
+Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
+Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
+Link: https://lore.kernel.org/r/20190920130218.32690-2-s.nawrocki@samsung.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/codecs/wm8994.c | 43 +++++++++++++++++++++++----------------
+ 1 file changed, 26 insertions(+), 17 deletions(-)
+
+diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
+index c3d06e8bc54f2..d5fb7f5dd551c 100644
+--- a/sound/soc/codecs/wm8994.c
++++ b/sound/soc/codecs/wm8994.c
+@@ -533,13 +533,10 @@ static SOC_ENUM_SINGLE_DECL(dac_osr,
+ static SOC_ENUM_SINGLE_DECL(adc_osr,
+ WM8994_OVERSAMPLING, 1, osr_text);
+
+-static const struct snd_kcontrol_new wm8994_snd_controls[] = {
++static const struct snd_kcontrol_new wm8994_common_snd_controls[] = {
+ SOC_DOUBLE_R_TLV("AIF1ADC1 Volume", WM8994_AIF1_ADC1_LEFT_VOLUME,
+ WM8994_AIF1_ADC1_RIGHT_VOLUME,
+ 1, 119, 0, digital_tlv),
+-SOC_DOUBLE_R_TLV("AIF1ADC2 Volume", WM8994_AIF1_ADC2_LEFT_VOLUME,
+- WM8994_AIF1_ADC2_RIGHT_VOLUME,
+- 1, 119, 0, digital_tlv),
+ SOC_DOUBLE_R_TLV("AIF2ADC Volume", WM8994_AIF2_ADC_LEFT_VOLUME,
+ WM8994_AIF2_ADC_RIGHT_VOLUME,
+ 1, 119, 0, digital_tlv),
+@@ -556,8 +553,6 @@ SOC_ENUM("AIF2DACR Source", aif2dacr_src),
+
+ SOC_DOUBLE_R_TLV("AIF1DAC1 Volume", WM8994_AIF1_DAC1_LEFT_VOLUME,
+ WM8994_AIF1_DAC1_RIGHT_VOLUME, 1, 96, 0, digital_tlv),
+-SOC_DOUBLE_R_TLV("AIF1DAC2 Volume", WM8994_AIF1_DAC2_LEFT_VOLUME,
+- WM8994_AIF1_DAC2_RIGHT_VOLUME, 1, 96, 0, digital_tlv),
+ SOC_DOUBLE_R_TLV("AIF2DAC Volume", WM8994_AIF2_DAC_LEFT_VOLUME,
+ WM8994_AIF2_DAC_RIGHT_VOLUME, 1, 96, 0, digital_tlv),
+
+@@ -565,17 +560,12 @@ SOC_SINGLE_TLV("AIF1 Boost Volume", WM8994_AIF1_CONTROL_2, 10, 3, 0, aif_tlv),
+ SOC_SINGLE_TLV("AIF2 Boost Volume", WM8994_AIF2_CONTROL_2, 10, 3, 0, aif_tlv),
+
+ SOC_SINGLE("AIF1DAC1 EQ Switch", WM8994_AIF1_DAC1_EQ_GAINS_1, 0, 1, 0),
+-SOC_SINGLE("AIF1DAC2 EQ Switch", WM8994_AIF1_DAC2_EQ_GAINS_1, 0, 1, 0),
+ SOC_SINGLE("AIF2 EQ Switch", WM8994_AIF2_EQ_GAINS_1, 0, 1, 0),
+
+ WM8994_DRC_SWITCH("AIF1DAC1 DRC Switch", WM8994_AIF1_DRC1_1, 2),
+ WM8994_DRC_SWITCH("AIF1ADC1L DRC Switch", WM8994_AIF1_DRC1_1, 1),
+ WM8994_DRC_SWITCH("AIF1ADC1R DRC Switch", WM8994_AIF1_DRC1_1, 0),
+
+-WM8994_DRC_SWITCH("AIF1DAC2 DRC Switch", WM8994_AIF1_DRC2_1, 2),
+-WM8994_DRC_SWITCH("AIF1ADC2L DRC Switch", WM8994_AIF1_DRC2_1, 1),
+-WM8994_DRC_SWITCH("AIF1ADC2R DRC Switch", WM8994_AIF1_DRC2_1, 0),
+-
+ WM8994_DRC_SWITCH("AIF2DAC DRC Switch", WM8994_AIF2_DRC_1, 2),
+ WM8994_DRC_SWITCH("AIF2ADCL DRC Switch", WM8994_AIF2_DRC_1, 1),
+ WM8994_DRC_SWITCH("AIF2ADCR DRC Switch", WM8994_AIF2_DRC_1, 0),
+@@ -594,9 +584,6 @@ SOC_SINGLE("Sidetone HPF Switch", WM8994_SIDETONE, 6, 1, 0),
+ SOC_ENUM("AIF1ADC1 HPF Mode", aif1adc1_hpf),
+ SOC_DOUBLE("AIF1ADC1 HPF Switch", WM8994_AIF1_ADC1_FILTERS, 12, 11, 1, 0),
+
+-SOC_ENUM("AIF1ADC2 HPF Mode", aif1adc2_hpf),
+-SOC_DOUBLE("AIF1ADC2 HPF Switch", WM8994_AIF1_ADC2_FILTERS, 12, 11, 1, 0),
+-
+ SOC_ENUM("AIF2ADC HPF Mode", aif2adc_hpf),
+ SOC_DOUBLE("AIF2ADC HPF Switch", WM8994_AIF2_ADC_FILTERS, 12, 11, 1, 0),
+
+@@ -637,6 +624,24 @@ SOC_SINGLE("AIF2DAC 3D Stereo Switch", WM8994_AIF2_DAC_FILTERS_2,
+ 8, 1, 0),
+ };
+
++/* Controls not available on WM1811 */
++static const struct snd_kcontrol_new wm8994_snd_controls[] = {
++SOC_DOUBLE_R_TLV("AIF1ADC2 Volume", WM8994_AIF1_ADC2_LEFT_VOLUME,
++ WM8994_AIF1_ADC2_RIGHT_VOLUME,
++ 1, 119, 0, digital_tlv),
++SOC_DOUBLE_R_TLV("AIF1DAC2 Volume", WM8994_AIF1_DAC2_LEFT_VOLUME,
++ WM8994_AIF1_DAC2_RIGHT_VOLUME, 1, 96, 0, digital_tlv),
++
++SOC_SINGLE("AIF1DAC2 EQ Switch", WM8994_AIF1_DAC2_EQ_GAINS_1, 0, 1, 0),
++
++WM8994_DRC_SWITCH("AIF1DAC2 DRC Switch", WM8994_AIF1_DRC2_1, 2),
++WM8994_DRC_SWITCH("AIF1ADC2L DRC Switch", WM8994_AIF1_DRC2_1, 1),
++WM8994_DRC_SWITCH("AIF1ADC2R DRC Switch", WM8994_AIF1_DRC2_1, 0),
++
++SOC_ENUM("AIF1ADC2 HPF Mode", aif1adc2_hpf),
++SOC_DOUBLE("AIF1ADC2 HPF Switch", WM8994_AIF1_ADC2_FILTERS, 12, 11, 1, 0),
++};
++
+ static const struct snd_kcontrol_new wm8994_eq_controls[] = {
+ SOC_SINGLE_TLV("AIF1DAC1 EQ1 Volume", WM8994_AIF1_DAC1_EQ_GAINS_1, 11, 31, 0,
+ eq_tlv),
+@@ -4258,13 +4263,15 @@ static int wm8994_component_probe(struct snd_soc_component *component)
+ wm8994_handle_pdata(wm8994);
+
+ wm_hubs_add_analogue_controls(component);
+- snd_soc_add_component_controls(component, wm8994_snd_controls,
+- ARRAY_SIZE(wm8994_snd_controls));
++ snd_soc_add_component_controls(component, wm8994_common_snd_controls,
++ ARRAY_SIZE(wm8994_common_snd_controls));
+ snd_soc_dapm_new_controls(dapm, wm8994_dapm_widgets,
+ ARRAY_SIZE(wm8994_dapm_widgets));
+
+ switch (control->type) {
+ case WM8994:
++ snd_soc_add_component_controls(component, wm8994_snd_controls,
++ ARRAY_SIZE(wm8994_snd_controls));
+ snd_soc_dapm_new_controls(dapm, wm8994_specific_dapm_widgets,
+ ARRAY_SIZE(wm8994_specific_dapm_widgets));
+ if (control->revision < 4) {
+@@ -4284,8 +4291,10 @@ static int wm8994_component_probe(struct snd_soc_component *component)
+ }
+ break;
+ case WM8958:
++ snd_soc_add_component_controls(component, wm8994_snd_controls,
++ ARRAY_SIZE(wm8994_snd_controls));
+ snd_soc_add_component_controls(component, wm8958_snd_controls,
+- ARRAY_SIZE(wm8958_snd_controls));
++ ARRAY_SIZE(wm8958_snd_controls));
+ snd_soc_dapm_new_controls(dapm, wm8958_dapm_widgets,
+ ARRAY_SIZE(wm8958_dapm_widgets));
+ if (control->revision < 1) {
+--
+2.20.1
+
--- /dev/null
+From bb0125ad7fd597b42bdc73debdce796aab286695 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 2 Oct 2019 09:42:40 +0100
+Subject: ASoC: wm_adsp: Don't generate kcontrols without READ flags
+
+From: Stuart Henderson <stuarth@opensource.cirrus.com>
+
+[ Upstream commit 3ae7359c0e39f42a96284d6798fc669acff38140 ]
+
+User space always expects to be able to read ALSA controls, so ensure
+no kcontrols are generated without an appropriate READ flag. In the case
+of a read of such a control zeros will be returned.
+
+Signed-off-by: Stuart Henderson <stuarth@opensource.cirrus.com>
+Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
+Link: https://lore.kernel.org/r/20191002084240.21589-1-ckeepax@opensource.cirrus.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/codecs/wm_adsp.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
+index f5fbadc5e7e25..914fb3be5feae 100644
+--- a/sound/soc/codecs/wm_adsp.c
++++ b/sound/soc/codecs/wm_adsp.c
+@@ -1259,8 +1259,7 @@ static unsigned int wmfw_convert_flags(unsigned int in, unsigned int len)
+ }
+
+ if (in) {
+- if (in & WMFW_CTL_FLAG_READABLE)
+- out |= rd;
++ out |= rd;
+ if (in & WMFW_CTL_FLAG_WRITEABLE)
+ out |= wr;
+ if (in & WMFW_CTL_FLAG_VOLATILE)
+--
+2.20.1
+
--- /dev/null
+From aaf306c5945100fc0f02ad0aa877c499a92f83d4 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 16 Oct 2019 11:51:05 +0100
+Subject: ata: libahci_platform: Fix regulator_get_optional() misuse
+
+From: Mark Brown <broonie@kernel.org>
+
+[ Upstream commit 962399bb7fbf5ce0c5b768ca7115614f31ff8f3f ]
+
+This driver is using regulator_get_optional() to handle all the supplies
+that it handles, and only ever enables and disables all supplies en masse
+without ever doing any other configuration of the device to handle missing
+power. These are clear signs that the API is being misused - it should only
+be used for supplies that may be physically absent from the system and in
+these cases the hardware usually needs different configuration if the
+supply is missing. Instead use normal regualtor_get(), if the supply is
+not described in DT then the framework will substitute a dummy regulator in
+so no special handling is needed by the consumer driver.
+
+In the case of the PHY regulator the handling in the driver is a hack to
+deal with integrated PHYs; the supplies are only optional in the sense
+that that there's some confusion in the code about where they're bound to.
+From a code point of view they function exactly as normal supplies so can
+be treated as such. It'd probably be better to model this by instantiating
+a PHY object for integrated PHYs.
+
+Reviewed-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/ata/libahci_platform.c | 38 +++++++++++++---------------------
+ 1 file changed, 14 insertions(+), 24 deletions(-)
+
+diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c
+index 9e9583a6bba99..57882b3e46eb4 100644
+--- a/drivers/ata/libahci_platform.c
++++ b/drivers/ata/libahci_platform.c
+@@ -153,17 +153,13 @@ int ahci_platform_enable_regulators(struct ahci_host_priv *hpriv)
+ {
+ int rc, i;
+
+- if (hpriv->ahci_regulator) {
+- rc = regulator_enable(hpriv->ahci_regulator);
+- if (rc)
+- return rc;
+- }
++ rc = regulator_enable(hpriv->ahci_regulator);
++ if (rc)
++ return rc;
+
+- if (hpriv->phy_regulator) {
+- rc = regulator_enable(hpriv->phy_regulator);
+- if (rc)
+- goto disable_ahci_pwrs;
+- }
++ rc = regulator_enable(hpriv->phy_regulator);
++ if (rc)
++ goto disable_ahci_pwrs;
+
+ for (i = 0; i < hpriv->nports; i++) {
+ if (!hpriv->target_pwrs[i])
+@@ -181,11 +177,9 @@ int ahci_platform_enable_regulators(struct ahci_host_priv *hpriv)
+ if (hpriv->target_pwrs[i])
+ regulator_disable(hpriv->target_pwrs[i]);
+
+- if (hpriv->phy_regulator)
+- regulator_disable(hpriv->phy_regulator);
++ regulator_disable(hpriv->phy_regulator);
+ disable_ahci_pwrs:
+- if (hpriv->ahci_regulator)
+- regulator_disable(hpriv->ahci_regulator);
++ regulator_disable(hpriv->ahci_regulator);
+ return rc;
+ }
+ EXPORT_SYMBOL_GPL(ahci_platform_enable_regulators);
+@@ -207,10 +201,8 @@ void ahci_platform_disable_regulators(struct ahci_host_priv *hpriv)
+ regulator_disable(hpriv->target_pwrs[i]);
+ }
+
+- if (hpriv->ahci_regulator)
+- regulator_disable(hpriv->ahci_regulator);
+- if (hpriv->phy_regulator)
+- regulator_disable(hpriv->phy_regulator);
++ regulator_disable(hpriv->ahci_regulator);
++ regulator_disable(hpriv->phy_regulator);
+ }
+ EXPORT_SYMBOL_GPL(ahci_platform_disable_regulators);
+ /**
+@@ -359,7 +351,7 @@ static int ahci_platform_get_regulator(struct ahci_host_priv *hpriv, u32 port,
+ struct regulator *target_pwr;
+ int rc = 0;
+
+- target_pwr = regulator_get_optional(dev, "target");
++ target_pwr = regulator_get(dev, "target");
+
+ if (!IS_ERR(target_pwr))
+ hpriv->target_pwrs[port] = target_pwr;
+@@ -436,16 +428,14 @@ struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev,
+ hpriv->clks[i] = clk;
+ }
+
+- hpriv->ahci_regulator = devm_regulator_get_optional(dev, "ahci");
++ hpriv->ahci_regulator = devm_regulator_get(dev, "ahci");
+ if (IS_ERR(hpriv->ahci_regulator)) {
+ rc = PTR_ERR(hpriv->ahci_regulator);
+- if (rc == -EPROBE_DEFER)
++ if (rc != 0)
+ goto err_out;
+- rc = 0;
+- hpriv->ahci_regulator = NULL;
+ }
+
+- hpriv->phy_regulator = devm_regulator_get_optional(dev, "phy");
++ hpriv->phy_regulator = devm_regulator_get(dev, "phy");
+ if (IS_ERR(hpriv->phy_regulator)) {
+ rc = PTR_ERR(hpriv->phy_regulator);
+ if (rc == -EPROBE_DEFER)
+--
+2.20.1
+
--- /dev/null
+From 5db7f51d516a031b6c9d639f4c38b65ec2c1862c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 23 Oct 2019 05:02:33 -0400
+Subject: cifs: Fix cifsInodeInfo lock_sem deadlock when reconnect occurs
+
+From: Dave Wysochanski <dwysocha@redhat.com>
+
+[ Upstream commit d46b0da7a33dd8c99d969834f682267a45444ab3 ]
+
+There's a deadlock that is possible and can easily be seen with
+a test where multiple readers open/read/close of the same file
+and a disruption occurs causing reconnect. The deadlock is due
+a reader thread inside cifs_strict_readv calling down_read and
+obtaining lock_sem, and then after reconnect inside
+cifs_reopen_file calling down_read a second time. If in
+between the two down_read calls, a down_write comes from
+another process, deadlock occurs.
+
+ CPU0 CPU1
+ ---- ----
+cifs_strict_readv()
+ down_read(&cifsi->lock_sem);
+ _cifsFileInfo_put
+ OR
+ cifs_new_fileinfo
+ down_write(&cifsi->lock_sem);
+cifs_reopen_file()
+ down_read(&cifsi->lock_sem);
+
+Fix the above by changing all down_write(lock_sem) calls to
+down_write_trylock(lock_sem)/msleep() loop, which in turn
+makes the second down_read call benign since it will never
+block behind the writer while holding lock_sem.
+
+Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
+Suggested-by: Ronnie Sahlberg <lsahlber@redhat.com>
+Reviewed--by: Ronnie Sahlberg <lsahlber@redhat.com>
+Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/cifs/cifsglob.h | 5 +++++
+ fs/cifs/cifsproto.h | 1 +
+ fs/cifs/file.c | 23 +++++++++++++++--------
+ fs/cifs/smb2file.c | 2 +-
+ 4 files changed, 22 insertions(+), 9 deletions(-)
+
+diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
+index 5ef5a16c01d26..7289d443bfb33 100644
+--- a/fs/cifs/cifsglob.h
++++ b/fs/cifs/cifsglob.h
+@@ -1379,6 +1379,11 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file);
+ struct cifsInodeInfo {
+ bool can_cache_brlcks;
+ struct list_head llist; /* locks helb by this inode */
++ /*
++ * NOTE: Some code paths call down_read(lock_sem) twice, so
++ * we must always use use cifs_down_write() instead of down_write()
++ * for this semaphore to avoid deadlocks.
++ */
+ struct rw_semaphore lock_sem; /* protect the fields above */
+ /* BB add in lists for dirty pages i.e. write caching info for oplock */
+ struct list_head openFileList;
+diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
+index 592a6cea2b79f..65b07f92bc71d 100644
+--- a/fs/cifs/cifsproto.h
++++ b/fs/cifs/cifsproto.h
+@@ -166,6 +166,7 @@ extern int cifs_unlock_range(struct cifsFileInfo *cfile,
+ struct file_lock *flock, const unsigned int xid);
+ extern int cifs_push_mandatory_locks(struct cifsFileInfo *cfile);
+
++extern void cifs_down_write(struct rw_semaphore *sem);
+ extern struct cifsFileInfo *cifs_new_fileinfo(struct cifs_fid *fid,
+ struct file *file,
+ struct tcon_link *tlink,
+diff --git a/fs/cifs/file.c b/fs/cifs/file.c
+index 53dbb6e0d390d..facb52d37d19c 100644
+--- a/fs/cifs/file.c
++++ b/fs/cifs/file.c
+@@ -281,6 +281,13 @@ cifs_has_mand_locks(struct cifsInodeInfo *cinode)
+ return has_locks;
+ }
+
++void
++cifs_down_write(struct rw_semaphore *sem)
++{
++ while (!down_write_trylock(sem))
++ msleep(10);
++}
++
+ struct cifsFileInfo *
+ cifs_new_fileinfo(struct cifs_fid *fid, struct file *file,
+ struct tcon_link *tlink, __u32 oplock)
+@@ -306,7 +313,7 @@ cifs_new_fileinfo(struct cifs_fid *fid, struct file *file,
+ INIT_LIST_HEAD(&fdlocks->locks);
+ fdlocks->cfile = cfile;
+ cfile->llist = fdlocks;
+- down_write(&cinode->lock_sem);
++ cifs_down_write(&cinode->lock_sem);
+ list_add(&fdlocks->llist, &cinode->llist);
+ up_write(&cinode->lock_sem);
+
+@@ -464,7 +471,7 @@ void _cifsFileInfo_put(struct cifsFileInfo *cifs_file, bool wait_oplock_handler)
+ * Delete any outstanding lock records. We'll lose them when the file
+ * is closed anyway.
+ */
+- down_write(&cifsi->lock_sem);
++ cifs_down_write(&cifsi->lock_sem);
+ list_for_each_entry_safe(li, tmp, &cifs_file->llist->locks, llist) {
+ list_del(&li->llist);
+ cifs_del_lock_waiters(li);
+@@ -1027,7 +1034,7 @@ static void
+ cifs_lock_add(struct cifsFileInfo *cfile, struct cifsLockInfo *lock)
+ {
+ struct cifsInodeInfo *cinode = CIFS_I(d_inode(cfile->dentry));
+- down_write(&cinode->lock_sem);
++ cifs_down_write(&cinode->lock_sem);
+ list_add_tail(&lock->llist, &cfile->llist->locks);
+ up_write(&cinode->lock_sem);
+ }
+@@ -1049,7 +1056,7 @@ cifs_lock_add_if(struct cifsFileInfo *cfile, struct cifsLockInfo *lock,
+
+ try_again:
+ exist = false;
+- down_write(&cinode->lock_sem);
++ cifs_down_write(&cinode->lock_sem);
+
+ exist = cifs_find_lock_conflict(cfile, lock->offset, lock->length,
+ lock->type, lock->flags, &conf_lock,
+@@ -1072,7 +1079,7 @@ cifs_lock_add_if(struct cifsFileInfo *cfile, struct cifsLockInfo *lock,
+ (lock->blist.next == &lock->blist));
+ if (!rc)
+ goto try_again;
+- down_write(&cinode->lock_sem);
++ cifs_down_write(&cinode->lock_sem);
+ list_del_init(&lock->blist);
+ }
+
+@@ -1125,7 +1132,7 @@ cifs_posix_lock_set(struct file *file, struct file_lock *flock)
+ return rc;
+
+ try_again:
+- down_write(&cinode->lock_sem);
++ cifs_down_write(&cinode->lock_sem);
+ if (!cinode->can_cache_brlcks) {
+ up_write(&cinode->lock_sem);
+ return rc;
+@@ -1331,7 +1338,7 @@ cifs_push_locks(struct cifsFileInfo *cfile)
+ int rc = 0;
+
+ /* we are going to update can_cache_brlcks here - need a write access */
+- down_write(&cinode->lock_sem);
++ cifs_down_write(&cinode->lock_sem);
+ if (!cinode->can_cache_brlcks) {
+ up_write(&cinode->lock_sem);
+ return rc;
+@@ -1522,7 +1529,7 @@ cifs_unlock_range(struct cifsFileInfo *cfile, struct file_lock *flock,
+ if (!buf)
+ return -ENOMEM;
+
+- down_write(&cinode->lock_sem);
++ cifs_down_write(&cinode->lock_sem);
+ for (i = 0; i < 2; i++) {
+ cur = buf;
+ num = 0;
+diff --git a/fs/cifs/smb2file.c b/fs/cifs/smb2file.c
+index e6a1fc72018fd..8b0b512c57920 100644
+--- a/fs/cifs/smb2file.c
++++ b/fs/cifs/smb2file.c
+@@ -145,7 +145,7 @@ smb2_unlock_range(struct cifsFileInfo *cfile, struct file_lock *flock,
+
+ cur = buf;
+
+- down_write(&cinode->lock_sem);
++ cifs_down_write(&cinode->lock_sem);
+ list_for_each_entry_safe(li, tmp, &cfile->llist->locks, llist) {
+ if (flock->fl_start > li->offset ||
+ (flock->fl_start + length) <
+--
+2.20.1
+
--- /dev/null
+From ae237d7371c0856a5a3cd954f7ee8c94a6ac586e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 18 Sep 2019 19:42:14 +0200
+Subject: drm/amdgpu: fix error handling in amdgpu_bo_list_create
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Christian König <christian.koenig@amd.com>
+
+[ Upstream commit de51a5019ff32960218da8fd899fa3f361b031e9 ]
+
+We need to drop normal and userptr BOs separately.
+
+Signed-off-by: Christian König <christian.koenig@amd.com>
+Acked-by: Huang Rui <ray.huang@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
+index 61e38e43ad1d5..85b0515c0fdcf 100644
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
+@@ -140,7 +140,12 @@ int amdgpu_bo_list_create(struct amdgpu_device *adev, struct drm_file *filp,
+ return 0;
+
+ error_free:
+- while (i--) {
++ for (i = 0; i < last_entry; ++i) {
++ struct amdgpu_bo *bo = ttm_to_amdgpu_bo(array[i].tv.bo);
++
++ amdgpu_bo_unref(&bo);
++ }
++ for (i = first_userptr; i < num_entries; ++i) {
+ struct amdgpu_bo *bo = ttm_to_amdgpu_bo(array[i].tv.bo);
+
+ amdgpu_bo_unref(&bo);
+--
+2.20.1
+
--- /dev/null
+From 02fe97bf8f8c4a279117c12e65fb4b0536c66c2f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 19 Sep 2019 10:38:57 +0200
+Subject: drm/amdgpu: fix potential VM faults
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Christian König <christian.koenig@amd.com>
+
+[ Upstream commit 3122051edc7c27cc08534be730f4c7c180919b8a ]
+
+When we allocate new page tables under memory
+pressure we should not evict old ones.
+
+Signed-off-by: Christian König <christian.koenig@amd.com>
+Acked-by: Alex Deucher <alexander.deucher@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+index bea6f298dfdc5..0ff786dec8c4a 100644
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+@@ -421,7 +421,8 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev,
+ .interruptible = (bp->type != ttm_bo_type_kernel),
+ .no_wait_gpu = false,
+ .resv = bp->resv,
+- .flags = TTM_OPT_FLAG_ALLOW_RES_EVICT
++ .flags = bp->type != ttm_bo_type_kernel ?
++ TTM_OPT_FLAG_ALLOW_RES_EVICT : 0
+ };
+ struct amdgpu_bo *bo;
+ unsigned long page_align, size = bp->size;
+--
+2.20.1
+
--- /dev/null
+From 14e64a5afdde53b158afd4454934241e5551370d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 10 Oct 2019 10:30:07 +0000
+Subject: drm/komeda: Don't flush inactive pipes
+
+From: Mihail Atanassov <Mihail.Atanassov@arm.com>
+
+[ Upstream commit b88639b8e3808c948169af390bd7e84e909bde8d ]
+
+HW doesn't allow flushing inactive pipes and raises an MERR interrupt
+if you try to do so. Stop triggering the MERR interrupt in the
+middle of a commit by calling drm_atomic_helper_commit_planes
+with the ACTIVE_ONLY flag.
+
+Reviewed-by: James Qian Wang (Arm Technology China) <james.qian.wang@arm.com>
+Signed-off-by: Mihail Atanassov <mihail.atanassov@arm.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/20191010102950.56253-1-mihail.atanassov@arm.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/arm/display/komeda/komeda_kms.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c
+index 69d9e26c60c81..9e110d51dc1f3 100644
+--- a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c
++++ b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c
+@@ -85,7 +85,8 @@ static void komeda_kms_commit_tail(struct drm_atomic_state *old_state)
+
+ drm_atomic_helper_commit_modeset_disables(dev, old_state);
+
+- drm_atomic_helper_commit_planes(dev, old_state, 0);
++ drm_atomic_helper_commit_planes(dev, old_state,
++ DRM_PLANE_COMMIT_ACTIVE_ONLY);
+
+ drm_atomic_helper_commit_modeset_enables(dev, old_state);
+
+--
+2.20.1
+
--- /dev/null
+From 4d9cc315c32c2b7d60d9695b72f648adcac576dd Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 9 Oct 2019 14:20:34 -0700
+Subject: i2c: aspeed: fix master pending state handling
+
+From: Jae Hyun Yoo <jae.hyun.yoo@linux.intel.com>
+
+[ Upstream commit 1f0d9cbeec9bb0a1c2013342836f2c9754d6502b ]
+
+In case of master pending state, it should not trigger a master
+command, otherwise data could be corrupted because this H/W shares
+the same data buffer for slave and master operations. It also means
+that H/W command queue handling is unreliable because of the buffer
+sharing issue. To fix this issue, it clears command queue if a
+master command is queued in pending state to use S/W solution
+instead of H/W command queue handling. Also, it refines restarting
+mechanism of the pending master command.
+
+Fixes: 2e57b7cebb98 ("i2c: aspeed: Add multi-master use case support")
+Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@linux.intel.com>
+Reviewed-by: Brendan Higgins <brendanhiggins@google.com>
+Acked-by: Joel Stanley <joel@jms.id.au>
+Tested-by: Tao Ren <taoren@fb.com>
+Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/i2c/busses/i2c-aspeed.c | 54 +++++++++++++++++++++------------
+ 1 file changed, 34 insertions(+), 20 deletions(-)
+
+diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c
+index fa66951b05d06..7b098ff5f5dd3 100644
+--- a/drivers/i2c/busses/i2c-aspeed.c
++++ b/drivers/i2c/busses/i2c-aspeed.c
+@@ -108,6 +108,12 @@
+ #define ASPEED_I2CD_S_TX_CMD BIT(2)
+ #define ASPEED_I2CD_M_TX_CMD BIT(1)
+ #define ASPEED_I2CD_M_START_CMD BIT(0)
++#define ASPEED_I2CD_MASTER_CMDS_MASK \
++ (ASPEED_I2CD_M_STOP_CMD | \
++ ASPEED_I2CD_M_S_RX_CMD_LAST | \
++ ASPEED_I2CD_M_RX_CMD | \
++ ASPEED_I2CD_M_TX_CMD | \
++ ASPEED_I2CD_M_START_CMD)
+
+ /* 0x18 : I2CD Slave Device Address Register */
+ #define ASPEED_I2CD_DEV_ADDR_MASK GENMASK(6, 0)
+@@ -336,18 +342,19 @@ static void aspeed_i2c_do_start(struct aspeed_i2c_bus *bus)
+ struct i2c_msg *msg = &bus->msgs[bus->msgs_index];
+ u8 slave_addr = i2c_8bit_addr_from_msg(msg);
+
+- bus->master_state = ASPEED_I2C_MASTER_START;
+-
+ #if IS_ENABLED(CONFIG_I2C_SLAVE)
+ /*
+ * If it's requested in the middle of a slave session, set the master
+ * state to 'pending' then H/W will continue handling this master
+ * command when the bus comes back to the idle state.
+ */
+- if (bus->slave_state != ASPEED_I2C_SLAVE_INACTIVE)
++ if (bus->slave_state != ASPEED_I2C_SLAVE_INACTIVE) {
+ bus->master_state = ASPEED_I2C_MASTER_PENDING;
++ return;
++ }
+ #endif /* CONFIG_I2C_SLAVE */
+
++ bus->master_state = ASPEED_I2C_MASTER_START;
+ bus->buf_index = 0;
+
+ if (msg->flags & I2C_M_RD) {
+@@ -422,20 +429,6 @@ static u32 aspeed_i2c_master_irq(struct aspeed_i2c_bus *bus, u32 irq_status)
+ }
+ }
+
+-#if IS_ENABLED(CONFIG_I2C_SLAVE)
+- /*
+- * A pending master command will be started by H/W when the bus comes
+- * back to idle state after completing a slave operation so change the
+- * master state from 'pending' to 'start' at here if slave is inactive.
+- */
+- if (bus->master_state == ASPEED_I2C_MASTER_PENDING) {
+- if (bus->slave_state != ASPEED_I2C_SLAVE_INACTIVE)
+- goto out_no_complete;
+-
+- bus->master_state = ASPEED_I2C_MASTER_START;
+- }
+-#endif /* CONFIG_I2C_SLAVE */
+-
+ /* Master is not currently active, irq was for someone else. */
+ if (bus->master_state == ASPEED_I2C_MASTER_INACTIVE ||
+ bus->master_state == ASPEED_I2C_MASTER_PENDING)
+@@ -462,11 +455,15 @@ static u32 aspeed_i2c_master_irq(struct aspeed_i2c_bus *bus, u32 irq_status)
+ #if IS_ENABLED(CONFIG_I2C_SLAVE)
+ /*
+ * If a peer master starts a xfer immediately after it queues a
+- * master command, change its state to 'pending' then H/W will
+- * continue the queued master xfer just after completing the
+- * slave mode session.
++ * master command, clear the queued master command and change
++ * its state to 'pending'. To simplify handling of pending
++ * cases, it uses S/W solution instead of H/W command queue
++ * handling.
+ */
+ if (unlikely(irq_status & ASPEED_I2CD_INTR_SLAVE_MATCH)) {
++ writel(readl(bus->base + ASPEED_I2C_CMD_REG) &
++ ~ASPEED_I2CD_MASTER_CMDS_MASK,
++ bus->base + ASPEED_I2C_CMD_REG);
+ bus->master_state = ASPEED_I2C_MASTER_PENDING;
+ dev_dbg(bus->dev,
+ "master goes pending due to a slave start\n");
+@@ -629,6 +626,14 @@ static irqreturn_t aspeed_i2c_bus_irq(int irq, void *dev_id)
+ irq_handled |= aspeed_i2c_master_irq(bus,
+ irq_remaining);
+ }
++
++ /*
++ * Start a pending master command at here if a slave operation is
++ * completed.
++ */
++ if (bus->master_state == ASPEED_I2C_MASTER_PENDING &&
++ bus->slave_state == ASPEED_I2C_SLAVE_INACTIVE)
++ aspeed_i2c_do_start(bus);
+ #else
+ irq_handled = aspeed_i2c_master_irq(bus, irq_remaining);
+ #endif /* CONFIG_I2C_SLAVE */
+@@ -691,6 +696,15 @@ static int aspeed_i2c_master_xfer(struct i2c_adapter *adap,
+ ASPEED_I2CD_BUS_BUSY_STS))
+ aspeed_i2c_recover_bus(bus);
+
++ /*
++ * If timed out and the state is still pending, drop the pending
++ * master command.
++ */
++ spin_lock_irqsave(&bus->lock, flags);
++ if (bus->master_state == ASPEED_I2C_MASTER_PENDING)
++ bus->master_state = ASPEED_I2C_MASTER_INACTIVE;
++ spin_unlock_irqrestore(&bus->lock, flags);
++
+ return -ETIMEDOUT;
+ }
+
+--
+2.20.1
+
--- /dev/null
+From 5fd10b6ecea43ce937b7c2776ec99292717eab48 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 18 Oct 2019 19:32:13 +0200
+Subject: i2c: mt65xx: fix NULL ptr dereference
+
+From: Fabien Parent <fparent@baylibre.com>
+
+[ Upstream commit 62931ac2f9015ea38d80494ec37658ab3df6a6d7 ]
+
+Since commit abf4923e97c3 ("i2c: mediatek: disable zero-length transfers
+for mt8183"), there is a NULL pointer dereference for all the SoCs
+that don't have any quirk. mtk_i2c_functionality is not checking that
+the quirks pointer is not NULL before starting to use it.
+
+This commit add a call to i2c_check_quirks which will check whether
+the quirks pointer is set, and if so will check if the IP has the
+NO_ZERO_LEN quirk.
+
+Fixes: abf4923e97c3 ("i2c: mediatek: disable zero-length transfers for mt8183")
+Signed-off-by: Fabien Parent <fparent@baylibre.com>
+Reviewed-by: Cengiz Can <cengiz@kernel.wtf>
+Reviewed-by: Hsin-Yi Wang <hsinyi@chromium.org>
+Tested-by: Ulrich Hecht <uli@fpond.eu>
+Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/i2c/busses/i2c-mt65xx.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/i2c/busses/i2c-mt65xx.c b/drivers/i2c/busses/i2c-mt65xx.c
+index 29eae1bf4f861..2152ec5f535c1 100644
+--- a/drivers/i2c/busses/i2c-mt65xx.c
++++ b/drivers/i2c/busses/i2c-mt65xx.c
+@@ -875,7 +875,7 @@ static irqreturn_t mtk_i2c_irq(int irqno, void *dev_id)
+
+ static u32 mtk_i2c_functionality(struct i2c_adapter *adap)
+ {
+- if (adap->quirks->flags & I2C_AQ_NO_ZERO_LEN)
++ if (i2c_check_quirks(adap, I2C_AQ_NO_ZERO_LEN))
+ return I2C_FUNC_I2C |
+ (I2C_FUNC_SMBUS_EMUL & ~I2C_FUNC_SMBUS_QUICK);
+ else
+--
+2.20.1
+
--- /dev/null
+From 35afb06fb25aad6c4d3e27958dc344a614b89d40 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 1 Oct 2019 10:51:09 +0200
+Subject: i2c: stm32f7: fix a race in slave mode with arbitration loss irq
+
+From: Fabrice Gasnier <fabrice.gasnier@st.com>
+
+[ Upstream commit 6d6b0d0d5afc8c4c84b08261260ba11dfa5206f2 ]
+
+When in slave mode, an arbitration loss (ARLO) may be detected before the
+slave had a chance to detect the stop condition (STOPF in ISR).
+This is seen when two master + slave adapters switch their roles. It
+provokes the i2c bus to be stuck, busy as SCL line is stretched.
+- the I2C_SLAVE_STOP event is never generated due to STOPF flag is set but
+ don't generate an irq (race with ARLO irq, STOPIE is masked). STOPF flag
+ remains set until next master xfer (e.g. when STOPIE irq get unmasked).
+ In this case, completion is generated too early: immediately upon new
+ transfer request (then it doesn't send all data).
+- Some data get stuck in TXDR register. As a consequence, the controller
+ stretches the SCL line: the bus gets busy until a future master transfer
+ triggers the bus busy / recovery mechanism (this can take time... and
+ may never happen at all)
+
+So choice is to let the STOPF being detected by the slave isr handler,
+to properly handle this stop condition. E.g. don't mask IRQs in error
+handler, when the slave is running.
+
+Fixes: 60d609f30de2 ("i2c: i2c-stm32f7: Add slave support")
+Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
+Reviewed-by: Pierre-Yves MORDRET <pierre-yves.mordret@st.com>
+Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/i2c/busses/i2c-stm32f7.c | 17 ++++++++++-------
+ 1 file changed, 10 insertions(+), 7 deletions(-)
+
+diff --git a/drivers/i2c/busses/i2c-stm32f7.c b/drivers/i2c/busses/i2c-stm32f7.c
+index 0af9219e45f79..82705deef7bff 100644
+--- a/drivers/i2c/busses/i2c-stm32f7.c
++++ b/drivers/i2c/busses/i2c-stm32f7.c
+@@ -1503,7 +1503,7 @@ static irqreturn_t stm32f7_i2c_isr_error(int irq, void *data)
+ void __iomem *base = i2c_dev->base;
+ struct device *dev = i2c_dev->dev;
+ struct stm32_i2c_dma *dma = i2c_dev->dma;
+- u32 mask, status;
++ u32 status;
+
+ status = readl_relaxed(i2c_dev->base + STM32F7_I2C_ISR);
+
+@@ -1528,12 +1528,15 @@ static irqreturn_t stm32f7_i2c_isr_error(int irq, void *data)
+ f7_msg->result = -EINVAL;
+ }
+
+- /* Disable interrupts */
+- if (stm32f7_i2c_is_slave_registered(i2c_dev))
+- mask = STM32F7_I2C_XFER_IRQ_MASK;
+- else
+- mask = STM32F7_I2C_ALL_IRQ_MASK;
+- stm32f7_i2c_disable_irq(i2c_dev, mask);
++ if (!i2c_dev->slave_running) {
++ u32 mask;
++ /* Disable interrupts */
++ if (stm32f7_i2c_is_slave_registered(i2c_dev))
++ mask = STM32F7_I2C_XFER_IRQ_MASK;
++ else
++ mask = STM32F7_I2C_ALL_IRQ_MASK;
++ stm32f7_i2c_disable_irq(i2c_dev, mask);
++ }
+
+ /* Disable dma */
+ if (i2c_dev->use_dma) {
+--
+2.20.1
+
--- /dev/null
+From 61db305c3ebb284ea4344d4a896f36712b454f44 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 30 Sep 2019 17:28:01 +0200
+Subject: i2c: stm32f7: fix first byte to send in slave mode
+
+From: Fabrice Gasnier <fabrice.gasnier@st.com>
+
+[ Upstream commit 02e64276c6dbcc4c5f39844f33d18180832a58f3 ]
+
+The slave-interface documentation [1] states "the bus driver should
+transmit the first byte" upon I2C_SLAVE_READ_REQUESTED slave event:
+- 'val': backend returns first byte to be sent
+The driver currently ignores the 1st byte to send on this event.
+
+[1] https://www.kernel.org/doc/Documentation/i2c/slave-interface
+
+Fixes: 60d609f30de2 ("i2c: i2c-stm32f7: Add slave support")
+Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
+Reviewed-by: Pierre-Yves MORDRET <pierre-yves.mordret@st.com>
+Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/i2c/busses/i2c-stm32f7.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/drivers/i2c/busses/i2c-stm32f7.c b/drivers/i2c/busses/i2c-stm32f7.c
+index 266d1c269b835..0af9219e45f79 100644
+--- a/drivers/i2c/busses/i2c-stm32f7.c
++++ b/drivers/i2c/busses/i2c-stm32f7.c
+@@ -1192,6 +1192,8 @@ static void stm32f7_i2c_slave_start(struct stm32f7_i2c_dev *i2c_dev)
+ STM32F7_I2C_CR1_TXIE;
+ stm32f7_i2c_set_bits(base + STM32F7_I2C_CR1, mask);
+
++ /* Write 1st data byte */
++ writel_relaxed(value, base + STM32F7_I2C_TXDR);
+ } else {
+ /* Notify i2c slave that new write transfer is starting */
+ i2c_slave_event(slave, I2C_SLAVE_WRITE_REQUESTED, &value);
+--
+2.20.1
+
--- /dev/null
+From 21f737f32ed0ce9091707bea5146265789c75c9a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 15 Oct 2019 15:11:58 +0200
+Subject: i2c: stm32f7: remove warning when compiling with W=1
+
+From: Alain Volmat <alain.volmat@st.com>
+
+[ Upstream commit 348e46fbb4cdb2aead79aee1fd8bb25ec5fd25db ]
+
+Remove the following warning:
+
+drivers/i2c/busses/i2c-stm32f7.c:315:
+warning: cannot understand function prototype:
+'struct stm32f7_i2c_spec i2c_specs[] =
+
+Replace a comment starting with /** by simply /* to avoid having
+it interpreted as a kernel-doc comment.
+
+Fixes: aeb068c57214 ("i2c: i2c-stm32f7: add driver")
+Signed-off-by: Alain Volmat <alain.volmat@st.com>
+Reviewed-by: Pierre-Yves MORDRET <pierre-yves.mordret@st.com>
+Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/i2c/busses/i2c-stm32f7.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/i2c/busses/i2c-stm32f7.c b/drivers/i2c/busses/i2c-stm32f7.c
+index 82705deef7bff..1fac7344ae9c2 100644
+--- a/drivers/i2c/busses/i2c-stm32f7.c
++++ b/drivers/i2c/busses/i2c-stm32f7.c
+@@ -305,7 +305,7 @@ struct stm32f7_i2c_dev {
+ struct regmap *regmap;
+ };
+
+-/**
++/*
+ * All these values are coming from I2C Specification, Version 6.0, 4th of
+ * April 2014.
+ *
+--
+2.20.1
+
--- /dev/null
+From a44dff14a7659f82919e2ecded048e2cbab4382f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 23 Oct 2019 03:46:26 +0000
+Subject: irqchip/gic-v3-its: Use the exact ITSList for VMOVP
+
+From: Zenghui Yu <yuzenghui@huawei.com>
+
+[ Upstream commit 8424312516e5d9baeeb0a95d0e4523579b7aa395 ]
+
+On a system without Single VMOVP support (say GITS_TYPER.VMOVP == 0),
+we will map vPEs only on ITSs that will actually control interrupts
+for the given VM. And when moving a vPE, the VMOVP command will be
+issued only for those ITSs.
+
+But when issuing VMOVPs we seemed fail to present the exact ITSList
+to ITSs who are actually included in the synchronization operation.
+The its_list_map we're currently using includes all ITSs in the system,
+even though some of them don't have the corresponding vPE mapping at all.
+
+Introduce get_its_list() to get the per-VM its_list_map, to indicate
+which ITSs have vPE mappings for the given VM, and use this map as
+the expected ITSList when building VMOVP. This is hopefully a performance
+gain not to do some synchronization with those unsuspecting ITSs.
+And initialize the whole command descriptor to zero at beginning, since
+the seq_num and its_list should be RES0 when GITS_TYPER.VMOVP == 1.
+
+Signed-off-by: Zenghui Yu <yuzenghui@huawei.com>
+Signed-off-by: Marc Zyngier <maz@kernel.org>
+Link: https://lore.kernel.org/r/1571802386-2680-1-git-send-email-yuzenghui@huawei.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/irqchip/irq-gic-v3-its.c | 21 ++++++++++++++++++---
+ 1 file changed, 18 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
+index c3a8d732805f5..868c356fbf496 100644
+--- a/drivers/irqchip/irq-gic-v3-its.c
++++ b/drivers/irqchip/irq-gic-v3-its.c
+@@ -175,6 +175,22 @@ static DEFINE_IDA(its_vpeid_ida);
+ #define gic_data_rdist_rd_base() (gic_data_rdist()->rd_base)
+ #define gic_data_rdist_vlpi_base() (gic_data_rdist_rd_base() + SZ_128K)
+
++static u16 get_its_list(struct its_vm *vm)
++{
++ struct its_node *its;
++ unsigned long its_list = 0;
++
++ list_for_each_entry(its, &its_nodes, entry) {
++ if (!its->is_v4)
++ continue;
++
++ if (vm->vlpi_count[its->list_nr])
++ __set_bit(its->list_nr, &its_list);
++ }
++
++ return (u16)its_list;
++}
++
+ static struct its_collection *dev_event_to_col(struct its_device *its_dev,
+ u32 event)
+ {
+@@ -976,17 +992,15 @@ static void its_send_vmapp(struct its_node *its,
+
+ static void its_send_vmovp(struct its_vpe *vpe)
+ {
+- struct its_cmd_desc desc;
++ struct its_cmd_desc desc = {};
+ struct its_node *its;
+ unsigned long flags;
+ int col_id = vpe->col_idx;
+
+ desc.its_vmovp_cmd.vpe = vpe;
+- desc.its_vmovp_cmd.its_list = (u16)its_list_map;
+
+ if (!its_list_map) {
+ its = list_first_entry(&its_nodes, struct its_node, entry);
+- desc.its_vmovp_cmd.seq_num = 0;
+ desc.its_vmovp_cmd.col = &its->collections[col_id];
+ its_send_single_vcommand(its, its_build_vmovp_cmd, &desc);
+ return;
+@@ -1003,6 +1017,7 @@ static void its_send_vmovp(struct its_vpe *vpe)
+ raw_spin_lock_irqsave(&vmovp_lock, flags);
+
+ desc.its_vmovp_cmd.seq_num = vmovp_seq_num++;
++ desc.its_vmovp_cmd.its_list = get_its_list(vpe->its_vm);
+
+ /* Emit VMOVPs */
+ list_for_each_entry(its, &its_nodes, entry) {
+--
+2.20.1
+
--- /dev/null
+From 68092bf5346c7b9d89f5f46422229d29617c304c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 24 Oct 2019 09:11:43 -0700
+Subject: irqchip/sifive-plic: Skip contexts except supervisor in plic_init()
+
+From: Alan Mikhak <alan.mikhak@sifive.com>
+
+[ Upstream commit 41860cc447045c811ce6d5a92f93a065a691fe8e ]
+
+Modify plic_init() to skip .dts interrupt contexts other
+than supervisor external interrupt.
+
+The .dts entry for plic may specify multiple interrupt contexts.
+For example, it may assign two entries IRQ_M_EXT and IRQ_S_EXT,
+in that order, to the same interrupt controller. This patch
+modifies plic_init() to skip the IRQ_M_EXT context since
+IRQ_S_EXT is currently the only supported context.
+
+If IRQ_M_EXT is not skipped, plic_init() will report "handler
+already present for context" when it comes across the IRQ_S_EXT
+context in the next iteration of its loop.
+
+Without this patch, .dts would have to be edited to replace the
+value of IRQ_M_EXT with -1 for it to be skipped.
+
+Signed-off-by: Alan Mikhak <alan.mikhak@sifive.com>
+Signed-off-by: Marc Zyngier <maz@kernel.org>
+Reviewed-by: Christoph Hellwig <hch@lst.de>
+Acked-by: Paul Walmsley <paul.walmsley@sifive.com> # arch/riscv
+Link: https://lkml.kernel.org/r/1571933503-21504-1-git-send-email-alan.mikhak@sifive.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/irqchip/irq-sifive-plic.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/irqchip/irq-sifive-plic.c b/drivers/irqchip/irq-sifive-plic.c
+index daefc52b0ec55..7d0a12fe2714a 100644
+--- a/drivers/irqchip/irq-sifive-plic.c
++++ b/drivers/irqchip/irq-sifive-plic.c
+@@ -252,8 +252,8 @@ static int __init plic_init(struct device_node *node,
+ continue;
+ }
+
+- /* skip context holes */
+- if (parent.args[0] == -1)
++ /* skip contexts other than supervisor external interrupt */
++ if (parent.args[0] != IRQ_S_EXT)
+ continue;
+
+ hartid = plic_find_hart_id(parent.np);
+--
+2.20.1
+
--- /dev/null
+From 1207bb4108401d8ad5e120b6a6f90c3ca71d98bf Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 22 Oct 2019 21:11:00 +0200
+Subject: MIPS: bmips: mark exception vectors as char arrays
+
+From: Jonas Gorski <jonas.gorski@gmail.com>
+
+[ Upstream commit e4f5cb1a9b27c0f94ef4f5a0178a3fde2d3d0e9e ]
+
+The vectors span more than one byte, so mark them as arrays.
+
+Fixes the following build error when building when using GCC 8.3:
+
+In file included from ./include/linux/string.h:19,
+ from ./include/linux/bitmap.h:9,
+ from ./include/linux/cpumask.h:12,
+ from ./arch/mips/include/asm/processor.h:15,
+ from ./arch/mips/include/asm/thread_info.h:16,
+ from ./include/linux/thread_info.h:38,
+ from ./include/asm-generic/preempt.h:5,
+ from ./arch/mips/include/generated/asm/preempt.h:1,
+ from ./include/linux/preempt.h:81,
+ from ./include/linux/spinlock.h:51,
+ from ./include/linux/mmzone.h:8,
+ from ./include/linux/bootmem.h:8,
+ from arch/mips/bcm63xx/prom.c:10:
+arch/mips/bcm63xx/prom.c: In function 'prom_init':
+./arch/mips/include/asm/string.h:162:11: error: '__builtin_memcpy' forming offset [2, 32] is out of the bounds [0, 1] of object 'bmips_smp_movevec' with type 'char' [-Werror=array-bounds]
+ __ret = __builtin_memcpy((dst), (src), __len); \
+ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+arch/mips/bcm63xx/prom.c:97:3: note: in expansion of macro 'memcpy'
+ memcpy((void *)0xa0000200, &bmips_smp_movevec, 0x20);
+ ^~~~~~
+In file included from arch/mips/bcm63xx/prom.c:14:
+./arch/mips/include/asm/bmips.h:80:13: note: 'bmips_smp_movevec' declared here
+ extern char bmips_smp_movevec;
+
+Fixes: 18a1eef92dcd ("MIPS: BMIPS: Introduce bmips.h")
+Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
+Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
+Signed-off-by: Paul Burton <paulburton@kernel.org>
+Cc: linux-mips@vger.kernel.org
+Cc: Ralf Baechle <ralf@linux-mips.org>
+Cc: James Hogan <jhogan@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/mips/bcm63xx/prom.c | 2 +-
+ arch/mips/include/asm/bmips.h | 10 +++++-----
+ arch/mips/kernel/smp-bmips.c | 8 ++++----
+ 3 files changed, 10 insertions(+), 10 deletions(-)
+
+diff --git a/arch/mips/bcm63xx/prom.c b/arch/mips/bcm63xx/prom.c
+index 77a836e661c9e..df69eaa453a1c 100644
+--- a/arch/mips/bcm63xx/prom.c
++++ b/arch/mips/bcm63xx/prom.c
+@@ -84,7 +84,7 @@ void __init prom_init(void)
+ * Here we will start up CPU1 in the background and ask it to
+ * reconfigure itself then go back to sleep.
+ */
+- memcpy((void *)0xa0000200, &bmips_smp_movevec, 0x20);
++ memcpy((void *)0xa0000200, bmips_smp_movevec, 0x20);
+ __sync();
+ set_c0_cause(C_SW0);
+ cpumask_set_cpu(1, &bmips_booted_mask);
+diff --git a/arch/mips/include/asm/bmips.h b/arch/mips/include/asm/bmips.h
+index bf6a8afd7ad27..581a6a3c66e40 100644
+--- a/arch/mips/include/asm/bmips.h
++++ b/arch/mips/include/asm/bmips.h
+@@ -75,11 +75,11 @@ static inline int register_bmips_smp_ops(void)
+ #endif
+ }
+
+-extern char bmips_reset_nmi_vec;
+-extern char bmips_reset_nmi_vec_end;
+-extern char bmips_smp_movevec;
+-extern char bmips_smp_int_vec;
+-extern char bmips_smp_int_vec_end;
++extern char bmips_reset_nmi_vec[];
++extern char bmips_reset_nmi_vec_end[];
++extern char bmips_smp_movevec[];
++extern char bmips_smp_int_vec[];
++extern char bmips_smp_int_vec_end[];
+
+ extern int bmips_smp_enabled;
+ extern int bmips_cpu_offset;
+diff --git a/arch/mips/kernel/smp-bmips.c b/arch/mips/kernel/smp-bmips.c
+index 76fae9b79f131..712c15de6ab9f 100644
+--- a/arch/mips/kernel/smp-bmips.c
++++ b/arch/mips/kernel/smp-bmips.c
+@@ -464,10 +464,10 @@ static void bmips_wr_vec(unsigned long dst, char *start, char *end)
+
+ static inline void bmips_nmi_handler_setup(void)
+ {
+- bmips_wr_vec(BMIPS_NMI_RESET_VEC, &bmips_reset_nmi_vec,
+- &bmips_reset_nmi_vec_end);
+- bmips_wr_vec(BMIPS_WARM_RESTART_VEC, &bmips_smp_int_vec,
+- &bmips_smp_int_vec_end);
++ bmips_wr_vec(BMIPS_NMI_RESET_VEC, bmips_reset_nmi_vec,
++ bmips_reset_nmi_vec_end);
++ bmips_wr_vec(BMIPS_WARM_RESTART_VEC, bmips_smp_int_vec,
++ bmips_smp_int_vec_end);
+ }
+
+ struct reset_vec_info {
+--
+2.20.1
+
--- /dev/null
+From 8ae0e7b1ad03ffc59134cbe6caf5de3fa512e7a0 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 21 Oct 2019 15:56:28 -0400
+Subject: nbd: handle racing with error'ed out commands
+
+From: Josef Bacik <josef@toxicpanda.com>
+
+[ Upstream commit 7ce23e8e0a9cd38338fc8316ac5772666b565ca9 ]
+
+We hit the following warning in production
+
+print_req_error: I/O error, dev nbd0, sector 7213934408 flags 80700
+------------[ cut here ]------------
+refcount_t: underflow; use-after-free.
+WARNING: CPU: 25 PID: 32407 at lib/refcount.c:190 refcount_sub_and_test_checked+0x53/0x60
+Workqueue: knbd-recv recv_work [nbd]
+RIP: 0010:refcount_sub_and_test_checked+0x53/0x60
+Call Trace:
+ blk_mq_free_request+0xb7/0xf0
+ blk_mq_complete_request+0x62/0xf0
+ recv_work+0x29/0xa1 [nbd]
+ process_one_work+0x1f5/0x3f0
+ worker_thread+0x2d/0x3d0
+ ? rescuer_thread+0x340/0x340
+ kthread+0x111/0x130
+ ? kthread_create_on_node+0x60/0x60
+ ret_from_fork+0x1f/0x30
+---[ end trace b079c3c67f98bb7c ]---
+
+This was preceded by us timing out everything and shutting down the
+sockets for the device. The problem is we had a request in the queue at
+the same time, so we completed the request twice. This can actually
+happen in a lot of cases, we fail to get a ref on our config, we only
+have one connection and just error out the command, etc.
+
+Fix this by checking cmd->status in nbd_read_stat. We only change this
+under the cmd->lock, so we are safe to check this here and see if we've
+already error'ed this command out, which would indicate that we've
+completed it as well.
+
+Reviewed-by: Mike Christie <mchristi@redhat.com>
+Signed-off-by: Josef Bacik <josef@toxicpanda.com>
+
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/block/nbd.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
+index 7301fe55084bf..5f9d12ce91e5a 100644
+--- a/drivers/block/nbd.c
++++ b/drivers/block/nbd.c
+@@ -673,6 +673,12 @@ static struct nbd_cmd *nbd_read_stat(struct nbd_device *nbd, int index)
+ ret = -ENOENT;
+ goto out;
+ }
++ if (cmd->status != BLK_STS_OK) {
++ dev_err(disk_to_dev(nbd->disk), "Command already handled %p\n",
++ req);
++ ret = -ENOENT;
++ goto out;
++ }
+ if (test_bit(NBD_CMD_REQUEUED, &cmd->flags)) {
+ dev_err(disk_to_dev(nbd->disk), "Raced with timeout on req %p\n",
+ req);
+--
+2.20.1
+
--- /dev/null
+From cf0989c4a75bbc2d0f975a41d629dd94d348cc4d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 21 Oct 2019 15:56:27 -0400
+Subject: nbd: protect cmd->status with cmd->lock
+
+From: Josef Bacik <josef@toxicpanda.com>
+
+[ Upstream commit de6346ecbc8f5591ebd6c44ac164e8b8671d71d7 ]
+
+We already do this for the most part, except in timeout and clear_req.
+For the timeout case we take the lock after we grab a ref on the config,
+but that isn't really necessary because we're safe to touch the cmd at
+this point, so just move the order around.
+
+For the clear_req cause this is initiated by the user, so again is safe.
+
+Reviewed-by: Mike Christie <mchristi@redhat.com>
+Signed-off-by: Josef Bacik <josef@toxicpanda.com>
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/block/nbd.c | 12 +++++++-----
+ 1 file changed, 7 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
+index 9650777d0aaf1..7301fe55084bf 100644
+--- a/drivers/block/nbd.c
++++ b/drivers/block/nbd.c
+@@ -351,17 +351,16 @@ static enum blk_eh_timer_return nbd_xmit_timeout(struct request *req,
+ struct nbd_device *nbd = cmd->nbd;
+ struct nbd_config *config;
+
++ if (!mutex_trylock(&cmd->lock))
++ return BLK_EH_RESET_TIMER;
++
+ if (!refcount_inc_not_zero(&nbd->config_refs)) {
+ cmd->status = BLK_STS_TIMEOUT;
++ mutex_unlock(&cmd->lock);
+ goto done;
+ }
+ config = nbd->config;
+
+- if (!mutex_trylock(&cmd->lock)) {
+- nbd_config_put(nbd);
+- return BLK_EH_RESET_TIMER;
+- }
+-
+ if (config->num_connections > 1) {
+ dev_err_ratelimited(nbd_to_dev(nbd),
+ "Connection timed out, retrying (%d/%d alive)\n",
+@@ -755,7 +754,10 @@ static bool nbd_clear_req(struct request *req, void *data, bool reserved)
+ {
+ struct nbd_cmd *cmd = blk_mq_rq_to_pdu(req);
+
++ mutex_lock(&cmd->lock);
+ cmd->status = BLK_STS_IOERR;
++ mutex_unlock(&cmd->lock);
++
+ blk_mq_complete_request(req);
+ return true;
+ }
+--
+2.20.1
+
--- /dev/null
+From 4ea72f2420ad0644337deeac9131b0dbefecc7f9 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 4 Oct 2019 13:58:43 -0500
+Subject: of: unittest: fix memory leak in unittest_data_add
+
+From: Navid Emamdoost <navid.emamdoost@gmail.com>
+
+[ Upstream commit e13de8fe0d6a51341671bbe384826d527afe8d44 ]
+
+In unittest_data_add, a copy buffer is created via kmemdup. This buffer
+is leaked if of_fdt_unflatten_tree fails. The release for the
+unittest_data buffer is added.
+
+Fixes: b951f9dc7f25 ("Enabling OF selftest to run without machine's devicetree")
+Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
+Reviewed-by: Frank Rowand <frowand.list@gmail.com>
+Signed-off-by: Rob Herring <robh@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/of/unittest.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
+index e6b175370f2eb..8b7bd48224657 100644
+--- a/drivers/of/unittest.c
++++ b/drivers/of/unittest.c
+@@ -1205,6 +1205,7 @@ static int __init unittest_data_add(void)
+ of_fdt_unflatten_tree(unittest_data, NULL, &unittest_data_node);
+ if (!unittest_data_node) {
+ pr_warn("%s: No tree to attach; not running tests\n", __func__);
++ kfree(unittest_data);
+ return -ENODATA;
+ }
+
+--
+2.20.1
+
--- /dev/null
+From 9027d67098c35b5ca3a64259d12328aaacaa6ade Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 15 Oct 2019 10:54:14 +0800
+Subject: perf c2c: Fix memory leak in build_cl_output()
+
+From: Yunfeng Ye <yeyunfeng@huawei.com>
+
+[ Upstream commit ae199c580da1754a2b051321eeb76d6dacd8707b ]
+
+There is a memory leak problem in the failure paths of
+build_cl_output(), so fix it.
+
+Signed-off-by: Yunfeng Ye <yeyunfeng@huawei.com>
+Acked-by: Jiri Olsa <jolsa@kernel.org>
+Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
+Cc: Feilong Lin <linfeilong@huawei.com>
+Cc: Hu Shiyuan <hushiyuan@huawei.com>
+Cc: Mark Rutland <mark.rutland@arm.com>
+Cc: Namhyung Kim <namhyung@kernel.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Link: http://lore.kernel.org/lkml/4d3c0178-5482-c313-98e1-f82090d2d456@huawei.com
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ tools/perf/builtin-c2c.c | 14 +++++++++-----
+ 1 file changed, 9 insertions(+), 5 deletions(-)
+
+diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c
+index e3776f5c2e01a..637e181426587 100644
+--- a/tools/perf/builtin-c2c.c
++++ b/tools/perf/builtin-c2c.c
+@@ -2627,6 +2627,7 @@ static int build_cl_output(char *cl_sort, bool no_source)
+ bool add_sym = false;
+ bool add_dso = false;
+ bool add_src = false;
++ int ret = 0;
+
+ if (!buf)
+ return -ENOMEM;
+@@ -2645,7 +2646,8 @@ static int build_cl_output(char *cl_sort, bool no_source)
+ add_dso = true;
+ } else if (strcmp(tok, "offset")) {
+ pr_err("unrecognized sort token: %s\n", tok);
+- return -EINVAL;
++ ret = -EINVAL;
++ goto err;
+ }
+ }
+
+@@ -2668,13 +2670,15 @@ static int build_cl_output(char *cl_sort, bool no_source)
+ add_sym ? "symbol," : "",
+ add_dso ? "dso," : "",
+ add_src ? "cl_srcline," : "",
+- "node") < 0)
+- return -ENOMEM;
++ "node") < 0) {
++ ret = -ENOMEM;
++ goto err;
++ }
+
+ c2c.show_src = add_src;
+-
++err:
+ free(buf);
+- return 0;
++ return ret;
+ }
+
+ static int setup_coalesce(const char *coalesce, bool no_source)
+--
+2.20.1
+
--- /dev/null
+From 714b1e9c5e36bdcb7d53f1d009dcc7a42f6efcfa Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 16 Oct 2019 16:38:45 +0800
+Subject: perf kmem: Fix memory leak in compact_gfp_flags()
+
+From: Yunfeng Ye <yeyunfeng@huawei.com>
+
+[ Upstream commit 1abecfcaa7bba21c9985e0136fa49836164dd8fd ]
+
+The memory @orig_flags is allocated by strdup(), it is freed on the
+normal path, but leak to free on the error path.
+
+Fix this by adding free(orig_flags) on the error path.
+
+Fixes: 0e11115644b3 ("perf kmem: Print gfp flags in human readable string")
+Signed-off-by: Yunfeng Ye <yeyunfeng@huawei.com>
+Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
+Cc: Feilong Lin <linfeilong@huawei.com>
+Cc: Hu Shiyuan <hushiyuan@huawei.com>
+Cc: Jiri Olsa <jolsa@redhat.com>
+Cc: Mark Rutland <mark.rutland@arm.com>
+Cc: Namhyung Kim <namhyung@kernel.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Link: http://lore.kernel.org/lkml/f9e9f458-96f3-4a97-a1d5-9feec2420e07@huawei.com
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ tools/perf/builtin-kmem.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c
+index 9e5e608980832..353c9417e864b 100644
+--- a/tools/perf/builtin-kmem.c
++++ b/tools/perf/builtin-kmem.c
+@@ -688,6 +688,7 @@ static char *compact_gfp_flags(char *gfp_flags)
+ new = realloc(new_flags, len + strlen(cpt) + 2);
+ if (new == NULL) {
+ free(new_flags);
++ free(orig_flags);
+ return NULL;
+ }
+
+--
+2.20.1
+
--- /dev/null
+From 495c796a59010c0a815b8f099fbc9a815075d149 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 15 Oct 2019 16:30:08 +0800
+Subject: perf tools: Fix resource leak of closedir() on the error paths
+
+From: Yunfeng Ye <yeyunfeng@huawei.com>
+
+[ Upstream commit 6080728ff8e9c9116e52e6f840152356ac2fea56 ]
+
+Both build_mem_topology() and rm_rf_depth_pat() have resource leaks of
+closedir() on the error paths.
+
+Fix this by calling closedir() before function returns.
+
+Fixes: e2091cedd51b ("perf tools: Add MEM_TOPOLOGY feature to perf data file")
+Fixes: cdb6b0235f17 ("perf tools: Add pattern name checking to rm_rf")
+Signed-off-by: Yunfeng Ye <yeyunfeng@huawei.com>
+Acked-by: Jiri Olsa <jolsa@kernel.org>
+Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
+Cc: Alexei Starovoitov <ast@kernel.org>
+Cc: Alexey Budankov <alexey.budankov@linux.intel.com>
+Cc: Andi Kleen <ak@linux.intel.com>
+Cc: Daniel Borkmann <daniel@iogearbox.net>
+Cc: Feilong Lin <linfeilong@huawei.com>
+Cc: Hu Shiyuan <hushiyuan@huawei.com>
+Cc: Igor Lubashev <ilubashe@akamai.com>
+Cc: Kan Liang <kan.liang@linux.intel.com>
+Cc: Mark Rutland <mark.rutland@arm.com>
+Cc: Martin KaFai Lau <kafai@fb.com>
+Cc: Namhyung Kim <namhyung@kernel.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Song Liu <songliubraving@fb.com>
+Cc: Yonghong Song <yhs@fb.com>
+Link: http://lore.kernel.org/lkml/cd5f7cd2-b80d-6add-20a1-32f4f43e0744@huawei.com
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ tools/perf/util/header.c | 4 +++-
+ tools/perf/util/util.c | 6 ++++--
+ 2 files changed, 7 insertions(+), 3 deletions(-)
+
+diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
+index e95a2a26c40a8..277cdf1fc5ac8 100644
+--- a/tools/perf/util/header.c
++++ b/tools/perf/util/header.c
+@@ -1282,8 +1282,10 @@ static int build_mem_topology(struct memory_node *nodes, u64 size, u64 *cntp)
+ continue;
+
+ if (WARN_ONCE(cnt >= size,
+- "failed to write MEM_TOPOLOGY, way too many nodes\n"))
++ "failed to write MEM_TOPOLOGY, way too many nodes\n")) {
++ closedir(dir);
+ return -1;
++ }
+
+ ret = memory_node__read(&nodes[cnt++], idx);
+ }
+diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
+index a61535cf1bca2..d0930c38e147e 100644
+--- a/tools/perf/util/util.c
++++ b/tools/perf/util/util.c
+@@ -176,8 +176,10 @@ static int rm_rf_depth_pat(const char *path, int depth, const char **pat)
+ if (!strcmp(d->d_name, ".") || !strcmp(d->d_name, ".."))
+ continue;
+
+- if (!match_pat(d->d_name, pat))
+- return -2;
++ if (!match_pat(d->d_name, pat)) {
++ ret = -2;
++ break;
++ }
+
+ scnprintf(namebuf, sizeof(namebuf), "%s/%s",
+ path, d->d_name);
+--
+2.20.1
+
--- /dev/null
+From e3d373387d168731e639adc56349c16b7eee23f7 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 16 Sep 2019 17:47:51 +0300
+Subject: pinctrl: intel: Allocate IRQ chip dynamic
+
+From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+
+[ Upstream commit 57ff2df1b952c7934d7b0e1d3a2ec403ec76edec ]
+
+Keeping the IRQ chip definition static shares it with multiple instances of
+the GPIO chip in the system. This is bad and now we get this warning from
+GPIO library:
+
+"detected irqchip that is shared with multiple gpiochips: please fix the driver."
+
+Hence, move the IRQ chip definition from being driver static into the struct
+intel_pinctrl. So a unique IRQ chip is used for each GPIO chip instance.
+
+Fixes: ee1a6ca43dba ("pinctrl: intel: Add Intel Broxton pin controller support")
+Depends-on: 5ff56b015e85 ("pinctrl: intel: Disable GPIO pin interrupts in suspend")
+Reported-by: Federico Ricchiuto <fed.ricchiuto@gmail.com>
+Suggested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
+Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/pinctrl/intel/pinctrl-intel.c | 27 ++++++++++++++-------------
+ 1 file changed, 14 insertions(+), 13 deletions(-)
+
+diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c
+index a18d6eefe6726..4323796cbe118 100644
+--- a/drivers/pinctrl/intel/pinctrl-intel.c
++++ b/drivers/pinctrl/intel/pinctrl-intel.c
+@@ -96,6 +96,7 @@ struct intel_pinctrl_context {
+ * @pctldesc: Pin controller description
+ * @pctldev: Pointer to the pin controller device
+ * @chip: GPIO chip in this pin controller
++ * @irqchip: IRQ chip in this pin controller
+ * @soc: SoC/PCH specific pin configuration data
+ * @communities: All communities in this pin controller
+ * @ncommunities: Number of communities in this pin controller
+@@ -108,6 +109,7 @@ struct intel_pinctrl {
+ struct pinctrl_desc pctldesc;
+ struct pinctrl_dev *pctldev;
+ struct gpio_chip chip;
++ struct irq_chip irqchip;
+ const struct intel_pinctrl_soc_data *soc;
+ struct intel_community *communities;
+ size_t ncommunities;
+@@ -1081,16 +1083,6 @@ static irqreturn_t intel_gpio_irq(int irq, void *data)
+ return ret;
+ }
+
+-static struct irq_chip intel_gpio_irqchip = {
+- .name = "intel-gpio",
+- .irq_ack = intel_gpio_irq_ack,
+- .irq_mask = intel_gpio_irq_mask,
+- .irq_unmask = intel_gpio_irq_unmask,
+- .irq_set_type = intel_gpio_irq_type,
+- .irq_set_wake = intel_gpio_irq_wake,
+- .flags = IRQCHIP_MASK_ON_SUSPEND,
+-};
+-
+ static int intel_gpio_add_pin_ranges(struct intel_pinctrl *pctrl,
+ const struct intel_community *community)
+ {
+@@ -1140,12 +1132,22 @@ static int intel_gpio_probe(struct intel_pinctrl *pctrl, int irq)
+
+ pctrl->chip = intel_gpio_chip;
+
++ /* Setup GPIO chip */
+ pctrl->chip.ngpio = intel_gpio_ngpio(pctrl);
+ pctrl->chip.label = dev_name(pctrl->dev);
+ pctrl->chip.parent = pctrl->dev;
+ pctrl->chip.base = -1;
+ pctrl->irq = irq;
+
++ /* Setup IRQ chip */
++ pctrl->irqchip.name = dev_name(pctrl->dev);
++ pctrl->irqchip.irq_ack = intel_gpio_irq_ack;
++ pctrl->irqchip.irq_mask = intel_gpio_irq_mask;
++ pctrl->irqchip.irq_unmask = intel_gpio_irq_unmask;
++ pctrl->irqchip.irq_set_type = intel_gpio_irq_type;
++ pctrl->irqchip.irq_set_wake = intel_gpio_irq_wake;
++ pctrl->irqchip.flags = IRQCHIP_MASK_ON_SUSPEND;
++
+ ret = devm_gpiochip_add_data(pctrl->dev, &pctrl->chip, pctrl);
+ if (ret) {
+ dev_err(pctrl->dev, "failed to register gpiochip\n");
+@@ -1175,15 +1177,14 @@ static int intel_gpio_probe(struct intel_pinctrl *pctrl, int irq)
+ return ret;
+ }
+
+- ret = gpiochip_irqchip_add(&pctrl->chip, &intel_gpio_irqchip, 0,
++ ret = gpiochip_irqchip_add(&pctrl->chip, &pctrl->irqchip, 0,
+ handle_bad_irq, IRQ_TYPE_NONE);
+ if (ret) {
+ dev_err(pctrl->dev, "failed to add irqchip\n");
+ return ret;
+ }
+
+- gpiochip_set_chained_irqchip(&pctrl->chip, &intel_gpio_irqchip, irq,
+- NULL);
++ gpiochip_set_chained_irqchip(&pctrl->chip, &pctrl->irqchip, irq, NULL);
+ return 0;
+ }
+
+--
+2.20.1
+
--- /dev/null
+From 47f8d6169a0220555845c2d26aebf83ef3f86f5d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 26 Sep 2019 11:14:26 +0300
+Subject: pinctrl: ns2: Fix off by one bugs in ns2_pinmux_enable()
+
+From: Dan Carpenter <dan.carpenter@oracle.com>
+
+[ Upstream commit 39b65fbb813089e366b376bd8acc300b6fd646dc ]
+
+The pinctrl->functions[] array has pinctrl->num_functions elements and
+the pinctrl->groups[] array is the same way. These are set in
+ns2_pinmux_probe(). So the > comparisons should be >= so that we don't
+read one element beyond the end of the array.
+
+Fixes: b5aa1006e4a9 ("pinctrl: ns2: add pinmux driver support for Broadcom NS2 SoC")
+Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
+Link: https://lore.kernel.org/r/20190926081426.GB2332@mwanda
+Acked-by: Scott Branden <scott.branden@broadcom.com>
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/pinctrl/bcm/pinctrl-ns2-mux.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/pinctrl/bcm/pinctrl-ns2-mux.c b/drivers/pinctrl/bcm/pinctrl-ns2-mux.c
+index 2bf6af7df7d94..9fabc451550ea 100644
+--- a/drivers/pinctrl/bcm/pinctrl-ns2-mux.c
++++ b/drivers/pinctrl/bcm/pinctrl-ns2-mux.c
+@@ -640,8 +640,8 @@ static int ns2_pinmux_enable(struct pinctrl_dev *pctrl_dev,
+ const struct ns2_pin_function *func;
+ const struct ns2_pin_group *grp;
+
+- if (grp_select > pinctrl->num_groups ||
+- func_select > pinctrl->num_functions)
++ if (grp_select >= pinctrl->num_groups ||
++ func_select >= pinctrl->num_functions)
+ return -EINVAL;
+
+ func = &pinctrl->functions[func_select];
+--
+2.20.1
+
--- /dev/null
+From c9b74b0daacac4065e920129f58c019bbfb23449 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 4 Oct 2019 14:23:42 +0200
+Subject: pinctrl: stmfx: fix null pointer on remove
+
+From: Amelie Delaunay <amelie.delaunay@st.com>
+
+[ Upstream commit 2fd215b8fdbe4d3a609adbe3a323696393cb1e53 ]
+
+dev_get_platdata(&pdev->dev) returns a pointer on struct stmfx_pinctrl,
+not on struct stmfx (platform_set_drvdata(pdev, pctl); in probe).
+Pointer on struct stmfx is stored in driver data of pdev parent (in probe:
+struct stmfx *stmfx = dev_get_drvdata(pdev->dev.parent);).
+
+Fixes: 1490d9f841b1 ("pinctrl: Add STMFX GPIO expander Pinctrl/GPIO driver")
+Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
+Link: https://lore.kernel.org/r/20191004122342.22018-1-amelie.delaunay@st.com
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/pinctrl/pinctrl-stmfx.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/pinctrl/pinctrl-stmfx.c b/drivers/pinctrl/pinctrl-stmfx.c
+index 31b6e511670fc..b7c7f24699c96 100644
+--- a/drivers/pinctrl/pinctrl-stmfx.c
++++ b/drivers/pinctrl/pinctrl-stmfx.c
+@@ -697,7 +697,7 @@ static int stmfx_pinctrl_probe(struct platform_device *pdev)
+
+ static int stmfx_pinctrl_remove(struct platform_device *pdev)
+ {
+- struct stmfx *stmfx = dev_get_platdata(&pdev->dev);
++ struct stmfx *stmfx = dev_get_drvdata(pdev->dev.parent);
+
+ return stmfx_function_disable(stmfx,
+ STMFX_FUNC_GPIO |
+--
+2.20.1
+
--- /dev/null
+From 0c93cbe2ab0464a2ff9dbbe24a38e18be68c367c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 17 Sep 2019 14:42:42 +0200
+Subject: regulator: da9062: fix suspend_enable/disable preparation
+
+From: Marco Felsch <m.felsch@pengutronix.de>
+
+[ Upstream commit a72865f057820ea9f57597915da4b651d65eb92f ]
+
+Currently the suspend reg_field maps to the pmic voltage selection bits
+and is used during suspend_enabe/disable() and during get_mode(). This
+seems to be wrong for both use cases.
+
+Use case one (suspend_enabe/disable):
+Those callbacks are used to mark a regulator device as enabled/disabled
+during suspend. Marking the regulator enabled during suspend is done by
+the LDOx_CONF/BUCKx_CONF bit within the LDOx_CONT/BUCKx_CONT registers.
+Setting this bit tells the DA9062 PMIC state machine to keep the
+regulator on in POWERDOWN mode and switch to suspend voltage.
+
+Use case two (get_mode):
+The get_mode callback is used to retrieve the active mode state. Since
+the regulator-setting-A is used for the active state and
+regulator-setting-B for the suspend state there is no need to check
+which regulator setting is active.
+
+Fixes: 4068e5182ada ("regulator: da9062: DA9062 regulator driver")
+Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
+Reviewed-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
+Link: https://lore.kernel.org/r/20190917124246.11732-2-m.felsch@pengutronix.de
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/regulator/da9062-regulator.c | 118 +++++++++++----------------
+ 1 file changed, 47 insertions(+), 71 deletions(-)
+
+diff --git a/drivers/regulator/da9062-regulator.c b/drivers/regulator/da9062-regulator.c
+index 2ffc64622451e..9b2ca472f70c5 100644
+--- a/drivers/regulator/da9062-regulator.c
++++ b/drivers/regulator/da9062-regulator.c
+@@ -136,7 +136,6 @@ static int da9062_buck_set_mode(struct regulator_dev *rdev, unsigned mode)
+ static unsigned da9062_buck_get_mode(struct regulator_dev *rdev)
+ {
+ struct da9062_regulator *regl = rdev_get_drvdata(rdev);
+- struct regmap_field *field;
+ unsigned int val, mode = 0;
+ int ret;
+
+@@ -158,18 +157,7 @@ static unsigned da9062_buck_get_mode(struct regulator_dev *rdev)
+ return REGULATOR_MODE_NORMAL;
+ }
+
+- /* Detect current regulator state */
+- ret = regmap_field_read(regl->suspend, &val);
+- if (ret < 0)
+- return 0;
+-
+- /* Read regulator mode from proper register, depending on state */
+- if (val)
+- field = regl->suspend_sleep;
+- else
+- field = regl->sleep;
+-
+- ret = regmap_field_read(field, &val);
++ ret = regmap_field_read(regl->sleep, &val);
+ if (ret < 0)
+ return 0;
+
+@@ -208,21 +196,9 @@ static int da9062_ldo_set_mode(struct regulator_dev *rdev, unsigned mode)
+ static unsigned da9062_ldo_get_mode(struct regulator_dev *rdev)
+ {
+ struct da9062_regulator *regl = rdev_get_drvdata(rdev);
+- struct regmap_field *field;
+ int ret, val;
+
+- /* Detect current regulator state */
+- ret = regmap_field_read(regl->suspend, &val);
+- if (ret < 0)
+- return 0;
+-
+- /* Read regulator mode from proper register, depending on state */
+- if (val)
+- field = regl->suspend_sleep;
+- else
+- field = regl->sleep;
+-
+- ret = regmap_field_read(field, &val);
++ ret = regmap_field_read(regl->sleep, &val);
+ if (ret < 0)
+ return 0;
+
+@@ -408,10 +384,10 @@ static const struct da9062_regulator_info local_da9061_regulator_info[] = {
+ __builtin_ffs((int)DA9062AA_BUCK1_MODE_MASK) - 1,
+ sizeof(unsigned int) * 8 -
+ __builtin_clz((DA9062AA_BUCK1_MODE_MASK)) - 1),
+- .suspend = REG_FIELD(DA9062AA_DVC_1,
+- __builtin_ffs((int)DA9062AA_VBUCK1_SEL_MASK) - 1,
++ .suspend = REG_FIELD(DA9062AA_BUCK1_CONT,
++ __builtin_ffs((int)DA9062AA_BUCK1_CONF_MASK) - 1,
+ sizeof(unsigned int) * 8 -
+- __builtin_clz((DA9062AA_VBUCK1_SEL_MASK)) - 1),
++ __builtin_clz(DA9062AA_BUCK1_CONF_MASK) - 1),
+ },
+ {
+ .desc.id = DA9061_ID_BUCK2,
+@@ -444,10 +420,10 @@ static const struct da9062_regulator_info local_da9061_regulator_info[] = {
+ __builtin_ffs((int)DA9062AA_BUCK3_MODE_MASK) - 1,
+ sizeof(unsigned int) * 8 -
+ __builtin_clz((DA9062AA_BUCK3_MODE_MASK)) - 1),
+- .suspend = REG_FIELD(DA9062AA_DVC_1,
+- __builtin_ffs((int)DA9062AA_VBUCK3_SEL_MASK) - 1,
++ .suspend = REG_FIELD(DA9062AA_BUCK3_CONT,
++ __builtin_ffs((int)DA9062AA_BUCK3_CONF_MASK) - 1,
+ sizeof(unsigned int) * 8 -
+- __builtin_clz((DA9062AA_VBUCK3_SEL_MASK)) - 1),
++ __builtin_clz(DA9062AA_BUCK3_CONF_MASK) - 1),
+ },
+ {
+ .desc.id = DA9061_ID_BUCK3,
+@@ -480,10 +456,10 @@ static const struct da9062_regulator_info local_da9061_regulator_info[] = {
+ __builtin_ffs((int)DA9062AA_BUCK4_MODE_MASK) - 1,
+ sizeof(unsigned int) * 8 -
+ __builtin_clz((DA9062AA_BUCK4_MODE_MASK)) - 1),
+- .suspend = REG_FIELD(DA9062AA_DVC_1,
+- __builtin_ffs((int)DA9062AA_VBUCK4_SEL_MASK) - 1,
++ .suspend = REG_FIELD(DA9062AA_BUCK4_CONT,
++ __builtin_ffs((int)DA9062AA_BUCK4_CONF_MASK) - 1,
+ sizeof(unsigned int) * 8 -
+- __builtin_clz((DA9062AA_VBUCK4_SEL_MASK)) - 1),
++ __builtin_clz(DA9062AA_BUCK4_CONF_MASK) - 1),
+ },
+ {
+ .desc.id = DA9061_ID_LDO1,
+@@ -509,10 +485,10 @@ static const struct da9062_regulator_info local_da9061_regulator_info[] = {
+ sizeof(unsigned int) * 8 -
+ __builtin_clz((DA9062AA_LDO1_SL_B_MASK)) - 1),
+ .suspend_vsel_reg = DA9062AA_VLDO1_B,
+- .suspend = REG_FIELD(DA9062AA_DVC_1,
+- __builtin_ffs((int)DA9062AA_VLDO1_SEL_MASK) - 1,
++ .suspend = REG_FIELD(DA9062AA_LDO1_CONT,
++ __builtin_ffs((int)DA9062AA_LDO1_CONF_MASK) - 1,
+ sizeof(unsigned int) * 8 -
+- __builtin_clz((DA9062AA_VLDO1_SEL_MASK)) - 1),
++ __builtin_clz(DA9062AA_LDO1_CONF_MASK) - 1),
+ .oc_event = REG_FIELD(DA9062AA_STATUS_D,
+ __builtin_ffs((int)DA9062AA_LDO1_ILIM_MASK) - 1,
+ sizeof(unsigned int) * 8 -
+@@ -542,10 +518,10 @@ static const struct da9062_regulator_info local_da9061_regulator_info[] = {
+ sizeof(unsigned int) * 8 -
+ __builtin_clz((DA9062AA_LDO2_SL_B_MASK)) - 1),
+ .suspend_vsel_reg = DA9062AA_VLDO2_B,
+- .suspend = REG_FIELD(DA9062AA_DVC_1,
+- __builtin_ffs((int)DA9062AA_VLDO2_SEL_MASK) - 1,
++ .suspend = REG_FIELD(DA9062AA_LDO2_CONT,
++ __builtin_ffs((int)DA9062AA_LDO2_CONF_MASK) - 1,
+ sizeof(unsigned int) * 8 -
+- __builtin_clz((DA9062AA_VLDO2_SEL_MASK)) - 1),
++ __builtin_clz(DA9062AA_LDO2_CONF_MASK) - 1),
+ .oc_event = REG_FIELD(DA9062AA_STATUS_D,
+ __builtin_ffs((int)DA9062AA_LDO2_ILIM_MASK) - 1,
+ sizeof(unsigned int) * 8 -
+@@ -575,10 +551,10 @@ static const struct da9062_regulator_info local_da9061_regulator_info[] = {
+ sizeof(unsigned int) * 8 -
+ __builtin_clz((DA9062AA_LDO3_SL_B_MASK)) - 1),
+ .suspend_vsel_reg = DA9062AA_VLDO3_B,
+- .suspend = REG_FIELD(DA9062AA_DVC_1,
+- __builtin_ffs((int)DA9062AA_VLDO3_SEL_MASK) - 1,
++ .suspend = REG_FIELD(DA9062AA_LDO3_CONT,
++ __builtin_ffs((int)DA9062AA_LDO3_CONF_MASK) - 1,
+ sizeof(unsigned int) * 8 -
+- __builtin_clz((DA9062AA_VLDO3_SEL_MASK)) - 1),
++ __builtin_clz(DA9062AA_LDO3_CONF_MASK) - 1),
+ .oc_event = REG_FIELD(DA9062AA_STATUS_D,
+ __builtin_ffs((int)DA9062AA_LDO3_ILIM_MASK) - 1,
+ sizeof(unsigned int) * 8 -
+@@ -608,10 +584,10 @@ static const struct da9062_regulator_info local_da9061_regulator_info[] = {
+ sizeof(unsigned int) * 8 -
+ __builtin_clz((DA9062AA_LDO4_SL_B_MASK)) - 1),
+ .suspend_vsel_reg = DA9062AA_VLDO4_B,
+- .suspend = REG_FIELD(DA9062AA_DVC_1,
+- __builtin_ffs((int)DA9062AA_VLDO4_SEL_MASK) - 1,
++ .suspend = REG_FIELD(DA9062AA_LDO4_CONT,
++ __builtin_ffs((int)DA9062AA_LDO4_CONF_MASK) - 1,
+ sizeof(unsigned int) * 8 -
+- __builtin_clz((DA9062AA_VLDO4_SEL_MASK)) - 1),
++ __builtin_clz(DA9062AA_LDO4_CONF_MASK) - 1),
+ .oc_event = REG_FIELD(DA9062AA_STATUS_D,
+ __builtin_ffs((int)DA9062AA_LDO4_ILIM_MASK) - 1,
+ sizeof(unsigned int) * 8 -
+@@ -652,10 +628,10 @@ static const struct da9062_regulator_info local_da9062_regulator_info[] = {
+ __builtin_ffs((int)DA9062AA_BUCK1_MODE_MASK) - 1,
+ sizeof(unsigned int) * 8 -
+ __builtin_clz((DA9062AA_BUCK1_MODE_MASK)) - 1),
+- .suspend = REG_FIELD(DA9062AA_DVC_1,
+- __builtin_ffs((int)DA9062AA_VBUCK1_SEL_MASK) - 1,
++ .suspend = REG_FIELD(DA9062AA_BUCK1_CONT,
++ __builtin_ffs((int)DA9062AA_BUCK1_CONF_MASK) - 1,
+ sizeof(unsigned int) * 8 -
+- __builtin_clz((DA9062AA_VBUCK1_SEL_MASK)) - 1),
++ __builtin_clz(DA9062AA_BUCK1_CONF_MASK) - 1),
+ },
+ {
+ .desc.id = DA9062_ID_BUCK2,
+@@ -688,10 +664,10 @@ static const struct da9062_regulator_info local_da9062_regulator_info[] = {
+ __builtin_ffs((int)DA9062AA_BUCK2_MODE_MASK) - 1,
+ sizeof(unsigned int) * 8 -
+ __builtin_clz((DA9062AA_BUCK2_MODE_MASK)) - 1),
+- .suspend = REG_FIELD(DA9062AA_DVC_1,
+- __builtin_ffs((int)DA9062AA_VBUCK2_SEL_MASK) - 1,
++ .suspend = REG_FIELD(DA9062AA_BUCK2_CONT,
++ __builtin_ffs((int)DA9062AA_BUCK2_CONF_MASK) - 1,
+ sizeof(unsigned int) * 8 -
+- __builtin_clz((DA9062AA_VBUCK2_SEL_MASK)) - 1),
++ __builtin_clz(DA9062AA_BUCK2_CONF_MASK) - 1),
+ },
+ {
+ .desc.id = DA9062_ID_BUCK3,
+@@ -724,10 +700,10 @@ static const struct da9062_regulator_info local_da9062_regulator_info[] = {
+ __builtin_ffs((int)DA9062AA_BUCK3_MODE_MASK) - 1,
+ sizeof(unsigned int) * 8 -
+ __builtin_clz((DA9062AA_BUCK3_MODE_MASK)) - 1),
+- .suspend = REG_FIELD(DA9062AA_DVC_1,
+- __builtin_ffs((int)DA9062AA_VBUCK3_SEL_MASK) - 1,
++ .suspend = REG_FIELD(DA9062AA_BUCK3_CONT,
++ __builtin_ffs((int)DA9062AA_BUCK3_CONF_MASK) - 1,
+ sizeof(unsigned int) * 8 -
+- __builtin_clz((DA9062AA_VBUCK3_SEL_MASK)) - 1),
++ __builtin_clz(DA9062AA_BUCK3_CONF_MASK) - 1),
+ },
+ {
+ .desc.id = DA9062_ID_BUCK4,
+@@ -760,10 +736,10 @@ static const struct da9062_regulator_info local_da9062_regulator_info[] = {
+ __builtin_ffs((int)DA9062AA_BUCK4_MODE_MASK) - 1,
+ sizeof(unsigned int) * 8 -
+ __builtin_clz((DA9062AA_BUCK4_MODE_MASK)) - 1),
+- .suspend = REG_FIELD(DA9062AA_DVC_1,
+- __builtin_ffs((int)DA9062AA_VBUCK4_SEL_MASK) - 1,
++ .suspend = REG_FIELD(DA9062AA_BUCK4_CONT,
++ __builtin_ffs((int)DA9062AA_BUCK4_CONF_MASK) - 1,
+ sizeof(unsigned int) * 8 -
+- __builtin_clz((DA9062AA_VBUCK4_SEL_MASK)) - 1),
++ __builtin_clz(DA9062AA_BUCK4_CONF_MASK) - 1),
+ },
+ {
+ .desc.id = DA9062_ID_LDO1,
+@@ -789,10 +765,10 @@ static const struct da9062_regulator_info local_da9062_regulator_info[] = {
+ sizeof(unsigned int) * 8 -
+ __builtin_clz((DA9062AA_LDO1_SL_B_MASK)) - 1),
+ .suspend_vsel_reg = DA9062AA_VLDO1_B,
+- .suspend = REG_FIELD(DA9062AA_DVC_1,
+- __builtin_ffs((int)DA9062AA_VLDO1_SEL_MASK) - 1,
++ .suspend = REG_FIELD(DA9062AA_LDO1_CONT,
++ __builtin_ffs((int)DA9062AA_LDO1_CONF_MASK) - 1,
+ sizeof(unsigned int) * 8 -
+- __builtin_clz((DA9062AA_VLDO1_SEL_MASK)) - 1),
++ __builtin_clz(DA9062AA_LDO1_CONF_MASK) - 1),
+ .oc_event = REG_FIELD(DA9062AA_STATUS_D,
+ __builtin_ffs((int)DA9062AA_LDO1_ILIM_MASK) - 1,
+ sizeof(unsigned int) * 8 -
+@@ -822,10 +798,10 @@ static const struct da9062_regulator_info local_da9062_regulator_info[] = {
+ sizeof(unsigned int) * 8 -
+ __builtin_clz((DA9062AA_LDO2_SL_B_MASK)) - 1),
+ .suspend_vsel_reg = DA9062AA_VLDO2_B,
+- .suspend = REG_FIELD(DA9062AA_DVC_1,
+- __builtin_ffs((int)DA9062AA_VLDO2_SEL_MASK) - 1,
++ .suspend = REG_FIELD(DA9062AA_LDO2_CONT,
++ __builtin_ffs((int)DA9062AA_LDO2_CONF_MASK) - 1,
+ sizeof(unsigned int) * 8 -
+- __builtin_clz((DA9062AA_VLDO2_SEL_MASK)) - 1),
++ __builtin_clz(DA9062AA_LDO2_CONF_MASK) - 1),
+ .oc_event = REG_FIELD(DA9062AA_STATUS_D,
+ __builtin_ffs((int)DA9062AA_LDO2_ILIM_MASK) - 1,
+ sizeof(unsigned int) * 8 -
+@@ -855,10 +831,10 @@ static const struct da9062_regulator_info local_da9062_regulator_info[] = {
+ sizeof(unsigned int) * 8 -
+ __builtin_clz((DA9062AA_LDO3_SL_B_MASK)) - 1),
+ .suspend_vsel_reg = DA9062AA_VLDO3_B,
+- .suspend = REG_FIELD(DA9062AA_DVC_1,
+- __builtin_ffs((int)DA9062AA_VLDO3_SEL_MASK) - 1,
++ .suspend = REG_FIELD(DA9062AA_LDO3_CONT,
++ __builtin_ffs((int)DA9062AA_LDO3_CONF_MASK) - 1,
+ sizeof(unsigned int) * 8 -
+- __builtin_clz((DA9062AA_VLDO3_SEL_MASK)) - 1),
++ __builtin_clz(DA9062AA_LDO3_CONF_MASK) - 1),
+ .oc_event = REG_FIELD(DA9062AA_STATUS_D,
+ __builtin_ffs((int)DA9062AA_LDO3_ILIM_MASK) - 1,
+ sizeof(unsigned int) * 8 -
+@@ -888,10 +864,10 @@ static const struct da9062_regulator_info local_da9062_regulator_info[] = {
+ sizeof(unsigned int) * 8 -
+ __builtin_clz((DA9062AA_LDO4_SL_B_MASK)) - 1),
+ .suspend_vsel_reg = DA9062AA_VLDO4_B,
+- .suspend = REG_FIELD(DA9062AA_DVC_1,
+- __builtin_ffs((int)DA9062AA_VLDO4_SEL_MASK) - 1,
++ .suspend = REG_FIELD(DA9062AA_LDO4_CONT,
++ __builtin_ffs((int)DA9062AA_LDO4_CONF_MASK) - 1,
+ sizeof(unsigned int) * 8 -
+- __builtin_clz((DA9062AA_VLDO4_SEL_MASK)) - 1),
++ __builtin_clz(DA9062AA_LDO4_CONF_MASK) - 1),
+ .oc_event = REG_FIELD(DA9062AA_STATUS_D,
+ __builtin_ffs((int)DA9062AA_LDO4_ILIM_MASK) - 1,
+ sizeof(unsigned int) * 8 -
+--
+2.20.1
+
--- /dev/null
+From 4739bc2ab891ad910009c3222e66f8ddd01f6f81 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 17 Sep 2019 17:40:20 +0200
+Subject: regulator: of: fix suspend-min/max-voltage parsing
+
+From: Marco Felsch <m.felsch@pengutronix.de>
+
+[ Upstream commit 131cb1210d4b58acb0695707dad2eb90dcb50a2a ]
+
+Currently the regulator-suspend-min/max-microvolt must be within the
+root regulator node but the dt-bindings specifies it as subnode
+properties for the regulator-state-[mem/disk/standby] node. The only DT
+using this bindings currently is the at91-sama5d2_xplained.dts and this
+DT uses it correctly. I don't know if it isn't tested but it can't work
+without this fix.
+
+Fixes: f7efad10b5c4 ("regulator: add PM suspend and resume hooks")
+Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
+Link: https://lore.kernel.org/r/20190917154021.14693-3-m.felsch@pengutronix.de
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/regulator/of_regulator.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c
+index 9112faa6a9a0e..38dd06fbab384 100644
+--- a/drivers/regulator/of_regulator.c
++++ b/drivers/regulator/of_regulator.c
+@@ -231,12 +231,12 @@ static int of_get_regulation_constraints(struct device *dev,
+ "regulator-off-in-suspend"))
+ suspend_state->enabled = DISABLE_IN_SUSPEND;
+
+- if (!of_property_read_u32(np, "regulator-suspend-min-microvolt",
+- &pval))
++ if (!of_property_read_u32(suspend_np,
++ "regulator-suspend-min-microvolt", &pval))
+ suspend_state->min_uV = pval;
+
+- if (!of_property_read_u32(np, "regulator-suspend-max-microvolt",
+- &pval))
++ if (!of_property_read_u32(suspend_np,
++ "regulator-suspend-max-microvolt", &pval))
+ suspend_state->max_uV = pval;
+
+ if (!of_property_read_u32(suspend_np,
+--
+2.20.1
+
--- /dev/null
+From 4daaa98882ef688ddfc534335e80a2a7cad1ef67 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 29 Sep 2019 10:09:57 -0700
+Subject: regulator: pfuze100-regulator: Variable "val" in
+ pfuze100_regulator_probe() could be uninitialized
+
+From: Yizhuo <yzhai003@ucr.edu>
+
+[ Upstream commit 1252b283141f03c3dffd139292c862cae10e174d ]
+
+In function pfuze100_regulator_probe(), variable "val" could be
+initialized if regmap_read() fails. However, "val" is used to
+decide the control flow later in the if statement, which is
+potentially unsafe.
+
+Signed-off-by: Yizhuo <yzhai003@ucr.edu>
+Link: https://lore.kernel.org/r/20190929170957.14775-1-yzhai003@ucr.edu
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/regulator/pfuze100-regulator.c | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/regulator/pfuze100-regulator.c b/drivers/regulator/pfuze100-regulator.c
+index df5df1c495adb..689537927f6f7 100644
+--- a/drivers/regulator/pfuze100-regulator.c
++++ b/drivers/regulator/pfuze100-regulator.c
+@@ -788,7 +788,13 @@ static int pfuze100_regulator_probe(struct i2c_client *client,
+
+ /* SW2~SW4 high bit check and modify the voltage value table */
+ if (i >= sw_check_start && i <= sw_check_end) {
+- regmap_read(pfuze_chip->regmap, desc->vsel_reg, &val);
++ ret = regmap_read(pfuze_chip->regmap,
++ desc->vsel_reg, &val);
++ if (ret) {
++ dev_err(&client->dev, "Fails to read from the register.\n");
++ return ret;
++ }
++
+ if (val & sw_hi) {
+ if (pfuze_chip->chip_id == PFUZE3000 ||
+ pfuze_chip->chip_id == PFUZE3001) {
+--
+2.20.1
+
--- /dev/null
+From 9b30ea832494ee191888f7c23eccfb10ba669807 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 29 Sep 2019 17:58:48 +0800
+Subject: regulator: ti-abb: Fix timeout in
+ ti_abb_wait_txdone/ti_abb_clear_all_txdone
+
+From: Axel Lin <axel.lin@ingics.com>
+
+[ Upstream commit f64db548799e0330897c3203680c2ee795ade518 ]
+
+ti_abb_wait_txdone() may return -ETIMEDOUT when ti_abb_check_txdone()
+returns true in the latest iteration of the while loop because the timeout
+value is abb->settling_time + 1. Similarly, ti_abb_clear_all_txdone() may
+return -ETIMEDOUT when ti_abb_check_txdone() returns false in the latest
+iteration of the while loop. Fix it.
+
+Signed-off-by: Axel Lin <axel.lin@ingics.com>
+Acked-by: Nishanth Menon <nm@ti.com>
+Link: https://lore.kernel.org/r/20190929095848.21960-1-axel.lin@ingics.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/regulator/ti-abb-regulator.c | 26 ++++++++------------------
+ 1 file changed, 8 insertions(+), 18 deletions(-)
+
+diff --git a/drivers/regulator/ti-abb-regulator.c b/drivers/regulator/ti-abb-regulator.c
+index cced1ffb896c1..89b9314d64c9d 100644
+--- a/drivers/regulator/ti-abb-regulator.c
++++ b/drivers/regulator/ti-abb-regulator.c
+@@ -173,19 +173,14 @@ static int ti_abb_wait_txdone(struct device *dev, struct ti_abb *abb)
+ while (timeout++ <= abb->settling_time) {
+ status = ti_abb_check_txdone(abb);
+ if (status)
+- break;
++ return 0;
+
+ udelay(1);
+ }
+
+- if (timeout > abb->settling_time) {
+- dev_warn_ratelimited(dev,
+- "%s:TRANXDONE timeout(%duS) int=0x%08x\n",
+- __func__, timeout, readl(abb->int_base));
+- return -ETIMEDOUT;
+- }
+-
+- return 0;
++ dev_warn_ratelimited(dev, "%s:TRANXDONE timeout(%duS) int=0x%08x\n",
++ __func__, timeout, readl(abb->int_base));
++ return -ETIMEDOUT;
+ }
+
+ /**
+@@ -205,19 +200,14 @@ static int ti_abb_clear_all_txdone(struct device *dev, const struct ti_abb *abb)
+
+ status = ti_abb_check_txdone(abb);
+ if (!status)
+- break;
++ return 0;
+
+ udelay(1);
+ }
+
+- if (timeout > abb->settling_time) {
+- dev_warn_ratelimited(dev,
+- "%s:TRANXDONE timeout(%duS) int=0x%08x\n",
+- __func__, timeout, readl(abb->int_base));
+- return -ETIMEDOUT;
+- }
+-
+- return 0;
++ dev_warn_ratelimited(dev, "%s:TRANXDONE timeout(%duS) int=0x%08x\n",
++ __func__, timeout, readl(abb->int_base));
++ return -ETIMEDOUT;
+ }
+
+ /**
+--
+2.20.1
+
--- /dev/null
+From 29b40751473270f246ce007f27703575002f08a5 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 9 Oct 2019 17:11:28 +0200
+Subject: scsi: fix kconfig dependency warning related to 53C700_LE_ON_BE
+
+From: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+
+[ Upstream commit 8cbf0c173aa096dda526d1ccd66fc751c31da346 ]
+
+When building a kernel with SCSI_SNI_53C710 enabled, Kconfig warns:
+
+WARNING: unmet direct dependencies detected for 53C700_LE_ON_BE
+ Depends on [n]: SCSI_LOWLEVEL [=y] && SCSI [=y] && SCSI_LASI700 [=n]
+ Selected by [y]:
+ - SCSI_SNI_53C710 [=y] && SCSI_LOWLEVEL [=y] && SNI_RM [=y] && SCSI [=y]
+
+Add the missing depends SCSI_SNI_53C710 to 53C700_LE_ON_BE to fix it.
+
+Link: https://lore.kernel.org/r/20191009151128.32411-1-tbogendoerfer@suse.de
+Signed-off-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/scsi/Kconfig | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
+index 1b92f3c19ff32..90cf4691b8c35 100644
+--- a/drivers/scsi/Kconfig
++++ b/drivers/scsi/Kconfig
+@@ -898,7 +898,7 @@ config SCSI_SNI_53C710
+
+ config 53C700_LE_ON_BE
+ bool
+- depends on SCSI_LASI700
++ depends on SCSI_LASI700 || SCSI_SNI_53C710
+ default y
+
+ config SCSI_STEX
+--
+2.20.1
+
--- /dev/null
+From 8c1b23e66233d4398d82832629fbcc72671d6e4d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 14 Oct 2019 13:03:58 -0500
+Subject: scsi: hpsa: add missing hunks in reset-patch
+
+From: Don Brace <don.brace@microsemi.com>
+
+[ Upstream commit 134993456c28c2ae14bd953236eb0742fe23d577 ]
+
+Correct returning from reset before outstanding commands are completed
+for the device.
+
+Link: https://lore.kernel.org/r/157107623870.17997.11208813089704833029.stgit@brunhilda
+Reviewed-by: Scott Benesh <scott.benesh@microsemi.com>
+Reviewed-by: Kevin Barnett <kevin.barnett@microsemi.com>
+Signed-off-by: Don Brace <don.brace@microsemi.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/scsi/hpsa.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
+index 1bb6aada93fab..a4519710b3fcf 100644
+--- a/drivers/scsi/hpsa.c
++++ b/drivers/scsi/hpsa.c
+@@ -5478,6 +5478,8 @@ static int hpsa_ciss_submit(struct ctlr_info *h,
+ return SCSI_MLQUEUE_HOST_BUSY;
+ }
+
++ c->device = dev;
++
+ enqueue_cmd_and_start_io(h, c);
+ /* the cmd'll come back via intr handler in complete_scsi_command() */
+ return 0;
+@@ -5549,6 +5551,7 @@ static int hpsa_ioaccel_submit(struct ctlr_info *h,
+ hpsa_cmd_init(h, c->cmdindex, c);
+ c->cmd_type = CMD_SCSI;
+ c->scsi_cmd = cmd;
++ c->device = dev;
+ rc = hpsa_scsi_ioaccel_raid_map(h, c);
+ if (rc < 0) /* scsi_dma_map failed. */
+ rc = SCSI_MLQUEUE_HOST_BUSY;
+@@ -5556,6 +5559,7 @@ static int hpsa_ioaccel_submit(struct ctlr_info *h,
+ hpsa_cmd_init(h, c->cmdindex, c);
+ c->cmd_type = CMD_SCSI;
+ c->scsi_cmd = cmd;
++ c->device = dev;
+ rc = hpsa_scsi_ioaccel_direct_map(h, c);
+ if (rc < 0) /* scsi_dma_map failed. */
+ rc = SCSI_MLQUEUE_HOST_BUSY;
+--
+2.20.1
+
--- /dev/null
+From e6edd2f811b60039f22acc5fc514b3548910a210 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 18 Sep 2019 22:06:58 +0530
+Subject: scsi: qla2xxx: fix a potential NULL pointer dereference
+
+From: Allen Pais <allen.pais@oracle.com>
+
+[ Upstream commit 35a79a63517981a8aea395497c548776347deda8 ]
+
+alloc_workqueue is not checked for errors and as a result a potential
+NULL dereference could occur.
+
+Link: https://lore.kernel.org/r/1568824618-4366-1-git-send-email-allen.pais@oracle.com
+Signed-off-by: Allen Pais <allen.pais@oracle.com>
+Reviewed-by: Martin Wilck <mwilck@suse.com>
+Acked-by: Himanshu Madhani <hmadhani@marvell.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/scsi/qla2xxx/qla_os.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
+index 2835afbd2edc7..04cf6986eb8e6 100644
+--- a/drivers/scsi/qla2xxx/qla_os.c
++++ b/drivers/scsi/qla2xxx/qla_os.c
+@@ -3233,6 +3233,10 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
+ req->req_q_in, req->req_q_out, rsp->rsp_q_in, rsp->rsp_q_out);
+
+ ha->wq = alloc_workqueue("qla2xxx_wq", 0, 0);
++ if (unlikely(!ha->wq)) {
++ ret = -ENOMEM;
++ goto probe_failed;
++ }
+
+ if (ha->isp_ops->initialize_adapter(base_vha)) {
+ ql_log(ql_log_fatal, base_vha, 0x00d6,
+--
+2.20.1
+
--- /dev/null
+From 44c51c233f3ec6f84ffead428e0878100af23c28 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 7 Oct 2019 15:57:01 +0200
+Subject: scsi: scsi_dh_alua: handle RTPG sense code correctly during state
+ transitions
+
+From: Hannes Reinecke <hare@suse.com>
+
+[ Upstream commit b6ce6fb121a655aefe41dccc077141c102145a37 ]
+
+Some arrays are not capable of returning RTPG data during state
+transitioning, but rather return an 'LUN not accessible, asymmetric access
+state transition' sense code. In these cases we can set the state to
+'transitioning' directly and don't need to evaluate the RTPG data (which we
+won't have anyway).
+
+Link: https://lore.kernel.org/r/20191007135701.32389-1-hare@suse.de
+Reviewed-by: Laurence Oberman <loberman@redhat.com>
+Reviewed-by: Ewan D. Milne <emilne@redhat.com>
+Reviewed-by: Bart Van Assche <bvanassche@acm.org>
+Signed-off-by: Hannes Reinecke <hare@suse.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/scsi/device_handler/scsi_dh_alua.c | 21 ++++++++++++++++-----
+ 1 file changed, 16 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/scsi/device_handler/scsi_dh_alua.c b/drivers/scsi/device_handler/scsi_dh_alua.c
+index 4971104b1817b..f32da0ca529e0 100644
+--- a/drivers/scsi/device_handler/scsi_dh_alua.c
++++ b/drivers/scsi/device_handler/scsi_dh_alua.c
+@@ -512,6 +512,7 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg)
+ unsigned int tpg_desc_tbl_off;
+ unsigned char orig_transition_tmo;
+ unsigned long flags;
++ bool transitioning_sense = false;
+
+ if (!pg->expiry) {
+ unsigned long transition_tmo = ALUA_FAILOVER_TIMEOUT * HZ;
+@@ -572,13 +573,19 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg)
+ goto retry;
+ }
+ /*
+- * Retry on ALUA state transition or if any
+- * UNIT ATTENTION occurred.
++ * If the array returns with 'ALUA state transition'
++ * sense code here it cannot return RTPG data during
++ * transition. So set the state to 'transitioning' directly.
+ */
+ if (sense_hdr.sense_key == NOT_READY &&
+- sense_hdr.asc == 0x04 && sense_hdr.ascq == 0x0a)
+- err = SCSI_DH_RETRY;
+- else if (sense_hdr.sense_key == UNIT_ATTENTION)
++ sense_hdr.asc == 0x04 && sense_hdr.ascq == 0x0a) {
++ transitioning_sense = true;
++ goto skip_rtpg;
++ }
++ /*
++ * Retry on any other UNIT ATTENTION occurred.
++ */
++ if (sense_hdr.sense_key == UNIT_ATTENTION)
+ err = SCSI_DH_RETRY;
+ if (err == SCSI_DH_RETRY &&
+ pg->expiry != 0 && time_before(jiffies, pg->expiry)) {
+@@ -666,7 +673,11 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg)
+ off = 8 + (desc[7] * 4);
+ }
+
++ skip_rtpg:
+ spin_lock_irqsave(&pg->lock, flags);
++ if (transitioning_sense)
++ pg->state = SCSI_ACCESS_STATE_TRANSITIONING;
++
+ sdev_printk(KERN_INFO, sdev,
+ "%s: port group %02x state %c %s supports %c%c%c%c%c%c%c\n",
+ ALUA_DH_NAME, pg->group_id, print_alua_state(pg->state),
+--
+2.20.1
+
--- /dev/null
+From 124f830ce3ec2cc85639b985fdb8f2e3ceb6b324 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 9 Oct 2019 17:11:18 +0200
+Subject: scsi: sni_53c710: fix compilation error
+
+From: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+
+[ Upstream commit 0ee6211408a8e939428f662833c7301394125b80 ]
+
+Drop out memory dev_printk() with wrong device pointer argument.
+
+[mkp: typo]
+
+Link: https://lore.kernel.org/r/20191009151118.32350-1-tbogendoerfer@suse.de
+Signed-off-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/scsi/sni_53c710.c | 4 +---
+ 1 file changed, 1 insertion(+), 3 deletions(-)
+
+diff --git a/drivers/scsi/sni_53c710.c b/drivers/scsi/sni_53c710.c
+index aef4881d8e215..a85d52b5dc320 100644
+--- a/drivers/scsi/sni_53c710.c
++++ b/drivers/scsi/sni_53c710.c
+@@ -66,10 +66,8 @@ static int snirm710_probe(struct platform_device *dev)
+
+ base = res->start;
+ hostdata = kzalloc(sizeof(*hostdata), GFP_KERNEL);
+- if (!hostdata) {
+- dev_printk(KERN_ERR, dev, "Failed to allocate host data\n");
++ if (!hostdata)
+ return -ENOMEM;
+- }
+
+ hostdata->dev = &dev->dev;
+ dma_set_mask(&dev->dev, DMA_BIT_MASK(32));
+--
+2.20.1
+
--- /dev/null
+From 1c19f12652fbba943c7b1ad34658a87149027cd2 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 14 Oct 2019 20:29:04 +0200
+Subject: scsi: target: core: Do not overwrite CDB byte 1
+
+From: Bodo Stroesser <bstroesser@ts.fujitsu.com>
+
+[ Upstream commit 27e84243cb63601a10e366afe3e2d05bb03c1cb5 ]
+
+passthrough_parse_cdb() - used by TCMU and PSCSI - attepts to reset the LUN
+field of SCSI-2 CDBs (bits 5,6,7 of byte 1). The current code is wrong as
+for newer commands not having the LUN field it overwrites relevant command
+bits (e.g. for SECURITY PROTOCOL IN / OUT). We think this code was
+unnecessary from the beginning or at least it is no longer useful. So we
+remove it entirely.
+
+Link: https://lore.kernel.org/r/12498eab-76fd-eaad-1316-c2827badb76a@ts.fujitsu.com
+Signed-off-by: Bodo Stroesser <bstroesser@ts.fujitsu.com>
+Reviewed-by: Bart Van Assche <bvanassche@acm.org>
+Reviewed-by: Hannes Reinecke <hare@suse.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/target/target_core_device.c | 21 ---------------------
+ 1 file changed, 21 deletions(-)
+
+diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c
+index 04bf2acd3800d..2d19f0e332b01 100644
+--- a/drivers/target/target_core_device.c
++++ b/drivers/target/target_core_device.c
+@@ -1074,27 +1074,6 @@ passthrough_parse_cdb(struct se_cmd *cmd,
+ struct se_device *dev = cmd->se_dev;
+ unsigned int size;
+
+- /*
+- * Clear a lun set in the cdb if the initiator talking to use spoke
+- * and old standards version, as we can't assume the underlying device
+- * won't choke up on it.
+- */
+- switch (cdb[0]) {
+- case READ_10: /* SBC - RDProtect */
+- case READ_12: /* SBC - RDProtect */
+- case READ_16: /* SBC - RDProtect */
+- case SEND_DIAGNOSTIC: /* SPC - SELF-TEST Code */
+- case VERIFY: /* SBC - VRProtect */
+- case VERIFY_16: /* SBC - VRProtect */
+- case WRITE_VERIFY: /* SBC - VRProtect */
+- case WRITE_VERIFY_12: /* SBC - VRProtect */
+- case MAINTENANCE_IN: /* SPC - Parameter Data Format for SA RTPG */
+- break;
+- default:
+- cdb[1] &= 0x1f; /* clear logical unit number */
+- break;
+- }
+-
+ /*
+ * For REPORT LUNS we always need to emulate the response, for everything
+ * else, pass it up.
+--
+2.20.1
+
--- /dev/null
+From 6b6e8f2d4786428521d516d92686cb4096abd0ae Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 8 Oct 2019 20:08:08 +0200
+Subject: selftests: kvm: fix sync_regs_test with newer gccs
+
+From: Vitaly Kuznetsov <vkuznets@redhat.com>
+
+[ Upstream commit ef4059809890f732c69cc1726d3a9a108a832a2f ]
+
+Commit 204c91eff798a ("KVM: selftests: do not blindly clobber registers in
+ guest asm") was intended to make test more gcc-proof, however, the result
+is exactly the opposite: on newer gccs (e.g. 8.2.1) the test breaks with
+
+==== Test Assertion Failure ====
+ x86_64/sync_regs_test.c:168: run->s.regs.regs.rbx == 0xBAD1DEA + 1
+ pid=14170 tid=14170 - Invalid argument
+ 1 0x00000000004015b3: main at sync_regs_test.c:166 (discriminator 6)
+ 2 0x00007f413fb66412: ?? ??:0
+ 3 0x000000000040191d: _start at ??:?
+ rbx sync regs value incorrect 0x1.
+
+Apparently, compile is still free to play games with registers even
+when they have variables attached.
+
+Re-write guest code with 'asm volatile' by embedding ucall there and
+making sure rbx is preserved.
+
+Fixes: 204c91eff798a ("KVM: selftests: do not blindly clobber registers in guest asm")
+Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
+Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ .../selftests/kvm/x86_64/sync_regs_test.c | 21 ++++++++++---------
+ 1 file changed, 11 insertions(+), 10 deletions(-)
+
+diff --git a/tools/testing/selftests/kvm/x86_64/sync_regs_test.c b/tools/testing/selftests/kvm/x86_64/sync_regs_test.c
+index 11c2a70a7b87a..5c82242562943 100644
+--- a/tools/testing/selftests/kvm/x86_64/sync_regs_test.c
++++ b/tools/testing/selftests/kvm/x86_64/sync_regs_test.c
+@@ -22,18 +22,19 @@
+
+ #define VCPU_ID 5
+
++#define UCALL_PIO_PORT ((uint16_t)0x1000)
++
++/*
++ * ucall is embedded here to protect against compiler reshuffling registers
++ * before calling a function. In this test we only need to get KVM_EXIT_IO
++ * vmexit and preserve RBX, no additional information is needed.
++ */
+ void guest_code(void)
+ {
+- /*
+- * use a callee-save register, otherwise the compiler
+- * saves it around the call to GUEST_SYNC.
+- */
+- register u32 stage asm("rbx");
+- for (;;) {
+- GUEST_SYNC(0);
+- stage++;
+- asm volatile ("" : : "r" (stage));
+- }
++ asm volatile("1: in %[port], %%al\n"
++ "add $0x1, %%rbx\n"
++ "jmp 1b"
++ : : [port] "d" (UCALL_PIO_PORT) : "rax", "rbx");
+ }
+
+ static void compare_regs(struct kvm_regs *left, struct kvm_regs *right)
+--
+2.20.1
+
--- /dev/null
+From 37a7f3347b84dd31baf55375161ef364ac0c1a08 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 8 Oct 2019 21:43:36 +0200
+Subject: selftests: kvm: vmx_set_nested_state_test: don't check for VMX
+ support twice
+
+From: Vitaly Kuznetsov <vkuznets@redhat.com>
+
+[ Upstream commit 700c17d9cec8712f4091692488fb63e2680f7a5d ]
+
+vmx_set_nested_state_test() checks if VMX is supported twice: in the very
+beginning (and skips the whole test if it's not) and before doing
+test_vmx_nested_state(). One should be enough.
+
+Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
+Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ .../selftests/kvm/x86_64/vmx_set_nested_state_test.c | 7 +------
+ 1 file changed, 1 insertion(+), 6 deletions(-)
+
+diff --git a/tools/testing/selftests/kvm/x86_64/vmx_set_nested_state_test.c b/tools/testing/selftests/kvm/x86_64/vmx_set_nested_state_test.c
+index 853e370e8a394..a6d85614ae4d6 100644
+--- a/tools/testing/selftests/kvm/x86_64/vmx_set_nested_state_test.c
++++ b/tools/testing/selftests/kvm/x86_64/vmx_set_nested_state_test.c
+@@ -271,12 +271,7 @@ int main(int argc, char *argv[])
+ state.flags = KVM_STATE_NESTED_RUN_PENDING;
+ test_nested_state_expect_einval(vm, &state);
+
+- /*
+- * TODO: When SVM support is added for KVM_SET_NESTED_STATE
+- * add tests here to support it like VMX.
+- */
+- if (entry->ecx & CPUID_VMX)
+- test_vmx_nested_state(vm);
++ test_vmx_nested_state(vm);
+
+ kvm_vm_free(vm);
+ return 0;
+--
+2.20.1
+
--- /dev/null
+regulator-of-fix-suspend-min-max-voltage-parsing.patch
+asoc-samsung-arndale-add-missing-of-node-dereferenci.patch
+asoc-wm8994-do-not-register-inapplicable-controls-fo.patch
+regulator-da9062-fix-suspend_enable-disable-preparat.patch
+asoc-topology-fix-a-signedness-bug-in-soc_tplg_dapm_.patch
+arm64-dts-allwinner-a64-pine64-plus-add-phy-regulato.patch
+arm64-dts-allwinner-a64-drop-pmu-node.patch
+arm64-dts-allwinner-a64-sopine-baseboard-add-phy-reg.patch
+arm64-dts-fix-gpio-to-pinmux-mapping.patch
+regulator-ti-abb-fix-timeout-in-ti_abb_wait_txdone-t.patch
+pinctrl-intel-allocate-irq-chip-dynamic.patch
+asoc-sof-loader-fix-kernel-oops-on-firmware-boot-fai.patch
+asoc-sof-topology-fix-parse-fail-issue-for-byte-bool.patch
+asoc-sof-intel-hda-fix-warnings-during-fw-load.patch
+asoc-sof-intel-initialise-and-verify-fw-crash-dump-d.patch
+asoc-sof-intel-hda-disable-dmi-l1-entry-during-captu.patch
+asoc-rt5682-add-null-handler-to-set_jack-function.patch
+asoc-intel-sof_rt5682-add-remove-function-to-disable.patch
+asoc-intel-bytcr_rt5651-add-null-check-to-support_bu.patch
+regulator-pfuze100-regulator-variable-val-in-pfuze10.patch
+asoc-wm_adsp-don-t-generate-kcontrols-without-read-f.patch
+asoc-rockchip-i2s-fix-rpm-imbalance.patch
+arm64-dts-rockchip-fix-rockpro64-rk808-interrupt-lin.patch
+arm-dts-logicpd-torpedo-som-remove-twl_keypad.patch
+arm64-dts-rockchip-fix-rockpro64-vdd-log-regulator-s.patch
+arm64-dts-rockchip-fix-rockpro64-sdhci-settings.patch
+pinctrl-ns2-fix-off-by-one-bugs-in-ns2_pinmux_enable.patch
+pinctrl-stmfx-fix-null-pointer-on-remove.patch
+arm64-dts-zii-ultra-fix-arm-regulator-states.patch
+arm-dts-am3874-iceboard-fix-i2c-mux-idle-disconnect-.patch
+asoc-msm8916-wcd-digital-add-missing-mix2-path-for-r.patch
+asoc-simple_card_utils.h-fix-potential-multiple-rede.patch
+arm-dts-use-level-interrupt-for-omap4-5-wlcore.patch
+arm-mm-fix-alignment-handler-faults-under-memory-pre.patch
+scsi-qla2xxx-fix-a-potential-null-pointer-dereferenc.patch
+scsi-scsi_dh_alua-handle-rtpg-sense-code-correctly-d.patch
+scsi-sni_53c710-fix-compilation-error.patch
+scsi-fix-kconfig-dependency-warning-related-to-53c70.patch
+arm-8908-1-add-__always_inline-to-functions-called-f.patch
+arm-8914-1-nommu-fix-exc_ret-for-xip.patch
+arm64-dts-rockchip-fix-rockpro64-sdmmc-settings.patch
+arm64-dts-rockchip-fix-usb-c-on-hugsun-x99-tv-box.patch
+arm64-dts-lx2160a-correct-cpu-core-idle-state-name.patch
+arm-dts-imx6q-logicpd-re-enable-snvs-power-key.patch
+arm-dts-vf610-zii-scu4-aib-specify-i2c-mux-idle-disc.patch
+arm-dts-imx7s-correct-gpt-s-ipg-clock-source.patch
+arm64-dts-imx8mq-use-correct-clock-for-usdhc-s-ipg-c.patch
+arm64-dts-imx8mm-use-correct-clock-for-usdhc-s-ipg-c.patch
+perf-tools-fix-resource-leak-of-closedir-on-the-erro.patch
+perf-c2c-fix-memory-leak-in-build_cl_output.patch
+8250-men-mcb-fix-error-checking-when-get_num_ports-r.patch
+perf-kmem-fix-memory-leak-in-compact_gfp_flags.patch
+arm-davinci-dm365-fix-mcbsp-dma_slave_map-entry.patch
+drm-amdgpu-fix-potential-vm-faults.patch
+drm-amdgpu-fix-error-handling-in-amdgpu_bo_list_crea.patch
+scsi-target-core-do-not-overwrite-cdb-byte-1.patch
+scsi-hpsa-add-missing-hunks-in-reset-patch.patch
+asoc-intel-sof-rt5682-add-a-check-for-devm_clk_get.patch
+asoc-sof-control-return-true-when-kcontrol-values-ch.patch
+tracing-fix-gfp_t-format-for-synthetic-events.patch
+arm-dts-bcm2837-rpi-cm3-avoid-leds-gpio-probing-issu.patch
+i2c-aspeed-fix-master-pending-state-handling.patch
+drm-komeda-don-t-flush-inactive-pipes.patch
+arm-8926-1-v7m-remove-register-save-to-stack-before-.patch
+selftests-kvm-vmx_set_nested_state_test-don-t-check-.patch
+selftests-kvm-fix-sync_regs_test-with-newer-gccs.patch
+alsa-hda-add-tigerlake-jasperlake-pci-id.patch
+of-unittest-fix-memory-leak-in-unittest_data_add.patch
+mips-bmips-mark-exception-vectors-as-char-arrays.patch
+irqchip-gic-v3-its-use-the-exact-itslist-for-vmovp.patch
+i2c-mt65xx-fix-null-ptr-dereference.patch
+i2c-stm32f7-fix-first-byte-to-send-in-slave-mode.patch
+i2c-stm32f7-fix-a-race-in-slave-mode-with-arbitratio.patch
+i2c-stm32f7-remove-warning-when-compiling-with-w-1.patch
+cifs-fix-cifsinodeinfo-lock_sem-deadlock-when-reconn.patch
+irqchip-sifive-plic-skip-contexts-except-supervisor-.patch
+nbd-protect-cmd-status-with-cmd-lock.patch
+nbd-handle-racing-with-error-ed-out-commands.patch
+ata-libahci_platform-fix-regulator_get_optional-misu.patch
--- /dev/null
+From a6625e4e4159723b4cc0c5148900ef0fd5da17b0 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 18 Oct 2019 09:20:34 +0800
+Subject: tracing: Fix "gfp_t" format for synthetic events
+
+From: Zhengjun Xing <zhengjun.xing@linux.intel.com>
+
+[ Upstream commit 9fa8c9c647be624e91b09ecffa7cd97ee0600b40 ]
+
+In the format of synthetic events, the "gfp_t" is shown as "signed:1",
+but in fact the "gfp_t" is "unsigned", should be shown as "signed:0".
+
+The issue can be reproduced by the following commands:
+
+echo 'memlatency u64 lat; unsigned int order; gfp_t gfp_flags; int migratetype' > /sys/kernel/debug/tracing/synthetic_events
+cat /sys/kernel/debug/tracing/events/synthetic/memlatency/format
+
+name: memlatency
+ID: 2233
+format:
+ field:unsigned short common_type; offset:0; size:2; signed:0;
+ field:unsigned char common_flags; offset:2; size:1; signed:0;
+ field:unsigned char common_preempt_count; offset:3; size:1; signed:0;
+ field:int common_pid; offset:4; size:4; signed:1;
+
+ field:u64 lat; offset:8; size:8; signed:0;
+ field:unsigned int order; offset:16; size:4; signed:0;
+ field:gfp_t gfp_flags; offset:24; size:4; signed:1;
+ field:int migratetype; offset:32; size:4; signed:1;
+
+print fmt: "lat=%llu, order=%u, gfp_flags=%x, migratetype=%d", REC->lat, REC->order, REC->gfp_flags, REC->migratetype
+
+Link: http://lkml.kernel.org/r/20191018012034.6404-1-zhengjun.xing@linux.intel.com
+
+Reviewed-by: Tom Zanussi <tom.zanussi@linux.intel.com>
+Signed-off-by: Zhengjun Xing <zhengjun.xing@linux.intel.com>
+Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ kernel/trace/trace_events_hist.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
+index dd310d3b58431..725b9b35f933c 100644
+--- a/kernel/trace/trace_events_hist.c
++++ b/kernel/trace/trace_events_hist.c
+@@ -674,6 +674,8 @@ static bool synth_field_signed(char *type)
+ {
+ if (str_has_prefix(type, "u"))
+ return false;
++ if (strcmp(type, "gfp_t") == 0)
++ return false;
+
+ return true;
+ }
+--
+2.20.1
+