]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
Revert "PCI: Enable ACS after configuring IOMMU for OF platforms"
authorManivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Tue, 31 Mar 2026 09:14:55 +0000 (14:44 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 18 Apr 2026 08:35:59 +0000 (10:35 +0200)
This reverts commit 5d57164c0ab0ac5c99eca49c577994bfbca70a2a which is
commit c41e2fb67e26b04d919257875fa954aa5f6e392e upstream.

The original commit attempted to enable ACS in pci_dma_configure() prior
to IOMMU group assignment in iommu_init_device() to fix the ACS enablement
issue for OF platforms. But that assumption doesn't hold true for kernel
versions prior to v6.15, because on these older kernels,
pci_dma_configure() is called *after* iommu_init_device(). So the IOMMU
groups are already created before the ACS gets enabled. This causes the
devices that should have been split into separate groups by ACS, getting
merged into one group, thereby breaking the IOMMU isolation as reported on
the AMD machines.

So revert the offending commit to restore the IOMMU group assignment on
those affected machines. It should be noted that ACS has never really
worked on kernel versions prior to v6.15, so the revert doesn't make any
difference for OF platforms.

Reported-by: John Hancock <john@kernel.doghat.io>
Reported-by: bjorn.forsman@gmail.com
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=221234
Fixes: b20b659c2c6a ("PCI: Enable ACS after configuring IOMMU for OF platforms")
Cc: Linux kernel regressions list <regressions@lists.linux.dev>
Link: https://lore.kernel.org/regressions/2c30f181-ffc6-4d63-a64e-763cf4528f48@leemhuis.info
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/pci/pci-driver.c
drivers/pci/pci.c
drivers/pci/pci.h

index 8b5796a6ed5ff644677d3a35106b778014629aa3..fe6e5f716543af1b3701afa2d52fcc6d598de43e 100644 (file)
@@ -1667,14 +1667,6 @@ static int pci_dma_configure(struct device *dev)
                ret = acpi_dma_configure(dev, acpi_get_dma_attr(adev));
        }
 
-       /*
-        * Attempt to enable ACS regardless of capability because some Root
-        * Ports (e.g. those quirked with *_intel_pch_acs_*) do not have
-        * the standard ACS capability but still support ACS via those
-        * quirks.
-        */
-       pci_enable_acs(to_pci_dev(dev));
-
        pci_put_host_bridge_device(bridge);
 
        if (!ret && !driver->driver_managed_dma) {
index d2d6b7da8c66cc83f968ad3b56a2b37140365cc7..0778bb09d87848e080f5b177d8d91011fc7fa061 100644 (file)
@@ -1040,7 +1040,7 @@ static void pci_std_enable_acs(struct pci_dev *dev)
  * pci_enable_acs - enable ACS if hardware support it
  * @dev: the PCI device
  */
-void pci_enable_acs(struct pci_dev *dev)
+static void pci_enable_acs(struct pci_dev *dev)
 {
        if (!pci_acs_enable)
                goto disable_acs_redir;
@@ -3777,6 +3777,14 @@ bool pci_acs_path_enabled(struct pci_dev *start,
 void pci_acs_init(struct pci_dev *dev)
 {
        dev->acs_cap = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ACS);
+
+       /*
+        * Attempt to enable ACS regardless of capability because some Root
+        * Ports (e.g. those quirked with *_intel_pch_acs_*) do not have
+        * the standard ACS capability but still support ACS via those
+        * quirks.
+        */
+       pci_enable_acs(dev);
 }
 
 /**
index 0debf921a9feb3a9902840c8738cc7c4b6188381..85488bc8e7795f8578abdec2f53a473ea6416a54 100644 (file)
@@ -526,7 +526,6 @@ static inline resource_size_t pci_resource_alignment(struct pci_dev *dev,
 }
 
 void pci_acs_init(struct pci_dev *dev);
-void pci_enable_acs(struct pci_dev *dev);
 #ifdef CONFIG_PCI_QUIRKS
 int pci_dev_specific_acs_enabled(struct pci_dev *dev, u16 acs_flags);
 int pci_dev_specific_enable_acs(struct pci_dev *dev);