From: Greg Kroah-Hartman Date: Wed, 22 Nov 2023 20:09:59 +0000 (+0000) Subject: 6.6-stable patches X-Git-Tag: v4.14.331~105 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3edf3c8f0882cd19b31563a74e9b0b2fca0a5b81;p=thirdparty%2Fkernel%2Fstable-queue.git 6.6-stable patches added patches: pci-aspm-fix-l1-substate-handling-in-aspm_attr_store_common.patch pci-exynos-don-t-discard-.remove-callback.patch pci-kirin-don-t-discard-.remove-callback.patch pci-lengthen-reset-delay-for-videopropulsion-torrent-qn16e-card.patch pci-qcom-ep-add-dedicated-callback-for-writing-to-dbi2-registers.patch --- diff --git a/queue-6.6/pci-aspm-fix-l1-substate-handling-in-aspm_attr_store_common.patch b/queue-6.6/pci-aspm-fix-l1-substate-handling-in-aspm_attr_store_common.patch new file mode 100644 index 00000000000..7f537b7f7c9 --- /dev/null +++ b/queue-6.6/pci-aspm-fix-l1-substate-handling-in-aspm_attr_store_common.patch @@ -0,0 +1,51 @@ +From 8e37372ad0bea4c9b4712d9943f6ae96cff9491f Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Wed, 11 Oct 2023 09:46:45 +0200 +Subject: PCI/ASPM: Fix L1 substate handling in aspm_attr_store_common() + +From: Heiner Kallweit + +commit 8e37372ad0bea4c9b4712d9943f6ae96cff9491f upstream. + +aspm_attr_store_common(), which handles sysfs control of ASPM, has the same +problem as fb097dcd5a28 ("PCI/ASPM: Disable only ASPM_STATE_L1 when driver +disables L1"): disabling L1 adds only ASPM_L1 (but not any of the L1.x +substates) to the "aspm_disable" mask. + +Enabling one substate, e.g., L1.1, via sysfs removes ASPM_L1 from the +disable mask. Since disabling L1 via sysfs doesn't add any of the +substates to the disable mask, enabling L1.1 actually enables *all* the +substates. + +In this scenario: + + - Write 0 to "l1_aspm" to disable L1 + - Write 1 to "l1_1_aspm" to enable L1.1 + +the intention is to disable L1 and all L1.x substates, then enable just +L1.1, but in fact, *all* L1.x substates are enabled. + +Fix this by explicitly disabling all the L1.x substates when disabling L1. + +Fixes: 72ea91afbfb0 ("PCI/ASPM: Add sysfs attributes for controlling ASPM link states") +Link: https://lore.kernel.org/r/6ba7dd79-9cfe-4ed0-a002-d99cb842f361@gmail.com +Signed-off-by: Heiner Kallweit +[bhelgaas: commit log] +Signed-off-by: Bjorn Helgaas +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/pci/pcie/aspm.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/pci/pcie/aspm.c ++++ b/drivers/pci/pcie/aspm.c +@@ -1248,6 +1248,8 @@ static ssize_t aspm_attr_store_common(st + link->aspm_disable &= ~ASPM_STATE_L1; + } else { + link->aspm_disable |= state; ++ if (state & ASPM_STATE_L1) ++ link->aspm_disable |= ASPM_STATE_L1SS; + } + + pcie_config_aspm_link(link, policy_to_aspm_state(link)); diff --git a/queue-6.6/pci-exynos-don-t-discard-.remove-callback.patch b/queue-6.6/pci-exynos-don-t-discard-.remove-callback.patch new file mode 100644 index 00000000000..2f25b80bc25 --- /dev/null +++ b/queue-6.6/pci-exynos-don-t-discard-.remove-callback.patch @@ -0,0 +1,55 @@ +From 83a939f0fdc208ff3639dd3d42ac9b3c35607fd2 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= +Date: Sun, 1 Oct 2023 19:02:51 +0200 +Subject: PCI: exynos: Don't discard .remove() callback +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Uwe Kleine-König + +commit 83a939f0fdc208ff3639dd3d42ac9b3c35607fd2 upstream. + +With CONFIG_PCI_EXYNOS=y and exynos_pcie_remove() marked with __exit, the +function is discarded from the driver. In this case a bound device can +still get unbound, e.g via sysfs. Then no cleanup code is run resulting in +resource leaks or worse. + +The right thing to do is do always have the remove callback available. +This fixes the following warning by modpost: + + WARNING: modpost: drivers/pci/controller/dwc/pci-exynos: section mismatch in reference: exynos_pcie_driver+0x8 (section: .data) -> exynos_pcie_remove (section: .exit.text) + +(with ARCH=x86_64 W=1 allmodconfig). + +Fixes: 340cba6092c2 ("pci: Add PCIe driver for Samsung Exynos") +Link: https://lore.kernel.org/r/20231001170254.2506508-2-u.kleine-koenig@pengutronix.de +Signed-off-by: Uwe Kleine-König +Signed-off-by: Bjorn Helgaas +Reviewed-by: Alim Akhtar +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/pci/controller/dwc/pci-exynos.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/pci/controller/dwc/pci-exynos.c ++++ b/drivers/pci/controller/dwc/pci-exynos.c +@@ -375,7 +375,7 @@ fail_probe: + return ret; + } + +-static int __exit exynos_pcie_remove(struct platform_device *pdev) ++static int exynos_pcie_remove(struct platform_device *pdev) + { + struct exynos_pcie *ep = platform_get_drvdata(pdev); + +@@ -431,7 +431,7 @@ static const struct of_device_id exynos_ + + static struct platform_driver exynos_pcie_driver = { + .probe = exynos_pcie_probe, +- .remove = __exit_p(exynos_pcie_remove), ++ .remove = exynos_pcie_remove, + .driver = { + .name = "exynos-pcie", + .of_match_table = exynos_pcie_of_match, diff --git a/queue-6.6/pci-kirin-don-t-discard-.remove-callback.patch b/queue-6.6/pci-kirin-don-t-discard-.remove-callback.patch new file mode 100644 index 00000000000..c906b350a24 --- /dev/null +++ b/queue-6.6/pci-kirin-don-t-discard-.remove-callback.patch @@ -0,0 +1,54 @@ +From 3064ef2e88c1629c1e67a77d7bc20020b35846f2 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= +Date: Sun, 1 Oct 2023 19:02:52 +0200 +Subject: PCI: kirin: Don't discard .remove() callback +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Uwe Kleine-König + +commit 3064ef2e88c1629c1e67a77d7bc20020b35846f2 upstream. + +With CONFIG_PCIE_KIRIN=y and kirin_pcie_remove() marked with __exit, the +function is discarded from the driver. In this case a bound device can +still get unbound, e.g via sysfs. Then no cleanup code is run resulting in +resource leaks or worse. + +The right thing to do is do always have the remove callback available. +This fixes the following warning by modpost: + + drivers/pci/controller/dwc/pcie-kirin: section mismatch in reference: kirin_pcie_driver+0x8 (section: .data) -> kirin_pcie_remove (section: .exit.text) + +(with ARCH=x86_64 W=1 allmodconfig). + +Fixes: 000f60db784b ("PCI: kirin: Add support for a PHY layer") +Link: https://lore.kernel.org/r/20231001170254.2506508-3-u.kleine-koenig@pengutronix.de +Signed-off-by: Uwe Kleine-König +Signed-off-by: Bjorn Helgaas +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/pci/controller/dwc/pcie-kirin.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/pci/controller/dwc/pcie-kirin.c ++++ b/drivers/pci/controller/dwc/pcie-kirin.c +@@ -741,7 +741,7 @@ err: + return ret; + } + +-static int __exit kirin_pcie_remove(struct platform_device *pdev) ++static int kirin_pcie_remove(struct platform_device *pdev) + { + struct kirin_pcie *kirin_pcie = platform_get_drvdata(pdev); + +@@ -818,7 +818,7 @@ static int kirin_pcie_probe(struct platf + + static struct platform_driver kirin_pcie_driver = { + .probe = kirin_pcie_probe, +- .remove = __exit_p(kirin_pcie_remove), ++ .remove = kirin_pcie_remove, + .driver = { + .name = "kirin-pcie", + .of_match_table = kirin_pcie_match, diff --git a/queue-6.6/pci-lengthen-reset-delay-for-videopropulsion-torrent-qn16e-card.patch b/queue-6.6/pci-lengthen-reset-delay-for-videopropulsion-torrent-qn16e-card.patch new file mode 100644 index 00000000000..8287eea5309 --- /dev/null +++ b/queue-6.6/pci-lengthen-reset-delay-for-videopropulsion-torrent-qn16e-card.patch @@ -0,0 +1,65 @@ +From c9260693aa0c1e029ed23693cfd4d7814eee6624 Mon Sep 17 00:00:00 2001 +From: Lukas Wunner +Date: Thu, 21 Sep 2023 16:23:34 +0200 +Subject: PCI: Lengthen reset delay for VideoPropulsion Torrent QN16e card + +From: Lukas Wunner + +commit c9260693aa0c1e029ed23693cfd4d7814eee6624 upstream. + +Commit ac91e6980563 ("PCI: Unify delay handling for reset and resume") +shortened an unconditional 1 sec delay after a Secondary Bus Reset to 100 +msec for PCIe (per PCIe r6.1 sec 6.6.1). The 1 sec delay is only required +for Conventional PCI. + +But it turns out that there are PCIe devices which require a longer delay +than prescribed before first config space access after reset recovery or +resume from D3cold: + +Chad reports that a "VideoPropulsion Torrent QN16e" MPEG QAM Modulator +"raises a PCI system error (PERR), as reported by the IPMI event log, and +the hardware itself would suffer a catastrophic event, cycling the server" +unless the longer delay is observed. + +The card is specified to conform to PCIe r1.0 and indeed only supports Gen1 +speed (2.5 GT/s) according to lspci. PCIe r1.0 sec 7.6 prescribes the same +100 msec delay as PCIe r6.1 sec 6.6.1: + + To allow components to perform internal initialization, system software + must wait for at least 100 ms from the end of a reset (cold/warm/hot) + before it is permitted to issue Configuration Requests + +The behavior of the Torrent QN16e card thus appears to be a quirk. Treat +it as such and lengthen the reset delay for this specific device. + +Fixes: ac91e6980563 ("PCI: Unify delay handling for reset and resume") +Link: https://lore.kernel.org/r/47727e792c7f0282dc144e3ec8ce8eb6e713394e.1695304512.git.lukas@wunner.de +Reported-by: Chad Schroeder +Closes: https://lore.kernel.org/linux-pci/DM6PR16MB2844903E34CAB910082DF019B1FAA@DM6PR16MB2844.namprd16.prod.outlook.com/ +Tested-by: Chad Schroeder +Signed-off-by: Lukas Wunner +Signed-off-by: Bjorn Helgaas +Cc: stable@vger.kernel.org # v5.4+ +Signed-off-by: Greg Kroah-Hartman +--- + drivers/pci/quirks.c | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +--- a/drivers/pci/quirks.c ++++ b/drivers/pci/quirks.c +@@ -6211,3 +6211,15 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_I + DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_XILINX, 0x5020, of_pci_make_dev_node); + DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_XILINX, 0x5021, of_pci_make_dev_node); + DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_REDHAT, 0x0005, of_pci_make_dev_node); ++ ++/* ++ * Devices known to require a longer delay before first config space access ++ * after reset recovery or resume from D3cold: ++ * ++ * VideoPropulsion (aka Genroco) Torrent QN16e MPEG QAM Modulator ++ */ ++static void pci_fixup_d3cold_delay_1sec(struct pci_dev *pdev) ++{ ++ pdev->d3cold_delay = 1000; ++} ++DECLARE_PCI_FIXUP_FINAL(0x5555, 0x0004, pci_fixup_d3cold_delay_1sec); diff --git a/queue-6.6/pci-qcom-ep-add-dedicated-callback-for-writing-to-dbi2-registers.patch b/queue-6.6/pci-qcom-ep-add-dedicated-callback-for-writing-to-dbi2-registers.patch new file mode 100644 index 00000000000..39525e63805 --- /dev/null +++ b/queue-6.6/pci-qcom-ep-add-dedicated-callback-for-writing-to-dbi2-registers.patch @@ -0,0 +1,77 @@ +From a07d2497ed657eb2efeb967af47e22f573dcd1d6 Mon Sep 17 00:00:00 2001 +From: Manivannan Sadhasivam +Date: Wed, 25 Oct 2023 18:30:29 +0530 +Subject: PCI: qcom-ep: Add dedicated callback for writing to DBI2 registers +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Manivannan Sadhasivam + +commit a07d2497ed657eb2efeb967af47e22f573dcd1d6 upstream. + +The DWC core driver exposes the write_dbi2() callback for writing to the +DBI2 registers in a vendor-specific way. + +On the Qcom EP platforms, the DBI_CS2 bit in the ELBI region needs to be +asserted before writing to any DBI2 registers and deasserted once done. + +So, let's implement the callback for the Qcom PCIe EP driver so that the +DBI2 writes are correctly handled in the hardware. + +Without this callback, the DBI2 register writes like BAR size won't go +through and as a result, the default BAR size is set for all BARs. + +[kwilczynski: commit log, renamed function to match the DWC convention] +Fixes: f55fee56a631 ("PCI: qcom-ep: Add Qualcomm PCIe Endpoint controller driver") +Suggested-by: Serge Semin +Link: https://lore.kernel.org/linux-pci/20231025130029.74693-2-manivannan.sadhasivam@linaro.org +Signed-off-by: Manivannan Sadhasivam +Signed-off-by: Krzysztof Wilczyński +Reviewed-by: Serge Semin +Cc: stable@vger.kernel.org # 5.16+ +Signed-off-by: Greg Kroah-Hartman +--- + drivers/pci/controller/dwc/pcie-qcom-ep.c | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + +--- a/drivers/pci/controller/dwc/pcie-qcom-ep.c ++++ b/drivers/pci/controller/dwc/pcie-qcom-ep.c +@@ -123,6 +123,7 @@ + + /* ELBI registers */ + #define ELBI_SYS_STTS 0x08 ++#define ELBI_CS2_ENABLE 0xa4 + + /* DBI registers */ + #define DBI_CON_STATUS 0x44 +@@ -263,6 +264,21 @@ static void qcom_pcie_dw_stop_link(struc + disable_irq(pcie_ep->perst_irq); + } + ++static void qcom_pcie_dw_write_dbi2(struct dw_pcie *pci, void __iomem *base, ++ u32 reg, size_t size, u32 val) ++{ ++ struct qcom_pcie_ep *pcie_ep = to_pcie_ep(pci); ++ int ret; ++ ++ writel(1, pcie_ep->elbi + ELBI_CS2_ENABLE); ++ ++ ret = dw_pcie_write(pci->dbi_base2 + reg, size, val); ++ if (ret) ++ dev_err(pci->dev, "Failed to write DBI2 register (0x%x): %d\n", reg, ret); ++ ++ writel(0, pcie_ep->elbi + ELBI_CS2_ENABLE); ++} ++ + static void qcom_pcie_ep_icc_update(struct qcom_pcie_ep *pcie_ep) + { + struct dw_pcie *pci = &pcie_ep->pci; +@@ -519,6 +535,7 @@ static const struct dw_pcie_ops pci_ops + .link_up = qcom_pcie_dw_link_up, + .start_link = qcom_pcie_dw_start_link, + .stop_link = qcom_pcie_dw_stop_link, ++ .write_dbi2 = qcom_pcie_dw_write_dbi2, + }; + + static int qcom_pcie_ep_get_io_resources(struct platform_device *pdev, diff --git a/queue-6.6/series b/queue-6.6/series index 4885ff8e3a9..b9f6f37ce5d 100644 --- a/queue-6.6/series +++ b/queue-6.6/series @@ -321,3 +321,8 @@ ksmbd-fix-slab-out-of-bounds-write-in-smb_inherit_dacl.patch mmc-vub300-fix-an-error-code.patch mmc-sdhci_am654-fix-start-loop-index-for-tap-value-parsing.patch mmc-add-quirk-mmc_quirk_broken_cache_flush-for-micron-emmc-q2j54a.patch +pci-qcom-ep-add-dedicated-callback-for-writing-to-dbi2-registers.patch +pci-aspm-fix-l1-substate-handling-in-aspm_attr_store_common.patch +pci-kirin-don-t-discard-.remove-callback.patch +pci-exynos-don-t-discard-.remove-callback.patch +pci-lengthen-reset-delay-for-videopropulsion-torrent-qn16e-card.patch