]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
fixes for 4.14
authorSasha Levin <sashal@kernel.org>
Sat, 5 Oct 2019 23:46:45 +0000 (19:46 -0400)
committerSasha Levin <sashal@kernel.org>
Sat, 5 Oct 2019 23:46:45 +0000 (19:46 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
49 files changed:
queue-4.14/arm-8898-1-mm-don-t-treat-faults-reported-from-cache.patch [new file with mode: 0644]
queue-4.14/arm-8903-1-ensure-that-usable-memory-in-bank-0-start.patch [new file with mode: 0644]
queue-4.14/arm64-fix-unreachable-code-issue-with-cmpxchg.patch [new file with mode: 0644]
queue-4.14/clk-at91-select-parent-if-main-oscillator-or-bypass-.patch [new file with mode: 0644]
queue-4.14/clk-jz4740-add-tcu-clock.patch [new file with mode: 0644]
queue-4.14/clk-qoriq-fix-wunused-const-variable.patch [new file with mode: 0644]
queue-4.14/clk-sirf-don-t-reference-clk_init_data-after-registr.patch [new file with mode: 0644]
queue-4.14/clk-sunxi-ng-v3s-add-missing-clock-slices-for-mmc2-m.patch [new file with mode: 0644]
queue-4.14/clk-zx296718-don-t-reference-clk_init_data-after-reg.patch [new file with mode: 0644]
queue-4.14/dma-buf-sw_sync-synchronize-signal-vs-syncpt-free.patch [new file with mode: 0644]
queue-4.14/drm-amdgpu-si-fix-asic-tests.patch [new file with mode: 0644]
queue-4.14/drm-bridge-tc358767-increase-aux-transfer-length-lim.patch [new file with mode: 0644]
queue-4.14/drm-nouveau-volt-fix-for-some-cards-having-0-maximum.patch [new file with mode: 0644]
queue-4.14/drm-panel-simple-fix-auo-g185han01-horizontal-blanki.patch [new file with mode: 0644]
queue-4.14/drm-radeon-fix-eeh-during-kexec.patch [new file with mode: 0644]
queue-4.14/drm-stm-attach-gem-fence-to-atomic-state.patch [new file with mode: 0644]
queue-4.14/fat-work-around-race-with-userspace-s-read-via-block.patch [new file with mode: 0644]
queue-4.14/gpu-drm-radeon-fix-a-possible-null-pointer-dereferen.patch [new file with mode: 0644]
queue-4.14/hid-apple-fix-stuck-function-keys-when-using-fn.patch [new file with mode: 0644]
queue-4.14/hypfs-fix-error-number-left-in-struct-pointer-member.patch [new file with mode: 0644]
queue-4.14/i2c-cht-wc-fix-lockdep-warning.patch [new file with mode: 0644]
queue-4.14/ipmi_si-only-schedule-continuously-in-the-thread-in-.patch [new file with mode: 0644]
queue-4.14/kbuild-clean-compressed-initramfs-image.patch [new file with mode: 0644]
queue-4.14/kmemleak-increase-debug_kmemleak_early_log_size-defa.patch [new file with mode: 0644]
queue-4.14/livepatch-nullify-obj-mod-in-klp_module_coming-s-err.patch [new file with mode: 0644]
queue-4.14/mfd-intel-lpss-remove-d3cold-delay.patch [new file with mode: 0644]
queue-4.14/mips-tlbex-explicitly-cast-_page_no_exec-to-a-boolea.patch [new file with mode: 0644]
queue-4.14/ocfs2-wait-for-recovering-done-after-direct-unlock-r.patch [new file with mode: 0644]
queue-4.14/pci-exynos-propagate-errors-for-optional-phys.patch [new file with mode: 0644]
queue-4.14/pci-imx6-propagate-errors-for-optional-regulators.patch [new file with mode: 0644]
queue-4.14/pci-rockchip-propagate-errors-for-optional-regulator.patch [new file with mode: 0644]
queue-4.14/pci-tegra-fix-of-node-reference-leak.patch [new file with mode: 0644]
queue-4.14/pinctrl-tegra-fix-write-barrier-placement-in-pmx_wri.patch [new file with mode: 0644]
queue-4.14/pktcdvd-remove-warning-on-attempting-to-register-non.patch [new file with mode: 0644]
queue-4.14/powerpc-64s-exception-machine-check-use-correct-cfar.patch [new file with mode: 0644]
queue-4.14/powerpc-futex-fix-warning-oldval-may-be-used-uniniti.patch [new file with mode: 0644]
queue-4.14/powerpc-pseries-correctly-track-irq-state-in-default.patch [new file with mode: 0644]
queue-4.14/powerpc-pseries-mobility-use-cond_resched-when-updat.patch [new file with mode: 0644]
queue-4.14/powerpc-rtas-use-device-model-apis-and-serialization.patch [new file with mode: 0644]
queue-4.14/powerpc-xmon-check-for-hv-mode-when-dumping-xive-inf.patch [new file with mode: 0644]
queue-4.14/rtc-snvs-fix-possible-race-condition.patch [new file with mode: 0644]
queue-4.14/scsi-core-reduce-memory-required-for-scsi-logging.patch [new file with mode: 0644]
queue-4.14/security-smack-fix-possible-null-pointer-dereference.patch [new file with mode: 0644]
queue-4.14/series [new file with mode: 0644]
queue-4.14/tpm-fix-tpm-1.2-shutdown-sequence-to-prevent-future-.patch [new file with mode: 0644]
queue-4.14/tpm-migrate-pubek_show-to-struct-tpm_buf.patch [new file with mode: 0644]
queue-4.14/tpm-use-tpm_try_get_ops-in-tpm-sysfs.c.patch [new file with mode: 0644]
queue-4.14/vfio_pci-restore-original-state-on-release.patch [new file with mode: 0644]
queue-4.14/video-ssd1307fb-start-page-range-at-page_offset.patch [new file with mode: 0644]

diff --git a/queue-4.14/arm-8898-1-mm-don-t-treat-faults-reported-from-cache.patch b/queue-4.14/arm-8898-1-mm-don-t-treat-faults-reported-from-cache.patch
new file mode 100644 (file)
index 0000000..0ebb9f8
--- /dev/null
@@ -0,0 +1,76 @@
+From cb3e5e9ee1023c89701c3c8bbdb685740e6f2159 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 8 Aug 2019 16:51:00 +0100
+Subject: ARM: 8898/1: mm: Don't treat faults reported from cache maintenance
+ as writes
+
+From: Will Deacon <will@kernel.org>
+
+[ Upstream commit 834020366da9ab3fb87d1eb9a3160eb22dbed63a ]
+
+Translation faults arising from cache maintenance instructions are
+rather unhelpfully reported with an FSR value where the WnR field is set
+to 1, indicating that the faulting access was a write. Since cache
+maintenance instructions on 32-bit ARM do not require any particular
+permissions, this can cause our private 'cacheflush' system call to fail
+spuriously if a translation fault is generated due to page aging when
+targetting a read-only VMA.
+
+In this situation, we will return -EFAULT to userspace, although this is
+unfortunately suppressed by the popular '__builtin___clear_cache()'
+intrinsic provided by GCC, which returns void.
+
+Although it's tempting to write this off as a userspace issue, we can
+actually do a little bit better on CPUs that support LPAE, even if the
+short-descriptor format is in use. On these CPUs, cache maintenance
+faults additionally set the CM field in the FSR, which we can use to
+suppress the write permission checks in the page fault handler and
+succeed in performing cache maintenance to read-only areas even in the
+presence of a translation fault.
+
+Reported-by: Orion Hodson <oth@google.com>
+Signed-off-by: Will Deacon <will@kernel.org>
+Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm/mm/fault.c | 4 ++--
+ arch/arm/mm/fault.h | 1 +
+ 2 files changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c
+index 49b1b80486358..9bb446cc135d1 100644
+--- a/arch/arm/mm/fault.c
++++ b/arch/arm/mm/fault.c
+@@ -215,7 +215,7 @@ static inline bool access_error(unsigned int fsr, struct vm_area_struct *vma)
+ {
+       unsigned int mask = VM_READ | VM_WRITE | VM_EXEC;
+-      if (fsr & FSR_WRITE)
++      if ((fsr & FSR_WRITE) && !(fsr & FSR_CM))
+               mask = VM_WRITE;
+       if (fsr & FSR_LNX_PF)
+               mask = VM_EXEC;
+@@ -285,7 +285,7 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
+       if (user_mode(regs))
+               flags |= FAULT_FLAG_USER;
+-      if (fsr & FSR_WRITE)
++      if ((fsr & FSR_WRITE) && !(fsr & FSR_CM))
+               flags |= FAULT_FLAG_WRITE;
+       /*
+diff --git a/arch/arm/mm/fault.h b/arch/arm/mm/fault.h
+index c063708fa5032..9ecc2097a87a0 100644
+--- a/arch/arm/mm/fault.h
++++ b/arch/arm/mm/fault.h
+@@ -6,6 +6,7 @@
+  * Fault status register encodings.  We steal bit 31 for our own purposes.
+  */
+ #define FSR_LNX_PF            (1 << 31)
++#define FSR_CM                        (1 << 13)
+ #define FSR_WRITE             (1 << 11)
+ #define FSR_FS4                       (1 << 10)
+ #define FSR_FS3_0             (15)
+-- 
+2.20.1
+
diff --git a/queue-4.14/arm-8903-1-ensure-that-usable-memory-in-bank-0-start.patch b/queue-4.14/arm-8903-1-ensure-that-usable-memory-in-bank-0-start.patch
new file mode 100644 (file)
index 0000000..7b70deb
--- /dev/null
@@ -0,0 +1,58 @@
+From 6069dc9ea5467faa9794d1b3fe6a6becfb093d2f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 30 Aug 2019 14:27:56 +0100
+Subject: ARM: 8903/1: ensure that usable memory in bank 0 starts from a
+ PMD-aligned address
+
+From: Mike Rapoport <mike.rapoport@gmail.com>
+
+[ Upstream commit 00d2ec1e6bd82c0538e6dd3e4a4040de93ba4fef ]
+
+The calculation of memblock_limit in adjust_lowmem_bounds() assumes that
+bank 0 starts from a PMD-aligned address. However, the beginning of the
+first bank may be NOMAP memory and the start of usable memory
+will be not aligned to PMD boundary. In such case the memblock_limit will
+be set to the end of the NOMAP region, which will prevent any memblock
+allocations.
+
+Mark the region between the end of the NOMAP area and the next PMD-aligned
+address as NOMAP as well, so that the usable memory will start at
+PMD-aligned address.
+
+Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
+Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm/mm/mmu.c | 16 ++++++++++++++++
+ 1 file changed, 16 insertions(+)
+
+diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
+index e46a6a446cdd2..70e560cf8ca03 100644
+--- a/arch/arm/mm/mmu.c
++++ b/arch/arm/mm/mmu.c
+@@ -1175,6 +1175,22 @@ void __init adjust_lowmem_bounds(void)
+        */
+       vmalloc_limit = (u64)(uintptr_t)vmalloc_min - PAGE_OFFSET + PHYS_OFFSET;
++      /*
++       * The first usable region must be PMD aligned. Mark its start
++       * as MEMBLOCK_NOMAP if it isn't
++       */
++      for_each_memblock(memory, reg) {
++              if (!memblock_is_nomap(reg)) {
++                      if (!IS_ALIGNED(reg->base, PMD_SIZE)) {
++                              phys_addr_t len;
++
++                              len = round_up(reg->base, PMD_SIZE) - reg->base;
++                              memblock_mark_nomap(reg->base, len);
++                      }
++                      break;
++              }
++      }
++
+       for_each_memblock(memory, reg) {
+               phys_addr_t block_start = reg->base;
+               phys_addr_t block_end = reg->base + reg->size;
+-- 
+2.20.1
+
diff --git a/queue-4.14/arm64-fix-unreachable-code-issue-with-cmpxchg.patch b/queue-4.14/arm64-fix-unreachable-code-issue-with-cmpxchg.patch
new file mode 100644 (file)
index 0000000..1b5fc10
--- /dev/null
@@ -0,0 +1,69 @@
+From d608fa69f667d7095bd318bfad06295ec8f816bf Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 10 Sep 2019 13:56:22 +0200
+Subject: arm64: fix unreachable code issue with cmpxchg
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+[ Upstream commit 920fdab7b3ce98c14c840261e364f490f3679a62 ]
+
+On arm64 build with clang, sometimes the __cmpxchg_mb is not inlined
+when CONFIG_OPTIMIZE_INLINING is set.
+Clang then fails a compile-time assertion, because it cannot tell at
+compile time what the size of the argument is:
+
+mm/memcontrol.o: In function `__cmpxchg_mb':
+memcontrol.c:(.text+0x1a4c): undefined reference to `__compiletime_assert_175'
+memcontrol.c:(.text+0x1a4c): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `__compiletime_assert_175'
+
+Mark all of the cmpxchg() style functions as __always_inline to
+ensure that the compiler can see the result.
+
+Acked-by: Nick Desaulniers <ndesaulniers@google.com>
+Reported-by: Nathan Chancellor <natechancellor@gmail.com>
+Link: https://github.com/ClangBuiltLinux/linux/issues/648
+Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
+Tested-by: Nathan Chancellor <natechancellor@gmail.com>
+Reviewed-by: Andrew Murray <andrew.murray@arm.com>
+Tested-by: Andrew Murray <andrew.murray@arm.com>
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Will Deacon <will@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm64/include/asm/cmpxchg.h | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/arch/arm64/include/asm/cmpxchg.h b/arch/arm64/include/asm/cmpxchg.h
+index 0f2e1ab5e1666..9b2e2e2e728ae 100644
+--- a/arch/arm64/include/asm/cmpxchg.h
++++ b/arch/arm64/include/asm/cmpxchg.h
+@@ -73,7 +73,7 @@ __XCHG_CASE( ,  ,  mb_8, dmb ish, nop,  , a, l, "memory")
+ #undef __XCHG_CASE
+ #define __XCHG_GEN(sfx)                                                       \
+-static inline unsigned long __xchg##sfx(unsigned long x,              \
++static __always_inline  unsigned long __xchg##sfx(unsigned long x,    \
+                                       volatile void *ptr,             \
+                                       int size)                       \
+ {                                                                     \
+@@ -115,7 +115,7 @@ __XCHG_GEN(_mb)
+ #define xchg(...)             __xchg_wrapper( _mb, __VA_ARGS__)
+ #define __CMPXCHG_GEN(sfx)                                            \
+-static inline unsigned long __cmpxchg##sfx(volatile void *ptr,                \
++static __always_inline unsigned long __cmpxchg##sfx(volatile void *ptr,       \
+                                          unsigned long old,           \
+                                          unsigned long new,           \
+                                          int size)                    \
+@@ -248,7 +248,7 @@ __CMPWAIT_CASE( ,  , 8);
+ #undef __CMPWAIT_CASE
+ #define __CMPWAIT_GEN(sfx)                                            \
+-static inline void __cmpwait##sfx(volatile void *ptr,                 \
++static __always_inline void __cmpwait##sfx(volatile void *ptr,                \
+                                 unsigned long val,                    \
+                                 int size)                             \
+ {                                                                     \
+-- 
+2.20.1
+
diff --git a/queue-4.14/clk-at91-select-parent-if-main-oscillator-or-bypass-.patch b/queue-4.14/clk-at91-select-parent-if-main-oscillator-or-bypass-.patch
new file mode 100644 (file)
index 0000000..a1065f9
--- /dev/null
@@ -0,0 +1,73 @@
+From b0d1475ef9140392ccac9ab66463f7b4db23e2c8 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 9 Sep 2019 15:30:34 +0000
+Subject: clk: at91: select parent if main oscillator or bypass is enabled
+
+From: Eugen Hristev <eugen.hristev@microchip.com>
+
+[ Upstream commit 69a6bcde7fd3fe6f3268ce26f31d9d9378384c98 ]
+
+Selecting the right parent for the main clock is done using only
+main oscillator enabled bit.
+In case we have this oscillator bypassed by an external signal (no driving
+on the XOUT line), we still use external clock, but with BYPASS bit set.
+So, in this case we must select the same parent as before.
+Create a macro that will select the right parent considering both bits from
+the MOR register.
+Use this macro when looking for the right parent.
+
+Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
+Link: https://lkml.kernel.org/r/1568042692-11784-2-git-send-email-eugen.hristev@microchip.com
+Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
+Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
+Signed-off-by: Stephen Boyd <sboyd@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/clk/at91/clk-main.c | 10 +++++++---
+ 1 file changed, 7 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/clk/at91/clk-main.c b/drivers/clk/at91/clk-main.c
+index c813c27f2e58c..2f97a843d6d6b 100644
+--- a/drivers/clk/at91/clk-main.c
++++ b/drivers/clk/at91/clk-main.c
+@@ -27,6 +27,10 @@
+ #define MOR_KEY_MASK          (0xff << 16)
++#define clk_main_parent_select(s)     (((s) & \
++                                      (AT91_PMC_MOSCEN | \
++                                      AT91_PMC_OSCBYPASS)) ? 1 : 0)
++
+ struct clk_main_osc {
+       struct clk_hw hw;
+       struct regmap *regmap;
+@@ -119,7 +123,7 @@ static int clk_main_osc_is_prepared(struct clk_hw *hw)
+       regmap_read(regmap, AT91_PMC_SR, &status);
+-      return (status & AT91_PMC_MOSCS) && (tmp & AT91_PMC_MOSCEN);
++      return (status & AT91_PMC_MOSCS) && clk_main_parent_select(tmp);
+ }
+ static const struct clk_ops main_osc_ops = {
+@@ -530,7 +534,7 @@ static u8 clk_sam9x5_main_get_parent(struct clk_hw *hw)
+       regmap_read(clkmain->regmap, AT91_CKGR_MOR, &status);
+-      return status & AT91_PMC_MOSCEN ? 1 : 0;
++      return clk_main_parent_select(status);
+ }
+ static const struct clk_ops sam9x5_main_ops = {
+@@ -572,7 +576,7 @@ at91_clk_register_sam9x5_main(struct regmap *regmap,
+       clkmain->hw.init = &init;
+       clkmain->regmap = regmap;
+       regmap_read(clkmain->regmap, AT91_CKGR_MOR, &status);
+-      clkmain->parent = status & AT91_PMC_MOSCEN ? 1 : 0;
++      clkmain->parent = clk_main_parent_select(status);
+       hw = &clkmain->hw;
+       ret = clk_hw_register(NULL, &clkmain->hw);
+-- 
+2.20.1
+
diff --git a/queue-4.14/clk-jz4740-add-tcu-clock.patch b/queue-4.14/clk-jz4740-add-tcu-clock.patch
new file mode 100644 (file)
index 0000000..d28635b
--- /dev/null
@@ -0,0 +1,73 @@
+From 4f350cf75e255308e2328596db1b41e0414ccce0 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 24 Jul 2019 13:16:10 -0400
+Subject: clk: jz4740: Add TCU clock
+
+From: Paul Cercueil <paul@crapouillou.net>
+
+[ Upstream commit 73dd11dc1a883d4c994d729dc9984f4890001157 ]
+
+Add the missing TCU clock to the list of clocks supplied by the CGU for
+the JZ4740 SoC.
+
+Signed-off-by: Paul Cercueil <paul@crapouillou.net>
+Tested-by: Mathieu Malaterre <malat@debian.org>
+Tested-by: Artur Rojek <contact@artur-rojek.eu>
+Acked-by: Stephen Boyd <sboyd@kernel.org>
+Acked-by: Rob Herring <robh@kernel.org>
+Signed-off-by: Paul Burton <paul.burton@mips.com>
+Cc: Ralf Baechle <ralf@linux-mips.org>
+Cc: James Hogan <jhogan@kernel.org>
+Cc: Jonathan Corbet <corbet@lwn.net>
+Cc: Lee Jones <lee.jones@linaro.org>
+Cc: Arnd Bergmann <arnd@arndb.de>
+Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: Michael Turquette <mturquette@baylibre.com>
+Cc: Jason Cooper <jason@lakedaemon.net>
+Cc: Marc Zyngier <marc.zyngier@arm.com>
+Cc: Rob Herring <robh+dt@kernel.org>
+Cc: Mark Rutland <mark.rutland@arm.com>
+Cc: devicetree@vger.kernel.org
+Cc: linux-kernel@vger.kernel.org
+Cc: linux-doc@vger.kernel.org
+Cc: linux-mips@vger.kernel.org
+Cc: linux-clk@vger.kernel.org
+Cc: od@zcrc.me
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/clk/ingenic/jz4740-cgu.c       | 6 ++++++
+ include/dt-bindings/clock/jz4740-cgu.h | 1 +
+ 2 files changed, 7 insertions(+)
+
+diff --git a/drivers/clk/ingenic/jz4740-cgu.c b/drivers/clk/ingenic/jz4740-cgu.c
+index 32fcc75f6f77e..216ba051e743c 100644
+--- a/drivers/clk/ingenic/jz4740-cgu.c
++++ b/drivers/clk/ingenic/jz4740-cgu.c
+@@ -211,6 +211,12 @@ static const struct ingenic_cgu_clk_info jz4740_cgu_clocks[] = {
+               .parents = { JZ4740_CLK_EXT, -1, -1, -1 },
+               .gate = { CGU_REG_CLKGR, 5 },
+       },
++
++      [JZ4740_CLK_TCU] = {
++              "tcu", CGU_CLK_GATE,
++              .parents = { JZ4740_CLK_EXT, -1, -1, -1 },
++              .gate = { CGU_REG_CLKGR, 1 },
++      },
+ };
+ static void __init jz4740_cgu_init(struct device_node *np)
+diff --git a/include/dt-bindings/clock/jz4740-cgu.h b/include/dt-bindings/clock/jz4740-cgu.h
+index 6ed83f926ae71..e82d77028581a 100644
+--- a/include/dt-bindings/clock/jz4740-cgu.h
++++ b/include/dt-bindings/clock/jz4740-cgu.h
+@@ -34,5 +34,6 @@
+ #define JZ4740_CLK_ADC                19
+ #define JZ4740_CLK_I2C                20
+ #define JZ4740_CLK_AIC                21
++#define JZ4740_CLK_TCU                22
+ #endif /* __DT_BINDINGS_CLOCK_JZ4740_CGU_H__ */
+-- 
+2.20.1
+
diff --git a/queue-4.14/clk-qoriq-fix-wunused-const-variable.patch b/queue-4.14/clk-qoriq-fix-wunused-const-variable.patch
new file mode 100644 (file)
index 0000000..3e8e7aa
--- /dev/null
@@ -0,0 +1,49 @@
+From dc0d772d0c8ee4cf74685040bd0d0758e8ef894e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 27 Jun 2019 15:06:42 -0700
+Subject: clk: qoriq: Fix -Wunused-const-variable
+
+From: Nathan Huckleberry <nhuck@google.com>
+
+[ Upstream commit a95fb581b144b5e73da382eaedb2e32027610597 ]
+
+drivers/clk/clk-qoriq.c:138:38: warning: unused variable
+'p5020_cmux_grp1' [-Wunused-const-variable] static const struct
+clockgen_muxinfo p5020_cmux_grp1
+
+drivers/clk/clk-qoriq.c:146:38: warning: unused variable
+'p5020_cmux_grp2' [-Wunused-const-variable] static const struct
+clockgen_muxinfo p5020_cmux_grp2
+
+In the definition of the p5020 chip, the p2041 chip's info was used
+instead.  The p5020 and p2041 chips have different info. This is most
+likely a typo.
+
+Link: https://github.com/ClangBuiltLinux/linux/issues/525
+Cc: clang-built-linux@googlegroups.com
+Signed-off-by: Nathan Huckleberry <nhuck@google.com>
+Link: https://lkml.kernel.org/r/20190627220642.78575-1-nhuck@google.com
+Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
+Acked-by: Scott Wood <oss@buserror.net>
+Signed-off-by: Stephen Boyd <sboyd@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/clk/clk-qoriq.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/clk/clk-qoriq.c b/drivers/clk/clk-qoriq.c
+index b0ea753b8709d..1a292519d84f2 100644
+--- a/drivers/clk/clk-qoriq.c
++++ b/drivers/clk/clk-qoriq.c
+@@ -610,7 +610,7 @@ static const struct clockgen_chipinfo chipinfo[] = {
+               .guts_compat = "fsl,qoriq-device-config-1.0",
+               .init_periph = p5020_init_periph,
+               .cmux_groups = {
+-                      &p2041_cmux_grp1, &p2041_cmux_grp2
++                      &p5020_cmux_grp1, &p5020_cmux_grp2
+               },
+               .cmux_to_group = {
+                       0, 1, -1
+-- 
+2.20.1
+
diff --git a/queue-4.14/clk-sirf-don-t-reference-clk_init_data-after-registr.patch b/queue-4.14/clk-sirf-don-t-reference-clk_init_data-after-registr.patch
new file mode 100644 (file)
index 0000000..b727542
--- /dev/null
@@ -0,0 +1,74 @@
+From 03a5176062788bfdb93aacda5a1e198b93bf0f8f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 31 Jul 2019 12:35:13 -0700
+Subject: clk: sirf: Don't reference clk_init_data after registration
+
+From: Stephen Boyd <sboyd@kernel.org>
+
+[ Upstream commit af55dadfbce35b4f4c6247244ce3e44b2e242b84 ]
+
+A future patch is going to change semantics of clk_register() so that
+clk_hw::init is guaranteed to be NULL after a clk is registered. Avoid
+referencing this member here so that we don't run into NULL pointer
+exceptions.
+
+Cc: Guo Zeng <Guo.Zeng@csr.com>
+Cc: Barry Song <Baohua.Song@csr.com>
+Signed-off-by: Stephen Boyd <sboyd@kernel.org>
+Link: https://lkml.kernel.org/r/20190731193517.237136-6-sboyd@kernel.org
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/clk/sirf/clk-common.c | 12 ++++++++----
+ 1 file changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/clk/sirf/clk-common.c b/drivers/clk/sirf/clk-common.c
+index 77e1e2491689b..edb7197cc4b4d 100644
+--- a/drivers/clk/sirf/clk-common.c
++++ b/drivers/clk/sirf/clk-common.c
+@@ -298,9 +298,10 @@ static u8 dmn_clk_get_parent(struct clk_hw *hw)
+ {
+       struct clk_dmn *clk = to_dmnclk(hw);
+       u32 cfg = clkc_readl(clk->regofs);
++      const char *name = clk_hw_get_name(hw);
+       /* parent of io domain can only be pll3 */
+-      if (strcmp(hw->init->name, "io") == 0)
++      if (strcmp(name, "io") == 0)
+               return 4;
+       WARN_ON((cfg & (BIT(3) - 1)) > 4);
+@@ -312,9 +313,10 @@ static int dmn_clk_set_parent(struct clk_hw *hw, u8 parent)
+ {
+       struct clk_dmn *clk = to_dmnclk(hw);
+       u32 cfg = clkc_readl(clk->regofs);
++      const char *name = clk_hw_get_name(hw);
+       /* parent of io domain can only be pll3 */
+-      if (strcmp(hw->init->name, "io") == 0)
++      if (strcmp(name, "io") == 0)
+               return -EINVAL;
+       cfg &= ~(BIT(3) - 1);
+@@ -354,7 +356,8 @@ static long dmn_clk_round_rate(struct clk_hw *hw, unsigned long rate,
+ {
+       unsigned long fin;
+       unsigned ratio, wait, hold;
+-      unsigned bits = (strcmp(hw->init->name, "mem") == 0) ? 3 : 4;
++      const char *name = clk_hw_get_name(hw);
++      unsigned bits = (strcmp(name, "mem") == 0) ? 3 : 4;
+       fin = *parent_rate;
+       ratio = fin / rate;
+@@ -376,7 +379,8 @@ static int dmn_clk_set_rate(struct clk_hw *hw, unsigned long rate,
+       struct clk_dmn *clk = to_dmnclk(hw);
+       unsigned long fin;
+       unsigned ratio, wait, hold, reg;
+-      unsigned bits = (strcmp(hw->init->name, "mem") == 0) ? 3 : 4;
++      const char *name = clk_hw_get_name(hw);
++      unsigned bits = (strcmp(name, "mem") == 0) ? 3 : 4;
+       fin = parent_rate;
+       ratio = fin / rate;
+-- 
+2.20.1
+
diff --git a/queue-4.14/clk-sunxi-ng-v3s-add-missing-clock-slices-for-mmc2-m.patch b/queue-4.14/clk-sunxi-ng-v3s-add-missing-clock-slices-for-mmc2-m.patch
new file mode 100644 (file)
index 0000000..622330e
--- /dev/null
@@ -0,0 +1,39 @@
+From b34d8bc25fe1f6eafd417044a60997668dd24313 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 28 Jul 2019 11:12:23 +0800
+Subject: clk: sunxi-ng: v3s: add missing clock slices for MMC2 module clocks
+
+From: Icenowy Zheng <icenowy@aosc.io>
+
+[ Upstream commit 720099603d1f62e37b789366d7e89824b009ca28 ]
+
+The MMC2 clock slices are currently not defined in V3s CCU driver, which
+makes MMC2 not working.
+
+Fix this issue.
+
+Fixes: d0f11d14b0bc ("clk: sunxi-ng: add support for V3s CCU")
+Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
+Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/clk/sunxi-ng/ccu-sun8i-v3s.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-v3s.c b/drivers/clk/sunxi-ng/ccu-sun8i-v3s.c
+index ac12f261f8caa..9e3f4088724b4 100644
+--- a/drivers/clk/sunxi-ng/ccu-sun8i-v3s.c
++++ b/drivers/clk/sunxi-ng/ccu-sun8i-v3s.c
+@@ -499,6 +499,9 @@ static struct clk_hw_onecell_data sun8i_v3s_hw_clks = {
+               [CLK_MMC1]              = &mmc1_clk.common.hw,
+               [CLK_MMC1_SAMPLE]       = &mmc1_sample_clk.common.hw,
+               [CLK_MMC1_OUTPUT]       = &mmc1_output_clk.common.hw,
++              [CLK_MMC2]              = &mmc2_clk.common.hw,
++              [CLK_MMC2_SAMPLE]       = &mmc2_sample_clk.common.hw,
++              [CLK_MMC2_OUTPUT]       = &mmc2_output_clk.common.hw,
+               [CLK_CE]                = &ce_clk.common.hw,
+               [CLK_SPI0]              = &spi0_clk.common.hw,
+               [CLK_USB_PHY0]          = &usb_phy0_clk.common.hw,
+-- 
+2.20.1
+
diff --git a/queue-4.14/clk-zx296718-don-t-reference-clk_init_data-after-reg.patch b/queue-4.14/clk-zx296718-don-t-reference-clk_init_data-after-reg.patch
new file mode 100644 (file)
index 0000000..9f0e309
--- /dev/null
@@ -0,0 +1,287 @@
+From 666129ca35ca4c1c87a7f56e8e40ad4054fe49e2 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 15 Aug 2019 09:00:18 -0700
+Subject: clk: zx296718: Don't reference clk_init_data after registration
+
+From: Stephen Boyd <sboyd@kernel.org>
+
+[ Upstream commit 1a4549c150e27dbc3aea762e879a88209df6d1a5 ]
+
+A future patch is going to change semantics of clk_register() so that
+clk_hw::init is guaranteed to be NULL after a clk is registered. Avoid
+referencing this member here so that we don't run into NULL pointer
+exceptions.
+
+Cc: Jun Nie <jun.nie@linaro.org>
+Cc: Shawn Guo <shawnguo@kernel.org>
+Signed-off-by: Stephen Boyd <sboyd@kernel.org>
+Link: https://lkml.kernel.org/r/20190815160020.183334-3-sboyd@kernel.org
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/clk/zte/clk-zx296718.c | 109 +++++++++++++++------------------
+ 1 file changed, 49 insertions(+), 60 deletions(-)
+
+diff --git a/drivers/clk/zte/clk-zx296718.c b/drivers/clk/zte/clk-zx296718.c
+index 354dd508c5169..8dfb8523b79db 100644
+--- a/drivers/clk/zte/clk-zx296718.c
++++ b/drivers/clk/zte/clk-zx296718.c
+@@ -567,6 +567,7 @@ static int __init top_clocks_init(struct device_node *np)
+ {
+       void __iomem *reg_base;
+       int i, ret;
++      const char *name;
+       reg_base = of_iomap(np, 0);
+       if (!reg_base) {
+@@ -576,11 +577,10 @@ static int __init top_clocks_init(struct device_node *np)
+       for (i = 0; i < ARRAY_SIZE(zx296718_pll_clk); i++) {
+               zx296718_pll_clk[i].reg_base += (uintptr_t)reg_base;
++              name = zx296718_pll_clk[i].hw.init->name;
+               ret = clk_hw_register(NULL, &zx296718_pll_clk[i].hw);
+-              if (ret) {
+-                      pr_warn("top clk %s init error!\n",
+-                              zx296718_pll_clk[i].hw.init->name);
+-              }
++              if (ret)
++                      pr_warn("top clk %s init error!\n", name);
+       }
+       for (i = 0; i < ARRAY_SIZE(top_ffactor_clk); i++) {
+@@ -588,11 +588,10 @@ static int __init top_clocks_init(struct device_node *np)
+                       top_hw_onecell_data.hws[top_ffactor_clk[i].id] =
+                                       &top_ffactor_clk[i].factor.hw;
++              name = top_ffactor_clk[i].factor.hw.init->name;
+               ret = clk_hw_register(NULL, &top_ffactor_clk[i].factor.hw);
+-              if (ret) {
+-                      pr_warn("top clk %s init error!\n",
+-                              top_ffactor_clk[i].factor.hw.init->name);
+-              }
++              if (ret)
++                      pr_warn("top clk %s init error!\n", name);
+       }
+       for (i = 0; i < ARRAY_SIZE(top_mux_clk); i++) {
+@@ -601,11 +600,10 @@ static int __init top_clocks_init(struct device_node *np)
+                                       &top_mux_clk[i].mux.hw;
+               top_mux_clk[i].mux.reg += (uintptr_t)reg_base;
++              name = top_mux_clk[i].mux.hw.init->name;
+               ret = clk_hw_register(NULL, &top_mux_clk[i].mux.hw);
+-              if (ret) {
+-                      pr_warn("top clk %s init error!\n",
+-                              top_mux_clk[i].mux.hw.init->name);
+-              }
++              if (ret)
++                      pr_warn("top clk %s init error!\n", name);
+       }
+       for (i = 0; i < ARRAY_SIZE(top_gate_clk); i++) {
+@@ -614,11 +612,10 @@ static int __init top_clocks_init(struct device_node *np)
+                                       &top_gate_clk[i].gate.hw;
+               top_gate_clk[i].gate.reg += (uintptr_t)reg_base;
++              name = top_gate_clk[i].gate.hw.init->name;
+               ret = clk_hw_register(NULL, &top_gate_clk[i].gate.hw);
+-              if (ret) {
+-                      pr_warn("top clk %s init error!\n",
+-                              top_gate_clk[i].gate.hw.init->name);
+-              }
++              if (ret)
++                      pr_warn("top clk %s init error!\n", name);
+       }
+       for (i = 0; i < ARRAY_SIZE(top_div_clk); i++) {
+@@ -627,11 +624,10 @@ static int __init top_clocks_init(struct device_node *np)
+                                       &top_div_clk[i].div.hw;
+               top_div_clk[i].div.reg += (uintptr_t)reg_base;
++              name = top_div_clk[i].div.hw.init->name;
+               ret = clk_hw_register(NULL, &top_div_clk[i].div.hw);
+-              if (ret) {
+-                      pr_warn("top clk %s init error!\n",
+-                              top_div_clk[i].div.hw.init->name);
+-              }
++              if (ret)
++                      pr_warn("top clk %s init error!\n", name);
+       }
+       ret = of_clk_add_hw_provider(np, of_clk_hw_onecell_get,
+@@ -757,6 +753,7 @@ static int __init lsp0_clocks_init(struct device_node *np)
+ {
+       void __iomem *reg_base;
+       int i, ret;
++      const char *name;
+       reg_base = of_iomap(np, 0);
+       if (!reg_base) {
+@@ -770,11 +767,10 @@ static int __init lsp0_clocks_init(struct device_node *np)
+                                       &lsp0_mux_clk[i].mux.hw;
+               lsp0_mux_clk[i].mux.reg += (uintptr_t)reg_base;
++              name = lsp0_mux_clk[i].mux.hw.init->name;
+               ret = clk_hw_register(NULL, &lsp0_mux_clk[i].mux.hw);
+-              if (ret) {
+-                      pr_warn("lsp0 clk %s init error!\n",
+-                              lsp0_mux_clk[i].mux.hw.init->name);
+-              }
++              if (ret)
++                      pr_warn("lsp0 clk %s init error!\n", name);
+       }
+       for (i = 0; i < ARRAY_SIZE(lsp0_gate_clk); i++) {
+@@ -783,11 +779,10 @@ static int __init lsp0_clocks_init(struct device_node *np)
+                                       &lsp0_gate_clk[i].gate.hw;
+               lsp0_gate_clk[i].gate.reg += (uintptr_t)reg_base;
++              name = lsp0_gate_clk[i].gate.hw.init->name;
+               ret = clk_hw_register(NULL, &lsp0_gate_clk[i].gate.hw);
+-              if (ret) {
+-                      pr_warn("lsp0 clk %s init error!\n",
+-                              lsp0_gate_clk[i].gate.hw.init->name);
+-              }
++              if (ret)
++                      pr_warn("lsp0 clk %s init error!\n", name);
+       }
+       for (i = 0; i < ARRAY_SIZE(lsp0_div_clk); i++) {
+@@ -796,11 +791,10 @@ static int __init lsp0_clocks_init(struct device_node *np)
+                                       &lsp0_div_clk[i].div.hw;
+               lsp0_div_clk[i].div.reg += (uintptr_t)reg_base;
++              name = lsp0_div_clk[i].div.hw.init->name;
+               ret = clk_hw_register(NULL, &lsp0_div_clk[i].div.hw);
+-              if (ret) {
+-                      pr_warn("lsp0 clk %s init error!\n",
+-                              lsp0_div_clk[i].div.hw.init->name);
+-              }
++              if (ret)
++                      pr_warn("lsp0 clk %s init error!\n", name);
+       }
+       ret = of_clk_add_hw_provider(np, of_clk_hw_onecell_get,
+@@ -865,6 +859,7 @@ static int __init lsp1_clocks_init(struct device_node *np)
+ {
+       void __iomem *reg_base;
+       int i, ret;
++      const char *name;
+       reg_base = of_iomap(np, 0);
+       if (!reg_base) {
+@@ -878,11 +873,10 @@ static int __init lsp1_clocks_init(struct device_node *np)
+                                       &lsp0_mux_clk[i].mux.hw;
+               lsp1_mux_clk[i].mux.reg += (uintptr_t)reg_base;
++              name = lsp1_mux_clk[i].mux.hw.init->name;
+               ret = clk_hw_register(NULL, &lsp1_mux_clk[i].mux.hw);
+-              if (ret) {
+-                      pr_warn("lsp1 clk %s init error!\n",
+-                              lsp1_mux_clk[i].mux.hw.init->name);
+-              }
++              if (ret)
++                      pr_warn("lsp1 clk %s init error!\n", name);
+       }
+       for (i = 0; i < ARRAY_SIZE(lsp1_gate_clk); i++) {
+@@ -891,11 +885,10 @@ static int __init lsp1_clocks_init(struct device_node *np)
+                                       &lsp1_gate_clk[i].gate.hw;
+               lsp1_gate_clk[i].gate.reg += (uintptr_t)reg_base;
++              name = lsp1_gate_clk[i].gate.hw.init->name;
+               ret = clk_hw_register(NULL, &lsp1_gate_clk[i].gate.hw);
+-              if (ret) {
+-                      pr_warn("lsp1 clk %s init error!\n",
+-                              lsp1_gate_clk[i].gate.hw.init->name);
+-              }
++              if (ret)
++                      pr_warn("lsp1 clk %s init error!\n", name);
+       }
+       for (i = 0; i < ARRAY_SIZE(lsp1_div_clk); i++) {
+@@ -904,11 +897,10 @@ static int __init lsp1_clocks_init(struct device_node *np)
+                                       &lsp1_div_clk[i].div.hw;
+               lsp1_div_clk[i].div.reg += (uintptr_t)reg_base;
++              name = lsp1_div_clk[i].div.hw.init->name;
+               ret = clk_hw_register(NULL, &lsp1_div_clk[i].div.hw);
+-              if (ret) {
+-                      pr_warn("lsp1 clk %s init error!\n",
+-                              lsp1_div_clk[i].div.hw.init->name);
+-              }
++              if (ret)
++                      pr_warn("lsp1 clk %s init error!\n", name);
+       }
+       ret = of_clk_add_hw_provider(np, of_clk_hw_onecell_get,
+@@ -982,6 +974,7 @@ static int __init audio_clocks_init(struct device_node *np)
+ {
+       void __iomem *reg_base;
+       int i, ret;
++      const char *name;
+       reg_base = of_iomap(np, 0);
+       if (!reg_base) {
+@@ -995,11 +988,10 @@ static int __init audio_clocks_init(struct device_node *np)
+                                       &audio_mux_clk[i].mux.hw;
+               audio_mux_clk[i].mux.reg += (uintptr_t)reg_base;
++              name = audio_mux_clk[i].mux.hw.init->name;
+               ret = clk_hw_register(NULL, &audio_mux_clk[i].mux.hw);
+-              if (ret) {
+-                      pr_warn("audio clk %s init error!\n",
+-                              audio_mux_clk[i].mux.hw.init->name);
+-              }
++              if (ret)
++                      pr_warn("audio clk %s init error!\n", name);
+       }
+       for (i = 0; i < ARRAY_SIZE(audio_adiv_clk); i++) {
+@@ -1008,11 +1000,10 @@ static int __init audio_clocks_init(struct device_node *np)
+                                       &audio_adiv_clk[i].hw;
+               audio_adiv_clk[i].reg_base += (uintptr_t)reg_base;
++              name = audio_adiv_clk[i].hw.init->name;
+               ret = clk_hw_register(NULL, &audio_adiv_clk[i].hw);
+-              if (ret) {
+-                      pr_warn("audio clk %s init error!\n",
+-                              audio_adiv_clk[i].hw.init->name);
+-              }
++              if (ret)
++                      pr_warn("audio clk %s init error!\n", name);
+       }
+       for (i = 0; i < ARRAY_SIZE(audio_div_clk); i++) {
+@@ -1021,11 +1012,10 @@ static int __init audio_clocks_init(struct device_node *np)
+                                       &audio_div_clk[i].div.hw;
+               audio_div_clk[i].div.reg += (uintptr_t)reg_base;
++              name = audio_div_clk[i].div.hw.init->name;
+               ret = clk_hw_register(NULL, &audio_div_clk[i].div.hw);
+-              if (ret) {
+-                      pr_warn("audio clk %s init error!\n",
+-                              audio_div_clk[i].div.hw.init->name);
+-              }
++              if (ret)
++                      pr_warn("audio clk %s init error!\n", name);
+       }
+       for (i = 0; i < ARRAY_SIZE(audio_gate_clk); i++) {
+@@ -1034,11 +1024,10 @@ static int __init audio_clocks_init(struct device_node *np)
+                                       &audio_gate_clk[i].gate.hw;
+               audio_gate_clk[i].gate.reg += (uintptr_t)reg_base;
++              name = audio_gate_clk[i].gate.hw.init->name;
+               ret = clk_hw_register(NULL, &audio_gate_clk[i].gate.hw);
+-              if (ret) {
+-                      pr_warn("audio clk %s init error!\n",
+-                              audio_gate_clk[i].gate.hw.init->name);
+-              }
++              if (ret)
++                      pr_warn("audio clk %s init error!\n", name);
+       }
+       ret = of_clk_add_hw_provider(np, of_clk_hw_onecell_get,
+-- 
+2.20.1
+
diff --git a/queue-4.14/dma-buf-sw_sync-synchronize-signal-vs-syncpt-free.patch b/queue-4.14/dma-buf-sw_sync-synchronize-signal-vs-syncpt-free.patch
new file mode 100644 (file)
index 0000000..4f68c47
--- /dev/null
@@ -0,0 +1,81 @@
+From 5e6fefb936f09fd9fbb420e296913ae59fb51d84 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 12 Aug 2019 16:42:47 +0100
+Subject: dma-buf/sw_sync: Synchronize signal vs syncpt free
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Chris Wilson <chris@chris-wilson.co.uk>
+
+[ Upstream commit d3c6dd1fb30d3853c2012549affe75c930f4a2f9 ]
+
+During release of the syncpt, we remove it from the list of syncpt and
+the tree, but only if it is not already been removed. However, during
+signaling, we first remove the syncpt from the list. So, if we
+concurrently free and signal the syncpt, the free may decide that it is
+not part of the tree and immediately free itself -- meanwhile the
+signaler goes on to use the now freed datastructure.
+
+In particular, we get struck by commit 0e2f733addbf ("dma-buf: make
+dma_fence structure a bit smaller v2") as the cb_list is immediately
+clobbered by the kfree_rcu.
+
+v2: Avoid calling into timeline_fence_release() from under the spinlock
+
+Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111381
+Fixes: d3862e44daa7 ("dma-buf/sw-sync: Fix locking around sync_timeline lists")
+References: 0e2f733addbf ("dma-buf: make dma_fence structure a bit smaller v2")
+Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+Cc: Sumit Semwal <sumit.semwal@linaro.org>
+Cc: Sean Paul <seanpaul@chromium.org>
+Cc: Gustavo Padovan <gustavo@padovan.org>
+Cc: Christian König <christian.koenig@amd.com>
+Cc: <stable@vger.kernel.org> # v4.14+
+Acked-by: Christian König <christian.koenig@amd.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/20190812154247.20508-1-chris@chris-wilson.co.uk
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/dma-buf/sw_sync.c | 16 +++++++---------
+ 1 file changed, 7 insertions(+), 9 deletions(-)
+
+diff --git a/drivers/dma-buf/sw_sync.c b/drivers/dma-buf/sw_sync.c
+index 24f83f9eeaedc..114b36674af42 100644
+--- a/drivers/dma-buf/sw_sync.c
++++ b/drivers/dma-buf/sw_sync.c
+@@ -141,17 +141,14 @@ static void timeline_fence_release(struct dma_fence *fence)
+ {
+       struct sync_pt *pt = dma_fence_to_sync_pt(fence);
+       struct sync_timeline *parent = dma_fence_parent(fence);
++      unsigned long flags;
++      spin_lock_irqsave(fence->lock, flags);
+       if (!list_empty(&pt->link)) {
+-              unsigned long flags;
+-
+-              spin_lock_irqsave(fence->lock, flags);
+-              if (!list_empty(&pt->link)) {
+-                      list_del(&pt->link);
+-                      rb_erase(&pt->node, &parent->pt_tree);
+-              }
+-              spin_unlock_irqrestore(fence->lock, flags);
++              list_del(&pt->link);
++              rb_erase(&pt->node, &parent->pt_tree);
+       }
++      spin_unlock_irqrestore(fence->lock, flags);
+       sync_timeline_put(parent);
+       dma_fence_free(fence);
+@@ -275,7 +272,8 @@ static struct sync_pt *sync_pt_create(struct sync_timeline *obj,
+                               p = &parent->rb_left;
+                       } else {
+                               if (dma_fence_get_rcu(&other->base)) {
+-                                      dma_fence_put(&pt->base);
++                                      sync_timeline_put(obj);
++                                      kfree(pt);
+                                       pt = other;
+                                       goto unlock;
+                               }
+-- 
+2.20.1
+
diff --git a/queue-4.14/drm-amdgpu-si-fix-asic-tests.patch b/queue-4.14/drm-amdgpu-si-fix-asic-tests.patch
new file mode 100644 (file)
index 0000000..3d50d2e
--- /dev/null
@@ -0,0 +1,62 @@
+From b0c026ae6364936cc689ead4606cd71ea30c452e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 28 Aug 2019 17:05:57 +0200
+Subject: drm/amdgpu/si: fix ASIC tests
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Jean Delvare <jdelvare@suse.de>
+
+[ Upstream commit 77efe48a729588527afb4d5811b9e0acb29f5e51 ]
+
+Comparing adev->family with CHIP constants is not correct.
+adev->family can only be compared with AMDGPU_FAMILY constants and
+adev->asic_type is the struct member to compare with CHIP constants.
+They are separate identification spaces.
+
+Signed-off-by: Jean Delvare <jdelvare@suse.de>
+Fixes: 62a37553414a ("drm/amdgpu: add si implementation v10")
+Cc: Ken Wang <Qingqing.Wang@amd.com>
+Cc: Alex Deucher <alexander.deucher@amd.com>
+Cc: "Christian König" <christian.koenig@amd.com>
+Cc: "David (ChunMing) Zhou" <David1.Zhou@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/amd/amdgpu/si.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/amdgpu/si.c b/drivers/gpu/drm/amd/amdgpu/si.c
+index 40520a968eaca..28eea8317e87d 100644
+--- a/drivers/gpu/drm/amd/amdgpu/si.c
++++ b/drivers/gpu/drm/amd/amdgpu/si.c
+@@ -1783,7 +1783,7 @@ static void si_program_aspm(struct amdgpu_device *adev)
+                       if (orig != data)
+                               si_pif_phy1_wreg(adev,PB1_PIF_PWRDOWN_1, data);
+-                      if ((adev->family != CHIP_OLAND) && (adev->family != CHIP_HAINAN)) {
++                      if ((adev->asic_type != CHIP_OLAND) && (adev->asic_type != CHIP_HAINAN)) {
+                               orig = data = si_pif_phy0_rreg(adev,PB0_PIF_PWRDOWN_0);
+                               data &= ~PLL_RAMP_UP_TIME_0_MASK;
+                               if (orig != data)
+@@ -1832,14 +1832,14 @@ static void si_program_aspm(struct amdgpu_device *adev)
+                       orig = data = si_pif_phy0_rreg(adev,PB0_PIF_CNTL);
+                       data &= ~LS2_EXIT_TIME_MASK;
+-                      if ((adev->family == CHIP_OLAND) || (adev->family == CHIP_HAINAN))
++                      if ((adev->asic_type == CHIP_OLAND) || (adev->asic_type == CHIP_HAINAN))
+                               data |= LS2_EXIT_TIME(5);
+                       if (orig != data)
+                               si_pif_phy0_wreg(adev,PB0_PIF_CNTL, data);
+                       orig = data = si_pif_phy1_rreg(adev,PB1_PIF_CNTL);
+                       data &= ~LS2_EXIT_TIME_MASK;
+-                      if ((adev->family == CHIP_OLAND) || (adev->family == CHIP_HAINAN))
++                      if ((adev->asic_type == CHIP_OLAND) || (adev->asic_type == CHIP_HAINAN))
+                               data |= LS2_EXIT_TIME(5);
+                       if (orig != data)
+                               si_pif_phy1_wreg(adev,PB1_PIF_CNTL, data);
+-- 
+2.20.1
+
diff --git a/queue-4.14/drm-bridge-tc358767-increase-aux-transfer-length-lim.patch b/queue-4.14/drm-bridge-tc358767-increase-aux-transfer-length-lim.patch
new file mode 100644 (file)
index 0000000..55ff7b7
--- /dev/null
@@ -0,0 +1,52 @@
+From abe4e6ab1125e568f316174e380f42b754de12bb Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 18 Jun 2019 22:27:09 -0700
+Subject: drm/bridge: tc358767: Increase AUX transfer length limit
+
+From: Andrey Smirnov <andrew.smirnov@gmail.com>
+
+[ Upstream commit e0655feaec62d5139b6b13a7b1bbb1ab8f1c2d83 ]
+
+According to the datasheet tc358767 can transfer up to 16 bytes via
+its AUX channel, so the artificial limit of 8 appears to be too
+low. However only up to 15-bytes seem to be actually supported and
+trying to use 16-byte transfers results in transfers failing
+sporadically (with bogus status in case of I2C transfers), so limit it
+to 15.
+
+Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
+Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
+Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
+Cc: Andrzej Hajda <a.hajda@samsung.com>
+Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
+Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
+Cc: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
+Cc: Philipp Zabel <p.zabel@pengutronix.de>
+Cc: Cory Tusar <cory.tusar@zii.aero>
+Cc: Chris Healy <cphealy@gmail.com>
+Cc: Lucas Stach <l.stach@pengutronix.de>
+Cc: dri-devel@lists.freedesktop.org
+Cc: linux-kernel@vger.kernel.org
+Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/20190619052716.16831-9-andrew.smirnov@gmail.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/bridge/tc358767.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c
+index 9705ca197b90d..cefa2c1685ba4 100644
+--- a/drivers/gpu/drm/bridge/tc358767.c
++++ b/drivers/gpu/drm/bridge/tc358767.c
+@@ -300,7 +300,7 @@ static ssize_t tc_aux_transfer(struct drm_dp_aux *aux,
+                              struct drm_dp_aux_msg *msg)
+ {
+       struct tc_data *tc = aux_to_tc(aux);
+-      size_t size = min_t(size_t, 8, msg->size);
++      size_t size = min_t(size_t, DP_AUX_MAX_PAYLOAD_BYTES - 1, msg->size);
+       u8 request = msg->request & ~DP_AUX_I2C_MOT;
+       u8 *buf = msg->buffer;
+       u32 tmp = 0;
+-- 
+2.20.1
+
diff --git a/queue-4.14/drm-nouveau-volt-fix-for-some-cards-having-0-maximum.patch b/queue-4.14/drm-nouveau-volt-fix-for-some-cards-having-0-maximum.patch
new file mode 100644 (file)
index 0000000..32ff5b4
--- /dev/null
@@ -0,0 +1,38 @@
+From c99ab56aeed5ec161ade528bed37a7dceb3b0e6e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 2 Aug 2019 11:21:00 +0200
+Subject: drm/nouveau/volt: Fix for some cards having 0 maximum voltage
+
+From: Mark Menzynski <mmenzyns@redhat.com>
+
+[ Upstream commit a1af2afbd244089560794c260b2d4326a86e39b6 ]
+
+Some, mostly Fermi, vbioses appear to have zero max voltage. That causes Nouveau to not parse voltage entries, thus users not being able to set higher clocks.
+
+When changing this value Nvidia driver still appeared to ignore it, and I wasn't able to find out why, thus the code is ignoring the value if it is zero.
+
+CC: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
+Signed-off-by: Mark Menzynski <mmenzyns@redhat.com>
+Reviewed-by: Karol Herbst <kherbst@redhat.com>
+Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/nouveau/nvkm/subdev/bios/volt.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/volt.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/volt.c
+index 7143ea4611aa3..33a9fb5ac5585 100644
+--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/volt.c
++++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/volt.c
+@@ -96,6 +96,8 @@ nvbios_volt_parse(struct nvkm_bios *bios, u8 *ver, u8 *hdr, u8 *cnt, u8 *len,
+               info->min     = min(info->base,
+                                   info->base + info->step * info->vidmask);
+               info->max     = nvbios_rd32(bios, volt + 0x0e);
++              if (!info->max)
++                      info->max = max(info->base, info->base + info->step * info->vidmask);
+               break;
+       case 0x50:
+               info->min     = nvbios_rd32(bios, volt + 0x0a);
+-- 
+2.20.1
+
diff --git a/queue-4.14/drm-panel-simple-fix-auo-g185han01-horizontal-blanki.patch b/queue-4.14/drm-panel-simple-fix-auo-g185han01-horizontal-blanki.patch
new file mode 100644 (file)
index 0000000..1e2fe95
--- /dev/null
@@ -0,0 +1,50 @@
+From 2a01f05c5fcd8f266da1c05e4b11580b40267077 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 10 Jul 2019 15:07:40 +0200
+Subject: drm/panel: simple: fix AUO g185han01 horizontal blanking
+
+From: Lucas Stach <l.stach@pengutronix.de>
+
+[ Upstream commit f8c6bfc612b56f02e1b8fae699dff12738aaf889 ]
+
+The horizontal blanking periods are too short, as the values are
+specified for a single LVDS channel. Since this panel is dual LVDS
+they need to be doubled. With this change the panel reaches its
+nominal vrefresh rate of 60Fps, instead of the 64Fps with the
+current wrong blanking.
+
+Philipp Zabel added:
+The datasheet specifies 960 active clocks + 40/128/160 clocks blanking
+on each of the two LVDS channels (min/typical/max), so doubled this is
+now correct.
+
+Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
+Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
+Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
+Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
+Link: https://patchwork.freedesktop.org/patch/msgid/1562764060.23869.12.camel@pengutronix.de
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/panel/panel-simple.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
+index 7a0fd4e4e78d5..c1daed3fe8428 100644
+--- a/drivers/gpu/drm/panel/panel-simple.c
++++ b/drivers/gpu/drm/panel/panel-simple.c
+@@ -614,9 +614,9 @@ static const struct panel_desc auo_g133han01 = {
+ static const struct display_timing auo_g185han01_timings = {
+       .pixelclock = { 120000000, 144000000, 175000000 },
+       .hactive = { 1920, 1920, 1920 },
+-      .hfront_porch = { 18, 60, 74 },
+-      .hback_porch = { 12, 44, 54 },
+-      .hsync_len = { 10, 24, 32 },
++      .hfront_porch = { 36, 120, 148 },
++      .hback_porch = { 24, 88, 108 },
++      .hsync_len = { 20, 48, 64 },
+       .vactive = { 1080, 1080, 1080 },
+       .vfront_porch = { 6, 10, 40 },
+       .vback_porch = { 2, 5, 20 },
+-- 
+2.20.1
+
diff --git a/queue-4.14/drm-radeon-fix-eeh-during-kexec.patch b/queue-4.14/drm-radeon-fix-eeh-during-kexec.patch
new file mode 100644 (file)
index 0000000..5cef606
--- /dev/null
@@ -0,0 +1,47 @@
+From 5dca2a5a984165c0fe83c39881b25f22a860f718 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 31 Jul 2019 17:10:14 -0500
+Subject: drm/radeon: Fix EEH during kexec
+
+From: KyleMahlkuch <kmahlkuc@linux.vnet.ibm.com>
+
+[ Upstream commit 6f7fe9a93e6c09bf988c5059403f5f88e17e21e6 ]
+
+During kexec some adapters hit an EEH since they are not properly
+shut down in the radeon_pci_shutdown() function. Adding
+radeon_suspend_kms() fixes this issue.
+
+Signed-off-by: KyleMahlkuch <kmahlkuc@linux.vnet.ibm.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/radeon/radeon_drv.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
+index f4becad0a78c0..54d97dd5780a1 100644
+--- a/drivers/gpu/drm/radeon/radeon_drv.c
++++ b/drivers/gpu/drm/radeon/radeon_drv.c
+@@ -368,11 +368,19 @@ radeon_pci_remove(struct pci_dev *pdev)
+ static void
+ radeon_pci_shutdown(struct pci_dev *pdev)
+ {
++      struct drm_device *ddev = pci_get_drvdata(pdev);
++
+       /* if we are running in a VM, make sure the device
+        * torn down properly on reboot/shutdown
+        */
+       if (radeon_device_is_virtual())
+               radeon_pci_remove(pdev);
++
++      /* Some adapters need to be suspended before a
++      * shutdown occurs in order to prevent an error
++      * during kexec.
++      */
++      radeon_suspend_kms(ddev, true, true, false);
+ }
+ static int radeon_pmops_suspend(struct device *dev)
+-- 
+2.20.1
+
diff --git a/queue-4.14/drm-stm-attach-gem-fence-to-atomic-state.patch b/queue-4.14/drm-stm-attach-gem-fence-to-atomic-state.patch
new file mode 100644 (file)
index 0000000..bfef6d3
--- /dev/null
@@ -0,0 +1,47 @@
+From 6b7a4d46d9455c30a850962d1c3fbb50bea2322e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 12 Jul 2019 10:42:28 +0200
+Subject: drm/stm: attach gem fence to atomic state
+
+From: Ahmad Fatoum <a.fatoum@pengutronix.de>
+
+[ Upstream commit 8fabc9c3109a71b3577959a05408153ae69ccd8d ]
+
+To properly synchronize with other devices the fence from the GEM
+object backing the framebuffer needs to be attached to the atomic
+state, so the commit work can wait on fence signaling.
+
+Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
+Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
+Acked-by: Philippe Cornu <philippe.cornu@st.com>
+Tested-by: Philippe Cornu <philippe.cornu@st.com>
+Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
+Link: https://patchwork.freedesktop.org/patch/msgid/20190712084228.8338-1-l.stach@pengutronix.de
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/stm/ltdc.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
+index d394a03632c45..c3bd80b03f165 100644
+--- a/drivers/gpu/drm/stm/ltdc.c
++++ b/drivers/gpu/drm/stm/ltdc.c
+@@ -20,6 +20,7 @@
+ #include <drm/drm_crtc_helper.h>
+ #include <drm/drm_fb_cma_helper.h>
+ #include <drm/drm_gem_cma_helper.h>
++#include <drm/drm_gem_framebuffer_helper.h>
+ #include <drm/drm_of.h>
+ #include <drm/drm_bridge.h>
+ #include <drm/drm_plane_helper.h>
+@@ -691,6 +692,7 @@ static const struct drm_plane_funcs ltdc_plane_funcs = {
+ };
+ static const struct drm_plane_helper_funcs ltdc_plane_helper_funcs = {
++      .prepare_fb = drm_gem_fb_prepare_fb,
+       .atomic_check = ltdc_plane_atomic_check,
+       .atomic_update = ltdc_plane_atomic_update,
+       .atomic_disable = ltdc_plane_atomic_disable,
+-- 
+2.20.1
+
diff --git a/queue-4.14/fat-work-around-race-with-userspace-s-read-via-block.patch b/queue-4.14/fat-work-around-race-with-userspace-s-read-via-block.patch
new file mode 100644 (file)
index 0000000..b388c4b
--- /dev/null
@@ -0,0 +1,110 @@
+From 6b2607d3e452e82c183608c6778821bd6412cf3f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 23 Sep 2019 15:32:53 -0700
+Subject: fat: work around race with userspace's read via blockdev while
+ mounting
+
+From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
+
+[ Upstream commit 07bfa4415ab607e459b69bd86aa7e7602ce10b4f ]
+
+If userspace reads the buffer via blockdev while mounting,
+sb_getblk()+modify can race with buffer read via blockdev.
+
+For example,
+
+            FS                               userspace
+    bh = sb_getblk()
+    modify bh->b_data
+                                  read
+                                   ll_rw_block(bh)
+                                     fill bh->b_data by on-disk data
+                                     /* lost modified data by FS */
+                                     set_buffer_uptodate(bh)
+    set_buffer_uptodate(bh)
+
+Userspace should not use the blockdev while mounting though, the udev
+seems to be already doing this.  Although I think the udev should try to
+avoid this, workaround the race by small overhead.
+
+Link: http://lkml.kernel.org/r/87pnk7l3sw.fsf_-_@mail.parknet.co.jp
+Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
+Reported-by: Jan Stancek <jstancek@redhat.com>
+Tested-by: Jan Stancek <jstancek@redhat.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/fat/dir.c    | 13 +++++++++++--
+ fs/fat/fatent.c |  3 +++
+ 2 files changed, 14 insertions(+), 2 deletions(-)
+
+diff --git a/fs/fat/dir.c b/fs/fat/dir.c
+index 81cecbe6d7cf6..971e369517a73 100644
+--- a/fs/fat/dir.c
++++ b/fs/fat/dir.c
+@@ -1097,8 +1097,11 @@ static int fat_zeroed_cluster(struct inode *dir, sector_t blknr, int nr_used,
+                       err = -ENOMEM;
+                       goto error;
+               }
++              /* Avoid race with userspace read via bdev */
++              lock_buffer(bhs[n]);
+               memset(bhs[n]->b_data, 0, sb->s_blocksize);
+               set_buffer_uptodate(bhs[n]);
++              unlock_buffer(bhs[n]);
+               mark_buffer_dirty_inode(bhs[n], dir);
+               n++;
+@@ -1155,6 +1158,8 @@ int fat_alloc_new_dir(struct inode *dir, struct timespec *ts)
+       fat_time_unix2fat(sbi, ts, &time, &date, &time_cs);
+       de = (struct msdos_dir_entry *)bhs[0]->b_data;
++      /* Avoid race with userspace read via bdev */
++      lock_buffer(bhs[0]);
+       /* filling the new directory slots ("." and ".." entries) */
+       memcpy(de[0].name, MSDOS_DOT, MSDOS_NAME);
+       memcpy(de[1].name, MSDOS_DOTDOT, MSDOS_NAME);
+@@ -1177,6 +1182,7 @@ int fat_alloc_new_dir(struct inode *dir, struct timespec *ts)
+       de[0].size = de[1].size = 0;
+       memset(de + 2, 0, sb->s_blocksize - 2 * sizeof(*de));
+       set_buffer_uptodate(bhs[0]);
++      unlock_buffer(bhs[0]);
+       mark_buffer_dirty_inode(bhs[0], dir);
+       err = fat_zeroed_cluster(dir, blknr, 1, bhs, MAX_BUF_PER_PAGE);
+@@ -1234,11 +1240,14 @@ static int fat_add_new_entries(struct inode *dir, void *slots, int nr_slots,
+                       /* fill the directory entry */
+                       copy = min(size, sb->s_blocksize);
++                      /* Avoid race with userspace read via bdev */
++                      lock_buffer(bhs[n]);
+                       memcpy(bhs[n]->b_data, slots, copy);
+-                      slots += copy;
+-                      size -= copy;
+                       set_buffer_uptodate(bhs[n]);
++                      unlock_buffer(bhs[n]);
+                       mark_buffer_dirty_inode(bhs[n], dir);
++                      slots += copy;
++                      size -= copy;
+                       if (!size)
+                               break;
+                       n++;
+diff --git a/fs/fat/fatent.c b/fs/fat/fatent.c
+index 9635df94db7d9..24ed1f4e48ae2 100644
+--- a/fs/fat/fatent.c
++++ b/fs/fat/fatent.c
+@@ -389,8 +389,11 @@ static int fat_mirror_bhs(struct super_block *sb, struct buffer_head **bhs,
+                               err = -ENOMEM;
+                               goto error;
+                       }
++                      /* Avoid race with userspace read via bdev */
++                      lock_buffer(c_bh);
+                       memcpy(c_bh->b_data, bhs[n]->b_data, sb->s_blocksize);
+                       set_buffer_uptodate(c_bh);
++                      unlock_buffer(c_bh);
+                       mark_buffer_dirty_inode(c_bh, sbi->fat_inode);
+                       if (sb->s_flags & MS_SYNCHRONOUS)
+                               err = sync_dirty_buffer(c_bh);
+-- 
+2.20.1
+
diff --git a/queue-4.14/gpu-drm-radeon-fix-a-possible-null-pointer-dereferen.patch b/queue-4.14/gpu-drm-radeon-fix-a-possible-null-pointer-dereferen.patch
new file mode 100644 (file)
index 0000000..ff0507b
--- /dev/null
@@ -0,0 +1,46 @@
+From f602ed5e7116628d3022fde272a87f89529e954e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 29 Jul 2019 16:36:44 +0800
+Subject: gpu: drm: radeon: Fix a possible null-pointer dereference in
+ radeon_connector_set_property()
+
+From: Jia-Ju Bai <baijiaju1990@gmail.com>
+
+[ Upstream commit f3eb9b8f67bc28783eddc142ad805ebdc53d6339 ]
+
+In radeon_connector_set_property(), there is an if statement on line 743
+to check whether connector->encoder is NULL:
+    if (connector->encoder)
+
+When connector->encoder is NULL, it is used on line 755:
+    if (connector->encoder->crtc)
+
+Thus, a possible null-pointer dereference may occur.
+
+To fix this bug, connector->encoder is checked before being used.
+
+This bug is found by a static analysis tool STCheck written by us.
+
+Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/radeon/radeon_connectors.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
+index 337d3a1c2a409..48f752cf7a920 100644
+--- a/drivers/gpu/drm/radeon/radeon_connectors.c
++++ b/drivers/gpu/drm/radeon/radeon_connectors.c
+@@ -764,7 +764,7 @@ static int radeon_connector_set_property(struct drm_connector *connector, struct
+               radeon_encoder->output_csc = val;
+-              if (connector->encoder->crtc) {
++              if (connector->encoder && connector->encoder->crtc) {
+                       struct drm_crtc *crtc  = connector->encoder->crtc;
+                       struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
+-- 
+2.20.1
+
diff --git a/queue-4.14/hid-apple-fix-stuck-function-keys-when-using-fn.patch b/queue-4.14/hid-apple-fix-stuck-function-keys-when-using-fn.patch
new file mode 100644 (file)
index 0000000..029a155
--- /dev/null
@@ -0,0 +1,111 @@
+From 88d3ca16f3da4d75e5313658909e660dbad299e4 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 3 Sep 2019 16:46:32 +0200
+Subject: HID: apple: Fix stuck function keys when using FN
+
+From: Joao Moreno <mail@joaomoreno.com>
+
+[ Upstream commit aec256d0ecd561036f188dbc8fa7924c47a9edfd ]
+
+This fixes an issue in which key down events for function keys would be
+repeatedly emitted even after the user has raised the physical key. For
+example, the driver fails to emit the F5 key up event when going through
+the following steps:
+- fnmode=1: hold FN, hold F5, release FN, release F5
+- fnmode=2: hold F5, hold FN, release F5, release FN
+
+The repeated F5 key down events can be easily verified using xev.
+
+Signed-off-by: Joao Moreno <mail@joaomoreno.com>
+Co-developed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
+Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/hid/hid-apple.c | 49 +++++++++++++++++++++++------------------
+ 1 file changed, 28 insertions(+), 21 deletions(-)
+
+diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c
+index 1cb41992aaa1f..d0a81a03ddbdd 100644
+--- a/drivers/hid/hid-apple.c
++++ b/drivers/hid/hid-apple.c
+@@ -57,7 +57,6 @@ MODULE_PARM_DESC(swap_opt_cmd, "Swap the Option (\"Alt\") and Command (\"Flag\")
+ struct apple_sc {
+       unsigned long quirks;
+       unsigned int fn_on;
+-      DECLARE_BITMAP(pressed_fn, KEY_CNT);
+       DECLARE_BITMAP(pressed_numlock, KEY_CNT);
+ };
+@@ -184,6 +183,8 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
+ {
+       struct apple_sc *asc = hid_get_drvdata(hid);
+       const struct apple_key_translation *trans, *table;
++      bool do_translate;
++      u16 code = 0;
+       if (usage->code == KEY_FN) {
+               asc->fn_on = !!value;
+@@ -192,8 +193,6 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
+       }
+       if (fnmode) {
+-              int do_translate;
+-
+               if (hid->product >= USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI &&
+                               hid->product <= USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS)
+                       table = macbookair_fn_keys;
+@@ -205,25 +204,33 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
+               trans = apple_find_translation (table, usage->code);
+               if (trans) {
+-                      if (test_bit(usage->code, asc->pressed_fn))
+-                              do_translate = 1;
+-                      else if (trans->flags & APPLE_FLAG_FKEY)
+-                              do_translate = (fnmode == 2 && asc->fn_on) ||
+-                                      (fnmode == 1 && !asc->fn_on);
+-                      else
+-                              do_translate = asc->fn_on;
+-
+-                      if (do_translate) {
+-                              if (value)
+-                                      set_bit(usage->code, asc->pressed_fn);
+-                              else
+-                                      clear_bit(usage->code, asc->pressed_fn);
+-
+-                              input_event(input, usage->type, trans->to,
+-                                              value);
+-
+-                              return 1;
++                      if (test_bit(trans->from, input->key))
++                              code = trans->from;
++                      else if (test_bit(trans->to, input->key))
++                              code = trans->to;
++
++                      if (!code) {
++                              if (trans->flags & APPLE_FLAG_FKEY) {
++                                      switch (fnmode) {
++                                      case 1:
++                                              do_translate = !asc->fn_on;
++                                              break;
++                                      case 2:
++                                              do_translate = asc->fn_on;
++                                              break;
++                                      default:
++                                              /* should never happen */
++                                              do_translate = false;
++                                      }
++                              } else {
++                                      do_translate = asc->fn_on;
++                              }
++
++                              code = do_translate ? trans->to : trans->from;
+                       }
++
++                      input_event(input, usage->type, code, value);
++                      return 1;
+               }
+               if (asc->quirks & APPLE_NUMLOCK_EMULATION &&
+-- 
+2.20.1
+
diff --git a/queue-4.14/hypfs-fix-error-number-left-in-struct-pointer-member.patch b/queue-4.14/hypfs-fix-error-number-left-in-struct-pointer-member.patch
new file mode 100644 (file)
index 0000000..044f089
--- /dev/null
@@ -0,0 +1,57 @@
+From cf901340f7af13831d37ec81aa8dad9ad2e59db5 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 21 Mar 2019 10:08:08 +0000
+Subject: hypfs: Fix error number left in struct pointer member
+
+From: David Howells <dhowells@redhat.com>
+
+[ Upstream commit b54c64f7adeb241423cd46598f458b5486b0375e ]
+
+In hypfs_fill_super(), if hypfs_create_update_file() fails,
+sbi->update_file is left holding an error number.  This is passed to
+hypfs_kill_super() which doesn't check for this.
+
+Fix this by not setting sbi->update_value until after we've checked for
+error.
+
+Fixes: 24bbb1faf3f0 ("[PATCH] s390_hypfs filesystem")
+Signed-off-by: David Howells <dhowells@redhat.com>
+cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
+cc: Heiko Carstens <heiko.carstens@de.ibm.com>
+cc: linux-s390@vger.kernel.org
+Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/s390/hypfs/inode.c | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/arch/s390/hypfs/inode.c b/arch/s390/hypfs/inode.c
+index 45eb5999110be..32f5b3fb069f3 100644
+--- a/arch/s390/hypfs/inode.c
++++ b/arch/s390/hypfs/inode.c
+@@ -269,7 +269,7 @@ static int hypfs_show_options(struct seq_file *s, struct dentry *root)
+ static int hypfs_fill_super(struct super_block *sb, void *data, int silent)
+ {
+       struct inode *root_inode;
+-      struct dentry *root_dentry;
++      struct dentry *root_dentry, *update_file;
+       int rc = 0;
+       struct hypfs_sb_info *sbi;
+@@ -300,9 +300,10 @@ static int hypfs_fill_super(struct super_block *sb, void *data, int silent)
+               rc = hypfs_diag_create_files(root_dentry);
+       if (rc)
+               return rc;
+-      sbi->update_file = hypfs_create_update_file(root_dentry);
+-      if (IS_ERR(sbi->update_file))
+-              return PTR_ERR(sbi->update_file);
++      update_file = hypfs_create_update_file(root_dentry);
++      if (IS_ERR(update_file))
++              return PTR_ERR(update_file);
++      sbi->update_file = update_file;
+       hypfs_update_update(sb);
+       pr_info("Hypervisor filesystem mounted\n");
+       return 0;
+-- 
+2.20.1
+
diff --git a/queue-4.14/i2c-cht-wc-fix-lockdep-warning.patch b/queue-4.14/i2c-cht-wc-fix-lockdep-warning.patch
new file mode 100644 (file)
index 0000000..de7f408
--- /dev/null
@@ -0,0 +1,190 @@
+From 4471a65575d0b99fb8e49673eb8192a0f74716fe Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 13 Aug 2019 12:03:01 +0200
+Subject: i2c-cht-wc: Fix lockdep warning
+
+From: Hans de Goede <hdegoede@redhat.com>
+
+[ Upstream commit 232219b9a464c2479c98aa589acb1bd3383ae9d6 ]
+
+When the kernel is build with lockdep support and the i2c-cht-wc driver is
+used, the following warning is shown:
+
+[   66.674334] ======================================================
+[   66.674337] WARNING: possible circular locking dependency detected
+[   66.674340] 5.3.0-rc4+ #83 Not tainted
+[   66.674342] ------------------------------------------------------
+[   66.674345] systemd-udevd/1232 is trying to acquire lock:
+[   66.674349] 00000000a74dab07 (intel_soc_pmic_chtwc:167:(&cht_wc_regmap_cfg)->lock){+.+.}, at: regmap_write+0x31/0x70
+[   66.674360]
+               but task is already holding lock:
+[   66.674362] 00000000d44a85b7 (i2c_register_adapter){+.+.}, at: i2c_smbus_xfer+0x49/0xf0
+[   66.674370]
+               which lock already depends on the new lock.
+
+[   66.674371]
+               the existing dependency chain (in reverse order) is:
+[   66.674374]
+               -> #1 (i2c_register_adapter){+.+.}:
+[   66.674381]        rt_mutex_lock_nested+0x46/0x60
+[   66.674384]        i2c_smbus_xfer+0x49/0xf0
+[   66.674387]        i2c_smbus_read_byte_data+0x45/0x70
+[   66.674391]        cht_wc_byte_reg_read+0x35/0x50
+[   66.674394]        _regmap_read+0x63/0x1a0
+[   66.674396]        _regmap_update_bits+0xa8/0xe0
+[   66.674399]        regmap_update_bits_base+0x63/0xa0
+[   66.674403]        regmap_irq_update_bits.isra.0+0x3b/0x50
+[   66.674406]        regmap_add_irq_chip+0x592/0x7a0
+[   66.674409]        devm_regmap_add_irq_chip+0x89/0xed
+[   66.674412]        cht_wc_probe+0x102/0x158
+[   66.674415]        i2c_device_probe+0x95/0x250
+[   66.674419]        really_probe+0xf3/0x380
+[   66.674422]        driver_probe_device+0x59/0xd0
+[   66.674425]        device_driver_attach+0x53/0x60
+[   66.674428]        __driver_attach+0x92/0x150
+[   66.674431]        bus_for_each_dev+0x7d/0xc0
+[   66.674434]        bus_add_driver+0x14d/0x1f0
+[   66.674437]        driver_register+0x6d/0xb0
+[   66.674440]        i2c_register_driver+0x45/0x80
+[   66.674445]        do_one_initcall+0x60/0x2f4
+[   66.674450]        kernel_init_freeable+0x20d/0x2b4
+[   66.674453]        kernel_init+0xa/0x10c
+[   66.674457]        ret_from_fork+0x3a/0x50
+[   66.674459]
+               -> #0 (intel_soc_pmic_chtwc:167:(&cht_wc_regmap_cfg)->lock){+.+.}:
+[   66.674465]        __lock_acquire+0xe07/0x1930
+[   66.674468]        lock_acquire+0x9d/0x1a0
+[   66.674472]        __mutex_lock+0xa8/0x9a0
+[   66.674474]        regmap_write+0x31/0x70
+[   66.674480]        cht_wc_i2c_adap_smbus_xfer+0x72/0x240 [i2c_cht_wc]
+[   66.674483]        __i2c_smbus_xfer+0x1a3/0x640
+[   66.674486]        i2c_smbus_xfer+0x67/0xf0
+[   66.674489]        i2c_smbus_read_byte_data+0x45/0x70
+[   66.674494]        bq24190_probe+0x26b/0x410 [bq24190_charger]
+[   66.674497]        i2c_device_probe+0x189/0x250
+[   66.674500]        really_probe+0xf3/0x380
+[   66.674503]        driver_probe_device+0x59/0xd0
+[   66.674506]        device_driver_attach+0x53/0x60
+[   66.674509]        __driver_attach+0x92/0x150
+[   66.674512]        bus_for_each_dev+0x7d/0xc0
+[   66.674515]        bus_add_driver+0x14d/0x1f0
+[   66.674518]        driver_register+0x6d/0xb0
+[   66.674521]        i2c_register_driver+0x45/0x80
+[   66.674524]        do_one_initcall+0x60/0x2f4
+[   66.674528]        do_init_module+0x5c/0x230
+[   66.674531]        load_module+0x2707/0x2a20
+[   66.674534]        __do_sys_init_module+0x188/0x1b0
+[   66.674537]        do_syscall_64+0x5c/0xb0
+[   66.674541]        entry_SYSCALL_64_after_hwframe+0x49/0xbe
+[   66.674543]
+               other info that might help us debug this:
+
+[   66.674545]  Possible unsafe locking scenario:
+
+[   66.674547]        CPU0                    CPU1
+[   66.674548]        ----                    ----
+[   66.674550]   lock(i2c_register_adapter);
+[   66.674553]                                lock(intel_soc_pmic_chtwc:167:(&cht_wc_regmap_cfg)->lock);
+[   66.674556]                                lock(i2c_register_adapter);
+[   66.674559]   lock(intel_soc_pmic_chtwc:167:(&cht_wc_regmap_cfg)->lock);
+[   66.674561]
+                *** DEADLOCK ***
+
+The problem is that the CHT Whiskey Cove PMIC's builtin i2c-adapter is
+itself a part of an i2c-client (the PMIC). This means that transfers done
+through it take adapter->bus_lock twice, once for the parent i2c-adapter
+and once for its own bus_lock. Lockdep does not like this nested locking.
+
+To make lockdep happy in the case of busses with muxes, the i2c-core's
+i2c_adapter_lock_bus function calls:
+
+ rt_mutex_lock_nested(&adapter->bus_lock, i2c_adapter_depth(adapter));
+
+But i2c_adapter_depth only works when the direct parent of the adapter is
+another adapter, as it is only meant for muxes. In this case there is an
+i2c-client and MFD instantiated platform_device in the parent->child chain
+between the 2 devices.
+
+This commit overrides the default i2c_lock_operations, passing a hardcoded
+depth of 1 to rt_mutex_lock_nested, making lockdep happy.
+
+Note that if there were to be a mux attached to the i2c-wc-cht adapter,
+this would break things again since the i2c-mux code expects the
+root-adapter to have a locking depth of 0. But the i2c-wc-cht adapter
+always has only 1 client directly attached in the form of the charger IC
+paired with the CHT Whiskey Cove PMIC.
+
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/i2c/busses/i2c-cht-wc.c | 46 +++++++++++++++++++++++++++++++++
+ 1 file changed, 46 insertions(+)
+
+diff --git a/drivers/i2c/busses/i2c-cht-wc.c b/drivers/i2c/busses/i2c-cht-wc.c
+index 190bbbc7bfeeb..29456c8821e7c 100644
+--- a/drivers/i2c/busses/i2c-cht-wc.c
++++ b/drivers/i2c/busses/i2c-cht-wc.c
+@@ -185,6 +185,51 @@ static const struct i2c_algorithm cht_wc_i2c_adap_algo = {
+       .smbus_xfer = cht_wc_i2c_adap_smbus_xfer,
+ };
++/*
++ * We are an i2c-adapter which itself is part of an i2c-client. This means that
++ * transfers done through us take adapter->bus_lock twice, once for our parent
++ * i2c-adapter and once to take our own bus_lock. Lockdep does not like this
++ * nested locking, to make lockdep happy in the case of busses with muxes, the
++ * i2c-core's i2c_adapter_lock_bus function calls:
++ * rt_mutex_lock_nested(&adapter->bus_lock, i2c_adapter_depth(adapter));
++ *
++ * But i2c_adapter_depth only works when the direct parent of the adapter is
++ * another adapter, as it is only meant for muxes. In our case there is an
++ * i2c-client and MFD instantiated platform_device in the parent->child chain
++ * between the 2 devices.
++ *
++ * So we override the default i2c_lock_operations and pass a hardcoded
++ * depth of 1 to rt_mutex_lock_nested, to make lockdep happy.
++ *
++ * Note that if there were to be a mux attached to our adapter, this would
++ * break things again since the i2c-mux code expects the root-adapter to have
++ * a locking depth of 0. But we always have only 1 client directly attached
++ * in the form of the Charger IC paired with the CHT Whiskey Cove PMIC.
++ */
++static void cht_wc_i2c_adap_lock_bus(struct i2c_adapter *adapter,
++                               unsigned int flags)
++{
++      rt_mutex_lock_nested(&adapter->bus_lock, 1);
++}
++
++static int cht_wc_i2c_adap_trylock_bus(struct i2c_adapter *adapter,
++                                 unsigned int flags)
++{
++      return rt_mutex_trylock(&adapter->bus_lock);
++}
++
++static void cht_wc_i2c_adap_unlock_bus(struct i2c_adapter *adapter,
++                                 unsigned int flags)
++{
++      rt_mutex_unlock(&adapter->bus_lock);
++}
++
++static const struct i2c_lock_operations cht_wc_i2c_adap_lock_ops = {
++      .lock_bus =    cht_wc_i2c_adap_lock_bus,
++      .trylock_bus = cht_wc_i2c_adap_trylock_bus,
++      .unlock_bus =  cht_wc_i2c_adap_unlock_bus,
++};
++
+ /**** irqchip for the client connected to the extchgr i2c adapter ****/
+ static void cht_wc_i2c_irq_lock(struct irq_data *data)
+ {
+@@ -268,6 +313,7 @@ static int cht_wc_i2c_adap_i2c_probe(struct platform_device *pdev)
+       adap->adapter.owner = THIS_MODULE;
+       adap->adapter.class = I2C_CLASS_HWMON;
+       adap->adapter.algo = &cht_wc_i2c_adap_algo;
++      adap->adapter.lock_ops = &cht_wc_i2c_adap_lock_ops;
+       strlcpy(adap->adapter.name, "PMIC I2C Adapter",
+               sizeof(adap->adapter.name));
+       adap->adapter.dev.parent = &pdev->dev;
+-- 
+2.20.1
+
diff --git a/queue-4.14/ipmi_si-only-schedule-continuously-in-the-thread-in-.patch b/queue-4.14/ipmi_si-only-schedule-continuously-in-the-thread-in-.patch
new file mode 100644 (file)
index 0000000..98fe597
--- /dev/null
@@ -0,0 +1,88 @@
+From 0ea8bfb758dbf1d430d3f81bb32643e017e651d0 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 2 Aug 2019 07:31:36 -0500
+Subject: ipmi_si: Only schedule continuously in the thread in maintenance mode
+
+From: Corey Minyard <cminyard@mvista.com>
+
+[ Upstream commit 340ff31ab00bca5c15915e70ad9ada3030c98cf8 ]
+
+ipmi_thread() uses back-to-back schedule() to poll for command
+completion which, on some machines, can push up CPU consumption and
+heavily tax the scheduler locks leading to noticeable overall
+performance degradation.
+
+This was originally added so firmware updates through IPMI would
+complete in a timely manner.  But we can't kill the scheduler
+locks for that one use case.
+
+Instead, only run schedule() continuously in maintenance mode,
+where firmware updates should run.
+
+Signed-off-by: Corey Minyard <cminyard@mvista.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/char/ipmi/ipmi_si_intf.c | 24 +++++++++++++++++++-----
+ 1 file changed, 19 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
+index a106cf7b5ee02..f6ba90b90503f 100644
+--- a/drivers/char/ipmi/ipmi_si_intf.c
++++ b/drivers/char/ipmi/ipmi_si_intf.c
+@@ -284,6 +284,9 @@ struct smi_info {
+        */
+       bool irq_enable_broken;
++      /* Is the driver in maintenance mode? */
++      bool in_maintenance_mode;
++
+       /*
+        * Did we get an attention that we did not handle?
+        */
+@@ -1094,11 +1097,20 @@ static int ipmi_thread(void *data)
+               spin_unlock_irqrestore(&(smi_info->si_lock), flags);
+               busy_wait = ipmi_thread_busy_wait(smi_result, smi_info,
+                                                 &busy_until);
+-              if (smi_result == SI_SM_CALL_WITHOUT_DELAY)
++              if (smi_result == SI_SM_CALL_WITHOUT_DELAY) {
+                       ; /* do nothing */
+-              else if (smi_result == SI_SM_CALL_WITH_DELAY && busy_wait)
+-                      schedule();
+-              else if (smi_result == SI_SM_IDLE) {
++              } else if (smi_result == SI_SM_CALL_WITH_DELAY && busy_wait) {
++                      /*
++                       * In maintenance mode we run as fast as
++                       * possible to allow firmware updates to
++                       * complete as fast as possible, but normally
++                       * don't bang on the scheduler.
++                       */
++                      if (smi_info->in_maintenance_mode)
++                              schedule();
++                      else
++                              usleep_range(100, 200);
++              } else if (smi_result == SI_SM_IDLE) {
+                       if (atomic_read(&smi_info->need_watch)) {
+                               schedule_timeout_interruptible(100);
+                       } else {
+@@ -1106,8 +1118,9 @@ static int ipmi_thread(void *data)
+                               __set_current_state(TASK_INTERRUPTIBLE);
+                               schedule();
+                       }
+-              } else
++              } else {
+                       schedule_timeout_interruptible(1);
++              }
+       }
+       return 0;
+ }
+@@ -1286,6 +1299,7 @@ static void set_maintenance_mode(void *send_info, bool enable)
+       if (!enable)
+               atomic_set(&smi_info->req_events, 0);
++      smi_info->in_maintenance_mode = enable;
+ }
+ static const struct ipmi_smi_handlers handlers = {
+-- 
+2.20.1
+
diff --git a/queue-4.14/kbuild-clean-compressed-initramfs-image.patch b/queue-4.14/kbuild-clean-compressed-initramfs-image.patch
new file mode 100644 (file)
index 0000000..08e4f95
--- /dev/null
@@ -0,0 +1,56 @@
+From 5f5179116888f0d2ab954aacfccb48d2a3ee3c08 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 23 Sep 2019 15:33:05 -0700
+Subject: kbuild: clean compressed initramfs image
+
+From: Greg Thelen <gthelen@google.com>
+
+[ Upstream commit 6279eb3dd7946c69346a3b98473ed13d3a44adb5 ]
+
+Since 9e3596b0c653 ("kbuild: initramfs cleanup, set target from Kconfig")
+"make clean" leaves behind compressed initramfs images.  Example:
+
+  $ make defconfig
+  $ sed -i 's|CONFIG_INITRAMFS_SOURCE=""|CONFIG_INITRAMFS_SOURCE="/tmp/ir.cpio"|' .config
+  $ make olddefconfig
+  $ make -s
+  $ make -s clean
+  $ git clean -ndxf | grep initramfs
+  Would remove usr/initramfs_data.cpio.gz
+
+clean rules do not have CONFIG_* context so they do not know which
+compression format was used.  Thus they don't know which files to delete.
+
+Tell clean to delete all possible compression formats.
+
+Once patched usr/initramfs_data.cpio.gz and friends are deleted by
+"make clean".
+
+Link: http://lkml.kernel.org/r/20190722063251.55541-1-gthelen@google.com
+Fixes: 9e3596b0c653 ("kbuild: initramfs cleanup, set target from Kconfig")
+Signed-off-by: Greg Thelen <gthelen@google.com>
+Cc: Nicholas Piggin <npiggin@gmail.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ usr/Makefile | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/usr/Makefile b/usr/Makefile
+index 237a028693ce9..5f1bc5b23b14c 100644
+--- a/usr/Makefile
++++ b/usr/Makefile
+@@ -11,6 +11,9 @@ datafile_y = initramfs_data.cpio$(suffix_y)
+ datafile_d_y = .$(datafile_y).d
+ AFLAGS_initramfs_data.o += -DINITRAMFS_IMAGE="usr/$(datafile_y)"
++# clean rules do not have CONFIG_INITRAMFS_COMPRESSION.  So clean up after all
++# possible compression formats.
++clean-files += initramfs_data.cpio*
+ # Generate builtin.o based on initramfs_data.o
+ obj-$(CONFIG_BLK_DEV_INITRD) := initramfs_data.o
+-- 
+2.20.1
+
diff --git a/queue-4.14/kmemleak-increase-debug_kmemleak_early_log_size-defa.patch b/queue-4.14/kmemleak-increase-debug_kmemleak_early_log_size-defa.patch
new file mode 100644 (file)
index 0000000..9891155
--- /dev/null
@@ -0,0 +1,57 @@
+From b6d38fab8fb15ecb6449d4f9802db940392490c3 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 23 Sep 2019 15:33:55 -0700
+Subject: kmemleak: increase DEBUG_KMEMLEAK_EARLY_LOG_SIZE default to 16K
+
+From: Nicolas Boichat <drinkcat@chromium.org>
+
+[ Upstream commit b751c52bb587ae66f773b15204ef7a147467f4c7 ]
+
+The current default value (400) is too low on many systems (e.g.  some
+ARM64 platform takes up 1000+ entries).
+
+syzbot uses 16000 as default value, and has proved to be enough on beefy
+configurations, so let's pick that value.
+
+This consumes more RAM on boot (each entry is 160 bytes, so in total
+~2.5MB of RAM), but the memory would later be freed (early_log is
+__initdata).
+
+Link: http://lkml.kernel.org/r/20190730154027.101525-1-drinkcat@chromium.org
+Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
+Suggested-by: Dmitry Vyukov <dvyukov@google.com>
+Acked-by: Catalin Marinas <catalin.marinas@arm.com>
+Acked-by: Dmitry Vyukov <dvyukov@google.com>
+Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
+Cc: Kees Cook <keescook@chromium.org>
+Cc: Petr Mladek <pmladek@suse.com>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
+Cc: Joe Lawrence <joe.lawrence@redhat.com>
+Cc: Uladzislau Rezki <urezki@gmail.com>
+Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+Cc: Stephen Rothwell <sfr@canb.auug.org.au>
+Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ lib/Kconfig.debug | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
+index 131d5871f8c98..e1df563cdfe7e 100644
+--- a/lib/Kconfig.debug
++++ b/lib/Kconfig.debug
+@@ -570,7 +570,7 @@ config DEBUG_KMEMLEAK_EARLY_LOG_SIZE
+       int "Maximum kmemleak early log entries"
+       depends on DEBUG_KMEMLEAK
+       range 200 40000
+-      default 400
++      default 16000
+       help
+         Kmemleak must track all the memory allocations to avoid
+         reporting false positives. Since memory may be allocated or
+-- 
+2.20.1
+
diff --git a/queue-4.14/livepatch-nullify-obj-mod-in-klp_module_coming-s-err.patch b/queue-4.14/livepatch-nullify-obj-mod-in-klp_module_coming-s-err.patch
new file mode 100644 (file)
index 0000000..4ce375a
--- /dev/null
@@ -0,0 +1,41 @@
+From 6487c421ba8a2071114a50043dc76b89087177ea Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 19 Jul 2019 14:28:39 +0200
+Subject: livepatch: Nullify obj->mod in klp_module_coming()'s error path
+
+From: Miroslav Benes <mbenes@suse.cz>
+
+[ Upstream commit 4ff96fb52c6964ad42e0a878be8f86a2e8052ddd ]
+
+klp_module_coming() is called for every module appearing in the system.
+It sets obj->mod to a patched module for klp_object obj. Unfortunately
+it leaves it set even if an error happens later in the function and the
+patched module is not allowed to be loaded.
+
+klp_is_object_loaded() uses obj->mod variable and could currently give a
+wrong return value. The bug is probably harmless as of now.
+
+Signed-off-by: Miroslav Benes <mbenes@suse.cz>
+Reviewed-by: Petr Mladek <pmladek@suse.com>
+Acked-by: Josh Poimboeuf <jpoimboe@redhat.com>
+Signed-off-by: Petr Mladek <pmladek@suse.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ kernel/livepatch/core.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c
+index 88754e9790f9b..f8dc77b18962c 100644
+--- a/kernel/livepatch/core.c
++++ b/kernel/livepatch/core.c
+@@ -941,6 +941,7 @@ err:
+       pr_warn("patch '%s' failed for module '%s', refusing to load module '%s'\n",
+               patch->mod->name, obj->mod->name, obj->mod->name);
+       mod->klp_alive = false;
++      obj->mod = NULL;
+       klp_cleanup_module_patches_limited(mod, patch);
+       mutex_unlock(&klp_mutex);
+-- 
+2.20.1
+
diff --git a/queue-4.14/mfd-intel-lpss-remove-d3cold-delay.patch b/queue-4.14/mfd-intel-lpss-remove-d3cold-delay.patch
new file mode 100644 (file)
index 0000000..e98ed76
--- /dev/null
@@ -0,0 +1,47 @@
+From 37206aad61b3b931670e21054ce04d1e7cc5beef Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 5 Jul 2019 12:55:03 +0800
+Subject: mfd: intel-lpss: Remove D3cold delay
+
+From: Kai-Heng Feng <kai.heng.feng@canonical.com>
+
+[ Upstream commit 76380a607ba0b28627c9b4b55cd47a079a59624b ]
+
+Goodix touchpad may drop its first couple input events when
+i2c-designware-platdrv and intel-lpss it connects to took too long to
+runtime resume from runtime suspended state.
+
+This issue happens becuase the touchpad has a rather small buffer to
+store up to 13 input events, so if the host doesn't read those events in
+time (i.e. runtime resume takes too long), events are dropped from the
+touchpad's buffer.
+
+The bottleneck is D3cold delay it waits when transitioning from D3cold
+to D0, hence remove the delay to make the resume faster. I've tested
+some systems with intel-lpss and haven't seen any regression.
+
+Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=202683
+Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
+Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+Signed-off-by: Lee Jones <lee.jones@linaro.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/mfd/intel-lpss-pci.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/drivers/mfd/intel-lpss-pci.c b/drivers/mfd/intel-lpss-pci.c
+index d9ae983095c54..2b7e8eeaa59e9 100644
+--- a/drivers/mfd/intel-lpss-pci.c
++++ b/drivers/mfd/intel-lpss-pci.c
+@@ -39,6 +39,8 @@ static int intel_lpss_pci_probe(struct pci_dev *pdev,
+       info->mem = &pdev->resource[0];
+       info->irq = pdev->irq;
++      pdev->d3cold_delay = 0;
++
+       /* Probably it is enough to set this for iDMA capable devices only */
+       pci_set_master(pdev);
+       pci_try_set_mwi(pdev);
+-- 
+2.20.1
+
diff --git a/queue-4.14/mips-tlbex-explicitly-cast-_page_no_exec-to-a-boolea.patch b/queue-4.14/mips-tlbex-explicitly-cast-_page_no_exec-to-a-boolea.patch
new file mode 100644 (file)
index 0000000..6026c00
--- /dev/null
@@ -0,0 +1,59 @@
+From 6859f65fac2395b153bd328839051eaacc9939ce Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 11 Aug 2019 20:31:20 -0700
+Subject: MIPS: tlbex: Explicitly cast _PAGE_NO_EXEC to a boolean
+
+From: Nathan Chancellor <natechancellor@gmail.com>
+
+[ Upstream commit c59ae0a1055127dd3828a88e111a0db59b254104 ]
+
+clang warns:
+
+arch/mips/mm/tlbex.c:634:19: error: use of logical '&&' with constant
+operand [-Werror,-Wconstant-logical-operand]
+        if (cpu_has_rixi && _PAGE_NO_EXEC) {
+                         ^  ~~~~~~~~~~~~~
+arch/mips/mm/tlbex.c:634:19: note: use '&' for a bitwise operation
+        if (cpu_has_rixi && _PAGE_NO_EXEC) {
+                         ^~
+                         &
+arch/mips/mm/tlbex.c:634:19: note: remove constant to silence this
+warning
+        if (cpu_has_rixi && _PAGE_NO_EXEC) {
+                        ~^~~~~~~~~~~~~~~~
+1 error generated.
+
+Explicitly cast this value to a boolean so that clang understands we
+intend for this to be a non-zero value.
+
+Fixes: 00bf1c691d08 ("MIPS: tlbex: Avoid placing software PTE bits in Entry* PFN fields")
+Link: https://github.com/ClangBuiltLinux/linux/issues/609
+Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
+Signed-off-by: Paul Burton <paul.burton@mips.com>
+Cc: Ralf Baechle <ralf@linux-mips.org>
+Cc: James Hogan <jhogan@kernel.org>
+Cc: Nick Desaulniers <ndesaulniers@google.com>
+Cc: linux-mips@vger.kernel.org
+Cc: linux-kernel@vger.kernel.org
+Cc: clang-built-linux@googlegroups.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/mips/mm/tlbex.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c
+index c2a6869418f77..dc495578d44d3 100644
+--- a/arch/mips/mm/tlbex.c
++++ b/arch/mips/mm/tlbex.c
+@@ -634,7 +634,7 @@ static __maybe_unused void build_convert_pte_to_entrylo(u32 **p,
+               return;
+       }
+-      if (cpu_has_rixi && _PAGE_NO_EXEC) {
++      if (cpu_has_rixi && !!_PAGE_NO_EXEC) {
+               if (fill_includes_sw_bits) {
+                       UASM_i_ROTR(p, reg, reg, ilog2(_PAGE_GLOBAL));
+               } else {
+-- 
+2.20.1
+
diff --git a/queue-4.14/ocfs2-wait-for-recovering-done-after-direct-unlock-r.patch b/queue-4.14/ocfs2-wait-for-recovering-done-after-direct-unlock-r.patch
new file mode 100644 (file)
index 0000000..3ee688d
--- /dev/null
@@ -0,0 +1,94 @@
+From 71e63dc5237a03379d914e85304c835388d441d9 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 23 Sep 2019 15:33:37 -0700
+Subject: ocfs2: wait for recovering done after direct unlock request
+
+From: Changwei Ge <gechangwei@live.cn>
+
+[ Upstream commit 0a3775e4f883912944481cf2ef36eb6383a9cc74 ]
+
+There is a scenario causing ocfs2 umount hang when multiple hosts are
+rebooting at the same time.
+
+NODE1                           NODE2               NODE3
+send unlock requset to NODE2
+                                dies
+                                                    become recovery master
+                                                    recover NODE2
+find NODE2 dead
+mark resource RECOVERING
+directly remove lock from grant list
+calculate usage but RECOVERING marked
+**miss the window of purging
+clear RECOVERING
+
+To reproduce this issue, crash a host and then umount ocfs2
+from another node.
+
+To solve this, just let unlock progress wait for recovery done.
+
+Link: http://lkml.kernel.org/r/1550124866-20367-1-git-send-email-gechangwei@live.cn
+Signed-off-by: Changwei Ge <gechangwei@live.cn>
+Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
+Cc: Mark Fasheh <mark@fasheh.com>
+Cc: Joel Becker <jlbec@evilplan.org>
+Cc: Junxiao Bi <junxiao.bi@oracle.com>
+Cc: Changwei Ge <gechangwei@live.cn>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/ocfs2/dlm/dlmunlock.c | 23 +++++++++++++++++++----
+ 1 file changed, 19 insertions(+), 4 deletions(-)
+
+diff --git a/fs/ocfs2/dlm/dlmunlock.c b/fs/ocfs2/dlm/dlmunlock.c
+index 63d701cd1e2e7..c8e9b7031d9ad 100644
+--- a/fs/ocfs2/dlm/dlmunlock.c
++++ b/fs/ocfs2/dlm/dlmunlock.c
+@@ -105,7 +105,8 @@ static enum dlm_status dlmunlock_common(struct dlm_ctxt *dlm,
+       enum dlm_status status;
+       int actions = 0;
+       int in_use;
+-        u8 owner;
++      u8 owner;
++      int recovery_wait = 0;
+       mlog(0, "master_node = %d, valblk = %d\n", master_node,
+            flags & LKM_VALBLK);
+@@ -208,9 +209,12 @@ static enum dlm_status dlmunlock_common(struct dlm_ctxt *dlm,
+               }
+               if (flags & LKM_CANCEL)
+                       lock->cancel_pending = 0;
+-              else
+-                      lock->unlock_pending = 0;
+-
++              else {
++                      if (!lock->unlock_pending)
++                              recovery_wait = 1;
++                      else
++                              lock->unlock_pending = 0;
++              }
+       }
+       /* get an extra ref on lock.  if we are just switching
+@@ -244,6 +248,17 @@ leave:
+       spin_unlock(&res->spinlock);
+       wake_up(&res->wq);
++      if (recovery_wait) {
++              spin_lock(&res->spinlock);
++              /* Unlock request will directly succeed after owner dies,
++               * and the lock is already removed from grant list. We have to
++               * wait for RECOVERING done or we miss the chance to purge it
++               * since the removement is much faster than RECOVERING proc.
++               */
++              __dlm_wait_on_lockres_flags(res, DLM_LOCK_RES_RECOVERING);
++              spin_unlock(&res->spinlock);
++      }
++
+       /* let the caller's final dlm_lock_put handle the actual kfree */
+       if (actions & DLM_UNLOCK_FREE_LOCK) {
+               /* this should always be coupled with list removal */
+-- 
+2.20.1
+
diff --git a/queue-4.14/pci-exynos-propagate-errors-for-optional-phys.patch b/queue-4.14/pci-exynos-propagate-errors-for-optional-phys.patch
new file mode 100644 (file)
index 0000000..4fb060d
--- /dev/null
@@ -0,0 +1,48 @@
+From 8f372148ff5cfb243d2666bfd6f6ea9339e3a218 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 29 Aug 2019 12:53:15 +0200
+Subject: PCI: exynos: Propagate errors for optional PHYs
+
+From: Thierry Reding <treding@nvidia.com>
+
+[ Upstream commit ddd6960087d4b45759434146d681a94bbb1c54ad ]
+
+devm_of_phy_get() can fail for a number of reasons besides probe
+deferral. It can for example return -ENOMEM if it runs out of memory as
+it tries to allocate devres structures. Propagating only -EPROBE_DEFER
+is problematic because it results in these legitimately fatal errors
+being treated as "PHY not specified in DT".
+
+What we really want is to ignore the optional PHYs only if they have not
+been specified in DT. devm_of_phy_get() returns -ENODEV in this case, so
+that's the special case that we need to handle. So we propagate all
+errors, except -ENODEV, so that real failures will still cause the
+driver to fail probe.
+
+Signed-off-by: Thierry Reding <treding@nvidia.com>
+Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
+Reviewed-by: Andrew Murray <andrew.murray@arm.com>
+Cc: Jingoo Han <jingoohan1@gmail.com>
+Cc: Kukjin Kim <kgene@kernel.org>
+Cc: Krzysztof Kozlowski <krzk@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/pci/dwc/pci-exynos.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/pci/dwc/pci-exynos.c b/drivers/pci/dwc/pci-exynos.c
+index ea03f1ec12a47..01acb418d1fdb 100644
+--- a/drivers/pci/dwc/pci-exynos.c
++++ b/drivers/pci/dwc/pci-exynos.c
+@@ -683,7 +683,7 @@ static int __init exynos_pcie_probe(struct platform_device *pdev)
+       ep->phy = devm_of_phy_get(dev, np, NULL);
+       if (IS_ERR(ep->phy)) {
+-              if (PTR_ERR(ep->phy) == -EPROBE_DEFER)
++              if (PTR_ERR(ep->phy) != -ENODEV)
+                       return PTR_ERR(ep->phy);
+               dev_warn(dev, "Use the 'phy' property. Current DT of pci-exynos was deprecated!!\n");
+       } else
+-- 
+2.20.1
+
diff --git a/queue-4.14/pci-imx6-propagate-errors-for-optional-regulators.patch b/queue-4.14/pci-imx6-propagate-errors-for-optional-regulators.patch
new file mode 100644 (file)
index 0000000..2de4887
--- /dev/null
@@ -0,0 +1,54 @@
+From 5c1ce6fe8655511cddb8e3a790ed902392fffa82 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 29 Aug 2019 12:53:16 +0200
+Subject: PCI: imx6: Propagate errors for optional regulators
+
+From: Thierry Reding <treding@nvidia.com>
+
+[ Upstream commit 2170a09fb4b0f66e06e5bcdcbc98c9ccbf353650 ]
+
+regulator_get_optional() can fail for a number of reasons besides probe
+deferral. It can for example return -ENOMEM if it runs out of memory as
+it tries to allocate data structures. Propagating only -EPROBE_DEFER is
+problematic because it results in these legitimately fatal errors being
+treated as "regulator not specified in DT".
+
+What we really want is to ignore the optional regulators only if they
+have not been specified in DT. regulator_get_optional() returns -ENODEV
+in this case, so that's the special case that we need to handle. So we
+propagate all errors, except -ENODEV, so that real failures will still
+cause the driver to fail probe.
+
+Signed-off-by: Thierry Reding <treding@nvidia.com>
+Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
+Reviewed-by: Andrew Murray <andrew.murray@arm.com>
+Cc: Richard Zhu <hongxing.zhu@nxp.com>
+Cc: Lucas Stach <l.stach@pengutronix.de>
+Cc: Shawn Guo <shawnguo@kernel.org>
+Cc: Sascha Hauer <s.hauer@pengutronix.de>
+Cc: Fabio Estevam <festevam@gmail.com>
+Cc: kernel@pengutronix.de
+Cc: linux-imx@nxp.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/pci/dwc/pci-imx6.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/pci/dwc/pci-imx6.c b/drivers/pci/dwc/pci-imx6.c
+index 1f1069b70e45a..5509b6e2de94b 100644
+--- a/drivers/pci/dwc/pci-imx6.c
++++ b/drivers/pci/dwc/pci-imx6.c
+@@ -827,8 +827,8 @@ static int imx6_pcie_probe(struct platform_device *pdev)
+       imx6_pcie->vpcie = devm_regulator_get_optional(&pdev->dev, "vpcie");
+       if (IS_ERR(imx6_pcie->vpcie)) {
+-              if (PTR_ERR(imx6_pcie->vpcie) == -EPROBE_DEFER)
+-                      return -EPROBE_DEFER;
++              if (PTR_ERR(imx6_pcie->vpcie) != -ENODEV)
++                      return PTR_ERR(imx6_pcie->vpcie);
+               imx6_pcie->vpcie = NULL;
+       }
+-- 
+2.20.1
+
diff --git a/queue-4.14/pci-rockchip-propagate-errors-for-optional-regulator.patch b/queue-4.14/pci-rockchip-propagate-errors-for-optional-regulator.patch
new file mode 100644 (file)
index 0000000..afc34c6
--- /dev/null
@@ -0,0 +1,80 @@
+From 28f9ac78f1497b6b018ff2bc30ddb95d54c94c5b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 29 Aug 2019 12:53:14 +0200
+Subject: PCI: rockchip: Propagate errors for optional regulators
+
+From: Thierry Reding <treding@nvidia.com>
+
+[ Upstream commit 0e3ff0ac5f71bdb6be2a698de0ed0c7e6e738269 ]
+
+regulator_get_optional() can fail for a number of reasons besides probe
+deferral. It can for example return -ENOMEM if it runs out of memory as
+it tries to allocate data structures. Propagating only -EPROBE_DEFER is
+problematic because it results in these legitimately fatal errors being
+treated as "regulator not specified in DT".
+
+What we really want is to ignore the optional regulators only if they
+have not been specified in DT. regulator_get_optional() returns -ENODEV
+in this case, so that's the special case that we need to handle. So we
+propagate all errors, except -ENODEV, so that real failures will still
+cause the driver to fail probe.
+
+Tested-by: Heiko Stuebner <heiko@sntech.de>
+Signed-off-by: Thierry Reding <treding@nvidia.com>
+Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
+Reviewed-by: Andrew Murray <andrew.murray@arm.com>
+Reviewed-by: Heiko Stuebner <heiko@sntech.de>
+Acked-by: Shawn Lin <shawn.lin@rock-chips.com>
+Cc: Shawn Lin <shawn.lin@rock-chips.com>
+Cc: Heiko Stuebner <heiko@sntech.de>
+Cc: linux-rockchip@lists.infradead.org
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/pci/host/pcie-rockchip.c | 16 ++++++++--------
+ 1 file changed, 8 insertions(+), 8 deletions(-)
+
+diff --git a/drivers/pci/host/pcie-rockchip.c b/drivers/pci/host/pcie-rockchip.c
+index 9051c6c8fea49..d3f9e7d247275 100644
+--- a/drivers/pci/host/pcie-rockchip.c
++++ b/drivers/pci/host/pcie-rockchip.c
+@@ -1129,29 +1129,29 @@ static int rockchip_pcie_parse_dt(struct rockchip_pcie *rockchip)
+       rockchip->vpcie12v = devm_regulator_get_optional(dev, "vpcie12v");
+       if (IS_ERR(rockchip->vpcie12v)) {
+-              if (PTR_ERR(rockchip->vpcie12v) == -EPROBE_DEFER)
+-                      return -EPROBE_DEFER;
++              if (PTR_ERR(rockchip->vpcie12v) != -ENODEV)
++                      return PTR_ERR(rockchip->vpcie12v);
+               dev_info(dev, "no vpcie12v regulator found\n");
+       }
+       rockchip->vpcie3v3 = devm_regulator_get_optional(dev, "vpcie3v3");
+       if (IS_ERR(rockchip->vpcie3v3)) {
+-              if (PTR_ERR(rockchip->vpcie3v3) == -EPROBE_DEFER)
+-                      return -EPROBE_DEFER;
++              if (PTR_ERR(rockchip->vpcie3v3) != -ENODEV)
++                      return PTR_ERR(rockchip->vpcie3v3);
+               dev_info(dev, "no vpcie3v3 regulator found\n");
+       }
+       rockchip->vpcie1v8 = devm_regulator_get_optional(dev, "vpcie1v8");
+       if (IS_ERR(rockchip->vpcie1v8)) {
+-              if (PTR_ERR(rockchip->vpcie1v8) == -EPROBE_DEFER)
+-                      return -EPROBE_DEFER;
++              if (PTR_ERR(rockchip->vpcie1v8) != -ENODEV)
++                      return PTR_ERR(rockchip->vpcie1v8);
+               dev_info(dev, "no vpcie1v8 regulator found\n");
+       }
+       rockchip->vpcie0v9 = devm_regulator_get_optional(dev, "vpcie0v9");
+       if (IS_ERR(rockchip->vpcie0v9)) {
+-              if (PTR_ERR(rockchip->vpcie0v9) == -EPROBE_DEFER)
+-                      return -EPROBE_DEFER;
++              if (PTR_ERR(rockchip->vpcie0v9) != -ENODEV)
++                      return PTR_ERR(rockchip->vpcie0v9);
+               dev_info(dev, "no vpcie0v9 regulator found\n");
+       }
+-- 
+2.20.1
+
diff --git a/queue-4.14/pci-tegra-fix-of-node-reference-leak.patch b/queue-4.14/pci-tegra-fix-of-node-reference-leak.patch
new file mode 100644 (file)
index 0000000..b33be72
--- /dev/null
@@ -0,0 +1,101 @@
+From 326f157e9b764db26ab6af253fcb775ae4c90236 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 24 Jul 2019 13:54:12 +0530
+Subject: PCI: tegra: Fix OF node reference leak
+
+From: Nishka Dasgupta <nishkadg.linux@gmail.com>
+
+[ Upstream commit 9e38e690ace3e7a22a81fc02652fc101efb340cf ]
+
+Each iteration of for_each_child_of_node() executes of_node_put() on the
+previous node, but in some return paths in the middle of the loop
+of_node_put() is missing thus causing a reference leak.
+
+Hence stash these mid-loop return values in a variable 'err' and add a
+new label err_node_put which executes of_node_put() on the previous node
+and returns 'err' on failure.
+
+Change mid-loop return statements to point to jump to this label to
+fix the reference leak.
+
+Issue found with Coccinelle.
+
+Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
+[lorenzo.pieralisi@arm.com: rewrote commit log]
+Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/pci/host/pci-tegra.c | 22 +++++++++++++++-------
+ 1 file changed, 15 insertions(+), 7 deletions(-)
+
+diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c
+index 1987fec1f126f..8efd086c57c96 100644
+--- a/drivers/pci/host/pci-tegra.c
++++ b/drivers/pci/host/pci-tegra.c
+@@ -1910,14 +1910,15 @@ static int tegra_pcie_parse_dt(struct tegra_pcie *pcie)
+               err = of_pci_get_devfn(port);
+               if (err < 0) {
+                       dev_err(dev, "failed to parse address: %d\n", err);
+-                      return err;
++                      goto err_node_put;
+               }
+               index = PCI_SLOT(err);
+               if (index < 1 || index > soc->num_ports) {
+                       dev_err(dev, "invalid port number: %d\n", index);
+-                      return -EINVAL;
++                      err = -EINVAL;
++                      goto err_node_put;
+               }
+               index--;
+@@ -1926,12 +1927,13 @@ static int tegra_pcie_parse_dt(struct tegra_pcie *pcie)
+               if (err < 0) {
+                       dev_err(dev, "failed to parse # of lanes: %d\n",
+                               err);
+-                      return err;
++                      goto err_node_put;
+               }
+               if (value > 16) {
+                       dev_err(dev, "invalid # of lanes: %u\n", value);
+-                      return -EINVAL;
++                      err = -EINVAL;
++                      goto err_node_put;
+               }
+               lanes |= value << (index << 3);
+@@ -1945,13 +1947,15 @@ static int tegra_pcie_parse_dt(struct tegra_pcie *pcie)
+               lane += value;
+               rp = devm_kzalloc(dev, sizeof(*rp), GFP_KERNEL);
+-              if (!rp)
+-                      return -ENOMEM;
++              if (!rp) {
++                      err = -ENOMEM;
++                      goto err_node_put;
++              }
+               err = of_address_to_resource(port, 0, &rp->regs);
+               if (err < 0) {
+                       dev_err(dev, "failed to parse address: %d\n", err);
+-                      return err;
++                      goto err_node_put;
+               }
+               INIT_LIST_HEAD(&rp->list);
+@@ -1978,6 +1982,10 @@ static int tegra_pcie_parse_dt(struct tegra_pcie *pcie)
+               return err;
+       return 0;
++
++err_node_put:
++      of_node_put(port);
++      return err;
+ }
+ /*
+-- 
+2.20.1
+
diff --git a/queue-4.14/pinctrl-tegra-fix-write-barrier-placement-in-pmx_wri.patch b/queue-4.14/pinctrl-tegra-fix-write-barrier-placement-in-pmx_wri.patch
new file mode 100644 (file)
index 0000000..6f8ab79
--- /dev/null
@@ -0,0 +1,44 @@
+From 98648d212d6b1b33d2dd721c7fe3c78ec16f8ef0 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 16 Aug 2019 12:41:46 -0700
+Subject: pinctrl: tegra: Fix write barrier placement in pmx_writel
+
+From: Sowjanya Komatineni <skomatineni@nvidia.com>
+
+[ Upstream commit c2cf351eba2ff6002ce8eb178452219d2521e38e ]
+
+pmx_writel uses writel which inserts write barrier before the
+register write.
+
+This patch has fix to replace writel with writel_relaxed followed
+by a readback and memory barrier to ensure write operation is
+completed for successful pinctrl change.
+
+Acked-by: Thierry Reding <treding@nvidia.com>
+Reviewed-by: Dmitry Osipenko <digetx@gmail.com>
+Signed-off-by: Sowjanya Komatineni <skomatineni@nvidia.com>
+Link: https://lore.kernel.org/r/1565984527-5272-2-git-send-email-skomatineni@nvidia.com
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/pinctrl/tegra/pinctrl-tegra.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/pinctrl/tegra/pinctrl-tegra.c b/drivers/pinctrl/tegra/pinctrl-tegra.c
+index 51716819129d2..e5c9b9c684289 100644
+--- a/drivers/pinctrl/tegra/pinctrl-tegra.c
++++ b/drivers/pinctrl/tegra/pinctrl-tegra.c
+@@ -51,7 +51,9 @@ static inline u32 pmx_readl(struct tegra_pmx *pmx, u32 bank, u32 reg)
+ static inline void pmx_writel(struct tegra_pmx *pmx, u32 val, u32 bank, u32 reg)
+ {
+-      writel(val, pmx->regs[bank] + reg);
++      writel_relaxed(val, pmx->regs[bank] + reg);
++      /* make sure pinmux register write completed */
++      pmx_readl(pmx, bank, reg);
+ }
+ static int tegra_pinctrl_get_groups_count(struct pinctrl_dev *pctldev)
+-- 
+2.20.1
+
diff --git a/queue-4.14/pktcdvd-remove-warning-on-attempting-to-register-non.patch b/queue-4.14/pktcdvd-remove-warning-on-attempting-to-register-non.patch
new file mode 100644 (file)
index 0000000..11234b2
--- /dev/null
@@ -0,0 +1,87 @@
+From f45edfcdd31ab373f7522ac0b465c0b5fbd920c3 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 22 Sep 2019 10:01:05 -0600
+Subject: pktcdvd: remove warning on attempting to register non-passthrough dev
+
+From: Jens Axboe <axboe@kernel.dk>
+
+[ Upstream commit eb09b3cc464d2c3bbde9a6648603c8d599ea8582 ]
+
+Anatoly reports that he gets the below warning when booting -git on
+a sparc64 box on debian unstable:
+
+...
+[   13.352975] aes_sparc64: Using sparc64 aes opcodes optimized AES
+implementation
+[   13.428002] ------------[ cut here ]------------
+[   13.428081] WARNING: CPU: 21 PID: 586 at
+drivers/block/pktcdvd.c:2597 pkt_setup_dev+0x2e4/0x5a0 [pktcdvd]
+[   13.428147] Attempt to register a non-SCSI queue
+[   13.428184] Modules linked in: pktcdvd libdes cdrom aes_sparc64
+n2_rng md5_sparc64 sha512_sparc64 rng_core sha256_sparc64 flash
+sha1_sparc64 ip_tables x_tables ipv6 crc_ccitt nf_defrag_ipv6 autofs4
+ext4 crc16 mbcache jbd2 raid10 raid456 async_raid6_recov async_memcpy
+async_pq async_xor xor async_tx raid6_pq raid1 raid0 multipath linear
+md_mod crc32c_sparc64
+[   13.428452] CPU: 21 PID: 586 Comm: pktsetup Not tainted
+5.3.0-10169-g574cc4539762 #1234
+[   13.428507] Call Trace:
+[   13.428542]  [00000000004635c0] __warn+0xc0/0x100
+[   13.428582]  [0000000000463634] warn_slowpath_fmt+0x34/0x60
+[   13.428626]  [000000001045b244] pkt_setup_dev+0x2e4/0x5a0 [pktcdvd]
+[   13.428674]  [000000001045ccf4] pkt_ctl_ioctl+0x94/0x220 [pktcdvd]
+[   13.428724]  [00000000006b95c8] do_vfs_ioctl+0x628/0x6e0
+[   13.428764]  [00000000006b96c8] ksys_ioctl+0x48/0x80
+[   13.428803]  [00000000006b9714] sys_ioctl+0x14/0x40
+[   13.428847]  [0000000000406294] linux_sparc_syscall+0x34/0x44
+[   13.428890] irq event stamp: 4181
+[   13.428924] hardirqs last  enabled at (4189): [<00000000004e0a74>]
+console_unlock+0x634/0x6c0
+[   13.428984] hardirqs last disabled at (4196): [<00000000004e0540>]
+console_unlock+0x100/0x6c0
+[   13.429048] softirqs last  enabled at (3978): [<0000000000b2e2d8>]
+__do_softirq+0x498/0x520
+[   13.429110] softirqs last disabled at (3967): [<000000000042cfb4>]
+do_softirq_own_stack+0x34/0x60
+[   13.429172] ---[ end trace 2220ca468f32967d ]---
+[   13.430018] pktcdvd: setup of pktcdvd device failed
+[   13.455589] des_sparc64: Using sparc64 des opcodes optimized DES
+implementation
+[   13.515334] camellia_sparc64: Using sparc64 camellia opcodes
+optimized CAMELLIA implementation
+[   13.522856] pktcdvd: setup of pktcdvd device failed
+[   13.529327] pktcdvd: setup of pktcdvd device failed
+[   13.532932] pktcdvd: setup of pktcdvd device failed
+[   13.536165] pktcdvd: setup of pktcdvd device failed
+[   13.539372] pktcdvd: setup of pktcdvd device failed
+[   13.542834] pktcdvd: setup of pktcdvd device failed
+[   13.546536] pktcdvd: setup of pktcdvd device failed
+[   15.431071] XFS (dm-0): Mounting V5 Filesystem
+...
+
+Apparently debian auto-attaches any cdrom like device to pktcdvd, which
+can lead to the above warning. There's really no reason to warn for this
+situation, kill it.
+
+Reported-by: Anatoly Pugachev <matorola@gmail.com>
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/block/pktcdvd.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
+index 11ec92e47455a..94944d063b372 100644
+--- a/drivers/block/pktcdvd.c
++++ b/drivers/block/pktcdvd.c
+@@ -2585,7 +2585,6 @@ static int pkt_new_dev(struct pktcdvd_device *pd, dev_t dev)
+       if (ret)
+               return ret;
+       if (!blk_queue_scsi_passthrough(bdev_get_queue(bdev))) {
+-              WARN_ONCE(true, "Attempt to register a non-SCSI queue\n");
+               blkdev_put(bdev, FMODE_READ | FMODE_NDELAY);
+               return -EINVAL;
+       }
+-- 
+2.20.1
+
diff --git a/queue-4.14/powerpc-64s-exception-machine-check-use-correct-cfar.patch b/queue-4.14/powerpc-64s-exception-machine-check-use-correct-cfar.patch
new file mode 100644 (file)
index 0000000..8fe13c0
--- /dev/null
@@ -0,0 +1,46 @@
+From 05e058ac955580c39ad7e472bf9d3782d00e187e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 2 Aug 2019 20:56:32 +1000
+Subject: powerpc/64s/exception: machine check use correct cfar for late
+ handler
+
+From: Nicholas Piggin <npiggin@gmail.com>
+
+[ Upstream commit 0b66370c61fcf5fcc1d6901013e110284da6e2bb ]
+
+Bare metal machine checks run an "early" handler in real mode before
+running the main handler which reports the event.
+
+The main handler runs exactly as a normal interrupt handler, after the
+"windup" which sets registers back as they were at interrupt entry.
+CFAR does not get restored by the windup code, so that will be wrong
+when the handler is run.
+
+Restore the CFAR to the saved value before running the late handler.
+
+Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
+Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
+Link: https://lore.kernel.org/r/20190802105709.27696-8-npiggin@gmail.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/powerpc/kernel/exceptions-64s.S | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
+index 43cde6c602795..cdc53fd905977 100644
+--- a/arch/powerpc/kernel/exceptions-64s.S
++++ b/arch/powerpc/kernel/exceptions-64s.S
+@@ -464,6 +464,10 @@ EXC_COMMON_BEGIN(machine_check_handle_early)
+       RFI_TO_USER_OR_KERNEL
+ 9:
+       /* Deliver the machine check to host kernel in V mode. */
++BEGIN_FTR_SECTION
++      ld      r10,ORIG_GPR3(r1)
++      mtspr   SPRN_CFAR,r10
++END_FTR_SECTION_IFSET(CPU_FTR_CFAR)
+       MACHINE_CHECK_HANDLER_WINDUP
+       b       machine_check_pSeries
+-- 
+2.20.1
+
diff --git a/queue-4.14/powerpc-futex-fix-warning-oldval-may-be-used-uniniti.patch b/queue-4.14/powerpc-futex-fix-warning-oldval-may-be-used-uniniti.patch
new file mode 100644 (file)
index 0000000..a98f7a1
--- /dev/null
@@ -0,0 +1,52 @@
+From 1084d36a404dbffdc11256436b632523365e69d6 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 14 Aug 2019 09:25:52 +0000
+Subject: powerpc/futex: Fix warning: 'oldval' may be used uninitialized in
+ this function
+
+From: Christophe Leroy <christophe.leroy@c-s.fr>
+
+[ Upstream commit 38a0d0cdb46d3f91534e5b9839ec2d67be14c59d ]
+
+We see warnings such as:
+  kernel/futex.c: In function 'do_futex':
+  kernel/futex.c:1676:17: warning: 'oldval' may be used uninitialized in this function [-Wmaybe-uninitialized]
+     return oldval == cmparg;
+                   ^
+  kernel/futex.c:1651:6: note: 'oldval' was declared here
+    int oldval, ret;
+        ^
+
+This is because arch_futex_atomic_op_inuser() only sets *oval if ret
+is 0 and GCC doesn't see that it will only use it when ret is 0.
+
+Anyway, the non-zero ret path is an error path that won't suffer from
+setting *oval, and as *oval is a local var in futex_atomic_op_inuser()
+it will have no impact.
+
+Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
+[mpe: reword change log slightly]
+Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
+Link: https://lore.kernel.org/r/86b72f0c134367b214910b27b9a6dd3321af93bb.1565774657.git.christophe.leroy@c-s.fr
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/powerpc/include/asm/futex.h | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/arch/powerpc/include/asm/futex.h b/arch/powerpc/include/asm/futex.h
+index 1a944c18c5390..3c7d859452294 100644
+--- a/arch/powerpc/include/asm/futex.h
++++ b/arch/powerpc/include/asm/futex.h
+@@ -59,8 +59,7 @@ static inline int arch_futex_atomic_op_inuser(int op, int oparg, int *oval,
+       pagefault_enable();
+-      if (!ret)
+-              *oval = oldval;
++      *oval = oldval;
+       return ret;
+ }
+-- 
+2.20.1
+
diff --git a/queue-4.14/powerpc-pseries-correctly-track-irq-state-in-default.patch b/queue-4.14/powerpc-pseries-correctly-track-irq-state-in-default.patch
new file mode 100644 (file)
index 0000000..ee1dc8b
--- /dev/null
@@ -0,0 +1,59 @@
+From 3d1067cf58f4a83c04d369494efb76b25fe6386b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 10 Sep 2019 17:52:44 -0500
+Subject: powerpc/pseries: correctly track irq state in default idle
+
+From: Nathan Lynch <nathanl@linux.ibm.com>
+
+[ Upstream commit 92c94dfb69e350471473fd3075c74bc68150879e ]
+
+prep_irq_for_idle() is intended to be called before entering
+H_CEDE (and it is used by the pseries cpuidle driver). However the
+default pseries idle routine does not call it, leading to mismanaged
+lazy irq state when the cpuidle driver isn't in use. Manifestations of
+this include:
+
+* Dropped IPIs in the time immediately after a cpu comes
+  online (before it has installed the cpuidle handler), making the
+  online operation block indefinitely waiting for the new cpu to
+  respond.
+
+* Hitting this WARN_ON in arch_local_irq_restore():
+       /*
+        * We should already be hard disabled here. We had bugs
+        * where that wasn't the case so let's dbl check it and
+        * warn if we are wrong. Only do that when IRQ tracing
+        * is enabled as mfmsr() can be costly.
+        */
+       if (WARN_ON_ONCE(mfmsr() & MSR_EE))
+               __hard_irq_disable();
+
+Call prep_irq_for_idle() from pseries_lpar_idle() and honor its
+result.
+
+Fixes: 363edbe2614a ("powerpc: Default arch idle could cede processor on pseries")
+Signed-off-by: Nathan Lynch <nathanl@linux.ibm.com>
+Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
+Link: https://lore.kernel.org/r/20190910225244.25056-1-nathanl@linux.ibm.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/powerpc/platforms/pseries/setup.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
+index 6a0ad56e89b93..7a9945b350536 100644
+--- a/arch/powerpc/platforms/pseries/setup.c
++++ b/arch/powerpc/platforms/pseries/setup.c
+@@ -307,6 +307,9 @@ static void pseries_lpar_idle(void)
+        * low power mode by ceding processor to hypervisor
+        */
++      if (!prep_irq_for_idle())
++              return;
++
+       /* Indicate to hypervisor that we are idle. */
+       get_lppaca()->idle = 1;
+-- 
+2.20.1
+
diff --git a/queue-4.14/powerpc-pseries-mobility-use-cond_resched-when-updat.patch b/queue-4.14/powerpc-pseries-mobility-use-cond_resched-when-updat.patch
new file mode 100644 (file)
index 0000000..ae9e5ec
--- /dev/null
@@ -0,0 +1,69 @@
+From 5691cf3ce381097b8d83b907c89a3be862b30259 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 2 Aug 2019 14:29:26 -0500
+Subject: powerpc/pseries/mobility: use cond_resched when updating device tree
+
+From: Nathan Lynch <nathanl@linux.ibm.com>
+
+[ Upstream commit ccfb5bd71d3d1228090a8633800ae7cdf42a94ac ]
+
+After a partition migration, pseries_devicetree_update() processes
+changes to the device tree communicated from the platform to
+Linux. This is a relatively heavyweight operation, with multiple
+device tree searches, memory allocations, and conversations with
+partition firmware.
+
+There's a few levels of nested loops which are bounded only by
+decisions made by the platform, outside of Linux's control, and indeed
+we have seen RCU stalls on large systems while executing this call
+graph. Use cond_resched() in these loops so that the cpu is yielded
+when needed.
+
+Signed-off-by: Nathan Lynch <nathanl@linux.ibm.com>
+Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
+Link: https://lore.kernel.org/r/20190802192926.19277-4-nathanl@linux.ibm.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/powerpc/platforms/pseries/mobility.c | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/arch/powerpc/platforms/pseries/mobility.c b/arch/powerpc/platforms/pseries/mobility.c
+index 4addc552eb33d..9739a055e5f7b 100644
+--- a/arch/powerpc/platforms/pseries/mobility.c
++++ b/arch/powerpc/platforms/pseries/mobility.c
+@@ -12,6 +12,7 @@
+ #include <linux/cpu.h>
+ #include <linux/kernel.h>
+ #include <linux/kobject.h>
++#include <linux/sched.h>
+ #include <linux/smp.h>
+ #include <linux/stat.h>
+ #include <linux/completion.h>
+@@ -208,7 +209,11 @@ static int update_dt_node(__be32 phandle, s32 scope)
+                               prop_data += vd;
+                       }
++
++                      cond_resched();
+               }
++
++              cond_resched();
+       } while (rtas_rc == 1);
+       of_node_put(dn);
+@@ -317,8 +322,12 @@ int pseries_devicetree_update(s32 scope)
+                                       add_dt_node(phandle, drc_index);
+                                       break;
+                               }
++
++                              cond_resched();
+                       }
+               }
++
++              cond_resched();
+       } while (rc == 1);
+       kfree(rtas_buf);
+-- 
+2.20.1
+
diff --git a/queue-4.14/powerpc-rtas-use-device-model-apis-and-serialization.patch b/queue-4.14/powerpc-rtas-use-device-model-apis-and-serialization.patch
new file mode 100644 (file)
index 0000000..4ce9ea1
--- /dev/null
@@ -0,0 +1,96 @@
+From 4a6b3c1f38ef9c5d3fa6f868b1c01f0648ce199b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 2 Aug 2019 14:29:24 -0500
+Subject: powerpc/rtas: use device model APIs and serialization during LPM
+
+From: Nathan Lynch <nathanl@linux.ibm.com>
+
+[ Upstream commit a6717c01ddc259f6f73364779df058e2c67309f8 ]
+
+The LPAR migration implementation and userspace-initiated cpu hotplug
+can interleave their executions like so:
+
+1. Set cpu 7 offline via sysfs.
+
+2. Begin a partition migration, whose implementation requires the OS
+   to ensure all present cpus are online; cpu 7 is onlined:
+
+     rtas_ibm_suspend_me -> rtas_online_cpus_mask -> cpu_up
+
+   This sets cpu 7 online in all respects except for the cpu's
+   corresponding struct device; dev->offline remains true.
+
+3. Set cpu 7 online via sysfs. _cpu_up() determines that cpu 7 is
+   already online and returns success. The driver core (device_online)
+   sets dev->offline = false.
+
+4. The migration completes and restores cpu 7 to offline state:
+
+     rtas_ibm_suspend_me -> rtas_offline_cpus_mask -> cpu_down
+
+This leaves cpu7 in a state where the driver core considers the cpu
+device online, but in all other respects it is offline and
+unused. Attempts to online the cpu via sysfs appear to succeed but the
+driver core actually does not pass the request to the lower-level
+cpuhp support code. This makes the cpu unusable until the cpu device
+is manually set offline and then online again via sysfs.
+
+Instead of directly calling cpu_up/cpu_down, the migration code should
+use the higher-level device core APIs to maintain consistent state and
+serialize operations.
+
+Fixes: 120496ac2d2d ("powerpc: Bring all threads online prior to migration/hibernation")
+Signed-off-by: Nathan Lynch <nathanl@linux.ibm.com>
+Reviewed-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
+Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
+Link: https://lore.kernel.org/r/20190802192926.19277-2-nathanl@linux.ibm.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/powerpc/kernel/rtas.c | 11 ++++++++---
+ 1 file changed, 8 insertions(+), 3 deletions(-)
+
+diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
+index 1643e9e536557..141d192c69538 100644
+--- a/arch/powerpc/kernel/rtas.c
++++ b/arch/powerpc/kernel/rtas.c
+@@ -874,15 +874,17 @@ static int rtas_cpu_state_change_mask(enum rtas_cpu_state state,
+               return 0;
+       for_each_cpu(cpu, cpus) {
++              struct device *dev = get_cpu_device(cpu);
++
+               switch (state) {
+               case DOWN:
+-                      cpuret = cpu_down(cpu);
++                      cpuret = device_offline(dev);
+                       break;
+               case UP:
+-                      cpuret = cpu_up(cpu);
++                      cpuret = device_online(dev);
+                       break;
+               }
+-              if (cpuret) {
++              if (cpuret < 0) {
+                       pr_debug("%s: cpu_%s for cpu#%d returned %d.\n",
+                                       __func__,
+                                       ((state == UP) ? "up" : "down"),
+@@ -971,6 +973,8 @@ int rtas_ibm_suspend_me(u64 handle)
+       data.token = rtas_token("ibm,suspend-me");
+       data.complete = &done;
++      lock_device_hotplug();
++
+       /* All present CPUs must be online */
+       cpumask_andnot(offline_mask, cpu_present_mask, cpu_online_mask);
+       cpuret = rtas_online_cpus_mask(offline_mask);
+@@ -1002,6 +1006,7 @@ int rtas_ibm_suspend_me(u64 handle)
+                               __func__);
+ out:
++      unlock_device_hotplug();
+       free_cpumask_var(offline_mask);
+       return atomic_read(&data.error);
+ }
+-- 
+2.20.1
+
diff --git a/queue-4.14/powerpc-xmon-check-for-hv-mode-when-dumping-xive-inf.patch b/queue-4.14/powerpc-xmon-check-for-hv-mode-when-dumping-xive-inf.patch
new file mode 100644 (file)
index 0000000..e9d3c0b
--- /dev/null
@@ -0,0 +1,56 @@
+From c9bdb44a8a91ff15b6e781d39518e0602041bf16 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 14 Aug 2019 17:47:52 +0200
+Subject: powerpc/xmon: Check for HV mode when dumping XIVE info from OPAL
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Cédric Le Goater <clg@kaod.org>
+
+[ Upstream commit c3e0dbd7f780a58c4695f1cd8fc8afde80376737 ]
+
+Currently, the xmon 'dx' command calls OPAL to dump the XIVE state in
+the OPAL logs and also outputs some of the fields of the internal XIVE
+structures in Linux. The OPAL calls can only be done on baremetal
+(PowerNV) and they crash a pseries machine. Fix by checking the
+hypervisor feature of the CPU.
+
+Signed-off-by: Cédric Le Goater <clg@kaod.org>
+Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
+Link: https://lore.kernel.org/r/20190814154754.23682-2-clg@kaod.org
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/powerpc/xmon/xmon.c | 15 +++++++++------
+ 1 file changed, 9 insertions(+), 6 deletions(-)
+
+diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
+index 6b9038a3e79f0..5a739588aa505 100644
+--- a/arch/powerpc/xmon/xmon.c
++++ b/arch/powerpc/xmon/xmon.c
+@@ -2438,13 +2438,16 @@ static void dump_pacas(void)
+ static void dump_one_xive(int cpu)
+ {
+       unsigned int hwid = get_hard_smp_processor_id(cpu);
++      bool hv = cpu_has_feature(CPU_FTR_HVMODE);
+-      opal_xive_dump(XIVE_DUMP_TM_HYP, hwid);
+-      opal_xive_dump(XIVE_DUMP_TM_POOL, hwid);
+-      opal_xive_dump(XIVE_DUMP_TM_OS, hwid);
+-      opal_xive_dump(XIVE_DUMP_TM_USER, hwid);
+-      opal_xive_dump(XIVE_DUMP_VP, hwid);
+-      opal_xive_dump(XIVE_DUMP_EMU_STATE, hwid);
++      if (hv) {
++              opal_xive_dump(XIVE_DUMP_TM_HYP, hwid);
++              opal_xive_dump(XIVE_DUMP_TM_POOL, hwid);
++              opal_xive_dump(XIVE_DUMP_TM_OS, hwid);
++              opal_xive_dump(XIVE_DUMP_TM_USER, hwid);
++              opal_xive_dump(XIVE_DUMP_VP, hwid);
++              opal_xive_dump(XIVE_DUMP_EMU_STATE, hwid);
++      }
+       if (setjmp(bus_error_jmp) != 0) {
+               catch_memory_errors = 0;
+-- 
+2.20.1
+
diff --git a/queue-4.14/rtc-snvs-fix-possible-race-condition.patch b/queue-4.14/rtc-snvs-fix-possible-race-condition.patch
new file mode 100644 (file)
index 0000000..cf7c65d
--- /dev/null
@@ -0,0 +1,57 @@
+From 3d8b1b9b25ce5900fe76a93f409d56b1b4c6e404 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 16 Jul 2019 15:18:58 +0800
+Subject: rtc: snvs: fix possible race condition
+
+From: Anson Huang <Anson.Huang@nxp.com>
+
+[ Upstream commit 6fd4fe9b496d9ba3382992ff4fde3871d1b6f63d ]
+
+The RTC IRQ is requested before the struct rtc_device is allocated,
+this may lead to a NULL pointer dereference in IRQ handler.
+
+To fix this issue, allocating the rtc_device struct before requesting
+the RTC IRQ using devm_rtc_allocate_device, and use rtc_register_device
+to register the RTC device.
+
+Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
+Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
+Link: https://lore.kernel.org/r/20190716071858.36750-1-Anson.Huang@nxp.com
+Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/rtc/rtc-snvs.c | 11 +++++++----
+ 1 file changed, 7 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/rtc/rtc-snvs.c b/drivers/rtc/rtc-snvs.c
+index 71eee39520f0b..7aa2c5ea0de4f 100644
+--- a/drivers/rtc/rtc-snvs.c
++++ b/drivers/rtc/rtc-snvs.c
+@@ -280,6 +280,10 @@ static int snvs_rtc_probe(struct platform_device *pdev)
+       if (!data)
+               return -ENOMEM;
++      data->rtc = devm_rtc_allocate_device(&pdev->dev);
++      if (IS_ERR(data->rtc))
++              return PTR_ERR(data->rtc);
++
+       data->regmap = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, "regmap");
+       if (IS_ERR(data->regmap)) {
+@@ -342,10 +346,9 @@ static int snvs_rtc_probe(struct platform_device *pdev)
+               goto error_rtc_device_register;
+       }
+-      data->rtc = devm_rtc_device_register(&pdev->dev, pdev->name,
+-                                      &snvs_rtc_ops, THIS_MODULE);
+-      if (IS_ERR(data->rtc)) {
+-              ret = PTR_ERR(data->rtc);
++      data->rtc->ops = &snvs_rtc_ops;
++      ret = rtc_register_device(data->rtc);
++      if (ret) {
+               dev_err(&pdev->dev, "failed to register rtc: %d\n", ret);
+               goto error_rtc_device_register;
+       }
+-- 
+2.20.1
+
diff --git a/queue-4.14/scsi-core-reduce-memory-required-for-scsi-logging.patch b/queue-4.14/scsi-core-reduce-memory-required-for-scsi-logging.patch
new file mode 100644 (file)
index 0000000..af8a8c6
--- /dev/null
@@ -0,0 +1,111 @@
+From 9f7743729516a5888cd49bd61850c36b4fb6144f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 1 Aug 2019 15:38:14 -0700
+Subject: scsi: core: Reduce memory required for SCSI logging
+
+From: Bart Van Assche <bvanassche@acm.org>
+
+[ Upstream commit dccc96abfb21dc19d69e707c38c8ba439bba7160 ]
+
+The data structure used for log messages is so large that it can cause a
+boot failure. Since allocations from that data structure can fail anyway,
+use kmalloc() / kfree() instead of that data structure.
+
+See also https://bugzilla.kernel.org/show_bug.cgi?id=204119.
+See also commit ded85c193a39 ("scsi: Implement per-cpu logging buffer") # v4.0.
+
+Reported-by: Jan Palus <jpalus@fastmail.com>
+Cc: Christoph Hellwig <hch@lst.de>
+Cc: Hannes Reinecke <hare@suse.com>
+Cc: Johannes Thumshirn <jthumshirn@suse.de>
+Cc: Ming Lei <ming.lei@redhat.com>
+Cc: Jan Palus <jpalus@fastmail.com>
+Signed-off-by: Bart Van Assche <bvanassche@acm.org>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/scsi/scsi_logging.c | 48 +++----------------------------------
+ include/scsi/scsi_dbg.h     |  2 --
+ 2 files changed, 3 insertions(+), 47 deletions(-)
+
+diff --git a/drivers/scsi/scsi_logging.c b/drivers/scsi/scsi_logging.c
+index bd70339c1242e..03d9855a6afd7 100644
+--- a/drivers/scsi/scsi_logging.c
++++ b/drivers/scsi/scsi_logging.c
+@@ -16,57 +16,15 @@
+ #include <scsi/scsi_eh.h>
+ #include <scsi/scsi_dbg.h>
+-#define SCSI_LOG_SPOOLSIZE 4096
+-
+-#if (SCSI_LOG_SPOOLSIZE / SCSI_LOG_BUFSIZE) > BITS_PER_LONG
+-#warning SCSI logging bitmask too large
+-#endif
+-
+-struct scsi_log_buf {
+-      char buffer[SCSI_LOG_SPOOLSIZE];
+-      unsigned long map;
+-};
+-
+-static DEFINE_PER_CPU(struct scsi_log_buf, scsi_format_log);
+-
+ static char *scsi_log_reserve_buffer(size_t *len)
+ {
+-      struct scsi_log_buf *buf;
+-      unsigned long map_bits = sizeof(buf->buffer) / SCSI_LOG_BUFSIZE;
+-      unsigned long idx = 0;
+-
+-      preempt_disable();
+-      buf = this_cpu_ptr(&scsi_format_log);
+-      idx = find_first_zero_bit(&buf->map, map_bits);
+-      if (likely(idx < map_bits)) {
+-              while (test_and_set_bit(idx, &buf->map)) {
+-                      idx = find_next_zero_bit(&buf->map, map_bits, idx);
+-                      if (idx >= map_bits)
+-                              break;
+-              }
+-      }
+-      if (WARN_ON(idx >= map_bits)) {
+-              preempt_enable();
+-              return NULL;
+-      }
+-      *len = SCSI_LOG_BUFSIZE;
+-      return buf->buffer + idx * SCSI_LOG_BUFSIZE;
++      *len = 128;
++      return kmalloc(*len, GFP_ATOMIC);
+ }
+ static void scsi_log_release_buffer(char *bufptr)
+ {
+-      struct scsi_log_buf *buf;
+-      unsigned long idx;
+-      int ret;
+-
+-      buf = this_cpu_ptr(&scsi_format_log);
+-      if (bufptr >= buf->buffer &&
+-          bufptr < buf->buffer + SCSI_LOG_SPOOLSIZE) {
+-              idx = (bufptr - buf->buffer) / SCSI_LOG_BUFSIZE;
+-              ret = test_and_clear_bit(idx, &buf->map);
+-              WARN_ON(!ret);
+-      }
+-      preempt_enable();
++      kfree(bufptr);
+ }
+ static inline const char *scmd_name(const struct scsi_cmnd *scmd)
+diff --git a/include/scsi/scsi_dbg.h b/include/scsi/scsi_dbg.h
+index 04e0679767f63..2b5dfae782722 100644
+--- a/include/scsi/scsi_dbg.h
++++ b/include/scsi/scsi_dbg.h
+@@ -6,8 +6,6 @@ struct scsi_cmnd;
+ struct scsi_device;
+ struct scsi_sense_hdr;
+-#define SCSI_LOG_BUFSIZE 128
+-
+ extern void scsi_print_command(struct scsi_cmnd *);
+ extern size_t __scsi_format_command(char *, size_t,
+                                  const unsigned char *, size_t);
+-- 
+2.20.1
+
diff --git a/queue-4.14/security-smack-fix-possible-null-pointer-dereference.patch b/queue-4.14/security-smack-fix-possible-null-pointer-dereference.patch
new file mode 100644 (file)
index 0000000..f40b1bf
--- /dev/null
@@ -0,0 +1,49 @@
+From c4df9881722d848d4ccaa4b70df2eaba5386d436 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 23 Jul 2019 18:00:15 +0800
+Subject: security: smack: Fix possible null-pointer dereferences in
+ smack_socket_sock_rcv_skb()
+
+From: Jia-Ju Bai <baijiaju1990@gmail.com>
+
+[ Upstream commit 3f4287e7d98a2954f20bf96c567fdffcd2b63eb9 ]
+
+In smack_socket_sock_rcv_skb(), there is an if statement
+on line 3920 to check whether skb is NULL:
+    if (skb && skb->secmark != 0)
+
+This check indicates skb can be NULL in some cases.
+
+But on lines 3931 and 3932, skb is used:
+    ad.a.u.net->netif = skb->skb_iif;
+    ipv6_skb_to_auditdata(skb, &ad.a, NULL);
+
+Thus, possible null-pointer dereferences may occur when skb is NULL.
+
+To fix these possible bugs, an if statement is added to check skb.
+
+These bugs are found by a static analysis tool STCheck written by us.
+
+Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
+Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ security/smack/smack_lsm.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
+index 0d5ce7190b17e..09119c43525ed 100644
+--- a/security/smack/smack_lsm.c
++++ b/security/smack/smack_lsm.c
+@@ -4031,6 +4031,8 @@ access_check:
+                       skp = smack_ipv6host_label(&sadd);
+               if (skp == NULL)
+                       skp = smack_net_ambient;
++              if (skb == NULL)
++                      break;
+ #ifdef CONFIG_AUDIT
+               smk_ad_init_net(&ad, __func__, LSM_AUDIT_DATA_NET, &net);
+               ad.a.u.net->family = family;
+-- 
+2.20.1
+
diff --git a/queue-4.14/series b/queue-4.14/series
new file mode 100644 (file)
index 0000000..6f66c14
--- /dev/null
@@ -0,0 +1,48 @@
+tpm-migrate-pubek_show-to-struct-tpm_buf.patch
+tpm-use-tpm_try_get_ops-in-tpm-sysfs.c.patch
+tpm-fix-tpm-1.2-shutdown-sequence-to-prevent-future-.patch
+drm-bridge-tc358767-increase-aux-transfer-length-lim.patch
+drm-panel-simple-fix-auo-g185han01-horizontal-blanki.patch
+video-ssd1307fb-start-page-range-at-page_offset.patch
+drm-stm-attach-gem-fence-to-atomic-state.patch
+drm-radeon-fix-eeh-during-kexec.patch
+gpu-drm-radeon-fix-a-possible-null-pointer-dereferen.patch
+ipmi_si-only-schedule-continuously-in-the-thread-in-.patch
+clk-qoriq-fix-wunused-const-variable.patch
+clk-sunxi-ng-v3s-add-missing-clock-slices-for-mmc2-m.patch
+clk-sirf-don-t-reference-clk_init_data-after-registr.patch
+clk-zx296718-don-t-reference-clk_init_data-after-reg.patch
+powerpc-xmon-check-for-hv-mode-when-dumping-xive-inf.patch
+powerpc-rtas-use-device-model-apis-and-serialization.patch
+powerpc-futex-fix-warning-oldval-may-be-used-uniniti.patch
+powerpc-pseries-mobility-use-cond_resched-when-updat.patch
+pinctrl-tegra-fix-write-barrier-placement-in-pmx_wri.patch
+vfio_pci-restore-original-state-on-release.patch
+drm-nouveau-volt-fix-for-some-cards-having-0-maximum.patch
+drm-amdgpu-si-fix-asic-tests.patch
+powerpc-64s-exception-machine-check-use-correct-cfar.patch
+powerpc-pseries-correctly-track-irq-state-in-default.patch
+arm64-fix-unreachable-code-issue-with-cmpxchg.patch
+clk-at91-select-parent-if-main-oscillator-or-bypass-.patch
+scsi-core-reduce-memory-required-for-scsi-logging.patch
+dma-buf-sw_sync-synchronize-signal-vs-syncpt-free.patch
+clk-jz4740-add-tcu-clock.patch
+mips-tlbex-explicitly-cast-_page_no_exec-to-a-boolea.patch
+i2c-cht-wc-fix-lockdep-warning.patch
+mfd-intel-lpss-remove-d3cold-delay.patch
+pci-tegra-fix-of-node-reference-leak.patch
+livepatch-nullify-obj-mod-in-klp_module_coming-s-err.patch
+arm-8898-1-mm-don-t-treat-faults-reported-from-cache.patch
+rtc-snvs-fix-possible-race-condition.patch
+hid-apple-fix-stuck-function-keys-when-using-fn.patch
+pci-rockchip-propagate-errors-for-optional-regulator.patch
+pci-imx6-propagate-errors-for-optional-regulators.patch
+pci-exynos-propagate-errors-for-optional-phys.patch
+security-smack-fix-possible-null-pointer-dereference.patch
+arm-8903-1-ensure-that-usable-memory-in-bank-0-start.patch
+fat-work-around-race-with-userspace-s-read-via-block.patch
+pktcdvd-remove-warning-on-attempting-to-register-non.patch
+hypfs-fix-error-number-left-in-struct-pointer-member.patch
+kbuild-clean-compressed-initramfs-image.patch
+ocfs2-wait-for-recovering-done-after-direct-unlock-r.patch
+kmemleak-increase-debug_kmemleak_early_log_size-defa.patch
diff --git a/queue-4.14/tpm-fix-tpm-1.2-shutdown-sequence-to-prevent-future-.patch b/queue-4.14/tpm-fix-tpm-1.2-shutdown-sequence-to-prevent-future-.patch
new file mode 100644 (file)
index 0000000..2a5e744
--- /dev/null
@@ -0,0 +1,49 @@
+From f87f61c1070a1f8cfa00268dcbdc1218a4536c1f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 3 Oct 2019 21:46:23 +0300
+Subject: tpm: Fix TPM 1.2 Shutdown sequence to prevent future TPM operations
+
+From: Vadim Sukhomlinov <sukhomlinov@google.com>
+
+commit db4d8cb9c9f2af71c4d087817160d866ed572cc9 upstream
+
+TPM 2.0 Shutdown involve sending TPM2_Shutdown to TPM chip and disabling
+future TPM operations. TPM 1.2 behavior was different, future TPM
+operations weren't disabled, causing rare issues. This patch ensures
+that future TPM operations are disabled.
+
+Fixes: d1bd4a792d39 ("tpm: Issue a TPM2_Shutdown for TPM2 devices.")
+Cc: stable@vger.kernel.org
+Signed-off-by: Vadim Sukhomlinov <sukhomlinov@google.com>
+[dianders: resolved merge conflicts with mainline]
+Signed-off-by: Douglas Anderson <dianders@chromium.org>
+Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
+Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/char/tpm/tpm-chip.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c
+index 0eca20c5a80cf..dcf5bb1534955 100644
+--- a/drivers/char/tpm/tpm-chip.c
++++ b/drivers/char/tpm/tpm-chip.c
+@@ -158,12 +158,13 @@ static int tpm_class_shutdown(struct device *dev)
+ {
+       struct tpm_chip *chip = container_of(dev, struct tpm_chip, dev);
++      down_write(&chip->ops_sem);
+       if (chip->flags & TPM_CHIP_FLAG_TPM2) {
+-              down_write(&chip->ops_sem);
+               tpm2_shutdown(chip, TPM2_SU_CLEAR);
+               chip->ops = NULL;
+-              up_write(&chip->ops_sem);
+       }
++      chip->ops = NULL;
++      up_write(&chip->ops_sem);
+       return 0;
+ }
+-- 
+2.20.1
+
diff --git a/queue-4.14/tpm-migrate-pubek_show-to-struct-tpm_buf.patch b/queue-4.14/tpm-migrate-pubek_show-to-struct-tpm_buf.patch
new file mode 100644 (file)
index 0000000..2072a50
--- /dev/null
@@ -0,0 +1,175 @@
+From 66b2ef22341517eb11133f75b7e8c03baf31ad28 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 3 Oct 2019 21:46:21 +0300
+Subject: tpm: migrate pubek_show to struct tpm_buf
+
+From: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
+
+commit da379f3c1db0c9a1fd27b11d24c9894b5edc7c75 upstream
+
+Migrated pubek_show to struct tpm_buf and cleaned up its implementation.
+Previously the output parameter structure was declared but left
+completely unused. Now it is used to refer different fields of the
+output. We can move it to tpm-sysfs.c as it does not have any use
+outside of that file.
+
+Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/char/tpm/tpm-sysfs.c | 87 ++++++++++++++++++++----------------
+ drivers/char/tpm/tpm.h       | 13 ------
+ 2 files changed, 48 insertions(+), 52 deletions(-)
+
+diff --git a/drivers/char/tpm/tpm-sysfs.c b/drivers/char/tpm/tpm-sysfs.c
+index 86f38d239476a..83a77a4455380 100644
+--- a/drivers/char/tpm/tpm-sysfs.c
++++ b/drivers/char/tpm/tpm-sysfs.c
+@@ -20,44 +20,48 @@
+ #include <linux/device.h>
+ #include "tpm.h"
+-#define READ_PUBEK_RESULT_SIZE 314
++struct tpm_readpubek_out {
++      u8 algorithm[4];
++      u8 encscheme[2];
++      u8 sigscheme[2];
++      __be32 paramsize;
++      u8 parameters[12];
++      __be32 keysize;
++      u8 modulus[256];
++      u8 checksum[20];
++} __packed;
++
+ #define READ_PUBEK_RESULT_MIN_BODY_SIZE (28 + 256)
+ #define TPM_ORD_READPUBEK 124
+-static const struct tpm_input_header tpm_readpubek_header = {
+-      .tag = cpu_to_be16(TPM_TAG_RQU_COMMAND),
+-      .length = cpu_to_be32(30),
+-      .ordinal = cpu_to_be32(TPM_ORD_READPUBEK)
+-};
++
+ static ssize_t pubek_show(struct device *dev, struct device_attribute *attr,
+                         char *buf)
+ {
+-      u8 *data;
+-      struct tpm_cmd_t tpm_cmd;
+-      ssize_t err;
+-      int i, rc;
++      struct tpm_buf tpm_buf;
++      struct tpm_readpubek_out *out;
++      ssize_t rc;
++      int i;
+       char *str = buf;
+       struct tpm_chip *chip = to_tpm_chip(dev);
++      char anti_replay[20];
+-      memset(&tpm_cmd, 0, sizeof(tpm_cmd));
+-
+-      tpm_cmd.header.in = tpm_readpubek_header;
+-      err = tpm_transmit_cmd(chip, NULL, &tpm_cmd, READ_PUBEK_RESULT_SIZE,
+-                             READ_PUBEK_RESULT_MIN_BODY_SIZE, 0,
+-                             "attempting to read the PUBEK");
+-      if (err)
+-              goto out;
+-
+-      /*
+-         ignore header 10 bytes
+-         algorithm 32 bits (1 == RSA )
+-         encscheme 16 bits
+-         sigscheme 16 bits
+-         parameters (RSA 12->bytes: keybit, #primes, expbit)
+-         keylenbytes 32 bits
+-         256 byte modulus
+-         ignore checksum 20 bytes
+-       */
+-      data = tpm_cmd.params.readpubek_out_buffer;
++      memset(&anti_replay, 0, sizeof(anti_replay));
++
++      rc = tpm_buf_init(&tpm_buf, TPM_TAG_RQU_COMMAND, TPM_ORD_READPUBEK);
++      if (rc)
++              return rc;
++
++      tpm_buf_append(&tpm_buf, anti_replay, sizeof(anti_replay));
++
++      rc = tpm_transmit_cmd(chip, NULL, tpm_buf.data, PAGE_SIZE,
++                            READ_PUBEK_RESULT_MIN_BODY_SIZE, 0,
++                            "attempting to read the PUBEK");
++      if (rc) {
++              tpm_buf_destroy(&tpm_buf);
++              return 0;
++      }
++
++      out = (struct tpm_readpubek_out *)&tpm_buf.data[10];
+       str +=
+           sprintf(str,
+                   "Algorithm: %02X %02X %02X %02X\n"
+@@ -68,21 +72,26 @@ static ssize_t pubek_show(struct device *dev, struct device_attribute *attr,
+                   "%02X %02X %02X %02X\n"
+                   "Modulus length: %d\n"
+                   "Modulus:\n",
+-                  data[0], data[1], data[2], data[3],
+-                  data[4], data[5],
+-                  data[6], data[7],
+-                  data[12], data[13], data[14], data[15],
+-                  data[16], data[17], data[18], data[19],
+-                  data[20], data[21], data[22], data[23],
+-                  be32_to_cpu(*((__be32 *) (data + 24))));
++                  out->algorithm[0], out->algorithm[1], out->algorithm[2],
++                  out->algorithm[3],
++                  out->encscheme[0], out->encscheme[1],
++                  out->sigscheme[0], out->sigscheme[1],
++                  out->parameters[0], out->parameters[1],
++                  out->parameters[2], out->parameters[3],
++                  out->parameters[4], out->parameters[5],
++                  out->parameters[6], out->parameters[7],
++                  out->parameters[8], out->parameters[9],
++                  out->parameters[10], out->parameters[11],
++                  be32_to_cpu(out->keysize));
+       for (i = 0; i < 256; i++) {
+-              str += sprintf(str, "%02X ", data[i + 28]);
++              str += sprintf(str, "%02X ", out->modulus[i]);
+               if ((i + 1) % 16 == 0)
+                       str += sprintf(str, "\n");
+       }
+-out:
++
+       rc = str - buf;
++      tpm_buf_destroy(&tpm_buf);
+       return rc;
+ }
+ static DEVICE_ATTR_RO(pubek);
+diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
+index 4bb9b4aa9b49c..d53d12f3df6d6 100644
+--- a/drivers/char/tpm/tpm.h
++++ b/drivers/char/tpm/tpm.h
+@@ -351,17 +351,6 @@ enum tpm_sub_capabilities {
+       TPM_CAP_PROP_TIS_DURATION = 0x120,
+ };
+-struct        tpm_readpubek_params_out {
+-      u8      algorithm[4];
+-      u8      encscheme[2];
+-      u8      sigscheme[2];
+-      __be32  paramsize;
+-      u8      parameters[12]; /*assuming RSA*/
+-      __be32  keysize;
+-      u8      modulus[256];
+-      u8      checksum[20];
+-} __packed;
+-
+ typedef union {
+       struct  tpm_input_header in;
+       struct  tpm_output_header out;
+@@ -391,8 +380,6 @@ struct tpm_getrandom_in {
+ } __packed;
+ typedef union {
+-      struct  tpm_readpubek_params_out readpubek_out;
+-      u8      readpubek_out_buffer[sizeof(struct tpm_readpubek_params_out)];
+       struct  tpm_pcrread_in  pcrread_in;
+       struct  tpm_pcrread_out pcrread_out;
+       struct  tpm_getrandom_in getrandom_in;
+-- 
+2.20.1
+
diff --git a/queue-4.14/tpm-use-tpm_try_get_ops-in-tpm-sysfs.c.patch b/queue-4.14/tpm-use-tpm_try_get_ops-in-tpm-sysfs.c.patch
new file mode 100644 (file)
index 0000000..b61f90e
--- /dev/null
@@ -0,0 +1,289 @@
+From 945cfd228f29815f95146876ba47e9fa9f5c94c9 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 3 Oct 2019 21:46:22 +0300
+Subject: tpm: use tpm_try_get_ops() in tpm-sysfs.c.
+
+From: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
+
+commit 2677ca98ae377517930c183248221f69f771c921 upstream
+
+Use tpm_try_get_ops() in tpm-sysfs.c so that we can consider moving
+other decorations (locking, localities, power management for example)
+inside it. This direction can be of course taken only after other call
+sites for tpm_transmit() have been treated in the same way.
+
+Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
+Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
+Tested-by: Stefan Berger <stefanb@linux.ibm.com>
+Reviewed-by: Jerry Snitselaar <jsnitsel@redhat.com>
+Reviewed-by: James Bottomley <James.Bottomley@HansenPartnership.com>
+Tested-by: Alexander Steffen <Alexander.Steffen@infineon.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/char/tpm/tpm-sysfs.c | 134 ++++++++++++++++++++++-------------
+ 1 file changed, 83 insertions(+), 51 deletions(-)
+
+diff --git a/drivers/char/tpm/tpm-sysfs.c b/drivers/char/tpm/tpm-sysfs.c
+index 83a77a4455380..177a60e5c6ec9 100644
+--- a/drivers/char/tpm/tpm-sysfs.c
++++ b/drivers/char/tpm/tpm-sysfs.c
+@@ -39,7 +39,6 @@ static ssize_t pubek_show(struct device *dev, struct device_attribute *attr,
+ {
+       struct tpm_buf tpm_buf;
+       struct tpm_readpubek_out *out;
+-      ssize_t rc;
+       int i;
+       char *str = buf;
+       struct tpm_chip *chip = to_tpm_chip(dev);
+@@ -47,19 +46,18 @@ static ssize_t pubek_show(struct device *dev, struct device_attribute *attr,
+       memset(&anti_replay, 0, sizeof(anti_replay));
+-      rc = tpm_buf_init(&tpm_buf, TPM_TAG_RQU_COMMAND, TPM_ORD_READPUBEK);
+-      if (rc)
+-              return rc;
++      if (tpm_try_get_ops(chip))
++              return 0;
++
++      if (tpm_buf_init(&tpm_buf, TPM_TAG_RQU_COMMAND, TPM_ORD_READPUBEK))
++              goto out_ops;
+       tpm_buf_append(&tpm_buf, anti_replay, sizeof(anti_replay));
+-      rc = tpm_transmit_cmd(chip, NULL, tpm_buf.data, PAGE_SIZE,
++      if (tpm_transmit_cmd(chip, NULL, tpm_buf.data, PAGE_SIZE,
+                             READ_PUBEK_RESULT_MIN_BODY_SIZE, 0,
+-                            "attempting to read the PUBEK");
+-      if (rc) {
+-              tpm_buf_destroy(&tpm_buf);
+-              return 0;
+-      }
++                            "attempting to read the PUBEK"))
++              goto out_buf;
+       out = (struct tpm_readpubek_out *)&tpm_buf.data[10];
+       str +=
+@@ -90,9 +88,11 @@ static ssize_t pubek_show(struct device *dev, struct device_attribute *attr,
+                       str += sprintf(str, "\n");
+       }
+-      rc = str - buf;
++out_buf:
+       tpm_buf_destroy(&tpm_buf);
+-      return rc;
++out_ops:
++      tpm_put_ops(chip);
++      return str - buf;
+ }
+ static DEVICE_ATTR_RO(pubek);
+@@ -106,12 +106,16 @@ static ssize_t pcrs_show(struct device *dev, struct device_attribute *attr,
+       char *str = buf;
+       struct tpm_chip *chip = to_tpm_chip(dev);
+-      rc = tpm_getcap(chip, TPM_CAP_PROP_PCR, &cap,
+-                      "attempting to determine the number of PCRS",
+-                      sizeof(cap.num_pcrs));
+-      if (rc)
++      if (tpm_try_get_ops(chip))
+               return 0;
++      if (tpm_getcap(chip, TPM_CAP_PROP_PCR, &cap,
++                     "attempting to determine the number of PCRS",
++                     sizeof(cap.num_pcrs))) {
++              tpm_put_ops(chip);
++              return 0;
++      }
++
+       num_pcrs = be32_to_cpu(cap.num_pcrs);
+       for (i = 0; i < num_pcrs; i++) {
+               rc = tpm_pcr_read_dev(chip, i, digest);
+@@ -122,6 +126,7 @@ static ssize_t pcrs_show(struct device *dev, struct device_attribute *attr,
+                       str += sprintf(str, "%02X ", digest[j]);
+               str += sprintf(str, "\n");
+       }
++      tpm_put_ops(chip);
+       return str - buf;
+ }
+ static DEVICE_ATTR_RO(pcrs);
+@@ -129,16 +134,21 @@ static DEVICE_ATTR_RO(pcrs);
+ static ssize_t enabled_show(struct device *dev, struct device_attribute *attr,
+                    char *buf)
+ {
++      struct tpm_chip *chip = to_tpm_chip(dev);
++      ssize_t rc = 0;
+       cap_t cap;
+-      ssize_t rc;
+-      rc = tpm_getcap(to_tpm_chip(dev), TPM_CAP_FLAG_PERM, &cap,
+-                      "attempting to determine the permanent enabled state",
+-                      sizeof(cap.perm_flags));
+-      if (rc)
++      if (tpm_try_get_ops(chip))
+               return 0;
++      if (tpm_getcap(chip, TPM_CAP_FLAG_PERM, &cap,
++                     "attempting to determine the permanent enabled state",
++                     sizeof(cap.perm_flags)))
++              goto out_ops;
++
+       rc = sprintf(buf, "%d\n", !cap.perm_flags.disable);
++out_ops:
++      tpm_put_ops(chip);
+       return rc;
+ }
+ static DEVICE_ATTR_RO(enabled);
+@@ -146,16 +156,21 @@ static DEVICE_ATTR_RO(enabled);
+ static ssize_t active_show(struct device *dev, struct device_attribute *attr,
+                   char *buf)
+ {
++      struct tpm_chip *chip = to_tpm_chip(dev);
++      ssize_t rc = 0;
+       cap_t cap;
+-      ssize_t rc;
+-      rc = tpm_getcap(to_tpm_chip(dev), TPM_CAP_FLAG_PERM, &cap,
+-                      "attempting to determine the permanent active state",
+-                      sizeof(cap.perm_flags));
+-      if (rc)
++      if (tpm_try_get_ops(chip))
+               return 0;
++      if (tpm_getcap(chip, TPM_CAP_FLAG_PERM, &cap,
++                     "attempting to determine the permanent active state",
++                     sizeof(cap.perm_flags)))
++              goto out_ops;
++
+       rc = sprintf(buf, "%d\n", !cap.perm_flags.deactivated);
++out_ops:
++      tpm_put_ops(chip);
+       return rc;
+ }
+ static DEVICE_ATTR_RO(active);
+@@ -163,16 +178,21 @@ static DEVICE_ATTR_RO(active);
+ static ssize_t owned_show(struct device *dev, struct device_attribute *attr,
+                         char *buf)
+ {
++      struct tpm_chip *chip = to_tpm_chip(dev);
++      ssize_t rc = 0;
+       cap_t cap;
+-      ssize_t rc;
+-      rc = tpm_getcap(to_tpm_chip(dev), TPM_CAP_PROP_OWNER, &cap,
+-                      "attempting to determine the owner state",
+-                      sizeof(cap.owned));
+-      if (rc)
++      if (tpm_try_get_ops(chip))
+               return 0;
++      if (tpm_getcap(to_tpm_chip(dev), TPM_CAP_PROP_OWNER, &cap,
++                     "attempting to determine the owner state",
++                     sizeof(cap.owned)))
++              goto out_ops;
++
+       rc = sprintf(buf, "%d\n", cap.owned);
++out_ops:
++      tpm_put_ops(chip);
+       return rc;
+ }
+ static DEVICE_ATTR_RO(owned);
+@@ -180,16 +200,21 @@ static DEVICE_ATTR_RO(owned);
+ static ssize_t temp_deactivated_show(struct device *dev,
+                                    struct device_attribute *attr, char *buf)
+ {
++      struct tpm_chip *chip = to_tpm_chip(dev);
++      ssize_t rc = 0;
+       cap_t cap;
+-      ssize_t rc;
+-      rc = tpm_getcap(to_tpm_chip(dev), TPM_CAP_FLAG_VOL, &cap,
+-                      "attempting to determine the temporary state",
+-                      sizeof(cap.stclear_flags));
+-      if (rc)
++      if (tpm_try_get_ops(chip))
+               return 0;
++      if (tpm_getcap(to_tpm_chip(dev), TPM_CAP_FLAG_VOL, &cap,
++                     "attempting to determine the temporary state",
++                     sizeof(cap.stclear_flags)))
++              goto out_ops;
++
+       rc = sprintf(buf, "%d\n", cap.stclear_flags.deactivated);
++out_ops:
++      tpm_put_ops(chip);
+       return rc;
+ }
+ static DEVICE_ATTR_RO(temp_deactivated);
+@@ -198,15 +223,18 @@ static ssize_t caps_show(struct device *dev, struct device_attribute *attr,
+                        char *buf)
+ {
+       struct tpm_chip *chip = to_tpm_chip(dev);
+-      cap_t cap;
+-      ssize_t rc;
++      ssize_t rc = 0;
+       char *str = buf;
++      cap_t cap;
+-      rc = tpm_getcap(chip, TPM_CAP_PROP_MANUFACTURER, &cap,
+-                      "attempting to determine the manufacturer",
+-                      sizeof(cap.manufacturer_id));
+-      if (rc)
++      if (tpm_try_get_ops(chip))
+               return 0;
++
++      if (tpm_getcap(chip, TPM_CAP_PROP_MANUFACTURER, &cap,
++                     "attempting to determine the manufacturer",
++                     sizeof(cap.manufacturer_id)))
++              goto out_ops;
++
+       str += sprintf(str, "Manufacturer: 0x%x\n",
+                      be32_to_cpu(cap.manufacturer_id));
+@@ -223,20 +251,22 @@ static ssize_t caps_show(struct device *dev, struct device_attribute *attr,
+                              cap.tpm_version_1_2.revMinor);
+       } else {
+               /* Otherwise just use TPM_STRUCT_VER */
+-              rc = tpm_getcap(chip, TPM_CAP_VERSION_1_1, &cap,
+-                              "attempting to determine the 1.1 version",
+-                              sizeof(cap.tpm_version));
+-              if (rc)
+-                      return 0;
++              if (tpm_getcap(chip, TPM_CAP_VERSION_1_1, &cap,
++                             "attempting to determine the 1.1 version",
++                             sizeof(cap.tpm_version)))
++                      goto out_ops;
++
+               str += sprintf(str,
+                              "TCG version: %d.%d\nFirmware version: %d.%d\n",
+                              cap.tpm_version.Major,
+                              cap.tpm_version.Minor,
+                              cap.tpm_version.revMajor,
+                              cap.tpm_version.revMinor);
+-      }
+-
+-      return str - buf;
++}
++      rc = str - buf;
++out_ops:
++      tpm_put_ops(chip);
++      return rc;
+ }
+ static DEVICE_ATTR_RO(caps);
+@@ -244,10 +274,12 @@ static ssize_t cancel_store(struct device *dev, struct device_attribute *attr,
+                           const char *buf, size_t count)
+ {
+       struct tpm_chip *chip = to_tpm_chip(dev);
+-      if (chip == NULL)
++
++      if (tpm_try_get_ops(chip))
+               return 0;
+       chip->ops->cancel(chip);
++      tpm_put_ops(chip);
+       return count;
+ }
+ static DEVICE_ATTR_WO(cancel);
+-- 
+2.20.1
+
diff --git a/queue-4.14/vfio_pci-restore-original-state-on-release.patch b/queue-4.14/vfio_pci-restore-original-state-on-release.patch
new file mode 100644 (file)
index 0000000..3667c30
--- /dev/null
@@ -0,0 +1,60 @@
+From 21696cdc09c58b4e4ed1196a8adb492009a8e4e5 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 22 Aug 2019 11:35:19 +0800
+Subject: vfio_pci: Restore original state on release
+
+From: hexin <hexin.op@gmail.com>
+
+[ Upstream commit 92c8026854c25093946e0d7fe536fd9eac440f06 ]
+
+vfio_pci_enable() saves the device's initial configuration information
+with the intent that it is restored in vfio_pci_disable().  However,
+the commit referenced in Fixes: below replaced the call to
+__pci_reset_function_locked(), which is not wrapped in a state save
+and restore, with pci_try_reset_function(), which overwrites the
+restored device state with the current state before applying it to the
+device.  Reinstate use of __pci_reset_function_locked() to return to
+the desired behavior.
+
+Fixes: 890ed578df82 ("vfio-pci: Use pci "try" reset interface")
+Signed-off-by: hexin <hexin15@baidu.com>
+Signed-off-by: Liu Qi <liuqi16@baidu.com>
+Signed-off-by: Zhang Yu <zhangyu31@baidu.com>
+Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/vfio/pci/vfio_pci.c | 17 +++++++++++++----
+ 1 file changed, 13 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c
+index 6f5cc67e343e7..15b1cd4ef5a77 100644
+--- a/drivers/vfio/pci/vfio_pci.c
++++ b/drivers/vfio/pci/vfio_pci.c
+@@ -363,11 +363,20 @@ static void vfio_pci_disable(struct vfio_pci_device *vdev)
+       pci_write_config_word(pdev, PCI_COMMAND, PCI_COMMAND_INTX_DISABLE);
+       /*
+-       * Try to reset the device.  The success of this is dependent on
+-       * being able to lock the device, which is not always possible.
++       * Try to get the locks ourselves to prevent a deadlock. The
++       * success of this is dependent on being able to lock the device,
++       * which is not always possible.
++       * We can not use the "try" reset interface here, which will
++       * overwrite the previously restored configuration information.
+        */
+-      if (vdev->reset_works && !pci_try_reset_function(pdev))
+-              vdev->needs_reset = false;
++      if (vdev->reset_works && pci_cfg_access_trylock(pdev)) {
++              if (device_trylock(&pdev->dev)) {
++                      if (!__pci_reset_function_locked(pdev))
++                              vdev->needs_reset = false;
++                      device_unlock(&pdev->dev);
++              }
++              pci_cfg_access_unlock(pdev);
++      }
+       pci_restore_state(pdev);
+ out:
+-- 
+2.20.1
+
diff --git a/queue-4.14/video-ssd1307fb-start-page-range-at-page_offset.patch b/queue-4.14/video-ssd1307fb-start-page-range-at-page_offset.patch
new file mode 100644 (file)
index 0000000..bb05110
--- /dev/null
@@ -0,0 +1,47 @@
+From 2f414dad32cca69c2902a9121dbdbe6a17c5332e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 18 Jun 2019 10:41:08 +0300
+Subject: video: ssd1307fb: Start page range at page_offset
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Marko Kohtala <marko.kohtala@okoko.fi>
+
+[ Upstream commit dd9782834dd9dde3624ff1acea8859f3d3e792d4 ]
+
+The page_offset was only applied to the end of the page range. This caused
+the display updates to cause a scrolling effect on the display because the
+amount of data written to the display did not match the range display
+expected.
+
+Fixes: 301bc0675b67 ("video: ssd1307fb: Make use of horizontal addressing mode")
+Signed-off-by: Marko Kohtala <marko.kohtala@okoko.fi>
+Cc: Mark Rutland <mark.rutland@arm.com>
+Cc: Rob Herring <robh+dt@kernel.org>
+Cc: Daniel Vetter <daniel@ffwll.ch>
+Cc: David Airlie <airlied@linux.ie>
+Cc: Michal Vokáč <michal.vokac@ysoft.com>
+Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/20190618074111.9309-4-marko.kohtala@okoko.fi
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/video/fbdev/ssd1307fb.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/video/fbdev/ssd1307fb.c b/drivers/video/fbdev/ssd1307fb.c
+index f599520374ddf..5f7dbf1c46092 100644
+--- a/drivers/video/fbdev/ssd1307fb.c
++++ b/drivers/video/fbdev/ssd1307fb.c
+@@ -433,7 +433,7 @@ static int ssd1307fb_init(struct ssd1307fb_par *par)
+       if (ret < 0)
+               return ret;
+-      ret = ssd1307fb_write_cmd(par->client, 0x0);
++      ret = ssd1307fb_write_cmd(par->client, par->page_offset);
+       if (ret < 0)
+               return ret;
+-- 
+2.20.1
+