From: Greg Kroah-Hartman Date: Sat, 2 Apr 2022 13:07:24 +0000 (+0200) Subject: 4.14-stable patches X-Git-Tag: v5.17.2~180 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=816d32fa320b3607d13c05e99f1cc1d81e66790a;p=thirdparty%2Fkernel%2Fstable-queue.git 4.14-stable patches added patches: brcmfmac-firmware-allocate-space-for-default-boardrev-in-nvram.patch brcmfmac-pcie-replace-brcmf_pcie_copy_mem_todev-with-memcpy_toio.patch dec-limit-pmax-memory-probing-to-r3k-systems.patch lib-raid6-test-fix-multiple-definition-linking-error.patch media-davinci-vpif-fix-unbalanced-runtime-pm-get.patch pci-pciehp-clear-cmd_busy-bit-in-polling-mode.patch --- diff --git a/queue-4.14/brcmfmac-firmware-allocate-space-for-default-boardrev-in-nvram.patch b/queue-4.14/brcmfmac-firmware-allocate-space-for-default-boardrev-in-nvram.patch new file mode 100644 index 00000000000..a69375c35c4 --- /dev/null +++ b/queue-4.14/brcmfmac-firmware-allocate-space-for-default-boardrev-in-nvram.patch @@ -0,0 +1,36 @@ +From d19d8e3ba256f81ea4a27209dbbd1f0a00ef1903 Mon Sep 17 00:00:00 2001 +From: Hector Martin +Date: Tue, 1 Feb 2022 01:07:06 +0900 +Subject: brcmfmac: firmware: Allocate space for default boardrev in nvram + +From: Hector Martin + +commit d19d8e3ba256f81ea4a27209dbbd1f0a00ef1903 upstream. + +If boardrev is missing from the NVRAM we add a default one, but this +might need more space in the output buffer than was allocated. Ensure +we have enough padding for this in the buffer. + +Fixes: 46f2b38a91b0 ("brcmfmac: insert default boardrev in nvram data if missing") +Reviewed-by: Arend van Spriel +Cc: stable@vger.kernel.org +Signed-off-by: Hector Martin +Reviewed-by: Andy Shevchenko +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20220131160713.245637-3-marcan@marcan.st +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c +@@ -216,6 +216,8 @@ static int brcmf_init_nvram_parser(struc + size = BRCMF_FW_MAX_NVRAM_SIZE; + else + size = data_len; ++ /* Add space for properties we may add */ ++ size += strlen(BRCMF_FW_DEFAULT_BOARDREV) + 1; + /* Alloc for extra 0 byte + roundup by 4 + length field */ + size += 1 + 3 + sizeof(u32); + nvp->nvram = kzalloc(size, GFP_KERNEL); diff --git a/queue-4.14/brcmfmac-pcie-replace-brcmf_pcie_copy_mem_todev-with-memcpy_toio.patch b/queue-4.14/brcmfmac-pcie-replace-brcmf_pcie_copy_mem_todev-with-memcpy_toio.patch new file mode 100644 index 00000000000..a543c2be099 --- /dev/null +++ b/queue-4.14/brcmfmac-pcie-replace-brcmf_pcie_copy_mem_todev-with-memcpy_toio.patch @@ -0,0 +1,108 @@ +From 9466987f246758eb7e9071ae58005253f631271e Mon Sep 17 00:00:00 2001 +From: Hector Martin +Date: Tue, 1 Feb 2022 01:07:09 +0900 +Subject: brcmfmac: pcie: Replace brcmf_pcie_copy_mem_todev with memcpy_toio + +From: Hector Martin + +commit 9466987f246758eb7e9071ae58005253f631271e upstream. + +The alignment check was wrong (e.g. & 4 instead of & 3), and the logic +was also inefficient if the length was not a multiple of 4, since it +would needlessly fall back to copying the entire buffer bytewise. + +We already have a perfectly good memcpy_toio function, so just call that +instead of rolling our own copy logic here. brcmf_pcie_init_ringbuffers +was already using it anyway. + +Fixes: 9e37f045d5e7 ("brcmfmac: Adding PCIe bus layer support.") +Reviewed-by: Linus Walleij +Reviewed-by: Arend van Spriel +Reviewed-by: Andy Shevchenko +Cc: stable@vger.kernel.org +Signed-off-by: Hector Martin +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20220131160713.245637-6-marcan@marcan.st +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 48 +--------------- + 1 file changed, 4 insertions(+), 44 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +@@ -22,6 +22,7 @@ + #include + #include + #include ++#include + #include + + #include +@@ -429,47 +430,6 @@ brcmf_pcie_write_ram32(struct brcmf_pcie + + + static void +-brcmf_pcie_copy_mem_todev(struct brcmf_pciedev_info *devinfo, u32 mem_offset, +- void *srcaddr, u32 len) +-{ +- void __iomem *address = devinfo->tcm + mem_offset; +- __le32 *src32; +- __le16 *src16; +- u8 *src8; +- +- if (((ulong)address & 4) || ((ulong)srcaddr & 4) || (len & 4)) { +- if (((ulong)address & 2) || ((ulong)srcaddr & 2) || (len & 2)) { +- src8 = (u8 *)srcaddr; +- while (len) { +- iowrite8(*src8, address); +- address++; +- src8++; +- len--; +- } +- } else { +- len = len / 2; +- src16 = (__le16 *)srcaddr; +- while (len) { +- iowrite16(le16_to_cpu(*src16), address); +- address += 2; +- src16++; +- len--; +- } +- } +- } else { +- len = len / 4; +- src32 = (__le32 *)srcaddr; +- while (len) { +- iowrite32(le32_to_cpu(*src32), address); +- address += 4; +- src32++; +- len--; +- } +- } +-} +- +- +-static void + brcmf_pcie_copy_dev_tomem(struct brcmf_pciedev_info *devinfo, u32 mem_offset, + void *dstaddr, u32 len) + { +@@ -1454,8 +1414,8 @@ static int brcmf_pcie_download_fw_nvram( + return err; + + brcmf_dbg(PCIE, "Download FW %s\n", devinfo->fw_name); +- brcmf_pcie_copy_mem_todev(devinfo, devinfo->ci->rambase, +- (void *)fw->data, fw->size); ++ memcpy_toio(devinfo->tcm + devinfo->ci->rambase, ++ (void *)fw->data, fw->size); + + resetintr = get_unaligned_le32(fw->data); + release_firmware(fw); +@@ -1469,7 +1429,7 @@ static int brcmf_pcie_download_fw_nvram( + brcmf_dbg(PCIE, "Download NVRAM %s\n", devinfo->nvram_name); + address = devinfo->ci->rambase + devinfo->ci->ramsize - + nvram_len; +- brcmf_pcie_copy_mem_todev(devinfo, address, nvram, nvram_len); ++ memcpy_toio(devinfo->tcm + address, nvram, nvram_len); + brcmf_fw_nvram_free(nvram); + } else { + brcmf_dbg(PCIE, "No matching NVRAM file found %s\n", diff --git a/queue-4.14/dec-limit-pmax-memory-probing-to-r3k-systems.patch b/queue-4.14/dec-limit-pmax-memory-probing-to-r3k-systems.patch new file mode 100644 index 00000000000..3d8b80a4e76 --- /dev/null +++ b/queue-4.14/dec-limit-pmax-memory-probing-to-r3k-systems.patch @@ -0,0 +1,70 @@ +From 244eae91a94c6dab82b3232967d10eeb9dfa21c6 Mon Sep 17 00:00:00 2001 +From: "Maciej W. Rozycki" +Date: Fri, 4 Mar 2022 20:16:23 +0000 +Subject: DEC: Limit PMAX memory probing to R3k systems + +From: Maciej W. Rozycki + +commit 244eae91a94c6dab82b3232967d10eeb9dfa21c6 upstream. + +Recent tightening of the opcode table in binutils so as to consistently +disallow the assembly or disassembly of CP0 instructions not supported +by the processor architecture chosen has caused a regression like below: + +arch/mips/dec/prom/locore.S: Assembler messages: +arch/mips/dec/prom/locore.S:29: Error: opcode not supported on this processor: r4600 (mips3) `rfe' + +in a piece of code used to probe for memory with PMAX DECstation models, +which have non-REX firmware. Those computers always have an R2000 CPU +and consequently the exception handler used in memory probing uses the +RFE instruction, which those processors use. + +While adding 64-bit support this code was correctly excluded for 64-bit +configurations, however it should have also been excluded for irrelevant +32-bit configurations. Do this now then, and only enable PMAX memory +probing for R3k systems. + +Reported-by: Jan-Benedict Glaw +Reported-by: Sudip Mukherjee +Signed-off-by: Maciej W. Rozycki +Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") +Cc: stable@vger.kernel.org # v2.6.12+ +Signed-off-by: Thomas Bogendoerfer +Signed-off-by: Greg Kroah-Hartman +--- + arch/mips/dec/prom/Makefile | 2 +- + arch/mips/include/asm/dec/prom.h | 15 +++++---------- + 2 files changed, 6 insertions(+), 11 deletions(-) + +--- a/arch/mips/dec/prom/Makefile ++++ b/arch/mips/dec/prom/Makefile +@@ -5,4 +5,4 @@ + + lib-y += init.o memory.o cmdline.o identify.o console.o + +-lib-$(CONFIG_32BIT) += locore.o ++lib-$(CONFIG_CPU_R3000) += locore.o +--- a/arch/mips/include/asm/dec/prom.h ++++ b/arch/mips/include/asm/dec/prom.h +@@ -47,16 +47,11 @@ + */ + #define REX_PROM_MAGIC 0x30464354 + +-#ifdef CONFIG_64BIT +- +-#define prom_is_rex(magic) 1 /* KN04 and KN05 are REX PROMs. */ +- +-#else /* !CONFIG_64BIT */ +- +-#define prom_is_rex(magic) ((magic) == REX_PROM_MAGIC) +- +-#endif /* !CONFIG_64BIT */ +- ++/* KN04 and KN05 are REX PROMs, so only do the check for R3k systems. */ ++static inline bool prom_is_rex(u32 magic) ++{ ++ return !IS_ENABLED(CONFIG_CPU_R3000) || magic == REX_PROM_MAGIC; ++} + + /* + * 3MIN/MAXINE PROM entry points for DS5000/1xx's, DS5000/xx's and diff --git a/queue-4.14/lib-raid6-test-fix-multiple-definition-linking-error.patch b/queue-4.14/lib-raid6-test-fix-multiple-definition-linking-error.patch new file mode 100644 index 00000000000..f7ed9c60cef --- /dev/null +++ b/queue-4.14/lib-raid6-test-fix-multiple-definition-linking-error.patch @@ -0,0 +1,41 @@ +From a5359ddd052860bacf957e65fe819c63e974b3a6 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Dirk=20M=C3=BCller?= +Date: Tue, 8 Feb 2022 17:50:50 +0100 +Subject: lib/raid6/test: fix multiple definition linking error +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Dirk Müller + +commit a5359ddd052860bacf957e65fe819c63e974b3a6 upstream. + +GCC 10+ defaults to -fno-common, which enforces proper declaration of +external references using "extern". without this change a link would +fail with: + + lib/raid6/test/algos.c:28: multiple definition of `raid6_call'; + lib/raid6/test/test.c:22: first defined here + +the pq.h header that is included already includes an extern declaration +so we can just remove the redundant one here. + +Cc: +Signed-off-by: Dirk Müller +Reviewed-by: Paul Menzel +Signed-off-by: Song Liu +Signed-off-by: Greg Kroah-Hartman +--- + lib/raid6/test/test.c | 1 - + 1 file changed, 1 deletion(-) + +--- a/lib/raid6/test/test.c ++++ b/lib/raid6/test/test.c +@@ -22,7 +22,6 @@ + #define NDISKS 16 /* Including P and Q */ + + const char raid6_empty_zero_page[PAGE_SIZE] __attribute__((aligned(PAGE_SIZE))); +-struct raid6_calls raid6_call; + + char *dataptrs[NDISKS]; + char data[NDISKS][PAGE_SIZE] __attribute__((aligned(PAGE_SIZE))); diff --git a/queue-4.14/media-davinci-vpif-fix-unbalanced-runtime-pm-get.patch b/queue-4.14/media-davinci-vpif-fix-unbalanced-runtime-pm-get.patch new file mode 100644 index 00000000000..143ee4bd748 --- /dev/null +++ b/queue-4.14/media-davinci-vpif-fix-unbalanced-runtime-pm-get.patch @@ -0,0 +1,33 @@ +From 4a321de239213300a714fa0353a5f1272d381a44 Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Wed, 22 Dec 2021 15:20:22 +0100 +Subject: media: davinci: vpif: fix unbalanced runtime PM get + +From: Johan Hovold + +commit 4a321de239213300a714fa0353a5f1272d381a44 upstream. + +Make sure to balance the runtime PM usage counter on driver unbind. + +Fixes: 407ccc65bfd2 ("[media] davinci: vpif: add pm_runtime support") +Cc: stable@vger.kernel.org # 3.9 +Cc: Lad, Prabhakar +Signed-off-by: Johan Hovold +Reviewed-by: Lad Prabhakar +Signed-off-by: Hans Verkuil +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Greg Kroah-Hartman +--- + drivers/media/platform/davinci/vpif.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/media/platform/davinci/vpif.c ++++ b/drivers/media/platform/davinci/vpif.c +@@ -495,6 +495,7 @@ static int vpif_probe(struct platform_de + + static int vpif_remove(struct platform_device *pdev) + { ++ pm_runtime_put(&pdev->dev); + pm_runtime_disable(&pdev->dev); + return 0; + } diff --git a/queue-4.14/pci-pciehp-clear-cmd_busy-bit-in-polling-mode.patch b/queue-4.14/pci-pciehp-clear-cmd_busy-bit-in-polling-mode.patch new file mode 100644 index 00000000000..320c70f4751 --- /dev/null +++ b/queue-4.14/pci-pciehp-clear-cmd_busy-bit-in-polling-mode.patch @@ -0,0 +1,53 @@ +From 92912b175178c7e895f5e5e9f1e30ac30319162b Mon Sep 17 00:00:00 2001 +From: Liguang Zhang +Date: Thu, 11 Nov 2021 13:42:58 +0800 +Subject: PCI: pciehp: Clear cmd_busy bit in polling mode + +From: Liguang Zhang + +commit 92912b175178c7e895f5e5e9f1e30ac30319162b upstream. + +Writes to a Downstream Port's Slot Control register are PCIe hotplug +"commands." If the Port supports Command Completed events, software must +wait for a command to complete before writing to Slot Control again. + +pcie_do_write_cmd() sets ctrl->cmd_busy when it writes to Slot Control. If +software notification is enabled, i.e., PCI_EXP_SLTCTL_HPIE and +PCI_EXP_SLTCTL_CCIE are set, ctrl->cmd_busy is cleared by pciehp_isr(). + +But when software notification is disabled, as it is when pcie_init() +powers off an empty slot, pcie_wait_cmd() uses pcie_poll_cmd() to poll for +command completion, and it neglects to clear ctrl->cmd_busy, which leads to +spurious timeouts: + + pcieport 0000:00:03.0: pciehp: Timeout on hotplug command 0x01c0 (issued 2264 msec ago) + pcieport 0000:00:03.0: pciehp: Timeout on hotplug command 0x05c0 (issued 2288 msec ago) + +Clear ctrl->cmd_busy in pcie_poll_cmd() when it detects a Command Completed +event (PCI_EXP_SLTSTA_CC). + +[bhelgaas: commit log] +Fixes: a5dd4b4b0570 ("PCI: pciehp: Wait for hotplug command completion where necessary") +Link: https://lore.kernel.org/r/20211111054258.7309-1-zhangliguang@linux.alibaba.com +Link: https://bugzilla.kernel.org/show_bug.cgi?id=215143 +Link: https://lore.kernel.org/r/20211126173309.GA12255@wunner.de +Signed-off-by: Liguang Zhang +Signed-off-by: Bjorn Helgaas +Reviewed-by: Lukas Wunner +Cc: stable@vger.kernel.org # v4.19+ +Signed-off-by: Greg Kroah-Hartman +--- + drivers/pci/hotplug/pciehp_hpc.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/pci/hotplug/pciehp_hpc.c ++++ b/drivers/pci/hotplug/pciehp_hpc.c +@@ -120,6 +120,8 @@ static int pcie_poll_cmd(struct controll + if (slot_status & PCI_EXP_SLTSTA_CC) { + pcie_capability_write_word(pdev, PCI_EXP_SLTSTA, + PCI_EXP_SLTSTA_CC); ++ ctrl->cmd_busy = 0; ++ smp_mb(); + return 1; + } + if (timeout < 0) diff --git a/queue-4.14/series b/queue-4.14/series index ad9563e4ace..e1fb1f2e417 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -45,3 +45,9 @@ arm-dts-exynos-add-missing-hdmi-supplies-on-smdk5250.patch arm-dts-exynos-add-missing-hdmi-supplies-on-smdk5420.patch carl9170-fix-missing-bit-wise-or-operator-for-tx_params.patch thermal-int340x-increase-bitmap-size.patch +lib-raid6-test-fix-multiple-definition-linking-error.patch +dec-limit-pmax-memory-probing-to-r3k-systems.patch +media-davinci-vpif-fix-unbalanced-runtime-pm-get.patch +brcmfmac-firmware-allocate-space-for-default-boardrev-in-nvram.patch +brcmfmac-pcie-replace-brcmf_pcie_copy_mem_todev-with-memcpy_toio.patch +pci-pciehp-clear-cmd_busy-bit-in-polling-mode.patch