--- /dev/null
+From 8e37372ad0bea4c9b4712d9943f6ae96cff9491f Mon Sep 17 00:00:00 2001
+From: Heiner Kallweit <hkallweit1@gmail.com>
+Date: Wed, 11 Oct 2023 09:46:45 +0200
+Subject: PCI/ASPM: Fix L1 substate handling in aspm_attr_store_common()
+
+From: Heiner Kallweit <hkallweit1@gmail.com>
+
+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 <hkallweit1@gmail.com>
+[bhelgaas: commit log]
+Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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));
--- /dev/null
+From 83a939f0fdc208ff3639dd3d42ac9b3c35607fd2 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>
+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 <u.kleine-koenig@pengutronix.de>
+
+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 <u.kleine-koenig@pengutronix.de>
+Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
+Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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,
--- /dev/null
+From 3064ef2e88c1629c1e67a77d7bc20020b35846f2 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>
+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 <u.kleine-koenig@pengutronix.de>
+
+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 <u.kleine-koenig@pengutronix.de>
+Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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
+@@ -742,7 +742,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);
+
+@@ -819,7 +819,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,
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-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