Skip to content

Commit c862c29

Browse files
Mani-Sadhasivamopsiff
authored andcommitted
Revert "PCI: Enable ACS after configuring IOMMU for OF platforms"
This reverts commit ec494c0260bf57a6fa3aa43a91daf7a774f8bd97 which is commit c41e2fb 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> (cherry picked from commit 53b86879e92b773085b97e2adf03f60c40e77e35) Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
1 parent b9e9a33 commit c862c29

3 files changed

Lines changed: 9 additions & 10 deletions

File tree

drivers/pci/pci-driver.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1668,14 +1668,6 @@ static int pci_dma_configure(struct device *dev)
16681668
ret = acpi_dma_configure(dev, acpi_get_dma_attr(adev));
16691669
}
16701670

1671-
/*
1672-
* Attempt to enable ACS regardless of capability because some Root
1673-
* Ports (e.g. those quirked with *_intel_pch_acs_*) do not have
1674-
* the standard ACS capability but still support ACS via those
1675-
* quirks.
1676-
*/
1677-
pci_enable_acs(to_pci_dev(dev));
1678-
16791671
pci_put_host_bridge_device(bridge);
16801672

16811673
if (!ret && !driver->driver_managed_dma) {

drivers/pci/pci.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1061,7 +1061,7 @@ static void pci_std_enable_acs(struct pci_dev *dev)
10611061
* pci_enable_acs - enable ACS if hardware support it
10621062
* @dev: the PCI device
10631063
*/
1064-
void pci_enable_acs(struct pci_dev *dev)
1064+
static void pci_enable_acs(struct pci_dev *dev)
10651065
{
10661066
if (!pci_acs_enable)
10671067
goto disable_acs_redir;
@@ -3838,6 +3838,14 @@ bool pci_acs_path_enabled(struct pci_dev *start,
38383838
void pci_acs_init(struct pci_dev *dev)
38393839
{
38403840
dev->acs_cap = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ACS);
3841+
3842+
/*
3843+
* Attempt to enable ACS regardless of capability because some Root
3844+
* Ports (e.g. those quirked with *_intel_pch_acs_*) do not have
3845+
* the standard ACS capability but still support ACS via those
3846+
* quirks.
3847+
*/
3848+
pci_enable_acs(dev);
38413849
}
38423850

38433851
/**

drivers/pci/pci.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,6 @@ static inline resource_size_t pci_resource_alignment(struct pci_dev *dev,
566566
}
567567

568568
void pci_acs_init(struct pci_dev *dev);
569-
void pci_enable_acs(struct pci_dev *dev);
570569
#ifdef CONFIG_PCI_QUIRKS
571570
int pci_dev_specific_acs_enabled(struct pci_dev *dev, u16 acs_flags);
572571
int pci_dev_specific_enable_acs(struct pci_dev *dev);

0 commit comments

Comments
 (0)