From 3b0de3814b59611f189ec02a8933673c906ed6d4 Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Sat, 5 Oct 2019 19:46:45 -0400 Subject: [PATCH] fixes for 4.19 Signed-off-by: Sasha Levin --- ...5-1-kconfig-default-to-aeabi-w-clang.patch | 50 +++ ...n-t-treat-faults-reported-from-cache.patch | 76 ++++ ...e-that-usable-memory-in-bank-0-start.patch | 58 +++ ...ount-for-stack-randomization-and-sta.patch | 71 ++++ ...top-when-computing-mmap-base-address.patch | 59 +++ ...tack-randomization-for-mmap-base-onl.patch | 55 +++ ...-unreachable-code-issue-with-cmpxchg.patch | 69 +++ ...t-reference-clk_init_data-after-regi.patch | 51 +++ ...parent-if-main-oscillator-or-bypass-.patch | 73 ++++ queue-4.19/clk-jz4740-add-tcu-clock.patch | 73 ++++ ...c-sdm845-use-floor-ops-for-sdcc-clks.patch | 56 +++ ...clk-qoriq-fix-wunused-const-variable.patch | 49 +++ ...mssr-set-genpd_flag_always_on-for-cl.patch | 44 ++ ...-set-genpd_flag_always_on-for-clock-.patch | 45 ++ ...eference-clk_init_data-after-registr.patch | 74 ++++ queue-4.19/clk-sprd-add-missing-kfree.patch | 45 ++ ...eference-clk_init_data-after-registr.patch | 52 +++ ...-add-missing-clock-slices-for-mmc2-m.patch | 39 ++ ...-t-reference-clk_init_data-after-reg.patch | 287 +++++++++++++ ...n-fix-double-free-in-sec_free_hw_sgl.patch | 63 +++ ...nc-synchronize-signal-vs-syncpt-free.patch | 81 ++++ ...fix-issue-where-252-255-values-are-c.patch | 46 ++ ...reprogram-vm-config-when-system-resu.patch | 50 +++ .../drm-amd-display-support-spdif.patch | 107 +++++ queue-4.19/drm-amdgpu-si-fix-asic-tests.patch | 62 +++ ...767-increase-aux-transfer-length-lim.patch | 52 +++ ...-fix-for-some-cards-having-0-maximum.patch | 38 ++ ...heck-failure-cases-in-the-probe-func.patch | 68 +++ ...-fix-auo-g185han01-horizontal-blanki.patch | 50 +++ .../drm-radeon-fix-eeh-during-kexec.patch | 47 +++ ...ck-for-fast-link-training-before-ena.patch | 67 +++ ...stm-attach-gem-fence-to-atomic-state.patch | 47 +++ ...al-use-after-free-after-remounting-w.patch | 394 ++++++++++++++++++ ...race-with-userspace-s-read-via-block.patch | 110 +++++ ...ix-a-possible-null-pointer-dereferen.patch | 46 ++ ...ix-stuck-function-keys-when-using-fn.patch | 111 +++++ ...-fix-several-minor-compiler-warnings.patch | 89 ++++ ...number-left-in-struct-pointer-member.patch | 57 +++ .../i2c-cht-wc-fix-lockdep-warning.patch | 190 +++++++++ ...edule-continuously-in-the-thread-in-.patch | 88 ++++ ...ild-clean-compressed-initramfs-image.patch | 56 +++ ...e-debug_kmemleak_early_log_size-defa.patch | 57 +++ ...y-obj-mod-in-klp_module_coming-s-err.patch | 41 ++ ...com-add-apcs-child-device-for-qcs404.patch | 59 +++ .../mfd-intel-lpss-remove-d3cold-delay.patch | 47 +++ ...sable-broken-btb-lookup-optimization.patch | 78 ++++ ...count-for-stack-randomization-and-st.patch | 71 ++++ ...citly-cast-_page_no_exec-to-a-boolea.patch | 59 +++ ...ecovering-done-after-direct-unlock-r.patch | 94 +++++ ...s-propagate-errors-for-optional-phys.patch | 48 +++ ...agate-errors-for-optional-regulators.patch | 48 +++ ...agate-errors-for-optional-regulators.patch | 54 +++ ...pagate-errors-for-optional-regulator.patch | 80 ++++ ...id-a-sometimes-uninitialized-warning.patch | 87 ++++ ...pci-tegra-fix-of-node-reference-leak.patch | 101 +++++ ...md-disable-spurious-firing-gpio-irqs.patch | 74 ++++ ...bb-fix-wrong-pinning-definition-for-.patch | 63 +++ ...x-write-barrier-placement-in-pmx_wri.patch | 44 ++ ...arning-on-attempting-to-register-non.patch | 87 ++++ ...ption-machine-check-use-correct-cfar.patch | 46 ++ ...nel-log-before-carrying-out-fadump-o.patch | 43 ++ ...-clear-stale-eeh_dev_no_handler-flag.patch | 75 ++++ ...x-warning-oldval-may-be-used-uniniti.patch | 52 +++ ...ioda2-allocate-tce-table-levels-on-d.patch | 262 ++++++++++++ ...correctly-track-irq-state-in-default.patch | 59 +++ ...mobility-use-cond_resched-when-updat.patch | 69 +++ ...-device-model-apis-and-serialization.patch | 96 +++++ ...ck-for-hv-mode-when-dumping-xive-inf.patch | 56 +++ queue-4.19/pstore-fs-superblock-limits.patch | 52 +++ ...cf85263-fix-regmap-error-in-set_time.patch | 62 +++ ...rtc-snvs-fix-possible-race-condition.patch | 57 +++ ...uce-memory-required-for-scsi-logging.patch | 111 +++++ ...ix-possible-null-pointer-dereference.patch | 49 +++ queue-4.19/series | 78 ++++ ...fix-channel-number-reported-by-hardw.patch | 47 +++ ...shutdown-sequence-to-prevent-future-.patch | 49 +++ ...m-use-tpm_try_get_ops-in-tpm-sysfs.c.patch | 289 +++++++++++++ ...ci-restore-original-state-on-release.patch | 60 +++ ...07fb-start-page-range-at-page_offset.patch | 47 +++ 79 files changed, 6096 insertions(+) create mode 100644 queue-4.19/arm-8875-1-kconfig-default-to-aeabi-w-clang.patch create mode 100644 queue-4.19/arm-8898-1-mm-don-t-treat-faults-reported-from-cache.patch create mode 100644 queue-4.19/arm-8903-1-ensure-that-usable-memory-in-bank-0-start.patch create mode 100644 queue-4.19/arm-properly-account-for-stack-randomization-and-sta.patch create mode 100644 queue-4.19/arm-use-stack_top-when-computing-mmap-base-address.patch create mode 100644 queue-4.19/arm64-consider-stack-randomization-for-mmap-base-onl.patch create mode 100644 queue-4.19/arm64-fix-unreachable-code-issue-with-cmpxchg.patch create mode 100644 queue-4.19/clk-actions-don-t-reference-clk_init_data-after-regi.patch create mode 100644 queue-4.19/clk-at91-select-parent-if-main-oscillator-or-bypass-.patch create mode 100644 queue-4.19/clk-jz4740-add-tcu-clock.patch create mode 100644 queue-4.19/clk-qcom-gcc-sdm845-use-floor-ops-for-sdcc-clks.patch create mode 100644 queue-4.19/clk-qoriq-fix-wunused-const-variable.patch create mode 100644 queue-4.19/clk-renesas-cpg-mssr-set-genpd_flag_always_on-for-cl.patch create mode 100644 queue-4.19/clk-renesas-mstp-set-genpd_flag_always_on-for-clock-.patch create mode 100644 queue-4.19/clk-sirf-don-t-reference-clk_init_data-after-registr.patch create mode 100644 queue-4.19/clk-sprd-add-missing-kfree.patch create mode 100644 queue-4.19/clk-sprd-don-t-reference-clk_init_data-after-registr.patch create mode 100644 queue-4.19/clk-sunxi-ng-v3s-add-missing-clock-slices-for-mmc2-m.patch create mode 100644 queue-4.19/clk-zx296718-don-t-reference-clk_init_data-after-reg.patch create mode 100644 queue-4.19/crypto-hisilicon-fix-double-free-in-sec_free_hw_sgl.patch create mode 100644 queue-4.19/dma-buf-sw_sync-synchronize-signal-vs-syncpt-free.patch create mode 100644 queue-4.19/drm-amd-display-fix-issue-where-252-255-values-are-c.patch create mode 100644 queue-4.19/drm-amd-display-reprogram-vm-config-when-system-resu.patch create mode 100644 queue-4.19/drm-amd-display-support-spdif.patch create mode 100644 queue-4.19/drm-amdgpu-si-fix-asic-tests.patch create mode 100644 queue-4.19/drm-bridge-tc358767-increase-aux-transfer-length-lim.patch create mode 100644 queue-4.19/drm-nouveau-volt-fix-for-some-cards-having-0-maximum.patch create mode 100644 queue-4.19/drm-panel-check-failure-cases-in-the-probe-func.patch create mode 100644 queue-4.19/drm-panel-simple-fix-auo-g185han01-horizontal-blanki.patch create mode 100644 queue-4.19/drm-radeon-fix-eeh-during-kexec.patch create mode 100644 queue-4.19/drm-rockchip-check-for-fast-link-training-before-ena.patch create mode 100644 queue-4.19/drm-stm-attach-gem-fence-to-atomic-state.patch create mode 100644 queue-4.19/ext4-fix-potential-use-after-free-after-remounting-w.patch create mode 100644 queue-4.19/fat-work-around-race-with-userspace-s-read-via-block.patch create mode 100644 queue-4.19/gpu-drm-radeon-fix-a-possible-null-pointer-dereferen.patch create mode 100644 queue-4.19/hid-apple-fix-stuck-function-keys-when-using-fn.patch create mode 100644 queue-4.19/hid-wacom-fix-several-minor-compiler-warnings.patch create mode 100644 queue-4.19/hypfs-fix-error-number-left-in-struct-pointer-member.patch create mode 100644 queue-4.19/i2c-cht-wc-fix-lockdep-warning.patch create mode 100644 queue-4.19/ipmi_si-only-schedule-continuously-in-the-thread-in-.patch create mode 100644 queue-4.19/kbuild-clean-compressed-initramfs-image.patch create mode 100644 queue-4.19/kmemleak-increase-debug_kmemleak_early_log_size-defa.patch create mode 100644 queue-4.19/livepatch-nullify-obj-mod-in-klp_module_coming-s-err.patch create mode 100644 queue-4.19/mbox-qcom-add-apcs-child-device-for-qcs404.patch create mode 100644 queue-4.19/mfd-intel-lpss-remove-d3cold-delay.patch create mode 100644 queue-4.19/mips-ingenic-disable-broken-btb-lookup-optimization.patch create mode 100644 queue-4.19/mips-properly-account-for-stack-randomization-and-st.patch create mode 100644 queue-4.19/mips-tlbex-explicitly-cast-_page_no_exec-to-a-boolea.patch create mode 100644 queue-4.19/ocfs2-wait-for-recovering-done-after-direct-unlock-r.patch create mode 100644 queue-4.19/pci-exynos-propagate-errors-for-optional-phys.patch create mode 100644 queue-4.19/pci-histb-propagate-errors-for-optional-regulators.patch create mode 100644 queue-4.19/pci-imx6-propagate-errors-for-optional-regulators.patch create mode 100644 queue-4.19/pci-rockchip-propagate-errors-for-optional-regulator.patch create mode 100644 queue-4.19/pci-rpaphp-avoid-a-sometimes-uninitialized-warning.patch create mode 100644 queue-4.19/pci-tegra-fix-of-node-reference-leak.patch create mode 100644 queue-4.19/pinctrl-amd-disable-spurious-firing-gpio-irqs.patch create mode 100644 queue-4.19/pinctrl-meson-gxbb-fix-wrong-pinning-definition-for-.patch create mode 100644 queue-4.19/pinctrl-tegra-fix-write-barrier-placement-in-pmx_wri.patch create mode 100644 queue-4.19/pktcdvd-remove-warning-on-attempting-to-register-non.patch create mode 100644 queue-4.19/powerpc-64s-exception-machine-check-use-correct-cfar.patch create mode 100644 queue-4.19/powerpc-dump-kernel-log-before-carrying-out-fadump-o.patch create mode 100644 queue-4.19/powerpc-eeh-clear-stale-eeh_dev_no_handler-flag.patch create mode 100644 queue-4.19/powerpc-futex-fix-warning-oldval-may-be-used-uniniti.patch create mode 100644 queue-4.19/powerpc-powernv-ioda2-allocate-tce-table-levels-on-d.patch create mode 100644 queue-4.19/powerpc-pseries-correctly-track-irq-state-in-default.patch create mode 100644 queue-4.19/powerpc-pseries-mobility-use-cond_resched-when-updat.patch create mode 100644 queue-4.19/powerpc-rtas-use-device-model-apis-and-serialization.patch create mode 100644 queue-4.19/powerpc-xmon-check-for-hv-mode-when-dumping-xive-inf.patch create mode 100644 queue-4.19/pstore-fs-superblock-limits.patch create mode 100644 queue-4.19/rtc-pcf85363-pcf85263-fix-regmap-error-in-set_time.patch create mode 100644 queue-4.19/rtc-snvs-fix-possible-race-condition.patch create mode 100644 queue-4.19/scsi-core-reduce-memory-required-for-scsi-logging.patch create mode 100644 queue-4.19/security-smack-fix-possible-null-pointer-dereference.patch create mode 100644 queue-4.19/series create mode 100644 queue-4.19/soundwire-intel-fix-channel-number-reported-by-hardw.patch create mode 100644 queue-4.19/tpm-fix-tpm-1.2-shutdown-sequence-to-prevent-future-.patch create mode 100644 queue-4.19/tpm-use-tpm_try_get_ops-in-tpm-sysfs.c.patch create mode 100644 queue-4.19/vfio_pci-restore-original-state-on-release.patch create mode 100644 queue-4.19/video-ssd1307fb-start-page-range-at-page_offset.patch diff --git a/queue-4.19/arm-8875-1-kconfig-default-to-aeabi-w-clang.patch b/queue-4.19/arm-8875-1-kconfig-default-to-aeabi-w-clang.patch new file mode 100644 index 00000000000..ecd5dada475 --- /dev/null +++ b/queue-4.19/arm-8875-1-kconfig-default-to-aeabi-w-clang.patch @@ -0,0 +1,50 @@ +From e5f148558268836647cabd50482d5f18d3014d3e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 8 Jul 2019 20:38:15 +0100 +Subject: ARM: 8875/1: Kconfig: default to AEABI w/ Clang + +From: Nick Desaulniers + +[ Upstream commit a05b9608456e0d4464c6f7ca8572324ace57a3f4 ] + +Clang produces references to __aeabi_uidivmod and __aeabi_idivmod for +arm-linux-gnueabi and arm-linux-gnueabihf targets incorrectly when AEABI +is not selected (such as when OABI_COMPAT is selected). + +While this means that OABI userspaces wont be able to upgraded to +kernels built with Clang, it means that boards that don't enable AEABI +like s3c2410_defconfig will stop failing to link in KernelCI when built +with Clang. + +Link: https://github.com/ClangBuiltLinux/linux/issues/482 +Link: https://groups.google.com/forum/#!msg/clang-built-linux/yydsAAux5hk/GxjqJSW-AQAJ + +Suggested-by: Arnd Bergmann +Signed-off-by: Nick Desaulniers +Reviewed-by: Arnd Bergmann +Reviewed-by: Linus Walleij +Signed-off-by: Russell King +Signed-off-by: Sasha Levin +--- + arch/arm/Kconfig | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig +index 51794c7fa6d5b..185e552f14610 100644 +--- a/arch/arm/Kconfig ++++ b/arch/arm/Kconfig +@@ -1586,8 +1586,9 @@ config ARM_PATCH_IDIV + code to do integer division. + + config AEABI +- bool "Use the ARM EABI to compile the kernel" if !CPU_V7 && !CPU_V7M && !CPU_V6 && !CPU_V6K +- default CPU_V7 || CPU_V7M || CPU_V6 || CPU_V6K ++ bool "Use the ARM EABI to compile the kernel" if !CPU_V7 && \ ++ !CPU_V7M && !CPU_V6 && !CPU_V6K && !CC_IS_CLANG ++ default CPU_V7 || CPU_V7M || CPU_V6 || CPU_V6K || CC_IS_CLANG + help + This option allows for the kernel to be compiled using the latest + ARM ABI (aka EABI). This is only useful if you are using a user +-- +2.20.1 + diff --git a/queue-4.19/arm-8898-1-mm-don-t-treat-faults-reported-from-cache.patch b/queue-4.19/arm-8898-1-mm-don-t-treat-faults-reported-from-cache.patch new file mode 100644 index 00000000000..de98d58983e --- /dev/null +++ b/queue-4.19/arm-8898-1-mm-don-t-treat-faults-reported-from-cache.patch @@ -0,0 +1,76 @@ +From 36d12f4f722ad76d3400651df702eff5b52c294b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +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 + +[ 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 +Signed-off-by: Will Deacon +Signed-off-by: Russell King +Signed-off-by: Sasha Levin +--- + 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 3232afb6fdc00..a9ee0d9dc740a 100644 +--- a/arch/arm/mm/fault.c ++++ b/arch/arm/mm/fault.c +@@ -216,7 +216,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; +@@ -287,7 +287,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.19/arm-8903-1-ensure-that-usable-memory-in-bank-0-start.patch b/queue-4.19/arm-8903-1-ensure-that-usable-memory-in-bank-0-start.patch new file mode 100644 index 00000000000..55064d322d6 --- /dev/null +++ b/queue-4.19/arm-8903-1-ensure-that-usable-memory-in-bank-0-start.patch @@ -0,0 +1,58 @@ +From d6e43b11af0e9a7b0fd0d4ba77c9790d656c4bdc Mon Sep 17 00:00:00 2001 +From: Sasha Levin +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 + +[ 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 +Signed-off-by: Russell King +Signed-off-by: Sasha Levin +--- + 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.19/arm-properly-account-for-stack-randomization-and-sta.patch b/queue-4.19/arm-properly-account-for-stack-randomization-and-sta.patch new file mode 100644 index 00000000000..35431b6b1fb --- /dev/null +++ b/queue-4.19/arm-properly-account-for-stack-randomization-and-sta.patch @@ -0,0 +1,71 @@ +From f78843a7f1b755f0dbf21460c5d1352bc6ac036d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 23 Sep 2019 15:38:54 -0700 +Subject: arm: properly account for stack randomization and stack guard gap + +From: Alexandre Ghiti + +[ Upstream commit af0f4297286f13a75edf93677b1fb2fc16c412a7 ] + +This commit takes care of stack randomization and stack guard gap when +computing mmap base address and checks if the task asked for +randomization. This fixes the problem uncovered and not fixed for arm +here: https://lkml.kernel.org/r/20170622200033.25714-1-riel@redhat.com + +Link: http://lkml.kernel.org/r/20190730055113.23635-7-alex@ghiti.fr +Signed-off-by: Alexandre Ghiti +Acked-by: Kees Cook +Reviewed-by: Luis Chamberlain +Cc: Albert Ou +Cc: Alexander Viro +Cc: Catalin Marinas +Cc: Christoph Hellwig +Cc: Christoph Hellwig +Cc: James Hogan +Cc: Palmer Dabbelt +Cc: Paul Burton +Cc: Ralf Baechle +Cc: Russell King +Cc: Will Deacon +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Sasha Levin +--- + arch/arm/mm/mmap.c | 14 ++++++++++++-- + 1 file changed, 12 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/mm/mmap.c b/arch/arm/mm/mmap.c +index f866870db749c..bff3d00bda5be 100644 +--- a/arch/arm/mm/mmap.c ++++ b/arch/arm/mm/mmap.c +@@ -18,8 +18,9 @@ + (((pgoff)<> (PAGE_SHIFT - 12)) + + static int mmap_is_legacy(struct rlimit *rlim_stack) + { +@@ -35,6 +36,15 @@ static int mmap_is_legacy(struct rlimit *rlim_stack) + static unsigned long mmap_base(unsigned long rnd, struct rlimit *rlim_stack) + { + unsigned long gap = rlim_stack->rlim_cur; ++ unsigned long pad = stack_guard_gap; ++ ++ /* Account for stack randomization if necessary */ ++ if (current->flags & PF_RANDOMIZE) ++ pad += (STACK_RND_MASK << PAGE_SHIFT); ++ ++ /* Values close to RLIM_INFINITY can overflow. */ ++ if (gap + pad > gap) ++ gap += pad; + + if (gap < MIN_GAP) + gap = MIN_GAP; +-- +2.20.1 + diff --git a/queue-4.19/arm-use-stack_top-when-computing-mmap-base-address.patch b/queue-4.19/arm-use-stack_top-when-computing-mmap-base-address.patch new file mode 100644 index 00000000000..bd0feae62eb --- /dev/null +++ b/queue-4.19/arm-use-stack_top-when-computing-mmap-base-address.patch @@ -0,0 +1,59 @@ +From 48e92caac16c7433554d99ccb30bf2facf050658 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 23 Sep 2019 15:38:57 -0700 +Subject: arm: use STACK_TOP when computing mmap base address + +From: Alexandre Ghiti + +[ Upstream commit 86e568e9c0525fc40e76d827212d5e9721cf7504 ] + +mmap base address must be computed wrt stack top address, using TASK_SIZE +is wrong since STACK_TOP and TASK_SIZE are not equivalent. + +Link: http://lkml.kernel.org/r/20190730055113.23635-8-alex@ghiti.fr +Signed-off-by: Alexandre Ghiti +Acked-by: Kees Cook +Reviewed-by: Luis Chamberlain +Cc: Albert Ou +Cc: Alexander Viro +Cc: Catalin Marinas +Cc: Christoph Hellwig +Cc: Christoph Hellwig +Cc: James Hogan +Cc: Palmer Dabbelt +Cc: Paul Burton +Cc: Ralf Baechle +Cc: Russell King +Cc: Will Deacon +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Sasha Levin +--- + arch/arm/mm/mmap.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/mm/mmap.c b/arch/arm/mm/mmap.c +index bff3d00bda5be..0b94b674aa91f 100644 +--- a/arch/arm/mm/mmap.c ++++ b/arch/arm/mm/mmap.c +@@ -19,7 +19,7 @@ + + /* gap between mmap and stack */ + #define MIN_GAP (128*1024*1024UL) +-#define MAX_GAP ((TASK_SIZE)/6*5) ++#define MAX_GAP ((STACK_TOP)/6*5) + #define STACK_RND_MASK (0x7ff >> (PAGE_SHIFT - 12)) + + static int mmap_is_legacy(struct rlimit *rlim_stack) +@@ -51,7 +51,7 @@ static unsigned long mmap_base(unsigned long rnd, struct rlimit *rlim_stack) + else if (gap > MAX_GAP) + gap = MAX_GAP; + +- return PAGE_ALIGN(TASK_SIZE - gap - rnd); ++ return PAGE_ALIGN(STACK_TOP - gap - rnd); + } + + /* +-- +2.20.1 + diff --git a/queue-4.19/arm64-consider-stack-randomization-for-mmap-base-onl.patch b/queue-4.19/arm64-consider-stack-randomization-for-mmap-base-onl.patch new file mode 100644 index 00000000000..c96bf5ed7c7 --- /dev/null +++ b/queue-4.19/arm64-consider-stack-randomization-for-mmap-base-onl.patch @@ -0,0 +1,55 @@ +From 9eedb9dfb07353fa743cf43795fd4ef1a23de320 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 23 Sep 2019 15:38:43 -0700 +Subject: arm64: consider stack randomization for mmap base only when necessary + +From: Alexandre Ghiti + +[ Upstream commit e8d54b62c55ab6201de6d195fc2c276294c1f6ae ] + +Do not offset mmap base address because of stack randomization if current +task does not want randomization. Note that x86 already implements this +behaviour. + +Link: http://lkml.kernel.org/r/20190730055113.23635-4-alex@ghiti.fr +Signed-off-by: Alexandre Ghiti +Acked-by: Catalin Marinas +Acked-by: Kees Cook +Reviewed-by: Christoph Hellwig +Reviewed-by: Luis Chamberlain +Cc: Albert Ou +Cc: Alexander Viro +Cc: Christoph Hellwig +Cc: James Hogan +Cc: Palmer Dabbelt +Cc: Paul Burton +Cc: Ralf Baechle +Cc: Russell King +Cc: Will Deacon +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Sasha Levin +--- + arch/arm64/mm/mmap.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/arch/arm64/mm/mmap.c b/arch/arm64/mm/mmap.c +index 842c8a5fcd53c..157f2caa13516 100644 +--- a/arch/arm64/mm/mmap.c ++++ b/arch/arm64/mm/mmap.c +@@ -65,7 +65,11 @@ unsigned long arch_mmap_rnd(void) + static unsigned long mmap_base(unsigned long rnd, struct rlimit *rlim_stack) + { + unsigned long gap = rlim_stack->rlim_cur; +- unsigned long pad = (STACK_RND_MASK << PAGE_SHIFT) + stack_guard_gap; ++ unsigned long pad = stack_guard_gap; ++ ++ /* Account for stack randomization if necessary */ ++ if (current->flags & PF_RANDOMIZE) ++ pad += (STACK_RND_MASK << PAGE_SHIFT); + + /* Values close to RLIM_INFINITY can overflow. */ + if (gap + pad > gap) +-- +2.20.1 + diff --git a/queue-4.19/arm64-fix-unreachable-code-issue-with-cmpxchg.patch b/queue-4.19/arm64-fix-unreachable-code-issue-with-cmpxchg.patch new file mode 100644 index 00000000000..d9077854d59 --- /dev/null +++ b/queue-4.19/arm64-fix-unreachable-code-issue-with-cmpxchg.patch @@ -0,0 +1,69 @@ +From 2fcbc1973cab183329dbad2e11d22f0ade3ba71b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 10 Sep 2019 13:56:22 +0200 +Subject: arm64: fix unreachable code issue with cmpxchg + +From: Arnd Bergmann + +[ 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 +Reported-by: Nathan Chancellor +Link: https://github.com/ClangBuiltLinux/linux/issues/648 +Reviewed-by: Nathan Chancellor +Tested-by: Nathan Chancellor +Reviewed-by: Andrew Murray +Tested-by: Andrew Murray +Signed-off-by: Arnd Bergmann +Signed-off-by: Will Deacon +Signed-off-by: Sasha Levin +--- + 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 3b09382815419..d8b01c7c9cd3f 100644 +--- a/arch/arm64/include/asm/cmpxchg.h ++++ b/arch/arm64/include/asm/cmpxchg.h +@@ -74,7 +74,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) \ + { \ +@@ -116,7 +116,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) \ +@@ -223,7 +223,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.19/clk-actions-don-t-reference-clk_init_data-after-regi.patch b/queue-4.19/clk-actions-don-t-reference-clk_init_data-after-regi.patch new file mode 100644 index 00000000000..648eea78523 --- /dev/null +++ b/queue-4.19/clk-actions-don-t-reference-clk_init_data-after-regi.patch @@ -0,0 +1,51 @@ +From e65e099aa72a93eaae1c671a2d02bfe36df147b5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 31 Jul 2019 12:35:09 -0700 +Subject: clk: actions: Don't reference clk_init_data after registration + +From: Stephen Boyd + +[ Upstream commit cf9ec1fc6d7cceb73e7f1efd079d2eae173fdf57 ] + +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: Manivannan Sadhasivam +Signed-off-by: Stephen Boyd +Link: https://lkml.kernel.org/r/20190731193517.237136-2-sboyd@kernel.org +[sboyd@kernel.org: Move name to after checking for error or NULL hw] +Acked-by: Manivannan Sadhasivam +Signed-off-by: Sasha Levin +--- + drivers/clk/actions/owl-common.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/drivers/clk/actions/owl-common.c b/drivers/clk/actions/owl-common.c +index 61c1071b5180a..e9be34b17f3f5 100644 +--- a/drivers/clk/actions/owl-common.c ++++ b/drivers/clk/actions/owl-common.c +@@ -67,16 +67,17 @@ int owl_clk_probe(struct device *dev, struct clk_hw_onecell_data *hw_clks) + struct clk_hw *hw; + + for (i = 0; i < hw_clks->num; i++) { ++ const char *name; + + hw = hw_clks->hws[i]; +- + if (IS_ERR_OR_NULL(hw)) + continue; + ++ name = hw->init->name; + ret = devm_clk_hw_register(dev, hw); + if (ret) { + dev_err(dev, "Couldn't register clock %d - %s\n", +- i, hw->init->name); ++ i, name); + return ret; + } + } +-- +2.20.1 + diff --git a/queue-4.19/clk-at91-select-parent-if-main-oscillator-or-bypass-.patch b/queue-4.19/clk-at91-select-parent-if-main-oscillator-or-bypass-.patch new file mode 100644 index 00000000000..bf44e009db3 --- /dev/null +++ b/queue-4.19/clk-at91-select-parent-if-main-oscillator-or-bypass-.patch @@ -0,0 +1,73 @@ +From 3ab3fdbb94ba9f3a58c8dc1eaac55b3fee83c9a3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 9 Sep 2019 15:30:34 +0000 +Subject: clk: at91: select parent if main oscillator or bypass is enabled + +From: Eugen Hristev + +[ 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 +Link: https://lkml.kernel.org/r/1568042692-11784-2-git-send-email-eugen.hristev@microchip.com +Acked-by: Alexandre Belloni +Reviewed-by: Claudiu Beznea +Signed-off-by: Stephen Boyd +Signed-off-by: Sasha Levin +--- + 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.19/clk-jz4740-add-tcu-clock.patch b/queue-4.19/clk-jz4740-add-tcu-clock.patch new file mode 100644 index 00000000000..30b6edc5208 --- /dev/null +++ b/queue-4.19/clk-jz4740-add-tcu-clock.patch @@ -0,0 +1,73 @@ +From 90f67a87d577a6407a5460d455b4efebc9ddf878 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 24 Jul 2019 13:16:10 -0400 +Subject: clk: jz4740: Add TCU clock + +From: Paul Cercueil + +[ 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 +Tested-by: Mathieu Malaterre +Tested-by: Artur Rojek +Acked-by: Stephen Boyd +Acked-by: Rob Herring +Signed-off-by: Paul Burton +Cc: Ralf Baechle +Cc: James Hogan +Cc: Jonathan Corbet +Cc: Lee Jones +Cc: Arnd Bergmann +Cc: Daniel Lezcano +Cc: Thomas Gleixner +Cc: Michael Turquette +Cc: Jason Cooper +Cc: Marc Zyngier +Cc: Rob Herring +Cc: Mark Rutland +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 +--- + 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 4479c102e8994..d8ac7f2e183a1 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.19/clk-qcom-gcc-sdm845-use-floor-ops-for-sdcc-clks.patch b/queue-4.19/clk-qcom-gcc-sdm845-use-floor-ops-for-sdcc-clks.patch new file mode 100644 index 00000000000..c0a007235c0 --- /dev/null +++ b/queue-4.19/clk-qcom-gcc-sdm845-use-floor-ops-for-sdcc-clks.patch @@ -0,0 +1,56 @@ +From 7df36b890f38bfd6c67322663965a8411342cee6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 30 Aug 2019 12:51:42 -0700 +Subject: clk: qcom: gcc-sdm845: Use floor ops for sdcc clks + +From: Stephen Boyd + +[ Upstream commit 5e4b7e82d497580bc430576c4c9bce157dd72512 ] + +Some MMC cards fail to enumerate properly when inserted into an MMC slot +on sdm845 devices. This is because the clk ops for qcom clks round the +frequency up to the nearest rate instead of down to the nearest rate. +For example, the MMC driver requests a frequency of 52MHz from +clk_set_rate() but the qcom implementation for these clks rounds 52MHz +up to the next supported frequency of 100MHz. The MMC driver could be +modified to request clk rate ranges but for now we can fix this in the +clk driver by changing the rounding policy for this clk to be round down +instead of round up. + +Fixes: 06391eddb60a ("clk: qcom: Add Global Clock controller (GCC) driver for SDM845") +Reported-by: Douglas Anderson +Cc: Taniya Das +Signed-off-by: Stephen Boyd +Link: https://lkml.kernel.org/r/20190830195142.103564-1-swboyd@chromium.org +Reviewed-by: Douglas Anderson +Signed-off-by: Stephen Boyd +Signed-off-by: Sasha Levin +--- + drivers/clk/qcom/gcc-sdm845.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/clk/qcom/gcc-sdm845.c b/drivers/clk/qcom/gcc-sdm845.c +index 3bf11a6200942..ada3e4aeb38f9 100644 +--- a/drivers/clk/qcom/gcc-sdm845.c ++++ b/drivers/clk/qcom/gcc-sdm845.c +@@ -647,7 +647,7 @@ static struct clk_rcg2 gcc_sdcc2_apps_clk_src = { + .name = "gcc_sdcc2_apps_clk_src", + .parent_names = gcc_parent_names_10, + .num_parents = 5, +- .ops = &clk_rcg2_ops, ++ .ops = &clk_rcg2_floor_ops, + }, + }; + +@@ -671,7 +671,7 @@ static struct clk_rcg2 gcc_sdcc4_apps_clk_src = { + .name = "gcc_sdcc4_apps_clk_src", + .parent_names = gcc_parent_names_0, + .num_parents = 4, +- .ops = &clk_rcg2_ops, ++ .ops = &clk_rcg2_floor_ops, + }, + }; + +-- +2.20.1 + diff --git a/queue-4.19/clk-qoriq-fix-wunused-const-variable.patch b/queue-4.19/clk-qoriq-fix-wunused-const-variable.patch new file mode 100644 index 00000000000..931a0d0f5a1 --- /dev/null +++ b/queue-4.19/clk-qoriq-fix-wunused-const-variable.patch @@ -0,0 +1,49 @@ +From bfcb308b6bd19f13052f5ce1f1c8e3bc2f8bab97 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 27 Jun 2019 15:06:42 -0700 +Subject: clk: qoriq: Fix -Wunused-const-variable + +From: Nathan Huckleberry + +[ 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 +Link: https://lkml.kernel.org/r/20190627220642.78575-1-nhuck@google.com +Reviewed-by: Nick Desaulniers +Acked-by: Scott Wood +Signed-off-by: Stephen Boyd +Signed-off-by: Sasha Levin +--- + 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 3a1812f65e5d8..8abc5c8cb8b8c 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.19/clk-renesas-cpg-mssr-set-genpd_flag_always_on-for-cl.patch b/queue-4.19/clk-renesas-cpg-mssr-set-genpd_flag_always_on-for-cl.patch new file mode 100644 index 00000000000..ff0f4075b62 --- /dev/null +++ b/queue-4.19/clk-renesas-cpg-mssr-set-genpd_flag_always_on-for-cl.patch @@ -0,0 +1,44 @@ +From 62b905df798a9f586dfba8c044c02995324b5a99 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 9 Aug 2019 15:44:51 +0200 +Subject: clk: renesas: cpg-mssr: Set GENPD_FLAG_ALWAYS_ON for clock domain + +From: Geert Uytterhoeven + +[ Upstream commit f787216f33ce5b5a2567766398f44ab62157114c ] + +The CPG/MSSR Clock Domain driver does not implement the +generic_pm_domain.power_{on,off}() callbacks, as the domain itself +cannot be powered down. Hence the domain should be marked as always-on +by setting the GENPD_FLAG_ALWAYS_ON flag, to prevent the core PM Domain +code from considering it for power-off, and doing unnessary processing. + +Note that this only affects RZ/A2 SoCs. On R-Car Gen2 and Gen3 SoCs, +the R-Car SYSC driver handles Clock Domain creation, and offloads only +device attachment/detachment to the CPG/MSSR driver. + +Signed-off-by: Geert Uytterhoeven +Reviewed-by: Simon Horman +Reviewed-by: Ulf Hansson +Signed-off-by: Sasha Levin +--- + drivers/clk/renesas/renesas-cpg-mssr.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/clk/renesas/renesas-cpg-mssr.c b/drivers/clk/renesas/renesas-cpg-mssr.c +index 24485bee9b49e..d7a2ad6173694 100644 +--- a/drivers/clk/renesas/renesas-cpg-mssr.c ++++ b/drivers/clk/renesas/renesas-cpg-mssr.c +@@ -514,7 +514,8 @@ static int __init cpg_mssr_add_clk_domain(struct device *dev, + + genpd = &pd->genpd; + genpd->name = np->name; +- genpd->flags = GENPD_FLAG_PM_CLK | GENPD_FLAG_ACTIVE_WAKEUP; ++ genpd->flags = GENPD_FLAG_PM_CLK | GENPD_FLAG_ALWAYS_ON | ++ GENPD_FLAG_ACTIVE_WAKEUP; + genpd->attach_dev = cpg_mssr_attach_dev; + genpd->detach_dev = cpg_mssr_detach_dev; + pm_genpd_init(genpd, &pm_domain_always_on_gov, false); +-- +2.20.1 + diff --git a/queue-4.19/clk-renesas-mstp-set-genpd_flag_always_on-for-clock-.patch b/queue-4.19/clk-renesas-mstp-set-genpd_flag_always_on-for-clock-.patch new file mode 100644 index 00000000000..7998d1b8dfe --- /dev/null +++ b/queue-4.19/clk-renesas-mstp-set-genpd_flag_always_on-for-clock-.patch @@ -0,0 +1,45 @@ +From 8cbc569eef84425a06af7eb65041acc1ee8d05db Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 9 Aug 2019 15:38:34 +0200 +Subject: clk: renesas: mstp: Set GENPD_FLAG_ALWAYS_ON for clock domain + +From: Geert Uytterhoeven + +[ Upstream commit a459a184c978ca9ad538aab93aafdde873953f30 ] + +The CPG/MSTP Clock Domain driver does not implement the +generic_pm_domain.power_{on,off}() callbacks, as the domain itself +cannot be powered down. Hence the domain should be marked as always-on +by setting the GENPD_FLAG_ALWAYS_ON flag, to prevent the core PM Domain +code from considering it for power-off, and doing unnessary processing. + +This also gets rid of a boot warning when the Clock Domain contains an +IRQ-safe device, e.g. on RZ/A1: + + sh_mtu2 fcff0000.timer: PM domain cpg_clocks will not be powered off + +Signed-off-by: Geert Uytterhoeven +Reviewed-by: Simon Horman +Reviewed-by: Ulf Hansson +Signed-off-by: Sasha Levin +--- + drivers/clk/renesas/clk-mstp.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/clk/renesas/clk-mstp.c b/drivers/clk/renesas/clk-mstp.c +index e82adcb16a52a..45d94fb9703d2 100644 +--- a/drivers/clk/renesas/clk-mstp.c ++++ b/drivers/clk/renesas/clk-mstp.c +@@ -341,7 +341,8 @@ void __init cpg_mstp_add_clk_domain(struct device_node *np) + return; + + pd->name = np->name; +- pd->flags = GENPD_FLAG_PM_CLK | GENPD_FLAG_ACTIVE_WAKEUP; ++ pd->flags = GENPD_FLAG_PM_CLK | GENPD_FLAG_ALWAYS_ON | ++ GENPD_FLAG_ACTIVE_WAKEUP; + pd->attach_dev = cpg_mstp_attach_dev; + pd->detach_dev = cpg_mstp_detach_dev; + pm_genpd_init(pd, &pm_domain_always_on_gov, false); +-- +2.20.1 + diff --git a/queue-4.19/clk-sirf-don-t-reference-clk_init_data-after-registr.patch b/queue-4.19/clk-sirf-don-t-reference-clk_init_data-after-registr.patch new file mode 100644 index 00000000000..51f3a167045 --- /dev/null +++ b/queue-4.19/clk-sirf-don-t-reference-clk_init_data-after-registr.patch @@ -0,0 +1,74 @@ +From b5615164c8be157ca588df8e58f96b111335a760 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 31 Jul 2019 12:35:13 -0700 +Subject: clk: sirf: Don't reference clk_init_data after registration + +From: Stephen Boyd + +[ 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 +Cc: Barry Song +Signed-off-by: Stephen Boyd +Link: https://lkml.kernel.org/r/20190731193517.237136-6-sboyd@kernel.org +Signed-off-by: Sasha Levin +--- + 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 d8f9efa5129ad..25351d6a55ba2 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.19/clk-sprd-add-missing-kfree.patch b/queue-4.19/clk-sprd-add-missing-kfree.patch new file mode 100644 index 00000000000..04e82341c4d --- /dev/null +++ b/queue-4.19/clk-sprd-add-missing-kfree.patch @@ -0,0 +1,45 @@ +From 4defa9984fdcd5c8c47cf7ea073eee12b4fb7db0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 5 Sep 2019 18:30:09 +0800 +Subject: clk: sprd: add missing kfree + +From: Chunyan Zhang + +[ Upstream commit 5e75ea9c67433a065b0e8595ad3c91c7c0ca0d2d ] + +The number of config registers for different pll clocks probably are not +same, so we have to use malloc, and should free the memory before return. + +Fixes: 3e37b005580b ("clk: sprd: add adjustable pll support") +Signed-off-by: Chunyan Zhang +Signed-off-by: Chunyan Zhang +Link: https://lkml.kernel.org/r/20190905103009.27166-1-zhang.lyra@gmail.com +Signed-off-by: Stephen Boyd +Signed-off-by: Sasha Levin +--- + drivers/clk/sprd/pll.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/clk/sprd/pll.c b/drivers/clk/sprd/pll.c +index 36b4402bf09e3..640270f51aa56 100644 +--- a/drivers/clk/sprd/pll.c ++++ b/drivers/clk/sprd/pll.c +@@ -136,6 +136,7 @@ static unsigned long _sprd_pll_recalc_rate(const struct sprd_pll *pll, + k2 + refin * nint * CLK_PLL_1M; + } + ++ kfree(cfg); + return rate; + } + +@@ -222,6 +223,7 @@ static int _sprd_pll_set_rate(const struct sprd_pll *pll, + if (!ret) + udelay(pll->udelay); + ++ kfree(cfg); + return ret; + } + +-- +2.20.1 + diff --git a/queue-4.19/clk-sprd-don-t-reference-clk_init_data-after-registr.patch b/queue-4.19/clk-sprd-don-t-reference-clk_init_data-after-registr.patch new file mode 100644 index 00000000000..e7b31066e21 --- /dev/null +++ b/queue-4.19/clk-sprd-don-t-reference-clk_init_data-after-registr.patch @@ -0,0 +1,52 @@ +From 6ca687ea90558dba84d025b572ce2a09bc45ca45 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 31 Jul 2019 12:35:15 -0700 +Subject: clk: sprd: Don't reference clk_init_data after registration + +From: Stephen Boyd + +[ Upstream commit f6c90df8e7e33c3dc33d4d7471bc42c232b0510e ] + +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: Chunyan Zhang +Cc: Baolin Wang +Signed-off-by: Stephen Boyd +Link: https://lkml.kernel.org/r/20190731193517.237136-8-sboyd@kernel.org +Acked-by: Baolin Wang +Acked-by: Chunyan Zhang +Signed-off-by: Sasha Levin +--- + drivers/clk/sprd/common.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/drivers/clk/sprd/common.c b/drivers/clk/sprd/common.c +index e038b04472061..8bdab1c3013b8 100644 +--- a/drivers/clk/sprd/common.c ++++ b/drivers/clk/sprd/common.c +@@ -71,16 +71,17 @@ int sprd_clk_probe(struct device *dev, struct clk_hw_onecell_data *clkhw) + struct clk_hw *hw; + + for (i = 0; i < clkhw->num; i++) { ++ const char *name; + + hw = clkhw->hws[i]; +- + if (!hw) + continue; + ++ name = hw->init->name; + ret = devm_clk_hw_register(dev, hw); + if (ret) { + dev_err(dev, "Couldn't register clock %d - %s\n", +- i, hw->init->name); ++ i, name); + return ret; + } + } +-- +2.20.1 + diff --git a/queue-4.19/clk-sunxi-ng-v3s-add-missing-clock-slices-for-mmc2-m.patch b/queue-4.19/clk-sunxi-ng-v3s-add-missing-clock-slices-for-mmc2-m.patch new file mode 100644 index 00000000000..95c93ce595a --- /dev/null +++ b/queue-4.19/clk-sunxi-ng-v3s-add-missing-clock-slices-for-mmc2-m.patch @@ -0,0 +1,39 @@ +From 941b7b89ba322a82735eac2fa931e90cb1f06aee Mon Sep 17 00:00:00 2001 +From: Sasha Levin +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 + +[ 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 +Signed-off-by: Maxime Ripard +Signed-off-by: Sasha Levin +--- + 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.19/clk-zx296718-don-t-reference-clk_init_data-after-reg.patch b/queue-4.19/clk-zx296718-don-t-reference-clk_init_data-after-reg.patch new file mode 100644 index 00000000000..82e75308380 --- /dev/null +++ b/queue-4.19/clk-zx296718-don-t-reference-clk_init_data-after-reg.patch @@ -0,0 +1,287 @@ +From 4ccf616b422dd1ab44e3b5a1bef465aad5214f06 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 15 Aug 2019 09:00:18 -0700 +Subject: clk: zx296718: Don't reference clk_init_data after registration + +From: Stephen Boyd + +[ 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 +Cc: Shawn Guo +Signed-off-by: Stephen Boyd +Link: https://lkml.kernel.org/r/20190815160020.183334-3-sboyd@kernel.org +Signed-off-by: Sasha Levin +--- + 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.19/crypto-hisilicon-fix-double-free-in-sec_free_hw_sgl.patch b/queue-4.19/crypto-hisilicon-fix-double-free-in-sec_free_hw_sgl.patch new file mode 100644 index 00000000000..be9fbc008cf --- /dev/null +++ b/queue-4.19/crypto-hisilicon-fix-double-free-in-sec_free_hw_sgl.patch @@ -0,0 +1,63 @@ +From ee9e6f2717ac22fd594ae93ff54ce0010e8a2b77 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 15 Sep 2019 17:26:56 +0800 +Subject: crypto: hisilicon - Fix double free in sec_free_hw_sgl() + +From: Yunfeng Ye + +[ Upstream commit 24fbf7bad888767bed952f540ac963bc57e47e15 ] + +There are two problems in sec_free_hw_sgl(): + +First, when sgl_current->next is valid, @hw_sgl will be freed in the +first loop, but it free again after the loop. + +Second, sgl_current and sgl_current->next_sgl is not match when +dma_pool_free() is invoked, the third parameter should be the dma +address of sgl_current, but sgl_current->next_sgl is the dma address +of next chain, so use sgl_current->next_sgl is wrong. + +Fix this by deleting the last dma_pool_free() in sec_free_hw_sgl(), +modifying the condition for while loop, and matching the address for +dma_pool_free(). + +Fixes: 915e4e8413da ("crypto: hisilicon - SEC security accelerator driver") +Signed-off-by: Yunfeng Ye +Signed-off-by: Herbert Xu +Signed-off-by: Sasha Levin +--- + drivers/crypto/hisilicon/sec/sec_algs.c | 13 +++++++------ + 1 file changed, 7 insertions(+), 6 deletions(-) + +diff --git a/drivers/crypto/hisilicon/sec/sec_algs.c b/drivers/crypto/hisilicon/sec/sec_algs.c +index cdc4f9a171d98..db2983c51f1e6 100644 +--- a/drivers/crypto/hisilicon/sec/sec_algs.c ++++ b/drivers/crypto/hisilicon/sec/sec_algs.c +@@ -215,17 +215,18 @@ static void sec_free_hw_sgl(struct sec_hw_sgl *hw_sgl, + dma_addr_t psec_sgl, struct sec_dev_info *info) + { + struct sec_hw_sgl *sgl_current, *sgl_next; ++ dma_addr_t sgl_next_dma; + +- if (!hw_sgl) +- return; + sgl_current = hw_sgl; +- while (sgl_current->next) { ++ while (sgl_current) { + sgl_next = sgl_current->next; +- dma_pool_free(info->hw_sgl_pool, sgl_current, +- sgl_current->next_sgl); ++ sgl_next_dma = sgl_current->next_sgl; ++ ++ dma_pool_free(info->hw_sgl_pool, sgl_current, psec_sgl); ++ + sgl_current = sgl_next; ++ psec_sgl = sgl_next_dma; + } +- dma_pool_free(info->hw_sgl_pool, hw_sgl, psec_sgl); + } + + static int sec_alg_skcipher_setkey(struct crypto_skcipher *tfm, +-- +2.20.1 + diff --git a/queue-4.19/dma-buf-sw_sync-synchronize-signal-vs-syncpt-free.patch b/queue-4.19/dma-buf-sw_sync-synchronize-signal-vs-syncpt-free.patch new file mode 100644 index 00000000000..714c98ec571 --- /dev/null +++ b/queue-4.19/dma-buf-sw_sync-synchronize-signal-vs-syncpt-free.patch @@ -0,0 +1,81 @@ +From beef6f3d44f91be3e7e6095112bbf09b72b25a99 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +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 + +[ 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 +Cc: Sumit Semwal +Cc: Sean Paul +Cc: Gustavo Padovan +Cc: Christian König +Cc: # v4.14+ +Acked-by: Christian König +Link: https://patchwork.freedesktop.org/patch/msgid/20190812154247.20508-1-chris@chris-wilson.co.uk +Signed-off-by: Sasha Levin +--- + 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 53c1d6d36a642..81ba4eb348909 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); +@@ -274,7 +271,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.19/drm-amd-display-fix-issue-where-252-255-values-are-c.patch b/queue-4.19/drm-amd-display-fix-issue-where-252-255-values-are-c.patch new file mode 100644 index 00000000000..2398068e921 --- /dev/null +++ b/queue-4.19/drm-amd-display-fix-issue-where-252-255-values-are-c.patch @@ -0,0 +1,46 @@ +From 16dd0172439856a13f287a9d06feec17aacf59c6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 12 Jul 2019 10:52:54 -0400 +Subject: drm/amd/display: fix issue where 252-255 values are clipped + +From: Anthony Koo + +[ Upstream commit 1cbcfc975164f397b449efb17f59d81a703090db ] + +[Why] +When endpoint is at the boundary of a region, such as at 2^0=1 +we find that the last segment has a sharp slope and some points +are clipped at the top. + +[How] +If end point is 1, which is exactly at the 2^0 region boundary, we +need to program an additional region beyond this point. + +Signed-off-by: Anthony Koo +Reviewed-by: Aric Cyr +Acked-by: Leo Li +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/amd/display/dc/dcn10/dcn10_cm_common.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_cm_common.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_cm_common.c +index 5d95a997fd9f9..f8904f73f57b0 100644 +--- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_cm_common.c ++++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_cm_common.c +@@ -292,9 +292,10 @@ bool cm_helper_translate_curve_to_hw_format( + seg_distr[7] = 4; + seg_distr[8] = 4; + seg_distr[9] = 4; ++ seg_distr[10] = 1; + + region_start = -10; +- region_end = 0; ++ region_end = 1; + } + + for (i = region_end - region_start; i < MAX_REGIONS_NUMBER ; i++) +-- +2.20.1 + diff --git a/queue-4.19/drm-amd-display-reprogram-vm-config-when-system-resu.patch b/queue-4.19/drm-amd-display-reprogram-vm-config-when-system-resu.patch new file mode 100644 index 00000000000..0ee6b882892 --- /dev/null +++ b/queue-4.19/drm-amd-display-reprogram-vm-config-when-system-resu.patch @@ -0,0 +1,50 @@ +From 62fb1c34cf9750c7b9e3f7b032a32f6015a20409 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 22 Jul 2019 15:23:32 -0400 +Subject: drm/amd/display: reprogram VM config when system resume + +From: Lewis Huang + +[ Upstream commit e5382701c3520b3ed66169a6e4aa6ce5df8c56e0 ] + +[Why] +The vm config will be clear to 0 when system enter S4. It will +cause hubbub didn't know how to fetch data when system resume. +The flip always pending because earliest_inuse_address and +request_address are different. + +[How] +Reprogram VM config when system resume + +Signed-off-by: Lewis Huang +Reviewed-by: Jun Lei +Acked-by: Eric Yang +Acked-by: Leo Li +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/amd/display/dc/core/dc.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c +index f4b89d1ea6f6f..2b2efe443c36d 100644 +--- a/drivers/gpu/drm/amd/display/dc/core/dc.c ++++ b/drivers/gpu/drm/amd/display/dc/core/dc.c +@@ -1585,6 +1585,14 @@ void dc_set_power_state( + dc_resource_state_construct(dc, dc->current_state); + + dc->hwss.init_hw(dc); ++ ++#ifdef CONFIG_DRM_AMD_DC_DCN2_0 ++ if (dc->hwss.init_sys_ctx != NULL && ++ dc->vm_pa_config.valid) { ++ dc->hwss.init_sys_ctx(dc->hwseq, dc, &dc->vm_pa_config); ++ } ++#endif ++ + break; + default: + +-- +2.20.1 + diff --git a/queue-4.19/drm-amd-display-support-spdif.patch b/queue-4.19/drm-amd-display-support-spdif.patch new file mode 100644 index 00000000000..79e5f52d347 --- /dev/null +++ b/queue-4.19/drm-amd-display-support-spdif.patch @@ -0,0 +1,107 @@ +From a3c719e19b63ddfa93f4939617d5a85ce648a064 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 2 Aug 2019 14:49:58 -0400 +Subject: drm/amd/display: support spdif + +From: Charlene Liu + +[ Upstream commit b5a41620bb88efb9fb31a4fa5e652e3d5bead7d4 ] + +[Description] +port spdif fix to staging: + spdif hardwired to afmt inst 1. + spdif func pointer + spdif resource allocation (reserve last audio endpoint for spdif only) + +Signed-off-by: Charlene Liu +Reviewed-by: Dmytro Laktyushkin +Acked-by: Bhawanpreet Lakha +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + .../gpu/drm/amd/display/dc/core/dc_resource.c | 17 ++++++++--------- + drivers/gpu/drm/amd/display/dc/dce/dce_audio.c | 4 ++-- + 2 files changed, 10 insertions(+), 11 deletions(-) + +diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c +index f0d68aa7c8fcc..d440b28ee43fb 100644 +--- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c ++++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c +@@ -229,12 +229,10 @@ bool resource_construct( + DC_ERR("DC: failed to create audio!\n"); + return false; + } +- + if (!aud->funcs->endpoint_valid(aud)) { + aud->funcs->destroy(&aud); + break; + } +- + pool->audios[i] = aud; + pool->audio_count++; + } +@@ -1703,24 +1701,25 @@ static struct audio *find_first_free_audio( + const struct resource_pool *pool, + enum engine_id id) + { +- int i; +- for (i = 0; i < pool->audio_count; i++) { ++ int i, available_audio_count; ++ ++ available_audio_count = pool->audio_count; ++ ++ for (i = 0; i < available_audio_count; i++) { + if ((res_ctx->is_audio_acquired[i] == false) && (res_ctx->is_stream_enc_acquired[i] == true)) { + /*we have enough audio endpoint, find the matching inst*/ + if (id != i) + continue; +- + return pool->audios[i]; + } + } + +- /* use engine id to find free audio */ +- if ((id < pool->audio_count) && (res_ctx->is_audio_acquired[id] == false)) { ++ /* use engine id to find free audio */ ++ if ((id < available_audio_count) && (res_ctx->is_audio_acquired[id] == false)) { + return pool->audios[id]; + } +- + /*not found the matching one, first come first serve*/ +- for (i = 0; i < pool->audio_count; i++) { ++ for (i = 0; i < available_audio_count; i++) { + if (res_ctx->is_audio_acquired[i] == false) { + return pool->audios[i]; + } +diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_audio.c b/drivers/gpu/drm/amd/display/dc/dce/dce_audio.c +index 7f6d724686f1a..abb559ce64085 100644 +--- a/drivers/gpu/drm/amd/display/dc/dce/dce_audio.c ++++ b/drivers/gpu/drm/amd/display/dc/dce/dce_audio.c +@@ -611,6 +611,8 @@ void dce_aud_az_configure( + + AZ_REG_WRITE(AZALIA_F0_CODEC_PIN_CONTROL_SINK_INFO1, + value); ++ DC_LOG_HW_AUDIO("\n\tAUDIO:az_configure: index: %u data, 0x%x, displayName %s: \n", ++ audio->inst, value, audio_info->display_name); + + /* + *write the port ID: +@@ -922,7 +924,6 @@ static const struct audio_funcs funcs = { + .az_configure = dce_aud_az_configure, + .destroy = dce_aud_destroy, + }; +- + void dce_aud_destroy(struct audio **audio) + { + struct dce_audio *aud = DCE_AUD(*audio); +@@ -953,7 +954,6 @@ struct audio *dce_audio_create( + audio->regs = reg; + audio->shifts = shifts; + audio->masks = masks; +- + return &audio->base; + } + +-- +2.20.1 + diff --git a/queue-4.19/drm-amdgpu-si-fix-asic-tests.patch b/queue-4.19/drm-amdgpu-si-fix-asic-tests.patch new file mode 100644 index 00000000000..5c9e0f2ccf2 --- /dev/null +++ b/queue-4.19/drm-amdgpu-si-fix-asic-tests.patch @@ -0,0 +1,62 @@ +From 28b8443e77ae6ad35ec77256119408c800452baf Mon Sep 17 00:00:00 2001 +From: Sasha Levin +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 + +[ 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 +Fixes: 62a37553414a ("drm/amdgpu: add si implementation v10") +Cc: Ken Wang +Cc: Alex Deucher +Cc: "Christian König" +Cc: "David (ChunMing) Zhou" +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + 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 c364ef94cc366..77c9f4d8668ad 100644 +--- a/drivers/gpu/drm/amd/amdgpu/si.c ++++ b/drivers/gpu/drm/amd/amdgpu/si.c +@@ -1813,7 +1813,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) +@@ -1862,14 +1862,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.19/drm-bridge-tc358767-increase-aux-transfer-length-lim.patch b/queue-4.19/drm-bridge-tc358767-increase-aux-transfer-length-lim.patch new file mode 100644 index 00000000000..2a313ba7314 --- /dev/null +++ b/queue-4.19/drm-bridge-tc358767-increase-aux-transfer-length-lim.patch @@ -0,0 +1,52 @@ +From f2d0434e8af7659b4bea3eb2ce8016a466187bc9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 18 Jun 2019 22:27:09 -0700 +Subject: drm/bridge: tc358767: Increase AUX transfer length limit + +From: Andrey Smirnov + +[ 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 +Reviewed-by: Andrzej Hajda +Reviewed-by: Tomi Valkeinen +Cc: Andrzej Hajda +Cc: Laurent Pinchart +Cc: Tomi Valkeinen +Cc: Andrey Gusakov +Cc: Philipp Zabel +Cc: Cory Tusar +Cc: Chris Healy +Cc: Lucas Stach +Cc: dri-devel@lists.freedesktop.org +Cc: linux-kernel@vger.kernel.org +Signed-off-by: Andrzej Hajda +Link: https://patchwork.freedesktop.org/patch/msgid/20190619052716.16831-9-andrew.smirnov@gmail.com +Signed-off-by: Sasha Levin +--- + 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 aaca5248da070..d728b6cf61096 100644 +--- a/drivers/gpu/drm/bridge/tc358767.c ++++ b/drivers/gpu/drm/bridge/tc358767.c +@@ -302,7 +302,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.19/drm-nouveau-volt-fix-for-some-cards-having-0-maximum.patch b/queue-4.19/drm-nouveau-volt-fix-for-some-cards-having-0-maximum.patch new file mode 100644 index 00000000000..274a0d9032c --- /dev/null +++ b/queue-4.19/drm-nouveau-volt-fix-for-some-cards-having-0-maximum.patch @@ -0,0 +1,38 @@ +From 58b85bae7cc3494eb87a4b03b997f865171ce3f7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 2 Aug 2019 11:21:00 +0200 +Subject: drm/nouveau/volt: Fix for some cards having 0 maximum voltage + +From: Mark Menzynski + +[ 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 +Signed-off-by: Mark Menzynski +Reviewed-by: Karol Herbst +Signed-off-by: Ben Skeggs +Signed-off-by: Sasha Levin +--- + 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.19/drm-panel-check-failure-cases-in-the-probe-func.patch b/queue-4.19/drm-panel-check-failure-cases-in-the-probe-func.patch new file mode 100644 index 00000000000..c6342b11d7e --- /dev/null +++ b/queue-4.19/drm-panel-check-failure-cases-in-the-probe-func.patch @@ -0,0 +1,68 @@ +From 47431e3179ddb996cc0c8e1f8249a893e64ed5ea Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 24 Jul 2019 14:55:34 -0500 +Subject: drm/panel: check failure cases in the probe func + +From: Navid Emamdoost + +[ Upstream commit afd6d4f5a52c16e1483328ac074abb1cde92c29f ] + +The following function calls may fail and return NULL, so the null check +is added. +of_graph_get_next_endpoint +of_graph_get_remote_port_parent +of_graph_get_remote_port + +Update: Thanks to Sam Ravnborg, for suggession on the use of goto to avoid +leaking endpoint. + +Signed-off-by: Navid Emamdoost +Signed-off-by: Sam Ravnborg +Link: https://patchwork.freedesktop.org/patch/msgid/20190724195534.9303-1-navid.emamdoost@gmail.com +Signed-off-by: Sasha Levin +--- + .../gpu/drm/panel/panel-raspberrypi-touchscreen.c | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c +index 2c9c9722734f5..9a2cb8aeab3a4 100644 +--- a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c ++++ b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c +@@ -400,7 +400,13 @@ static int rpi_touchscreen_probe(struct i2c_client *i2c, + + /* Look up the DSI host. It needs to probe before we do. */ + endpoint = of_graph_get_next_endpoint(dev->of_node, NULL); ++ if (!endpoint) ++ return -ENODEV; ++ + dsi_host_node = of_graph_get_remote_port_parent(endpoint); ++ if (!dsi_host_node) ++ goto error; ++ + host = of_find_mipi_dsi_host_by_node(dsi_host_node); + of_node_put(dsi_host_node); + if (!host) { +@@ -409,6 +415,9 @@ static int rpi_touchscreen_probe(struct i2c_client *i2c, + } + + info.node = of_graph_get_remote_port(endpoint); ++ if (!info.node) ++ goto error; ++ + of_node_put(endpoint); + + ts->dsi = mipi_dsi_device_register_full(host, &info); +@@ -429,6 +438,10 @@ static int rpi_touchscreen_probe(struct i2c_client *i2c, + return ret; + + return 0; ++ ++error: ++ of_node_put(endpoint); ++ return -ENODEV; + } + + static int rpi_touchscreen_remove(struct i2c_client *i2c) +-- +2.20.1 + diff --git a/queue-4.19/drm-panel-simple-fix-auo-g185han01-horizontal-blanki.patch b/queue-4.19/drm-panel-simple-fix-auo-g185han01-horizontal-blanki.patch new file mode 100644 index 00000000000..92f36bc24dc --- /dev/null +++ b/queue-4.19/drm-panel-simple-fix-auo-g185han01-horizontal-blanki.patch @@ -0,0 +1,50 @@ +From 6cf21bd5b6d499b719ee470a1e33b8ef09b252f5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 10 Jul 2019 15:07:40 +0200 +Subject: drm/panel: simple: fix AUO g185han01 horizontal blanking + +From: Lucas Stach + +[ 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 +Reviewed-by: Philipp Zabel +Reviewed-by: Sam Ravnborg +Signed-off-by: Sam Ravnborg +Link: https://patchwork.freedesktop.org/patch/msgid/1562764060.23869.12.camel@pengutronix.de +Signed-off-by: Sasha Levin +--- + 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 5fd94e2060297..654fea2b43124 100644 +--- a/drivers/gpu/drm/panel/panel-simple.c ++++ b/drivers/gpu/drm/panel/panel-simple.c +@@ -689,9 +689,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.19/drm-radeon-fix-eeh-during-kexec.patch b/queue-4.19/drm-radeon-fix-eeh-during-kexec.patch new file mode 100644 index 00000000000..a631912461c --- /dev/null +++ b/queue-4.19/drm-radeon-fix-eeh-during-kexec.patch @@ -0,0 +1,47 @@ +From 98145f2c47ef6a1300890f604c71550b63d24e9d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 31 Jul 2019 17:10:14 -0500 +Subject: drm/radeon: Fix EEH during kexec + +From: KyleMahlkuch + +[ 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 +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + 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 2a7977a23b31c..25b5407c74b5a 100644 +--- a/drivers/gpu/drm/radeon/radeon_drv.c ++++ b/drivers/gpu/drm/radeon/radeon_drv.c +@@ -364,11 +364,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.19/drm-rockchip-check-for-fast-link-training-before-ena.patch b/queue-4.19/drm-rockchip-check-for-fast-link-training-before-ena.patch new file mode 100644 index 00000000000..450d15b6d49 --- /dev/null +++ b/queue-4.19/drm-rockchip-check-for-fast-link-training-before-ena.patch @@ -0,0 +1,67 @@ +From 46f6fb6db535939b9e4c4c037b4b8bf252022c0a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 11 Jun 2019 12:08:21 -0400 +Subject: drm/rockchip: Check for fast link training before enabling psr + +From: Sean Paul + +[ Upstream commit ad309284a52be47c8b3126c9376358bf381861bc ] + +Once we start shutting off the link during PSR, we're going to want fast +training to work. If the display doesn't support fast training, don't +enable psr. + +Changes in v2: +- None +Changes in v3: +- None +Changes in v4: +- None +Changes in v5: +- None + +Link to v1: https://patchwork.freedesktop.org/patch/msgid/20190228210939.83386-3-sean@poorly.run +Link to v2: https://patchwork.freedesktop.org/patch/msgid/20190326204509.96515-2-sean@poorly.run +Link to v3: https://patchwork.freedesktop.org/patch/msgid/20190502194956.218441-9-sean@poorly.run +Link to v4: https://patchwork.freedesktop.org/patch/msgid/20190508160920.144739-8-sean@poorly.run + +Cc: Zain Wang +Cc: Tomasz Figa +Tested-by: Heiko Stuebner +Reviewed-by: Heiko Stuebner +Signed-off-by: Sean Paul +Link: https://patchwork.freedesktop.org/patch/msgid/20190611160844.257498-8-sean@poorly.run +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +index d68986cea1325..84abf5d6f760a 100644 +--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c ++++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +@@ -1040,16 +1040,17 @@ static int analogix_dp_commit(struct analogix_dp_device *dp) + if (ret) + return ret; + ++ /* Check whether panel supports fast training */ ++ ret = analogix_dp_fast_link_train_detection(dp); ++ if (ret) ++ dp->psr_enable = false; ++ + if (dp->psr_enable) { + ret = analogix_dp_enable_sink_psr(dp); + if (ret) + return ret; + } + +- /* Check whether panel supports fast training */ +- ret = analogix_dp_fast_link_train_detection(dp); +- if (ret) +- dp->psr_enable = false; + + return ret; + } +-- +2.20.1 + diff --git a/queue-4.19/drm-stm-attach-gem-fence-to-atomic-state.patch b/queue-4.19/drm-stm-attach-gem-fence-to-atomic-state.patch new file mode 100644 index 00000000000..ba8096c3e86 --- /dev/null +++ b/queue-4.19/drm-stm-attach-gem-fence-to-atomic-state.patch @@ -0,0 +1,47 @@ +From 95fcfbaa5882a07b98cf295eb4805294db439f47 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 12 Jul 2019 10:42:28 +0200 +Subject: drm/stm: attach gem fence to atomic state + +From: Ahmad Fatoum + +[ 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 +Signed-off-by: Lucas Stach +Acked-by: Philippe Cornu +Tested-by: Philippe Cornu +Signed-off-by: Benjamin Gaignard +Link: https://patchwork.freedesktop.org/patch/msgid/20190712084228.8338-1-l.stach@pengutronix.de +Signed-off-by: Sasha Levin +--- + 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 808d9fb627e97..477d0a27b9a5d 100644 +--- a/drivers/gpu/drm/stm/ltdc.c ++++ b/drivers/gpu/drm/stm/ltdc.c +@@ -19,6 +19,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -825,6 +826,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.19/ext4-fix-potential-use-after-free-after-remounting-w.patch b/queue-4.19/ext4-fix-potential-use-after-free-after-remounting-w.patch new file mode 100644 index 00000000000..ea316daafe3 --- /dev/null +++ b/queue-4.19/ext4-fix-potential-use-after-free-after-remounting-w.patch @@ -0,0 +1,394 @@ +From 11363f7d82cbc4463e8c8c5eefe7b347177ab4c3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 28 Aug 2019 11:13:24 -0400 +Subject: ext4: fix potential use after free after remounting with + noblock_validity + +From: zhangyi (F) + +[ Upstream commit 7727ae52975d4f4ef7ff69ed8e6e25f6a4168158 ] + +Remount process will release system zone which was allocated before if +"noblock_validity" is specified. If we mount an ext4 file system to two +mountpoints with default mount options, and then remount one of them +with "noblock_validity", it may trigger a use after free problem when +someone accessing the other one. + + # mount /dev/sda foo + # mount /dev/sda bar + +User access mountpoint "foo" | Remount mountpoint "bar" + | +ext4_map_blocks() | ext4_remount() +check_block_validity() | ext4_setup_system_zone() +ext4_data_block_valid() | ext4_release_system_zone() + | free system_blks rb nodes +access system_blks rb nodes | +trigger use after free | + +This problem can also be reproduced by one mountpint, At the same time, +add_system_zone() can get called during remount as well so there can be +racing ext4_data_block_valid() reading the rbtree at the same time. + +This patch add RCU to protect system zone from releasing or building +when doing a remount which inverse current "noblock_validity" mount +option. It assign the rbtree after the whole tree was complete and +do actual freeing after rcu grace period, avoid any intermediate state. + +Reported-by: syzbot+1e470567330b7ad711d5@syzkaller.appspotmail.com +Signed-off-by: zhangyi (F) +Signed-off-by: Theodore Ts'o +Reviewed-by: Jan Kara +Signed-off-by: Sasha Levin +--- + fs/ext4/block_validity.c | 189 ++++++++++++++++++++++++++++----------- + fs/ext4/ext4.h | 10 ++- + 2 files changed, 147 insertions(+), 52 deletions(-) + +diff --git a/fs/ext4/block_validity.c b/fs/ext4/block_validity.c +index e8e27cdc2f677..7edc8172c53ad 100644 +--- a/fs/ext4/block_validity.c ++++ b/fs/ext4/block_validity.c +@@ -38,6 +38,7 @@ int __init ext4_init_system_zone(void) + + void ext4_exit_system_zone(void) + { ++ rcu_barrier(); + kmem_cache_destroy(ext4_system_zone_cachep); + } + +@@ -49,17 +50,26 @@ static inline int can_merge(struct ext4_system_zone *entry1, + return 0; + } + ++static void release_system_zone(struct ext4_system_blocks *system_blks) ++{ ++ struct ext4_system_zone *entry, *n; ++ ++ rbtree_postorder_for_each_entry_safe(entry, n, ++ &system_blks->root, node) ++ kmem_cache_free(ext4_system_zone_cachep, entry); ++} ++ + /* + * Mark a range of blocks as belonging to the "system zone" --- that + * is, filesystem metadata blocks which should never be used by + * inodes. + */ +-static int add_system_zone(struct ext4_sb_info *sbi, ++static int add_system_zone(struct ext4_system_blocks *system_blks, + ext4_fsblk_t start_blk, + unsigned int count) + { + struct ext4_system_zone *new_entry = NULL, *entry; +- struct rb_node **n = &sbi->system_blks.rb_node, *node; ++ struct rb_node **n = &system_blks->root.rb_node, *node; + struct rb_node *parent = NULL, *new_node = NULL; + + while (*n) { +@@ -91,7 +101,7 @@ static int add_system_zone(struct ext4_sb_info *sbi, + new_node = &new_entry->node; + + rb_link_node(new_node, parent, n); +- rb_insert_color(new_node, &sbi->system_blks); ++ rb_insert_color(new_node, &system_blks->root); + } + + /* Can we merge to the left? */ +@@ -101,7 +111,7 @@ static int add_system_zone(struct ext4_sb_info *sbi, + if (can_merge(entry, new_entry)) { + new_entry->start_blk = entry->start_blk; + new_entry->count += entry->count; +- rb_erase(node, &sbi->system_blks); ++ rb_erase(node, &system_blks->root); + kmem_cache_free(ext4_system_zone_cachep, entry); + } + } +@@ -112,7 +122,7 @@ static int add_system_zone(struct ext4_sb_info *sbi, + entry = rb_entry(node, struct ext4_system_zone, node); + if (can_merge(new_entry, entry)) { + new_entry->count += entry->count; +- rb_erase(node, &sbi->system_blks); ++ rb_erase(node, &system_blks->root); + kmem_cache_free(ext4_system_zone_cachep, entry); + } + } +@@ -126,7 +136,7 @@ static void debug_print_tree(struct ext4_sb_info *sbi) + int first = 1; + + printk(KERN_INFO "System zones: "); +- node = rb_first(&sbi->system_blks); ++ node = rb_first(&sbi->system_blks->root); + while (node) { + entry = rb_entry(node, struct ext4_system_zone, node); + printk(KERN_CONT "%s%llu-%llu", first ? "" : ", ", +@@ -137,7 +147,47 @@ static void debug_print_tree(struct ext4_sb_info *sbi) + printk(KERN_CONT "\n"); + } + +-static int ext4_protect_reserved_inode(struct super_block *sb, u32 ino) ++/* ++ * Returns 1 if the passed-in block region (start_blk, ++ * start_blk+count) is valid; 0 if some part of the block region ++ * overlaps with filesystem metadata blocks. ++ */ ++static int ext4_data_block_valid_rcu(struct ext4_sb_info *sbi, ++ struct ext4_system_blocks *system_blks, ++ ext4_fsblk_t start_blk, ++ unsigned int count) ++{ ++ struct ext4_system_zone *entry; ++ struct rb_node *n; ++ ++ if ((start_blk <= le32_to_cpu(sbi->s_es->s_first_data_block)) || ++ (start_blk + count < start_blk) || ++ (start_blk + count > ext4_blocks_count(sbi->s_es))) { ++ sbi->s_es->s_last_error_block = cpu_to_le64(start_blk); ++ return 0; ++ } ++ ++ if (system_blks == NULL) ++ return 1; ++ ++ n = system_blks->root.rb_node; ++ while (n) { ++ entry = rb_entry(n, struct ext4_system_zone, node); ++ if (start_blk + count - 1 < entry->start_blk) ++ n = n->rb_left; ++ else if (start_blk >= (entry->start_blk + entry->count)) ++ n = n->rb_right; ++ else { ++ sbi->s_es->s_last_error_block = cpu_to_le64(start_blk); ++ return 0; ++ } ++ } ++ return 1; ++} ++ ++static int ext4_protect_reserved_inode(struct super_block *sb, ++ struct ext4_system_blocks *system_blks, ++ u32 ino) + { + struct inode *inode; + struct ext4_sb_info *sbi = EXT4_SB(sb); +@@ -163,14 +213,15 @@ static int ext4_protect_reserved_inode(struct super_block *sb, u32 ino) + if (n == 0) { + i++; + } else { +- if (!ext4_data_block_valid(sbi, map.m_pblk, n)) { ++ if (!ext4_data_block_valid_rcu(sbi, system_blks, ++ map.m_pblk, n)) { + ext4_error(sb, "blocks %llu-%llu from inode %u " + "overlap system zone", map.m_pblk, + map.m_pblk + map.m_len - 1, ino); + err = -EFSCORRUPTED; + break; + } +- err = add_system_zone(sbi, map.m_pblk, n); ++ err = add_system_zone(system_blks, map.m_pblk, n); + if (err < 0) + break; + i += n; +@@ -180,93 +231,129 @@ static int ext4_protect_reserved_inode(struct super_block *sb, u32 ino) + return err; + } + ++static void ext4_destroy_system_zone(struct rcu_head *rcu) ++{ ++ struct ext4_system_blocks *system_blks; ++ ++ system_blks = container_of(rcu, struct ext4_system_blocks, rcu); ++ release_system_zone(system_blks); ++ kfree(system_blks); ++} ++ ++/* ++ * Build system zone rbtree which is used for block validity checking. ++ * ++ * The update of system_blks pointer in this function is protected by ++ * sb->s_umount semaphore. However we have to be careful as we can be ++ * racing with ext4_data_block_valid() calls reading system_blks rbtree ++ * protected only by RCU. That's why we first build the rbtree and then ++ * swap it in place. ++ */ + int ext4_setup_system_zone(struct super_block *sb) + { + ext4_group_t ngroups = ext4_get_groups_count(sb); + struct ext4_sb_info *sbi = EXT4_SB(sb); ++ struct ext4_system_blocks *system_blks; + struct ext4_group_desc *gdp; + ext4_group_t i; + int flex_size = ext4_flex_bg_size(sbi); + int ret; + + if (!test_opt(sb, BLOCK_VALIDITY)) { +- if (sbi->system_blks.rb_node) ++ if (sbi->system_blks) + ext4_release_system_zone(sb); + return 0; + } +- if (sbi->system_blks.rb_node) ++ if (sbi->system_blks) + return 0; + ++ system_blks = kzalloc(sizeof(*system_blks), GFP_KERNEL); ++ if (!system_blks) ++ return -ENOMEM; ++ + for (i=0; i < ngroups; i++) { + if (ext4_bg_has_super(sb, i) && + ((i < 5) || ((i % flex_size) == 0))) +- add_system_zone(sbi, ext4_group_first_block_no(sb, i), ++ add_system_zone(system_blks, ++ ext4_group_first_block_no(sb, i), + ext4_bg_num_gdb(sb, i) + 1); + gdp = ext4_get_group_desc(sb, i, NULL); +- ret = add_system_zone(sbi, ext4_block_bitmap(sb, gdp), 1); ++ ret = add_system_zone(system_blks, ++ ext4_block_bitmap(sb, gdp), 1); + if (ret) +- return ret; +- ret = add_system_zone(sbi, ext4_inode_bitmap(sb, gdp), 1); ++ goto err; ++ ret = add_system_zone(system_blks, ++ ext4_inode_bitmap(sb, gdp), 1); + if (ret) +- return ret; +- ret = add_system_zone(sbi, ext4_inode_table(sb, gdp), ++ goto err; ++ ret = add_system_zone(system_blks, ++ ext4_inode_table(sb, gdp), + sbi->s_itb_per_group); + if (ret) +- return ret; ++ goto err; + } + if (ext4_has_feature_journal(sb) && sbi->s_es->s_journal_inum) { +- ret = ext4_protect_reserved_inode(sb, ++ ret = ext4_protect_reserved_inode(sb, system_blks, + le32_to_cpu(sbi->s_es->s_journal_inum)); + if (ret) +- return ret; ++ goto err; + } + ++ /* ++ * System blks rbtree complete, announce it once to prevent racing ++ * with ext4_data_block_valid() accessing the rbtree at the same ++ * time. ++ */ ++ rcu_assign_pointer(sbi->system_blks, system_blks); ++ + if (test_opt(sb, DEBUG)) + debug_print_tree(sbi); + return 0; ++err: ++ release_system_zone(system_blks); ++ kfree(system_blks); ++ return ret; + } + +-/* Called when the filesystem is unmounted */ ++/* ++ * Called when the filesystem is unmounted or when remounting it with ++ * noblock_validity specified. ++ * ++ * The update of system_blks pointer in this function is protected by ++ * sb->s_umount semaphore. However we have to be careful as we can be ++ * racing with ext4_data_block_valid() calls reading system_blks rbtree ++ * protected only by RCU. So we first clear the system_blks pointer and ++ * then free the rbtree only after RCU grace period expires. ++ */ + void ext4_release_system_zone(struct super_block *sb) + { +- struct ext4_system_zone *entry, *n; ++ struct ext4_system_blocks *system_blks; + +- rbtree_postorder_for_each_entry_safe(entry, n, +- &EXT4_SB(sb)->system_blks, node) +- kmem_cache_free(ext4_system_zone_cachep, entry); ++ system_blks = rcu_dereference_protected(EXT4_SB(sb)->system_blks, ++ lockdep_is_held(&sb->s_umount)); ++ rcu_assign_pointer(EXT4_SB(sb)->system_blks, NULL); + +- EXT4_SB(sb)->system_blks = RB_ROOT; ++ if (system_blks) ++ call_rcu(&system_blks->rcu, ext4_destroy_system_zone); + } + +-/* +- * Returns 1 if the passed-in block region (start_blk, +- * start_blk+count) is valid; 0 if some part of the block region +- * overlaps with filesystem metadata blocks. +- */ + int ext4_data_block_valid(struct ext4_sb_info *sbi, ext4_fsblk_t start_blk, + unsigned int count) + { +- struct ext4_system_zone *entry; +- struct rb_node *n = sbi->system_blks.rb_node; ++ struct ext4_system_blocks *system_blks; ++ int ret; + +- if ((start_blk <= le32_to_cpu(sbi->s_es->s_first_data_block)) || +- (start_blk + count < start_blk) || +- (start_blk + count > ext4_blocks_count(sbi->s_es))) { +- sbi->s_es->s_last_error_block = cpu_to_le64(start_blk); +- return 0; +- } +- while (n) { +- entry = rb_entry(n, struct ext4_system_zone, node); +- if (start_blk + count - 1 < entry->start_blk) +- n = n->rb_left; +- else if (start_blk >= (entry->start_blk + entry->count)) +- n = n->rb_right; +- else { +- sbi->s_es->s_last_error_block = cpu_to_le64(start_blk); +- return 0; +- } +- } +- return 1; ++ /* ++ * Lock the system zone to prevent it being released concurrently ++ * when doing a remount which inverse current "[no]block_validity" ++ * mount option. ++ */ ++ rcu_read_lock(); ++ system_blks = rcu_dereference(sbi->system_blks); ++ ret = ext4_data_block_valid_rcu(sbi, system_blks, start_blk, ++ count); ++ rcu_read_unlock(); ++ return ret; + } + + int ext4_check_blockref(const char *function, unsigned int line, +diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h +index 1ee51d3a978ad..f8456a423c4ea 100644 +--- a/fs/ext4/ext4.h ++++ b/fs/ext4/ext4.h +@@ -194,6 +194,14 @@ struct ext4_map_blocks { + unsigned int m_flags; + }; + ++/* ++ * Block validity checking, system zone rbtree. ++ */ ++struct ext4_system_blocks { ++ struct rb_root root; ++ struct rcu_head rcu; ++}; ++ + /* + * Flags for ext4_io_end->flags + */ +@@ -1409,7 +1417,7 @@ struct ext4_sb_info { + int s_jquota_fmt; /* Format of quota to use */ + #endif + unsigned int s_want_extra_isize; /* New inodes should reserve # bytes */ +- struct rb_root system_blks; ++ struct ext4_system_blocks __rcu *system_blks; + + #ifdef EXTENTS_STATS + /* ext4 extents stats */ +-- +2.20.1 + diff --git a/queue-4.19/fat-work-around-race-with-userspace-s-read-via-block.patch b/queue-4.19/fat-work-around-race-with-userspace-s-read-via-block.patch new file mode 100644 index 00000000000..8155795d7d8 --- /dev/null +++ b/queue-4.19/fat-work-around-race-with-userspace-s-read-via-block.patch @@ -0,0 +1,110 @@ +From ad451091aa70d2acd13f39c28a919dccdd4d31c3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +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 + +[ 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 +Reported-by: Jan Stancek +Tested-by: Jan Stancek +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Sasha Levin +--- + 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 7f5f3699fc6c0..de60c05c0ca1d 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 timespec64 *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 timespec64 *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 f58c0cacc531d..4c6c635bc8aaa 100644 +--- a/fs/fat/fatent.c ++++ b/fs/fat/fatent.c +@@ -390,8 +390,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 & SB_SYNCHRONOUS) + err = sync_dirty_buffer(c_bh); +-- +2.20.1 + diff --git a/queue-4.19/gpu-drm-radeon-fix-a-possible-null-pointer-dereferen.patch b/queue-4.19/gpu-drm-radeon-fix-a-possible-null-pointer-dereferen.patch new file mode 100644 index 00000000000..0b1e839f4bf --- /dev/null +++ b/queue-4.19/gpu-drm-radeon-fix-a-possible-null-pointer-dereferen.patch @@ -0,0 +1,46 @@ +From 1dbed2498badf5ee444d535e7f9b1a771d6df9bb Mon Sep 17 00:00:00 2001 +From: Sasha Levin +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 + +[ 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 +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + 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 414642e5b7a31..de656f5553839 100644 +--- a/drivers/gpu/drm/radeon/radeon_connectors.c ++++ b/drivers/gpu/drm/radeon/radeon_connectors.c +@@ -751,7 +751,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.19/hid-apple-fix-stuck-function-keys-when-using-fn.patch b/queue-4.19/hid-apple-fix-stuck-function-keys-when-using-fn.patch new file mode 100644 index 00000000000..86f2a7b8ba2 --- /dev/null +++ b/queue-4.19/hid-apple-fix-stuck-function-keys-when-using-fn.patch @@ -0,0 +1,111 @@ +From 8db333e1d1c0e7e41c897d142bd942d96a1c674f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 3 Sep 2019 16:46:32 +0200 +Subject: HID: apple: Fix stuck function keys when using FN + +From: Joao Moreno + +[ 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 +Co-developed-by: Benjamin Tissoires +Signed-off-by: Benjamin Tissoires +Signed-off-by: Sasha Levin +--- + 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.19/hid-wacom-fix-several-minor-compiler-warnings.patch b/queue-4.19/hid-wacom-fix-several-minor-compiler-warnings.patch new file mode 100644 index 00000000000..90e8b6802fb --- /dev/null +++ b/queue-4.19/hid-wacom-fix-several-minor-compiler-warnings.patch @@ -0,0 +1,89 @@ +From 5b8607e3e29684be1d58311f0d89f073d992349e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 16 Aug 2019 11:54:26 -0700 +Subject: HID: wacom: Fix several minor compiler warnings + +From: Jason Gerecke + +[ Upstream commit 073b50bccbbf99a3b79a1913604c656d0e1a56c9 ] + +Addresses a few issues that were noticed when compiling with non-default +warnings enabled. The trimmed-down warnings in the order they are fixed +below are: + +* declaration of 'size' shadows a parameter + +* '%s' directive output may be truncated writing up to 5 bytes into a + region of size between 1 and 64 + +* pointer targets in initialization of 'char *' from 'unsigned char *' + differ in signedness + +* left shift of negative value + +Signed-off-by: Jason Gerecke +Reviewed-by: Aaron Armstrong Skomra +Signed-off-by: Jiri Kosina +Signed-off-by: Sasha Levin +--- + drivers/hid/wacom_sys.c | 7 ++++--- + drivers/hid/wacom_wac.c | 4 ++-- + 2 files changed, 6 insertions(+), 5 deletions(-) + +diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c +index 5a2d5140c1f42..3038c975e417c 100644 +--- a/drivers/hid/wacom_sys.c ++++ b/drivers/hid/wacom_sys.c +@@ -91,7 +91,7 @@ static void wacom_wac_queue_flush(struct hid_device *hdev, + } + + static int wacom_wac_pen_serial_enforce(struct hid_device *hdev, +- struct hid_report *report, u8 *raw_data, int size) ++ struct hid_report *report, u8 *raw_data, int report_size) + { + struct wacom *wacom = hid_get_drvdata(hdev); + struct wacom_wac *wacom_wac = &wacom->wacom_wac; +@@ -152,7 +152,8 @@ static int wacom_wac_pen_serial_enforce(struct hid_device *hdev, + if (flush) + wacom_wac_queue_flush(hdev, &wacom_wac->pen_fifo); + else if (insert) +- wacom_wac_queue_insert(hdev, &wacom_wac->pen_fifo, raw_data, size); ++ wacom_wac_queue_insert(hdev, &wacom_wac->pen_fifo, ++ raw_data, report_size); + + return insert && !flush; + } +@@ -2147,7 +2148,7 @@ static void wacom_update_name(struct wacom *wacom, const char *suffix) + { + struct wacom_wac *wacom_wac = &wacom->wacom_wac; + struct wacom_features *features = &wacom_wac->features; +- char name[WACOM_NAME_MAX]; ++ char name[WACOM_NAME_MAX - 20]; /* Leave some room for suffixes */ + + /* Generic devices name unspecified */ + if ((features->type == HID_GENERIC) && !strcmp("Wacom HID", features->name)) { +diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c +index 6f5c838f9d474..1df037e7f0b42 100644 +--- a/drivers/hid/wacom_wac.c ++++ b/drivers/hid/wacom_wac.c +@@ -255,7 +255,7 @@ static int wacom_dtu_irq(struct wacom_wac *wacom) + + static int wacom_dtus_irq(struct wacom_wac *wacom) + { +- char *data = wacom->data; ++ unsigned char *data = wacom->data; + struct input_dev *input = wacom->pen_input; + unsigned short prox, pressure = 0; + +@@ -576,7 +576,7 @@ static int wacom_intuos_pad(struct wacom_wac *wacom) + strip2 = ((data[3] & 0x1f) << 8) | data[4]; + } + +- prox = (buttons & ~(~0 << nbuttons)) | (keys & ~(~0 << nkeys)) | ++ prox = (buttons & ~(~0U << nbuttons)) | (keys & ~(~0U << nkeys)) | + (ring1 & 0x80) | (ring2 & 0x80) | strip1 | strip2; + + wacom_report_numbered_buttons(input, nbuttons, buttons); +-- +2.20.1 + diff --git a/queue-4.19/hypfs-fix-error-number-left-in-struct-pointer-member.patch b/queue-4.19/hypfs-fix-error-number-left-in-struct-pointer-member.patch new file mode 100644 index 00000000000..6914d424ed8 --- /dev/null +++ b/queue-4.19/hypfs-fix-error-number-left-in-struct-pointer-member.patch @@ -0,0 +1,57 @@ +From 370819df6d74256fbcf49d3218e0ac05612e385c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 21 Mar 2019 10:08:08 +0000 +Subject: hypfs: Fix error number left in struct pointer member + +From: David Howells + +[ 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 +cc: Martin Schwidefsky +cc: Heiko Carstens +cc: linux-s390@vger.kernel.org +Signed-off-by: Al Viro +Signed-off-by: Sasha Levin +--- + 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 c681329fdeec6..e4d17d9ea93d8 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.19/i2c-cht-wc-fix-lockdep-warning.patch b/queue-4.19/i2c-cht-wc-fix-lockdep-warning.patch new file mode 100644 index 00000000000..ce30edde3eb --- /dev/null +++ b/queue-4.19/i2c-cht-wc-fix-lockdep-warning.patch @@ -0,0 +1,190 @@ +From 9db313ae56b18b7826ff4ec257175b9828553c7f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 13 Aug 2019 12:03:01 +0200 +Subject: i2c-cht-wc: Fix lockdep warning + +From: Hans de Goede + +[ 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 +Signed-off-by: Wolfram Sang +Signed-off-by: Sasha Levin +--- + 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 c4d176f5ed793..f890af67f5017 100644 +--- a/drivers/i2c/busses/i2c-cht-wc.c ++++ b/drivers/i2c/busses/i2c-cht-wc.c +@@ -187,6 +187,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) + { +@@ -295,6 +340,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.19/ipmi_si-only-schedule-continuously-in-the-thread-in-.patch b/queue-4.19/ipmi_si-only-schedule-continuously-in-the-thread-in-.patch new file mode 100644 index 00000000000..a793c66cc27 --- /dev/null +++ b/queue-4.19/ipmi_si-only-schedule-continuously-in-the-thread-in-.patch @@ -0,0 +1,88 @@ +From 75cfc88c5a74ec1f4df770404ce208734ffe4084 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 2 Aug 2019 07:31:36 -0500 +Subject: ipmi_si: Only schedule continuously in the thread in maintenance mode + +From: Corey Minyard + +[ 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 +Signed-off-by: Sasha Levin +--- + 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 75e5006f395a5..006d765256782 100644 +--- a/drivers/char/ipmi/ipmi_si_intf.c ++++ b/drivers/char/ipmi/ipmi_si_intf.c +@@ -221,6 +221,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? + */ +@@ -1013,11 +1016,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 { +@@ -1025,8 +1037,9 @@ static int ipmi_thread(void *data) + __set_current_state(TASK_INTERRUPTIBLE); + schedule(); + } +- } else ++ } else { + schedule_timeout_interruptible(1); ++ } + } + return 0; + } +@@ -1201,6 +1214,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 void shutdown_smi(void *send_info); +-- +2.20.1 + diff --git a/queue-4.19/kbuild-clean-compressed-initramfs-image.patch b/queue-4.19/kbuild-clean-compressed-initramfs-image.patch new file mode 100644 index 00000000000..d53c2f509c8 --- /dev/null +++ b/queue-4.19/kbuild-clean-compressed-initramfs-image.patch @@ -0,0 +1,56 @@ +From 8d4dcb9af76348bf8796d4fd82a73095120e0ef5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 23 Sep 2019 15:33:05 -0700 +Subject: kbuild: clean compressed initramfs image + +From: Greg Thelen + +[ 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 +Cc: Nicholas Piggin +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Sasha Levin +--- + usr/Makefile | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/usr/Makefile b/usr/Makefile +index 748f6a60bb1e0..138c18cefb529 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.19/kmemleak-increase-debug_kmemleak_early_log_size-defa.patch b/queue-4.19/kmemleak-increase-debug_kmemleak_early_log_size-defa.patch new file mode 100644 index 00000000000..adc20a95734 --- /dev/null +++ b/queue-4.19/kmemleak-increase-debug_kmemleak_early_log_size-defa.patch @@ -0,0 +1,57 @@ +From 414613137ad1ef7166b40a2c84554e6fe4cf14ab Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 23 Sep 2019 15:33:55 -0700 +Subject: kmemleak: increase DEBUG_KMEMLEAK_EARLY_LOG_SIZE default to 16K + +From: Nicolas Boichat + +[ 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 +Suggested-by: Dmitry Vyukov +Acked-by: Catalin Marinas +Acked-by: Dmitry Vyukov +Cc: Masahiro Yamada +Cc: Kees Cook +Cc: Petr Mladek +Cc: Thomas Gleixner +Cc: Tetsuo Handa +Cc: Joe Lawrence +Cc: Uladzislau Rezki +Cc: Andy Shevchenko +Cc: Stephen Rothwell +Cc: Andrey Ryabinin +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Sasha Levin +--- + lib/Kconfig.debug | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug +index 3dea52f7be9c1..46a910acce3f0 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.19/livepatch-nullify-obj-mod-in-klp_module_coming-s-err.patch b/queue-4.19/livepatch-nullify-obj-mod-in-klp_module_coming-s-err.patch new file mode 100644 index 00000000000..ae7e17f5a27 --- /dev/null +++ b/queue-4.19/livepatch-nullify-obj-mod-in-klp_module_coming-s-err.patch @@ -0,0 +1,41 @@ +From 25ab12f821e1f7396ada77656f697f007fdceed7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 19 Jul 2019 14:28:39 +0200 +Subject: livepatch: Nullify obj->mod in klp_module_coming()'s error path + +From: Miroslav Benes + +[ 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 +Reviewed-by: Petr Mladek +Acked-by: Josh Poimboeuf +Signed-off-by: Petr Mladek +Signed-off-by: Sasha Levin +--- + kernel/livepatch/core.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c +index 722c27c40e5b3..a1250ad591c1d 100644 +--- a/kernel/livepatch/core.c ++++ b/kernel/livepatch/core.c +@@ -1027,6 +1027,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.19/mbox-qcom-add-apcs-child-device-for-qcs404.patch b/queue-4.19/mbox-qcom-add-apcs-child-device-for-qcs404.patch new file mode 100644 index 00000000000..1141d36e16c --- /dev/null +++ b/queue-4.19/mbox-qcom-add-apcs-child-device-for-qcs404.patch @@ -0,0 +1,59 @@ +From e2144d91266b3e2b111fa3ca6b298fac71e2308b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 29 Aug 2019 10:27:58 +0200 +Subject: mbox: qcom: add APCS child device for QCS404 + +From: Jorge Ramirez-Ortiz + +[ Upstream commit 78c86458a440ff356073c21b568cb58ddb67b82b ] + +There is clock controller functionality in the APCS hardware block of +qcs404 devices similar to msm8916. + +Co-developed-by: Niklas Cassel +Signed-off-by: Niklas Cassel +Signed-off-by: Jorge Ramirez-Ortiz +Reviewed-by: Bjorn Andersson +Reviewed-by: Stephen Boyd +Signed-off-by: Jassi Brar +Signed-off-by: Sasha Levin +--- + drivers/mailbox/qcom-apcs-ipc-mailbox.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/drivers/mailbox/qcom-apcs-ipc-mailbox.c b/drivers/mailbox/qcom-apcs-ipc-mailbox.c +index 333ed4a9d4b8f..5255dcb551a78 100644 +--- a/drivers/mailbox/qcom-apcs-ipc-mailbox.c ++++ b/drivers/mailbox/qcom-apcs-ipc-mailbox.c +@@ -55,7 +55,6 @@ static const struct mbox_chan_ops qcom_apcs_ipc_ops = { + + static int qcom_apcs_ipc_probe(struct platform_device *pdev) + { +- struct device_node *np = pdev->dev.of_node; + struct qcom_apcs_ipc *apcs; + struct regmap *regmap; + struct resource *res; +@@ -63,6 +62,11 @@ static int qcom_apcs_ipc_probe(struct platform_device *pdev) + void __iomem *base; + unsigned long i; + int ret; ++ const struct of_device_id apcs_clk_match_table[] = { ++ { .compatible = "qcom,msm8916-apcs-kpss-global", }, ++ { .compatible = "qcom,qcs404-apcs-apps-global", }, ++ {} ++ }; + + apcs = devm_kzalloc(&pdev->dev, sizeof(*apcs), GFP_KERNEL); + if (!apcs) +@@ -97,7 +101,7 @@ static int qcom_apcs_ipc_probe(struct platform_device *pdev) + return ret; + } + +- if (of_device_is_compatible(np, "qcom,msm8916-apcs-kpss-global")) { ++ if (of_match_device(apcs_clk_match_table, &pdev->dev)) { + apcs->clk = platform_device_register_data(&pdev->dev, + "qcom-apcs-msm8916-clk", + -1, NULL, 0); +-- +2.20.1 + diff --git a/queue-4.19/mfd-intel-lpss-remove-d3cold-delay.patch b/queue-4.19/mfd-intel-lpss-remove-d3cold-delay.patch new file mode 100644 index 00000000000..fbbbdf1abf6 --- /dev/null +++ b/queue-4.19/mfd-intel-lpss-remove-d3cold-delay.patch @@ -0,0 +1,47 @@ +From a156b0c80396e51afea8303429ac58f93c532466 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 5 Jul 2019 12:55:03 +0800 +Subject: mfd: intel-lpss: Remove D3cold delay + +From: Kai-Heng Feng + +[ 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 +Reviewed-by: Andy Shevchenko +Signed-off-by: Lee Jones +Signed-off-by: Sasha Levin +--- + 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 0e5282fc14675..c37c8bb860685 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.19/mips-ingenic-disable-broken-btb-lookup-optimization.patch b/queue-4.19/mips-ingenic-disable-broken-btb-lookup-optimization.patch new file mode 100644 index 00000000000..90c764e38c2 --- /dev/null +++ b/queue-4.19/mips-ingenic-disable-broken-btb-lookup-optimization.patch @@ -0,0 +1,78 @@ +From ef98c40ee8884846b52966354c74326744895a31 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 2 Aug 2019 16:27:37 +0800 +Subject: MIPS: Ingenic: Disable broken BTB lookup optimization. + +From: Zhou Yanjie + +[ Upstream commit 053951dda71ecb4b554a2cdbe26f5f6f9bee9dd2 ] + +In order to further reduce power consumption, the XBurst core +by default attempts to avoid branch target buffer lookups by +detecting & special casing loops. This feature will cause +BogoMIPS and lpj calculate in error. Set cp0 config7 bit 4 to +disable this feature. + +Signed-off-by: Zhou Yanjie +Signed-off-by: Paul Burton +Cc: linux-mips@vger.kernel.org +Cc: linux-kernel@vger.kernel.org +Cc: ralf@linux-mips.org +Cc: paul@crapouillou.net +Cc: jhogan@kernel.org +Cc: malat@debian.org +Cc: gregkh@linuxfoundation.org +Cc: tglx@linutronix.de +Cc: allison@lohutok.net +Cc: syq@debian.org +Cc: chenhc@lemote.com +Cc: jiaxun.yang@flygoat.com +Signed-off-by: Sasha Levin +--- + arch/mips/include/asm/mipsregs.h | 4 ++++ + arch/mips/kernel/cpu-probe.c | 7 +++++++ + 2 files changed, 11 insertions(+) + +diff --git a/arch/mips/include/asm/mipsregs.h b/arch/mips/include/asm/mipsregs.h +index 01df9ad62fb83..1bb9448777c5c 100644 +--- a/arch/mips/include/asm/mipsregs.h ++++ b/arch/mips/include/asm/mipsregs.h +@@ -688,6 +688,9 @@ + #define MIPS_CONF7_IAR (_ULCAST_(1) << 10) + #define MIPS_CONF7_AR (_ULCAST_(1) << 16) + ++/* Ingenic Config7 bits */ ++#define MIPS_CONF7_BTB_LOOP_EN (_ULCAST_(1) << 4) ++ + /* Config7 Bits specific to MIPS Technologies. */ + + /* Performance counters implemented Per TC */ +@@ -2774,6 +2777,7 @@ __BUILD_SET_C0(status) + __BUILD_SET_C0(cause) + __BUILD_SET_C0(config) + __BUILD_SET_C0(config5) ++__BUILD_SET_C0(config7) + __BUILD_SET_C0(intcontrol) + __BUILD_SET_C0(intctl) + __BUILD_SET_C0(srsmap) +diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c +index d535fc706a8b3..25cd8737e7fe0 100644 +--- a/arch/mips/kernel/cpu-probe.c ++++ b/arch/mips/kernel/cpu-probe.c +@@ -1879,6 +1879,13 @@ static inline void cpu_probe_ingenic(struct cpuinfo_mips *c, unsigned int cpu) + c->cputype = CPU_JZRISC; + c->writecombine = _CACHE_UNCACHED_ACCELERATED; + __cpu_name[cpu] = "Ingenic JZRISC"; ++ /* ++ * The XBurst core by default attempts to avoid branch target ++ * buffer lookups by detecting & special casing loops. This ++ * feature will cause BogoMIPS and lpj calculate in error. ++ * Set cp0 config7 bit 4 to disable this feature. ++ */ ++ set_c0_config7(MIPS_CONF7_BTB_LOOP_EN); + break; + default: + panic("Unknown Ingenic Processor ID!"); +-- +2.20.1 + diff --git a/queue-4.19/mips-properly-account-for-stack-randomization-and-st.patch b/queue-4.19/mips-properly-account-for-stack-randomization-and-st.patch new file mode 100644 index 00000000000..39007a7b994 --- /dev/null +++ b/queue-4.19/mips-properly-account-for-stack-randomization-and-st.patch @@ -0,0 +1,71 @@ +From e62d3858368cb9438ba5d5b27851c0549fe72fd3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 23 Sep 2019 15:39:04 -0700 +Subject: mips: properly account for stack randomization and stack guard gap + +From: Alexandre Ghiti + +[ Upstream commit b1f61b5bde3a1f50392c97b4c8513d1b8efb1cf2 ] + +This commit takes care of stack randomization and stack guard gap when +computing mmap base address and checks if the task asked for +randomization. This fixes the problem uncovered and not fixed for arm +here: https://lkml.kernel.org/r/20170622200033.25714-1-riel@redhat.com + +Link: http://lkml.kernel.org/r/20190730055113.23635-10-alex@ghiti.fr +Signed-off-by: Alexandre Ghiti +Acked-by: Kees Cook +Acked-by: Paul Burton +Reviewed-by: Luis Chamberlain +Cc: Albert Ou +Cc: Alexander Viro +Cc: Catalin Marinas +Cc: Christoph Hellwig +Cc: Christoph Hellwig +Cc: James Hogan +Cc: Palmer Dabbelt +Cc: Ralf Baechle +Cc: Russell King +Cc: Will Deacon +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Sasha Levin +--- + arch/mips/mm/mmap.c | 14 ++++++++++++-- + 1 file changed, 12 insertions(+), 2 deletions(-) + +diff --git a/arch/mips/mm/mmap.c b/arch/mips/mm/mmap.c +index 1b705fb2f10c4..233033f99d8fc 100644 +--- a/arch/mips/mm/mmap.c ++++ b/arch/mips/mm/mmap.c +@@ -21,8 +21,9 @@ unsigned long shm_align_mask = PAGE_SIZE - 1; /* Sane caches */ + EXPORT_SYMBOL(shm_align_mask); + + /* gap between mmap and stack */ +-#define MIN_GAP (128*1024*1024UL) +-#define MAX_GAP ((TASK_SIZE)/6*5) ++#define MIN_GAP (128*1024*1024UL) ++#define MAX_GAP ((TASK_SIZE)/6*5) ++#define STACK_RND_MASK (0x7ff >> (PAGE_SHIFT - 12)) + + static int mmap_is_legacy(struct rlimit *rlim_stack) + { +@@ -38,6 +39,15 @@ static int mmap_is_legacy(struct rlimit *rlim_stack) + static unsigned long mmap_base(unsigned long rnd, struct rlimit *rlim_stack) + { + unsigned long gap = rlim_stack->rlim_cur; ++ unsigned long pad = stack_guard_gap; ++ ++ /* Account for stack randomization if necessary */ ++ if (current->flags & PF_RANDOMIZE) ++ pad += (STACK_RND_MASK << PAGE_SHIFT); ++ ++ /* Values close to RLIM_INFINITY can overflow. */ ++ if (gap + pad > gap) ++ gap += pad; + + if (gap < MIN_GAP) + gap = MIN_GAP; +-- +2.20.1 + diff --git a/queue-4.19/mips-tlbex-explicitly-cast-_page_no_exec-to-a-boolea.patch b/queue-4.19/mips-tlbex-explicitly-cast-_page_no_exec-to-a-boolea.patch new file mode 100644 index 00000000000..7f1f902770e --- /dev/null +++ b/queue-4.19/mips-tlbex-explicitly-cast-_page_no_exec-to-a-boolea.patch @@ -0,0 +1,59 @@ +From afdc71bbc49c9c237d3fcacecc33955a8fe5903e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 11 Aug 2019 20:31:20 -0700 +Subject: MIPS: tlbex: Explicitly cast _PAGE_NO_EXEC to a boolean + +From: Nathan Chancellor + +[ 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 +Signed-off-by: Paul Burton +Cc: Ralf Baechle +Cc: James Hogan +Cc: Nick Desaulniers +Cc: linux-mips@vger.kernel.org +Cc: linux-kernel@vger.kernel.org +Cc: clang-built-linux@googlegroups.com +Signed-off-by: Sasha Levin +--- + 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 8c4fda52b91dc..355f8eadb1cd2 100644 +--- a/arch/mips/mm/tlbex.c ++++ b/arch/mips/mm/tlbex.c +@@ -630,7 +630,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.19/ocfs2-wait-for-recovering-done-after-direct-unlock-r.patch b/queue-4.19/ocfs2-wait-for-recovering-done-after-direct-unlock-r.patch new file mode 100644 index 00000000000..14d1c60ce4a --- /dev/null +++ b/queue-4.19/ocfs2-wait-for-recovering-done-after-direct-unlock-r.patch @@ -0,0 +1,94 @@ +From 3f5219516e1e27d482b5d11b9898e321ba18282d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 23 Sep 2019 15:33:37 -0700 +Subject: ocfs2: wait for recovering done after direct unlock request + +From: Changwei Ge + +[ 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 +Reviewed-by: Joseph Qi +Cc: Mark Fasheh +Cc: Joel Becker +Cc: Junxiao Bi +Cc: Changwei Ge +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Sasha Levin +--- + 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.19/pci-exynos-propagate-errors-for-optional-phys.patch b/queue-4.19/pci-exynos-propagate-errors-for-optional-phys.patch new file mode 100644 index 00000000000..e2cf1c40abe --- /dev/null +++ b/queue-4.19/pci-exynos-propagate-errors-for-optional-phys.patch @@ -0,0 +1,48 @@ +From a742bd86676bad731127298961423a35c78ce658 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 29 Aug 2019 12:53:15 +0200 +Subject: PCI: exynos: Propagate errors for optional PHYs + +From: Thierry Reding + +[ 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 +Signed-off-by: Lorenzo Pieralisi +Reviewed-by: Andrew Murray +Cc: Jingoo Han +Cc: Kukjin Kim +Cc: Krzysztof Kozlowski +Signed-off-by: Sasha Levin +--- + drivers/pci/controller/dwc/pci-exynos.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/pci/controller/dwc/pci-exynos.c b/drivers/pci/controller/dwc/pci-exynos.c +index cee5f2f590e2d..14a6ba4067fbe 100644 +--- a/drivers/pci/controller/dwc/pci-exynos.c ++++ b/drivers/pci/controller/dwc/pci-exynos.c +@@ -465,7 +465,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); + + ep->phy = NULL; +-- +2.20.1 + diff --git a/queue-4.19/pci-histb-propagate-errors-for-optional-regulators.patch b/queue-4.19/pci-histb-propagate-errors-for-optional-regulators.patch new file mode 100644 index 00000000000..7c53fb13280 --- /dev/null +++ b/queue-4.19/pci-histb-propagate-errors-for-optional-regulators.patch @@ -0,0 +1,48 @@ +From 4d53334f64d64ec16171f8d9db12c2f5d76c3a58 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 29 Aug 2019 12:53:18 +0200 +Subject: PCI: histb: Propagate errors for optional regulators + +From: Thierry Reding + +[ Upstream commit 8f9e1641ba445437095411d9fda2324121110d5d ] + +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 +Signed-off-by: Lorenzo Pieralisi +Reviewed-by: Andrew Murray +Cc: Shawn Guo +Signed-off-by: Sasha Levin +--- + drivers/pci/controller/dwc/pcie-histb.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/pci/controller/dwc/pcie-histb.c b/drivers/pci/controller/dwc/pcie-histb.c +index 7b32e619b959c..a3489839a8fc3 100644 +--- a/drivers/pci/controller/dwc/pcie-histb.c ++++ b/drivers/pci/controller/dwc/pcie-histb.c +@@ -340,8 +340,8 @@ static int histb_pcie_probe(struct platform_device *pdev) + + hipcie->vpcie = devm_regulator_get_optional(dev, "vpcie"); + if (IS_ERR(hipcie->vpcie)) { +- if (PTR_ERR(hipcie->vpcie) == -EPROBE_DEFER) +- return -EPROBE_DEFER; ++ if (PTR_ERR(hipcie->vpcie) != -ENODEV) ++ return PTR_ERR(hipcie->vpcie); + hipcie->vpcie = NULL; + } + +-- +2.20.1 + diff --git a/queue-4.19/pci-imx6-propagate-errors-for-optional-regulators.patch b/queue-4.19/pci-imx6-propagate-errors-for-optional-regulators.patch new file mode 100644 index 00000000000..2cfc885c177 --- /dev/null +++ b/queue-4.19/pci-imx6-propagate-errors-for-optional-regulators.patch @@ -0,0 +1,54 @@ +From 92d05ab73a1038c802ffffa95bb12a9ff67a767e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 29 Aug 2019 12:53:16 +0200 +Subject: PCI: imx6: Propagate errors for optional regulators + +From: Thierry Reding + +[ 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 +Signed-off-by: Lorenzo Pieralisi +Reviewed-by: Andrew Murray +Cc: Richard Zhu +Cc: Lucas Stach +Cc: Shawn Guo +Cc: Sascha Hauer +Cc: Fabio Estevam +Cc: kernel@pengutronix.de +Cc: linux-imx@nxp.com +Signed-off-by: Sasha Levin +--- + drivers/pci/controller/dwc/pci-imx6.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c +index 3826b444298c1..3b2ceb5667289 100644 +--- a/drivers/pci/controller/dwc/pci-imx6.c ++++ b/drivers/pci/controller/dwc/pci-imx6.c +@@ -807,8 +807,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.19/pci-rockchip-propagate-errors-for-optional-regulator.patch b/queue-4.19/pci-rockchip-propagate-errors-for-optional-regulator.patch new file mode 100644 index 00000000000..042f1e382a3 --- /dev/null +++ b/queue-4.19/pci-rockchip-propagate-errors-for-optional-regulator.patch @@ -0,0 +1,80 @@ +From 671e8f6ef9c132bd81f2c4459d03d04cb14c98b3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 29 Aug 2019 12:53:14 +0200 +Subject: PCI: rockchip: Propagate errors for optional regulators + +From: Thierry Reding + +[ 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 +Signed-off-by: Thierry Reding +Signed-off-by: Lorenzo Pieralisi +Reviewed-by: Andrew Murray +Reviewed-by: Heiko Stuebner +Acked-by: Shawn Lin +Cc: Shawn Lin +Cc: Heiko Stuebner +Cc: linux-rockchip@lists.infradead.org +Signed-off-by: Sasha Levin +--- + drivers/pci/controller/pcie-rockchip-host.c | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +diff --git a/drivers/pci/controller/pcie-rockchip-host.c b/drivers/pci/controller/pcie-rockchip-host.c +index 1372d270764f9..5ce8e63756875 100644 +--- a/drivers/pci/controller/pcie-rockchip-host.c ++++ b/drivers/pci/controller/pcie-rockchip-host.c +@@ -608,29 +608,29 @@ static int rockchip_pcie_parse_host_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.19/pci-rpaphp-avoid-a-sometimes-uninitialized-warning.patch b/queue-4.19/pci-rpaphp-avoid-a-sometimes-uninitialized-warning.patch new file mode 100644 index 00000000000..3a0969c5c11 --- /dev/null +++ b/queue-4.19/pci-rpaphp-avoid-a-sometimes-uninitialized-warning.patch @@ -0,0 +1,87 @@ +From 605176dcdde21f2fddad5920b421f31a9cd371d0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 3 Jun 2019 15:11:58 -0700 +Subject: PCI: rpaphp: Avoid a sometimes-uninitialized warning + +From: Nathan Chancellor + +[ Upstream commit 0df3e42167caaf9f8c7b64de3da40a459979afe8 ] + +When building with -Wsometimes-uninitialized, clang warns: + +drivers/pci/hotplug/rpaphp_core.c:243:14: warning: variable 'fndit' is +used uninitialized whenever 'for' loop exits because its condition is +false [-Wsometimes-uninitialized] + for (j = 0; j < entries; j++) { + ^~~~~~~~~~~ +drivers/pci/hotplug/rpaphp_core.c:256:6: note: uninitialized use occurs +here + if (fndit) + ^~~~~ +drivers/pci/hotplug/rpaphp_core.c:243:14: note: remove the condition if +it is always true + for (j = 0; j < entries; j++) { + ^~~~~~~~~~~ +drivers/pci/hotplug/rpaphp_core.c:233:14: note: initialize the variable +'fndit' to silence this warning + int j, fndit; + ^ + = 0 + +fndit is only used to gate a sprintf call, which can be moved into the +loop to simplify the code and eliminate the local variable, which will +fix this warning. + +Fixes: 2fcf3ae508c2 ("hotplug/drc-info: Add code to search ibm,drc-info property") +Suggested-by: Nick Desaulniers +Signed-off-by: Nathan Chancellor +Acked-by: Tyrel Datwyler +Acked-by: Joel Savitz +Signed-off-by: Michael Ellerman +Link: https://github.com/ClangBuiltLinux/linux/issues/504 +Link: https://lore.kernel.org/r/20190603221157.58502-1-natechancellor@gmail.com +Signed-off-by: Sasha Levin +--- + drivers/pci/hotplug/rpaphp_core.c | 18 +++++++----------- + 1 file changed, 7 insertions(+), 11 deletions(-) + +diff --git a/drivers/pci/hotplug/rpaphp_core.c b/drivers/pci/hotplug/rpaphp_core.c +index 857c358b727b8..cc860c5f7d26f 100644 +--- a/drivers/pci/hotplug/rpaphp_core.c ++++ b/drivers/pci/hotplug/rpaphp_core.c +@@ -230,7 +230,7 @@ static int rpaphp_check_drc_props_v2(struct device_node *dn, char *drc_name, + struct of_drc_info drc; + const __be32 *value; + char cell_drc_name[MAX_DRC_NAME_LEN]; +- int j, fndit; ++ int j; + + info = of_find_property(dn->parent, "ibm,drc-info", NULL); + if (info == NULL) +@@ -245,17 +245,13 @@ static int rpaphp_check_drc_props_v2(struct device_node *dn, char *drc_name, + + /* Should now know end of current entry */ + +- if (my_index > drc.last_drc_index) +- continue; +- +- fndit = 1; +- break; ++ /* Found it */ ++ if (my_index <= drc.last_drc_index) { ++ sprintf(cell_drc_name, "%s%d", drc.drc_name_prefix, ++ my_index); ++ break; ++ } + } +- /* Found it */ +- +- if (fndit) +- sprintf(cell_drc_name, "%s%d", drc.drc_name_prefix, +- my_index); + + if (((drc_name == NULL) || + (drc_name && !strcmp(drc_name, cell_drc_name))) && +-- +2.20.1 + diff --git a/queue-4.19/pci-tegra-fix-of-node-reference-leak.patch b/queue-4.19/pci-tegra-fix-of-node-reference-leak.patch new file mode 100644 index 00000000000..c1bd18586f0 --- /dev/null +++ b/queue-4.19/pci-tegra-fix-of-node-reference-leak.patch @@ -0,0 +1,101 @@ +From 90af1e1005807513f0202d5d6b2411da5fa44b7d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 24 Jul 2019 13:54:12 +0530 +Subject: PCI: tegra: Fix OF node reference leak + +From: Nishka Dasgupta + +[ 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 +[lorenzo.pieralisi@arm.com: rewrote commit log] +Signed-off-by: Lorenzo Pieralisi +Signed-off-by: Sasha Levin +--- + drivers/pci/controller/pci-tegra.c | 22 +++++++++++++++------- + 1 file changed, 15 insertions(+), 7 deletions(-) + +diff --git a/drivers/pci/controller/pci-tegra.c b/drivers/pci/controller/pci-tegra.c +index f4f53d092e005..976eaa9a9f266 100644 +--- a/drivers/pci/controller/pci-tegra.c ++++ b/drivers/pci/controller/pci-tegra.c +@@ -1975,14 +1975,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--; +@@ -1991,12 +1992,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); +@@ -2010,13 +2012,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); +@@ -2043,6 +2047,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.19/pinctrl-amd-disable-spurious-firing-gpio-irqs.patch b/queue-4.19/pinctrl-amd-disable-spurious-firing-gpio-irqs.patch new file mode 100644 index 00000000000..9ac95b2aaaf --- /dev/null +++ b/queue-4.19/pinctrl-amd-disable-spurious-firing-gpio-irqs.patch @@ -0,0 +1,74 @@ +From 66fe4e7ba677f6cd987638ef3c1836c5bc0ef7b6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 14 Aug 2019 17:05:40 +0800 +Subject: pinctrl: amd: disable spurious-firing GPIO IRQs + +From: Daniel Drake + +[ Upstream commit d21b8adbd475dba19ac2086d3306327b4a297418 ] + +When cold-booting Asus X434DA, GPIO 7 is found to be already configured +as an interrupt, and the GPIO level is found to be in a state that +causes the interrupt to fire. + +As soon as pinctrl-amd probes, this interrupt fires and invokes +amd_gpio_irq_handler(). The IRQ is acked, but no GPIO-IRQ handler was +invoked, so the GPIO level being unchanged just causes another interrupt +to fire again immediately after. + +This results in an interrupt storm causing this platform to hang +during boot, right after pinctrl-amd is probed. + +Detect this situation and disable the GPIO interrupt when this happens. +This enables the affected platform to boot as normal. GPIO 7 actually is +the I2C touchpad interrupt line, and later on, i2c-multitouch loads and +re-enables this interrupt when it is ready to handle it. + +Instead of this approach, I considered disabling all GPIO interrupts at +probe time, however that seems a little risky, and I also confirmed that +Windows does not seem to have this behaviour: the same 41 GPIO IRQs are +enabled under both Linux and Windows, which is a far larger collection +than the GPIOs referenced by the DSDT on this platform. + +Signed-off-by: Daniel Drake +Link: https://lore.kernel.org/r/20190814090540.7152-1-drake@endlessm.com +Signed-off-by: Linus Walleij +Signed-off-by: Sasha Levin +--- + drivers/pinctrl/pinctrl-amd.c | 12 +++++++++++- + 1 file changed, 11 insertions(+), 1 deletion(-) + +diff --git a/drivers/pinctrl/pinctrl-amd.c b/drivers/pinctrl/pinctrl-amd.c +index 1425c2874d402..cd7a5d95b499a 100644 +--- a/drivers/pinctrl/pinctrl-amd.c ++++ b/drivers/pinctrl/pinctrl-amd.c +@@ -569,15 +569,25 @@ static irqreturn_t amd_gpio_irq_handler(int irq, void *dev_id) + !(regval & BIT(INTERRUPT_MASK_OFF))) + continue; + irq = irq_find_mapping(gc->irq.domain, irqnr + i); +- generic_handle_irq(irq); ++ if (irq != 0) ++ generic_handle_irq(irq); + + /* Clear interrupt. + * We must read the pin register again, in case the + * value was changed while executing + * generic_handle_irq() above. ++ * If we didn't find a mapping for the interrupt, ++ * disable it in order to avoid a system hang caused ++ * by an interrupt storm. + */ + raw_spin_lock_irqsave(&gpio_dev->lock, flags); + regval = readl(regs + i); ++ if (irq == 0) { ++ regval &= ~BIT(INTERRUPT_ENABLE_OFF); ++ dev_dbg(&gpio_dev->pdev->dev, ++ "Disabling spurious GPIO IRQ %d\n", ++ irqnr + i); ++ } + writel(regval, regs + i); + raw_spin_unlock_irqrestore(&gpio_dev->lock, flags); + ret = IRQ_HANDLED; +-- +2.20.1 + diff --git a/queue-4.19/pinctrl-meson-gxbb-fix-wrong-pinning-definition-for-.patch b/queue-4.19/pinctrl-meson-gxbb-fix-wrong-pinning-definition-for-.patch new file mode 100644 index 00000000000..e24901deca8 --- /dev/null +++ b/queue-4.19/pinctrl-meson-gxbb-fix-wrong-pinning-definition-for-.patch @@ -0,0 +1,63 @@ +From f2b94744af4c8b3ee07d484d4216e1586ffcfd43 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 10 Sep 2019 18:01:41 +0200 +Subject: pinctrl: meson-gxbb: Fix wrong pinning definition for uart_c + +From: Otto Meier + +[ Upstream commit cb0438e4436085d89706b5ccfce4d5da531253de ] + +Hi i tried to use the uart_C of the the odroid-c2. + +I enabled it in the dts file. During boot it crashed when the +the sdcard slot is addressed. + +After long search in the net i found this: + +https://forum.odroid.com/viewtopic.php?f=139&t=25371&p=194370&hilit=uart_C#p177856 + +After changing the pin definitions accordingly erverything works. +Uart_c is functioning and sdcard ist working. + +Fixes: 6db0f3a8a04e46 ("pinctrl: amlogic: gxbb: add more UART pins") +Signed-off-by: Otto Meier +Link: https://lore.kernel.org/r/1cc32a18-464d-5531-7a1c-084390e2ecb1@gmx.net +Signed-off-by: Linus Walleij +Signed-off-by: Sasha Levin +--- + drivers/pinctrl/meson/pinctrl-meson-gxbb.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/drivers/pinctrl/meson/pinctrl-meson-gxbb.c b/drivers/pinctrl/meson/pinctrl-meson-gxbb.c +index 4edeb4cae72aa..c4c70dc57dbee 100644 +--- a/drivers/pinctrl/meson/pinctrl-meson-gxbb.c ++++ b/drivers/pinctrl/meson/pinctrl-meson-gxbb.c +@@ -198,8 +198,8 @@ static const unsigned int uart_rts_b_pins[] = { GPIODV_27 }; + + static const unsigned int uart_tx_c_pins[] = { GPIOY_13 }; + static const unsigned int uart_rx_c_pins[] = { GPIOY_14 }; +-static const unsigned int uart_cts_c_pins[] = { GPIOX_11 }; +-static const unsigned int uart_rts_c_pins[] = { GPIOX_12 }; ++static const unsigned int uart_cts_c_pins[] = { GPIOY_11 }; ++static const unsigned int uart_rts_c_pins[] = { GPIOY_12 }; + + static const unsigned int i2c_sck_a_pins[] = { GPIODV_25 }; + static const unsigned int i2c_sda_a_pins[] = { GPIODV_24 }; +@@ -445,10 +445,10 @@ static struct meson_pmx_group meson_gxbb_periphs_groups[] = { + GROUP(pwm_f_x, 3, 18), + + /* Bank Y */ +- GROUP(uart_cts_c, 1, 19), +- GROUP(uart_rts_c, 1, 18), +- GROUP(uart_tx_c, 1, 17), +- GROUP(uart_rx_c, 1, 16), ++ GROUP(uart_cts_c, 1, 17), ++ GROUP(uart_rts_c, 1, 16), ++ GROUP(uart_tx_c, 1, 19), ++ GROUP(uart_rx_c, 1, 18), + GROUP(pwm_a_y, 1, 21), + GROUP(pwm_f_y, 1, 20), + GROUP(i2s_out_ch23_y, 1, 5), +-- +2.20.1 + diff --git a/queue-4.19/pinctrl-tegra-fix-write-barrier-placement-in-pmx_wri.patch b/queue-4.19/pinctrl-tegra-fix-write-barrier-placement-in-pmx_wri.patch new file mode 100644 index 00000000000..404affcd9fe --- /dev/null +++ b/queue-4.19/pinctrl-tegra-fix-write-barrier-placement-in-pmx_wri.patch @@ -0,0 +1,44 @@ +From 83a101c9950a0a429a468fe64cb45a24205bdc9a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 16 Aug 2019 12:41:46 -0700 +Subject: pinctrl: tegra: Fix write barrier placement in pmx_writel + +From: Sowjanya Komatineni + +[ 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 +Reviewed-by: Dmitry Osipenko +Signed-off-by: Sowjanya Komatineni +Link: https://lore.kernel.org/r/1565984527-5272-2-git-send-email-skomatineni@nvidia.com +Signed-off-by: Linus Walleij +Signed-off-by: Sasha Levin +--- + 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 1aba75897d147..26a3f1eb9c6bf 100644 +--- a/drivers/pinctrl/tegra/pinctrl-tegra.c ++++ b/drivers/pinctrl/tegra/pinctrl-tegra.c +@@ -40,7 +40,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.19/pktcdvd-remove-warning-on-attempting-to-register-non.patch b/queue-4.19/pktcdvd-remove-warning-on-attempting-to-register-non.patch new file mode 100644 index 00000000000..1b618cc5bca --- /dev/null +++ b/queue-4.19/pktcdvd-remove-warning-on-attempting-to-register-non.patch @@ -0,0 +1,87 @@ +From a6de5ef10bbf420c7154e50317d4ebe6d4d20795 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 22 Sep 2019 10:01:05 -0600 +Subject: pktcdvd: remove warning on attempting to register non-passthrough dev + +From: Jens Axboe + +[ 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 +Signed-off-by: Jens Axboe +Signed-off-by: Sasha Levin +--- + drivers/block/pktcdvd.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c +index 6f1d25c1eb640..0bc344d22f013 100644 +--- a/drivers/block/pktcdvd.c ++++ b/drivers/block/pktcdvd.c +@@ -2596,7 +2596,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.19/powerpc-64s-exception-machine-check-use-correct-cfar.patch b/queue-4.19/powerpc-64s-exception-machine-check-use-correct-cfar.patch new file mode 100644 index 00000000000..8a85c067afd --- /dev/null +++ b/queue-4.19/powerpc-64s-exception-machine-check-use-correct-cfar.patch @@ -0,0 +1,46 @@ +From 03acf1c8b85ba389fd435d421deff9c25778ff3b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 2 Aug 2019 20:56:32 +1000 +Subject: powerpc/64s/exception: machine check use correct cfar for late + handler + +From: Nicholas Piggin + +[ 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 +Signed-off-by: Michael Ellerman +Link: https://lore.kernel.org/r/20190802105709.27696-8-npiggin@gmail.com +Signed-off-by: Sasha Levin +--- + 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 06cc77813dbb7..90af86f143a91 100644 +--- a/arch/powerpc/kernel/exceptions-64s.S ++++ b/arch/powerpc/kernel/exceptions-64s.S +@@ -520,6 +520,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.19/powerpc-dump-kernel-log-before-carrying-out-fadump-o.patch b/queue-4.19/powerpc-dump-kernel-log-before-carrying-out-fadump-o.patch new file mode 100644 index 00000000000..7c231fcbc12 --- /dev/null +++ b/queue-4.19/powerpc-dump-kernel-log-before-carrying-out-fadump-o.patch @@ -0,0 +1,43 @@ +From 168a9fb4d7ffd0ee6692a5e9d137abfcfc784b60 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 4 Sep 2019 13:29:49 +0530 +Subject: powerpc: dump kernel log before carrying out fadump or kdump + +From: Ganesh Goudar + +[ Upstream commit e7ca44ed3ba77fc26cf32650bb71584896662474 ] + +Since commit 4388c9b3a6ee ("powerpc: Do not send system reset request +through the oops path"), pstore dmesg file is not updated when dump is +triggered from HMC. This commit modified system reset (sreset) handler +to invoke fadump or kdump (if configured), without pushing dmesg to +pstore. This leaves pstore to have old dmesg data which won't be much +of a help if kdump fails to capture the dump. This patch fixes that by +calling kmsg_dump() before heading to fadump ot kdump. + +Fixes: 4388c9b3a6ee ("powerpc: Do not send system reset request through the oops path") +Reviewed-by: Mahesh Salgaonkar +Reviewed-by: Nicholas Piggin +Signed-off-by: Ganesh Goudar +Signed-off-by: Michael Ellerman +Link: https://lore.kernel.org/r/20190904075949.15607-1-ganeshgr@linux.ibm.com +Signed-off-by: Sasha Levin +--- + arch/powerpc/kernel/traps.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c +index 02fe6d0201741..d5f351f02c153 100644 +--- a/arch/powerpc/kernel/traps.c ++++ b/arch/powerpc/kernel/traps.c +@@ -399,6 +399,7 @@ void system_reset_exception(struct pt_regs *regs) + if (debugger(regs)) + goto out; + ++ kmsg_dump(KMSG_DUMP_OOPS); + /* + * A system reset is a request to dump, so we always send + * it through the crashdump code (if fadump or kdump are +-- +2.20.1 + diff --git a/queue-4.19/powerpc-eeh-clear-stale-eeh_dev_no_handler-flag.patch b/queue-4.19/powerpc-eeh-clear-stale-eeh_dev_no_handler-flag.patch new file mode 100644 index 00000000000..b5d5859be37 --- /dev/null +++ b/queue-4.19/powerpc-eeh-clear-stale-eeh_dev_no_handler-flag.patch @@ -0,0 +1,75 @@ +From 76e198af1c7b674bcd76ee03744d5682f2f260c1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 16 Aug 2019 14:48:06 +1000 +Subject: powerpc/eeh: Clear stale EEH_DEV_NO_HANDLER flag + +From: Sam Bobroff + +[ Upstream commit aa06e3d60e245284d1e55497eb3108828092818d ] + +The EEH_DEV_NO_HANDLER flag is used by the EEH system to prevent the +use of driver callbacks in drivers that have been bound part way +through the recovery process. This is necessary to prevent later stage +handlers from being called when the earlier stage handlers haven't, +which can be confusing for drivers. + +However, the flag is set for all devices that are added after boot +time and only cleared at the end of the EEH recovery process. This +results in hot plugged devices erroneously having the flag set during +the first recovery after they are added (causing their driver's +handlers to be incorrectly ignored). + +To remedy this, clear the flag at the beginning of recovery +processing. The flag is still cleared at the end of recovery +processing, although it is no longer really necessary. + +Also clear the flag during eeh_handle_special_event(), for the same +reasons. + +Signed-off-by: Sam Bobroff +Signed-off-by: Michael Ellerman +Link: https://lore.kernel.org/r/b8ca5629d27de74c957d4f4b250177d1b6fc4bbd.1565930772.git.sbobroff@linux.ibm.com +Signed-off-by: Sasha Levin +--- + arch/powerpc/kernel/eeh_driver.c | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/arch/powerpc/kernel/eeh_driver.c b/arch/powerpc/kernel/eeh_driver.c +index 67619b4b3f96c..110eba400de7c 100644 +--- a/arch/powerpc/kernel/eeh_driver.c ++++ b/arch/powerpc/kernel/eeh_driver.c +@@ -811,6 +811,10 @@ void eeh_handle_normal_event(struct eeh_pe *pe) + pr_warn("EEH: This PCI device has failed %d times in the last hour and will be permanently disabled after %d failures.\n", + pe->freeze_count, eeh_max_freezes); + ++ eeh_for_each_pe(pe, tmp_pe) ++ eeh_pe_for_each_dev(tmp_pe, edev, tmp) ++ edev->mode &= ~EEH_DEV_NO_HANDLER; ++ + /* Walk the various device drivers attached to this slot through + * a reset sequence, giving each an opportunity to do what it needs + * to accomplish the reset. Each child gets a report of the +@@ -1004,7 +1008,8 @@ final: + */ + void eeh_handle_special_event(void) + { +- struct eeh_pe *pe, *phb_pe; ++ struct eeh_pe *pe, *phb_pe, *tmp_pe; ++ struct eeh_dev *edev, *tmp_edev; + struct pci_bus *bus; + struct pci_controller *hose; + unsigned long flags; +@@ -1075,6 +1080,10 @@ void eeh_handle_special_event(void) + (phb_pe->state & EEH_PE_RECOVERING)) + continue; + ++ eeh_for_each_pe(pe, tmp_pe) ++ eeh_pe_for_each_dev(tmp_pe, edev, tmp_edev) ++ edev->mode &= ~EEH_DEV_NO_HANDLER; ++ + /* Notify all devices to be down */ + eeh_pe_state_clear(pe, EEH_PE_PRI_BUS); + eeh_set_channel_state(pe, pci_channel_io_perm_failure); +-- +2.20.1 + diff --git a/queue-4.19/powerpc-futex-fix-warning-oldval-may-be-used-uniniti.patch b/queue-4.19/powerpc-futex-fix-warning-oldval-may-be-used-uniniti.patch new file mode 100644 index 00000000000..167dc1ac175 --- /dev/null +++ b/queue-4.19/powerpc-futex-fix-warning-oldval-may-be-used-uniniti.patch @@ -0,0 +1,52 @@ +From 224b6ad3106120deb345827355b0a4b6b76cadce Mon Sep 17 00:00:00 2001 +From: Sasha Levin +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 + +[ 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 +[mpe: reword change log slightly] +Signed-off-by: Michael Ellerman +Link: https://lore.kernel.org/r/86b72f0c134367b214910b27b9a6dd3321af93bb.1565774657.git.christophe.leroy@c-s.fr +Signed-off-by: Sasha Levin +--- + 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 94542776a62d6..2a7b01f97a56b 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.19/powerpc-powernv-ioda2-allocate-tce-table-levels-on-d.patch b/queue-4.19/powerpc-powernv-ioda2-allocate-tce-table-levels-on-d.patch new file mode 100644 index 00000000000..e6f4da4fdc4 --- /dev/null +++ b/queue-4.19/powerpc-powernv-ioda2-allocate-tce-table-levels-on-d.patch @@ -0,0 +1,262 @@ +From 919bb80a4db7b79ac823146a83d88e8bb4395346 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 18 Jul 2019 15:11:38 +1000 +Subject: powerpc/powernv/ioda2: Allocate TCE table levels on demand for + default DMA window + +From: Alexey Kardashevskiy + +[ Upstream commit c37c792dec0929dbb6360a609fb00fa20bb16fc2 ] + +We allocate only the first level of multilevel TCE tables for KVM +already (alloc_userspace_copy==true), and the rest is allocated on demand. +This is not enabled though for bare metal. + +This removes the KVM limitation (implicit, via the alloc_userspace_copy +parameter) and always allocates just the first level. The on-demand +allocation of missing levels is already implemented. + +As from now on DMA map might happen with disabled interrupts, this +allocates TCEs with GFP_ATOMIC; otherwise lockdep reports errors 1]. +In practice just a single page is allocated there so chances for failure +are quite low. + +To save time when creating a new clean table, this skips non-allocated +indirect TCE entries in pnv_tce_free just like we already do in +the VFIO IOMMU TCE driver. + +This changes the default level number from 1 to 2 to reduce the amount +of memory required for the default 32bit DMA window at the boot time. +The default window size is up to 2GB which requires 4MB of TCEs which is +unlikely to be used entirely or at all as most devices these days are +64bit capable so by switching to 2 levels by default we save 4032KB of +RAM per a device. + +While at this, add __GFP_NOWARN to alloc_pages_node() as the userspace +can trigger this path via VFIO, see the failure and try creating a table +again with different parameters which might succeed. + +[1]: +=== +BUG: sleeping function called from invalid context at mm/page_alloc.c:4596 +in_atomic(): 1, irqs_disabled(): 1, pid: 1038, name: scsi_eh_1 +2 locks held by scsi_eh_1/1038: + #0: 000000005efd659a (&host->eh_mutex){+.+.}, at: ata_eh_acquire+0x34/0x80 + #1: 0000000006cf56a6 (&(&host->lock)->rlock){....}, at: ata_exec_internal_sg+0xb0/0x5c0 +irq event stamp: 500 +hardirqs last enabled at (499): [] _raw_spin_unlock_irqrestore+0x94/0xd0 +hardirqs last disabled at (500): [] _raw_spin_lock_irqsave+0x44/0x120 +softirqs last enabled at (0): [] copy_process.isra.4.part.5+0x640/0x1a80 +softirqs last disabled at (0): [<0000000000000000>] 0x0 +CPU: 73 PID: 1038 Comm: scsi_eh_1 Not tainted 5.2.0-rc6-le_nv2_aikATfstn1-p1 #634 +Call Trace: +[c000003d064cef50] [c000000000c8e6c4] dump_stack+0xe8/0x164 (unreliable) +[c000003d064cefa0] [c00000000014ed78] ___might_sleep+0x2f8/0x310 +[c000003d064cf020] [c0000000003ca084] __alloc_pages_nodemask+0x2a4/0x1560 +[c000003d064cf220] [c0000000000c2530] pnv_alloc_tce_level.isra.0+0x90/0x130 +[c000003d064cf290] [c0000000000c2888] pnv_tce+0x128/0x3b0 +[c000003d064cf360] [c0000000000c2c00] pnv_tce_build+0xb0/0xf0 +[c000003d064cf3c0] [c0000000000bbd9c] pnv_ioda2_tce_build+0x3c/0xb0 +[c000003d064cf400] [c00000000004cfe0] ppc_iommu_map_sg+0x210/0x550 +[c000003d064cf510] [c00000000004b7a4] dma_iommu_map_sg+0x74/0xb0 +[c000003d064cf530] [c000000000863944] ata_qc_issue+0x134/0x470 +[c000003d064cf5b0] [c000000000863ec4] ata_exec_internal_sg+0x244/0x5c0 +[c000003d064cf700] [c0000000008642d0] ata_exec_internal+0x90/0xe0 +[c000003d064cf780] [c0000000008650ac] ata_dev_read_id+0x2ec/0x640 +[c000003d064cf8d0] [c000000000878e28] ata_eh_recover+0x948/0x16d0 +[c000003d064cfa10] [c00000000087d760] sata_pmp_error_handler+0x480/0xbf0 +[c000003d064cfbc0] [c000000000884624] ahci_error_handler+0x74/0xe0 +[c000003d064cfbf0] [c000000000879fa8] ata_scsi_port_error_handler+0x2d8/0x7c0 +[c000003d064cfca0] [c00000000087a544] ata_scsi_error+0xb4/0x100 +[c000003d064cfd00] [c000000000802450] scsi_error_handler+0x120/0x510 +[c000003d064cfdb0] [c000000000140c48] kthread+0x1b8/0x1c0 +[c000003d064cfe20] [c00000000000bd8c] ret_from_kernel_thread+0x5c/0x70 +ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300) +irq event stamp: 2305 + +======================================================== +hardirqs last enabled at (2305): [] fast_exc_return_irq+0x28/0x34 +hardirqs last disabled at (2303): [] __do_softirq+0x4a0/0x654 +WARNING: possible irq lock inversion dependency detected +5.2.0-rc6-le_nv2_aikATfstn1-p1 #634 Tainted: G W +softirqs last enabled at (2304): [] __do_softirq+0x524/0x654 +softirqs last disabled at (2297): [] irq_exit+0x128/0x180 +-------------------------------------------------------- +swapper/0/0 just changed the state of lock: +0000000006cf56a6 (&(&host->lock)->rlock){-...}, at: ahci_single_level_irq_intr+0xac/0x120 +but this lock took another, HARDIRQ-unsafe lock in the past: + (fs_reclaim){+.+.} + +and interrupts could create inverse lock ordering between them. + +other info that might help us debug this: + Possible interrupt unsafe locking scenario: + + CPU0 CPU1 + ---- ---- + lock(fs_reclaim); + local_irq_disable(); + lock(&(&host->lock)->rlock); + lock(fs_reclaim); + + lock(&(&host->lock)->rlock); + + *** DEADLOCK *** + +no locks held by swapper/0/0. + +the shortest dependencies between 2nd lock and 1st lock: + -> (fs_reclaim){+.+.} ops: 167579 { + HARDIRQ-ON-W at: + lock_acquire+0xf8/0x2a0 + fs_reclaim_acquire.part.23+0x44/0x60 + kmem_cache_alloc_node_trace+0x80/0x590 + alloc_desc+0x64/0x270 + __irq_alloc_descs+0x2e4/0x3a0 + irq_domain_alloc_descs+0xb0/0x150 + irq_create_mapping+0x168/0x2c0 + xics_smp_probe+0x2c/0x98 + pnv_smp_probe+0x40/0x9c + smp_prepare_cpus+0x524/0x6c4 + kernel_init_freeable+0x1b4/0x650 + kernel_init+0x2c/0x148 + ret_from_kernel_thread+0x5c/0x70 + SOFTIRQ-ON-W at: + lock_acquire+0xf8/0x2a0 + fs_reclaim_acquire.part.23+0x44/0x60 + kmem_cache_alloc_node_trace+0x80/0x590 + alloc_desc+0x64/0x270 + __irq_alloc_descs+0x2e4/0x3a0 + irq_domain_alloc_descs+0xb0/0x150 + irq_create_mapping+0x168/0x2c0 + xics_smp_probe+0x2c/0x98 + pnv_smp_probe+0x40/0x9c + smp_prepare_cpus+0x524/0x6c4 + kernel_init_freeable+0x1b4/0x650 + kernel_init+0x2c/0x148 + ret_from_kernel_thread+0x5c/0x70 + INITIAL USE at: + lock_acquire+0xf8/0x2a0 + fs_reclaim_acquire.part.23+0x44/0x60 + kmem_cache_alloc_node_trace+0x80/0x590 + alloc_desc+0x64/0x270 + __irq_alloc_descs+0x2e4/0x3a0 + irq_domain_alloc_descs+0xb0/0x150 + irq_create_mapping+0x168/0x2c0 + xics_smp_probe+0x2c/0x98 + pnv_smp_probe+0x40/0x9c + smp_prepare_cpus+0x524/0x6c4 + kernel_init_freeable+0x1b4/0x650 + kernel_init+0x2c/0x148 + ret_from_kernel_thread+0x5c/0x70 + } +=== + +Signed-off-by: Alexey Kardashevskiy +Reviewed-by: Alistair Popple +Signed-off-by: Michael Ellerman +Link: https://lore.kernel.org/r/20190718051139.74787-4-aik@ozlabs.ru +Signed-off-by: Sasha Levin +--- + arch/powerpc/platforms/powernv/pci-ioda-tce.c | 20 +++++++++---------- + arch/powerpc/platforms/powernv/pci.h | 2 +- + 2 files changed, 11 insertions(+), 11 deletions(-) + +diff --git a/arch/powerpc/platforms/powernv/pci-ioda-tce.c b/arch/powerpc/platforms/powernv/pci-ioda-tce.c +index f5adb6b756f75..29e66d6e57636 100644 +--- a/arch/powerpc/platforms/powernv/pci-ioda-tce.c ++++ b/arch/powerpc/platforms/powernv/pci-ioda-tce.c +@@ -36,7 +36,8 @@ static __be64 *pnv_alloc_tce_level(int nid, unsigned int shift) + struct page *tce_mem = NULL; + __be64 *addr; + +- tce_mem = alloc_pages_node(nid, GFP_KERNEL, shift - PAGE_SHIFT); ++ tce_mem = alloc_pages_node(nid, GFP_ATOMIC | __GFP_NOWARN, ++ shift - PAGE_SHIFT); + if (!tce_mem) { + pr_err("Failed to allocate a TCE memory, level shift=%d\n", + shift); +@@ -161,6 +162,9 @@ void pnv_tce_free(struct iommu_table *tbl, long index, long npages) + + if (ptce) + *ptce = cpu_to_be64(0); ++ else ++ /* Skip the rest of the level */ ++ i |= tbl->it_level_size - 1; + } + } + +@@ -260,7 +264,6 @@ long pnv_pci_ioda2_table_alloc_pages(int nid, __u64 bus_offset, + unsigned int table_shift = max_t(unsigned int, entries_shift + 3, + PAGE_SHIFT); + const unsigned long tce_table_size = 1UL << table_shift; +- unsigned int tmplevels = levels; + + if (!levels || (levels > POWERNV_IOMMU_MAX_LEVELS)) + return -EINVAL; +@@ -268,9 +271,6 @@ long pnv_pci_ioda2_table_alloc_pages(int nid, __u64 bus_offset, + if (!is_power_of_2(window_size)) + return -EINVAL; + +- if (alloc_userspace_copy && (window_size > (1ULL << 32))) +- tmplevels = 1; +- + /* Adjust direct table size from window_size and levels */ + entries_shift = (entries_shift + levels - 1) / levels; + level_shift = entries_shift + 3; +@@ -281,7 +281,7 @@ long pnv_pci_ioda2_table_alloc_pages(int nid, __u64 bus_offset, + + /* Allocate TCE table */ + addr = pnv_pci_ioda2_table_do_alloc_pages(nid, level_shift, +- tmplevels, tce_table_size, &offset, &total_allocated); ++ 1, tce_table_size, &offset, &total_allocated); + + /* addr==NULL means that the first level allocation failed */ + if (!addr) +@@ -292,18 +292,18 @@ long pnv_pci_ioda2_table_alloc_pages(int nid, __u64 bus_offset, + * we did not allocate as much as we wanted, + * release partially allocated table. + */ +- if (tmplevels == levels && offset < tce_table_size) ++ if (levels == 1 && offset < tce_table_size) + goto free_tces_exit; + + /* Allocate userspace view of the TCE table */ + if (alloc_userspace_copy) { + offset = 0; + uas = pnv_pci_ioda2_table_do_alloc_pages(nid, level_shift, +- tmplevels, tce_table_size, &offset, ++ 1, tce_table_size, &offset, + &total_allocated_uas); + if (!uas) + goto free_tces_exit; +- if (tmplevels == levels && (offset < tce_table_size || ++ if (levels == 1 && (offset < tce_table_size || + total_allocated_uas != total_allocated)) + goto free_uas_exit; + } +@@ -318,7 +318,7 @@ long pnv_pci_ioda2_table_alloc_pages(int nid, __u64 bus_offset, + + pr_debug("Created TCE table: ws=%08llx ts=%lx @%08llx base=%lx uas=%p levels=%d/%d\n", + window_size, tce_table_size, bus_offset, tbl->it_base, +- tbl->it_userspace, tmplevels, levels); ++ tbl->it_userspace, 1, levels); + + return 0; + +diff --git a/arch/powerpc/platforms/powernv/pci.h b/arch/powerpc/platforms/powernv/pci.h +index 8b37b28e38318..e302aa092d4f1 100644 +--- a/arch/powerpc/platforms/powernv/pci.h ++++ b/arch/powerpc/platforms/powernv/pci.h +@@ -243,7 +243,7 @@ extern void pnv_npu_release_ownership(struct pnv_ioda_pe *npe); + extern int pnv_npu2_init(struct pnv_phb *phb); + + /* pci-ioda-tce.c */ +-#define POWERNV_IOMMU_DEFAULT_LEVELS 1 ++#define POWERNV_IOMMU_DEFAULT_LEVELS 2 + #define POWERNV_IOMMU_MAX_LEVELS 5 + + extern int pnv_tce_build(struct iommu_table *tbl, long index, long npages, +-- +2.20.1 + diff --git a/queue-4.19/powerpc-pseries-correctly-track-irq-state-in-default.patch b/queue-4.19/powerpc-pseries-correctly-track-irq-state-in-default.patch new file mode 100644 index 00000000000..0072e60e517 --- /dev/null +++ b/queue-4.19/powerpc-pseries-correctly-track-irq-state-in-default.patch @@ -0,0 +1,59 @@ +From 182c4c9b00e43f74594aec0a905154df8e51bff8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 10 Sep 2019 17:52:44 -0500 +Subject: powerpc/pseries: correctly track irq state in default idle + +From: Nathan Lynch + +[ 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 +Signed-off-by: Michael Ellerman +Link: https://lore.kernel.org/r/20190910225244.25056-1-nathanl@linux.ibm.com +Signed-off-by: Sasha Levin +--- + 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 ba1791fd3234d..67f49159ea708 100644 +--- a/arch/powerpc/platforms/pseries/setup.c ++++ b/arch/powerpc/platforms/pseries/setup.c +@@ -325,6 +325,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.19/powerpc-pseries-mobility-use-cond_resched-when-updat.patch b/queue-4.19/powerpc-pseries-mobility-use-cond_resched-when-updat.patch new file mode 100644 index 00000000000..83ddd454ec7 --- /dev/null +++ b/queue-4.19/powerpc-pseries-mobility-use-cond_resched-when-updat.patch @@ -0,0 +1,69 @@ +From a7f95541fd05194c3baa09b53ac7380daff06abf Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 2 Aug 2019 14:29:26 -0500 +Subject: powerpc/pseries/mobility: use cond_resched when updating device tree + +From: Nathan Lynch + +[ 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 +Signed-off-by: Michael Ellerman +Link: https://lore.kernel.org/r/20190802192926.19277-4-nathanl@linux.ibm.com +Signed-off-by: Sasha Levin +--- + 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 7b60fcf04dc47..e4ea713833832 100644 +--- a/arch/powerpc/platforms/pseries/mobility.c ++++ b/arch/powerpc/platforms/pseries/mobility.c +@@ -12,6 +12,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -209,7 +210,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); +@@ -318,8 +323,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.19/powerpc-rtas-use-device-model-apis-and-serialization.patch b/queue-4.19/powerpc-rtas-use-device-model-apis-and-serialization.patch new file mode 100644 index 00000000000..e387ef4329e --- /dev/null +++ b/queue-4.19/powerpc-rtas-use-device-model-apis-and-serialization.patch @@ -0,0 +1,96 @@ +From 3db58572d18948117133edcb4e38aa0f7aac2485 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 2 Aug 2019 14:29:24 -0500 +Subject: powerpc/rtas: use device model APIs and serialization during LPM + +From: Nathan Lynch + +[ 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 +Reviewed-by: Gautham R. Shenoy +Signed-off-by: Michael Ellerman +Link: https://lore.kernel.org/r/20190802192926.19277-2-nathanl@linux.ibm.com +Signed-off-by: Sasha Levin +--- + 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 8afd146bc9c70..9e41a9de43235 100644 +--- a/arch/powerpc/kernel/rtas.c ++++ b/arch/powerpc/kernel/rtas.c +@@ -875,15 +875,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"), +@@ -972,6 +974,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); +@@ -1003,6 +1007,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.19/powerpc-xmon-check-for-hv-mode-when-dumping-xive-inf.patch b/queue-4.19/powerpc-xmon-check-for-hv-mode-when-dumping-xive-inf.patch new file mode 100644 index 00000000000..97c60d8610d --- /dev/null +++ b/queue-4.19/powerpc-xmon-check-for-hv-mode-when-dumping-xive-inf.patch @@ -0,0 +1,56 @@ +From 7b48ccee2ac911aeaa82ee1037216a25f1de8b46 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +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 + +[ 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 +Signed-off-by: Michael Ellerman +Link: https://lore.kernel.org/r/20190814154754.23682-2-clg@kaod.org +Signed-off-by: Sasha Levin +--- + 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 74cfc1be04d6e..bb5db7bfd8539 100644 +--- a/arch/powerpc/xmon/xmon.c ++++ b/arch/powerpc/xmon/xmon.c +@@ -2497,13 +2497,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.19/pstore-fs-superblock-limits.patch b/queue-4.19/pstore-fs-superblock-limits.patch new file mode 100644 index 00000000000..bcf50d4650c --- /dev/null +++ b/queue-4.19/pstore-fs-superblock-limits.patch @@ -0,0 +1,52 @@ +From 55f6ec8614cd01a856a98bea8d72f662676e2d89 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 23 Jun 2019 16:00:01 -0700 +Subject: pstore: fs superblock limits + +From: Deepa Dinamani + +[ Upstream commit 83b8a3fbe3aa82ac3c253b698ae6a9be2dbdd5e0 ] + +Leaving granularity at 1ns because it is dependent on the specific +attached backing pstore module. ramoops has microsecond resolution. + +Fix the readback of ramoops fractional timestamp microseconds, +which has incorrectly been reporting the value as nanoseconds. + +Fixes: 3f8f80f0cfeb ("pstore/ram: Read and write to the 'compressed' flag of pstore"). + +Signed-off-by: Deepa Dinamani +Acked-by: Kees Cook +Acked-by: Jeff Layton +Cc: anton@enomsg.org +Cc: ccross@android.com +Cc: keescook@chromium.org +Cc: tony.luck@intel.com +Signed-off-by: Sasha Levin +--- + fs/pstore/ram.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c +index 316c16463b20f..015d74ee31a03 100644 +--- a/fs/pstore/ram.c ++++ b/fs/pstore/ram.c +@@ -162,6 +162,7 @@ static int ramoops_read_kmsg_hdr(char *buffer, struct timespec64 *time, + if (sscanf(buffer, RAMOOPS_KERNMSG_HDR "%lld.%lu-%c\n%n", + (time64_t *)&time->tv_sec, &time->tv_nsec, &data_type, + &header_length) == 3) { ++ time->tv_nsec *= 1000; + if (data_type == 'C') + *compressed = true; + else +@@ -169,6 +170,7 @@ static int ramoops_read_kmsg_hdr(char *buffer, struct timespec64 *time, + } else if (sscanf(buffer, RAMOOPS_KERNMSG_HDR "%lld.%lu\n%n", + (time64_t *)&time->tv_sec, &time->tv_nsec, + &header_length) == 2) { ++ time->tv_nsec *= 1000; + *compressed = false; + } else { + time->tv_sec = 0; +-- +2.20.1 + diff --git a/queue-4.19/rtc-pcf85363-pcf85263-fix-regmap-error-in-set_time.patch b/queue-4.19/rtc-pcf85363-pcf85263-fix-regmap-error-in-set_time.patch new file mode 100644 index 00000000000..a19d54a69bb --- /dev/null +++ b/queue-4.19/rtc-pcf85363-pcf85263-fix-regmap-error-in-set_time.patch @@ -0,0 +1,62 @@ +From c8f17f18f1ea2f955612941b882638a0acd9f875 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 29 Aug 2019 10:14:18 +0800 +Subject: rtc: pcf85363/pcf85263: fix regmap error in set_time + +From: Biwen Li + +[ Upstream commit 7ef66122bdb3b839e9f51b76d7e600b6e21ef648 ] + +Issue: + - # hwclock -w + hwclock: RTC_SET_TIME: Invalid argument + +Why: + - Relative commit: 8b9f9d4dc511 ("regmap: verify if register is + writeable before writing operations"), this patch + will always check for unwritable registers, it will compare reg + with max_register in regmap_writeable. + + - The pcf85363/pcf85263 has the capability of address wrapping + which means if you access an address outside the allowed range + (0x00-0x2f) hardware actually wraps the access to a lower address. + The rtc-pcf85363 driver will use this feature to configure the time + and execute 2 actions in the same i2c write operation (stopping the + clock and configure the time). However the driver has also + configured the `regmap maxregister` protection mechanism that will + block accessing addresses outside valid range (0x00-0x2f). + +How: + - Split of writing regs to two parts, first part writes control + registers about stop_enable and resets, second part writes + RTC time and date registers. + +Signed-off-by: Biwen Li +Link: https://lore.kernel.org/r/20190829021418.4607-1-biwen.li@nxp.com +Signed-off-by: Alexandre Belloni +Signed-off-by: Sasha Levin +--- + drivers/rtc/rtc-pcf85363.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/drivers/rtc/rtc-pcf85363.c b/drivers/rtc/rtc-pcf85363.c +index c04a1edcd5716..c3702684b3426 100644 +--- a/drivers/rtc/rtc-pcf85363.c ++++ b/drivers/rtc/rtc-pcf85363.c +@@ -169,7 +169,12 @@ static int pcf85363_rtc_set_time(struct device *dev, struct rtc_time *tm) + buf[DT_YEARS] = bin2bcd(tm->tm_year % 100); + + ret = regmap_bulk_write(pcf85363->regmap, CTRL_STOP_EN, +- tmp, sizeof(tmp)); ++ tmp, 2); ++ if (ret) ++ return ret; ++ ++ ret = regmap_bulk_write(pcf85363->regmap, DT_100THS, ++ buf, sizeof(tmp) - 2); + if (ret) + return ret; + +-- +2.20.1 + diff --git a/queue-4.19/rtc-snvs-fix-possible-race-condition.patch b/queue-4.19/rtc-snvs-fix-possible-race-condition.patch new file mode 100644 index 00000000000..e160bca75bb --- /dev/null +++ b/queue-4.19/rtc-snvs-fix-possible-race-condition.patch @@ -0,0 +1,57 @@ +From 53baa7137ceb7aab9c849da47f385d0cc20b9817 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 16 Jul 2019 15:18:58 +0800 +Subject: rtc: snvs: fix possible race condition + +From: Anson Huang + +[ 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 +Reviewed-by: Dong Aisheng +Link: https://lore.kernel.org/r/20190716071858.36750-1-Anson.Huang@nxp.com +Signed-off-by: Alexandre Belloni +Signed-off-by: Sasha Levin +--- + 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 b2483a749ac45..3cf011e120530 100644 +--- a/drivers/rtc/rtc-snvs.c ++++ b/drivers/rtc/rtc-snvs.c +@@ -273,6 +273,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)) { +@@ -335,10 +339,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.19/scsi-core-reduce-memory-required-for-scsi-logging.patch b/queue-4.19/scsi-core-reduce-memory-required-for-scsi-logging.patch new file mode 100644 index 00000000000..cab424767c8 --- /dev/null +++ b/queue-4.19/scsi-core-reduce-memory-required-for-scsi-logging.patch @@ -0,0 +1,111 @@ +From 0f1a7bba0cdaa2e2975a784cce10aecbff2fcbb4 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 1 Aug 2019 15:38:14 -0700 +Subject: scsi: core: Reduce memory required for SCSI logging + +From: Bart Van Assche + +[ 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 +Cc: Christoph Hellwig +Cc: Hannes Reinecke +Cc: Johannes Thumshirn +Cc: Ming Lei +Cc: Jan Palus +Signed-off-by: Bart Van Assche +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + 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 + #include + +-#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 e03bd9d41fa8f..7b196d2346264 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.19/security-smack-fix-possible-null-pointer-dereference.patch b/queue-4.19/security-smack-fix-possible-null-pointer-dereference.patch new file mode 100644 index 00000000000..ac31219b19a --- /dev/null +++ b/queue-4.19/security-smack-fix-possible-null-pointer-dereference.patch @@ -0,0 +1,49 @@ +From 50bfae8938ab5574c53e96651ee92af044b0896c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +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 + +[ 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 +Signed-off-by: Casey Schaufler +Signed-off-by: Sasha Levin +--- + 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 017c47eb795eb..120bd56e5d89e 100644 +--- a/security/smack/smack_lsm.c ++++ b/security/smack/smack_lsm.c +@@ -4005,6 +4005,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.19/series b/queue-4.19/series new file mode 100644 index 00000000000..495cfe171f8 --- /dev/null +++ b/queue-4.19/series @@ -0,0 +1,78 @@ +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-panel-check-failure-cases-in-the-probe-func.patch +drm-rockchip-check-for-fast-link-training-before-ena.patch +drm-radeon-fix-eeh-during-kexec.patch +gpu-drm-radeon-fix-a-possible-null-pointer-dereferen.patch +pci-rpaphp-avoid-a-sometimes-uninitialized-warning.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 +drm-amd-display-fix-issue-where-252-255-values-are-c.patch +drm-amd-display-reprogram-vm-config-when-system-resu.patch +powerpc-powernv-ioda2-allocate-tce-table-levels-on-d.patch +clk-actions-don-t-reference-clk_init_data-after-regi.patch +clk-sirf-don-t-reference-clk_init_data-after-registr.patch +clk-sprd-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 +powerpc-eeh-clear-stale-eeh_dev_no_handler-flag.patch +vfio_pci-restore-original-state-on-release.patch +drm-nouveau-volt-fix-for-some-cards-having-0-maximum.patch +pinctrl-amd-disable-spurious-firing-gpio-irqs.patch +clk-renesas-mstp-set-genpd_flag_always_on-for-clock-.patch +clk-renesas-cpg-mssr-set-genpd_flag_always_on-for-cl.patch +drm-amd-display-support-spdif.patch +drm-amdgpu-si-fix-asic-tests.patch +powerpc-64s-exception-machine-check-use-correct-cfar.patch +pstore-fs-superblock-limits.patch +clk-qcom-gcc-sdm845-use-floor-ops-for-sdcc-clks.patch +powerpc-pseries-correctly-track-irq-state-in-default.patch +pinctrl-meson-gxbb-fix-wrong-pinning-definition-for-.patch +arm64-fix-unreachable-code-issue-with-cmpxchg.patch +clk-at91-select-parent-if-main-oscillator-or-bypass-.patch +powerpc-dump-kernel-log-before-carrying-out-fadump-o.patch +mbox-qcom-add-apcs-child-device-for-qcs404.patch +clk-sprd-add-missing-kfree.patch +scsi-core-reduce-memory-required-for-scsi-logging.patch +dma-buf-sw_sync-synchronize-signal-vs-syncpt-free.patch +ext4-fix-potential-use-after-free-after-remounting-w.patch +mips-ingenic-disable-broken-btb-lookup-optimization.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 +hid-wacom-fix-several-minor-compiler-warnings.patch +livepatch-nullify-obj-mod-in-klp_module_coming-s-err.patch +arm-8898-1-mm-don-t-treat-faults-reported-from-cache.patch +soundwire-intel-fix-channel-number-reported-by-hardw.patch +arm-8875-1-kconfig-default-to-aeabi-w-clang.patch +rtc-snvs-fix-possible-race-condition.patch +rtc-pcf85363-pcf85263-fix-regmap-error-in-set_time.patch +hid-apple-fix-stuck-function-keys-when-using-fn.patch +pci-rockchip-propagate-errors-for-optional-regulator.patch +pci-histb-propagate-errors-for-optional-regulators.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 +crypto-hisilicon-fix-double-free-in-sec_free_hw_sgl.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 +arm64-consider-stack-randomization-for-mmap-base-onl.patch +mips-properly-account-for-stack-randomization-and-st.patch +arm-properly-account-for-stack-randomization-and-sta.patch +arm-use-stack_top-when-computing-mmap-base-address.patch diff --git a/queue-4.19/soundwire-intel-fix-channel-number-reported-by-hardw.patch b/queue-4.19/soundwire-intel-fix-channel-number-reported-by-hardw.patch new file mode 100644 index 00000000000..7dcf7006c28 --- /dev/null +++ b/queue-4.19/soundwire-intel-fix-channel-number-reported-by-hardw.patch @@ -0,0 +1,47 @@ +From 41b814dd735ec932cb74a8d62b1c749db9555d96 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 5 Aug 2019 19:55:07 -0500 +Subject: soundwire: intel: fix channel number reported by hardware + +From: Pierre-Louis Bossart + +[ Upstream commit 18046335643de6d21327f5ae034c8fb8463f6715 ] + +On all released Intel controllers (CNL/CML/ICL), PDI2 reports an +invalid count, force the correct hardware-supported value + +This may have to be revisited with platform-specific values if the +hardware changes, but for now this is good enough. + +Signed-off-by: Pierre-Louis Bossart +Link: https://lore.kernel.org/r/20190806005522.22642-3-pierre-louis.bossart@linux.intel.com +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +--- + drivers/soundwire/intel.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c +index a6e2581ada703..29bc99c4a7b66 100644 +--- a/drivers/soundwire/intel.c ++++ b/drivers/soundwire/intel.c +@@ -282,6 +282,16 @@ intel_pdi_get_ch_cap(struct sdw_intel *sdw, unsigned int pdi_num, bool pcm) + + if (pcm) { + count = intel_readw(shim, SDW_SHIM_PCMSYCHC(link_id, pdi_num)); ++ ++ /* ++ * WORKAROUND: on all existing Intel controllers, pdi ++ * number 2 reports channel count as 1 even though it ++ * supports 8 channels. Performing hardcoding for pdi ++ * number 2. ++ */ ++ if (pdi_num == 2) ++ count = 7; ++ + } else { + count = intel_readw(shim, SDW_SHIM_PDMSCAP(link_id)); + count = ((count & SDW_SHIM_PDMSCAP_CPSS) >> +-- +2.20.1 + diff --git a/queue-4.19/tpm-fix-tpm-1.2-shutdown-sequence-to-prevent-future-.patch b/queue-4.19/tpm-fix-tpm-1.2-shutdown-sequence-to-prevent-future-.patch new file mode 100644 index 00000000000..7c23122cf91 --- /dev/null +++ b/queue-4.19/tpm-fix-tpm-1.2-shutdown-sequence-to-prevent-future-.patch @@ -0,0 +1,49 @@ +From 6d3f6c96568a6f1eb094f829b3a38506d71f5427 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +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 + +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 +[dianders: resolved merge conflicts with mainline] +Signed-off-by: Douglas Anderson +Reviewed-by: Jarkko Sakkinen +Signed-off-by: Jarkko Sakkinen +Signed-off-by: Sasha Levin +--- + 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 46caadca916a0..0b01eb7b14e53 100644 +--- a/drivers/char/tpm/tpm-chip.c ++++ b/drivers/char/tpm/tpm-chip.c +@@ -187,12 +187,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.19/tpm-use-tpm_try_get_ops-in-tpm-sysfs.c.patch b/queue-4.19/tpm-use-tpm_try_get_ops-in-tpm-sysfs.c.patch new file mode 100644 index 00000000000..d68fb481bcd --- /dev/null +++ b/queue-4.19/tpm-use-tpm_try_get_ops-in-tpm-sysfs.c.patch @@ -0,0 +1,289 @@ +From 2b6a5396ad536ef90dc7b5b5f1b90e77da9181a1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 3 Oct 2019 21:46:22 +0300 +Subject: tpm: use tpm_try_get_ops() in tpm-sysfs.c. + +From: Jarkko Sakkinen + +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 +Reviewed-by: Stefan Berger +Tested-by: Stefan Berger +Reviewed-by: Jerry Snitselaar +Reviewed-by: James Bottomley +Tested-by: Alexander Steffen +Signed-off-by: Sasha Levin +--- + 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.19/vfio_pci-restore-original-state-on-release.patch b/queue-4.19/vfio_pci-restore-original-state-on-release.patch new file mode 100644 index 00000000000..f3222e96af8 --- /dev/null +++ b/queue-4.19/vfio_pci-restore-original-state-on-release.patch @@ -0,0 +1,60 @@ +From 61753c3b5ae42668fe47ab47f404bf995b30d59b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 22 Aug 2019 11:35:19 +0800 +Subject: vfio_pci: Restore original state on release + +From: hexin + +[ 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 +Signed-off-by: Liu Qi +Signed-off-by: Zhang Yu +Signed-off-by: Alex Williamson +Signed-off-by: Sasha Levin +--- + 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 6cf00d9f512b7..a92c2868d9021 100644 +--- a/drivers/vfio/pci/vfio_pci.c ++++ b/drivers/vfio/pci/vfio_pci.c +@@ -373,11 +373,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.19/video-ssd1307fb-start-page-range-at-page_offset.patch b/queue-4.19/video-ssd1307fb-start-page-range-at-page_offset.patch new file mode 100644 index 00000000000..2e6ee5d69b2 --- /dev/null +++ b/queue-4.19/video-ssd1307fb-start-page-range-at-page_offset.patch @@ -0,0 +1,47 @@ +From 0b691567d39b41e433e18ad83c4c7ebd00fe5793 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +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 + +[ 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 +Cc: Mark Rutland +Cc: Rob Herring +Cc: Daniel Vetter +Cc: David Airlie +Cc: Michal Vokáč +Signed-off-by: Bartlomiej Zolnierkiewicz +Link: https://patchwork.freedesktop.org/patch/msgid/20190618074111.9309-4-marko.kohtala@okoko.fi +Signed-off-by: Sasha Levin +--- + 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 6439231f2db22..da565f39c9b06 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 + -- 2.47.2