Skip to contentSkip to conversation

iommu/amd: Enable PCIe ACS only if AMD IOMMU is

PATCH In review Jinhui Guo 2 participants 4 messages Oct 11, 2025 – Oct 27, 2025

Subsystems (2)
lore
Share & tools
lore

Jinhui Guo

author
#0 lore raw

v2 cover iommu/amd: Enable PCIe ACS only if AMD IOMMU is

Hi all,

To preserve PCIe performance, ACS is enabled only when AMD IOMMU is not disabled.

[This text serves solely as the patch changelog.]

Thanks,
Jinhui

---
v1: https://lore.kernel.org/all/[email protected]/

Changelog in v1 -> v2 (suggested by Suravee):
- Drop the amd_iommu_force_enable check; it's only used to skip a workaround in the same function.

Jinhui Guo (1):
iommu/amd: Enable PCIe ACS only if AMD IOMMU is on

 drivers/iommu/amd/init.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
Signature · 1 line
2.20.1
author
#1 lore raw

PATCH v2 1/1 iommu/amd: Enable PCIe ACS only if AMD IOMMU is on

To preserve PCIe performance, ACS is enabled only when AMD IOMMU is not disabled.

---
 drivers/iommu/amd/init.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/iommu/amd/init.c +4 -2
index f2991c11867c..38e8c38c5f10 100644
@@ -3314,8 +3314,10 @@ static bool __init detect_ivrs(void)
 	}
 
 out:
-	/* Make sure ACS will be enabled during PCI probe */
-	pci_request_acs();
+	if (!amd_iommu_disabled) {
+		/* Make sure ACS will be enabled during PCI probe */
+		pci_request_acs();
+	}
 
 	return true;
 }
Signature · 1 line
2.20.1
maintainer
#2 lore raw

Re: [PATCH v2 1/1] iommu/amd: Enable PCIe ACS only if AMD IOMMU is on

Quoted 14 lines · Jinhui Guo

To preserve PCIe performance, ACS is enabled only when AMD IOMMU is not disabled.

---
 drivers/iommu/amd/init.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/iommu/amd/init.c +0 -0
index f2991c11867c..38e8c38c5f10 100644

drivers/iommu/amd/init.c static bool __init detect_ivrs(void) · line 3320

Quoted 9 lines
drivers/iommu/amd/init.c +4 -2
@@ -3314,8 +3314,10 @@ static bool __init detect_ivrs(void)
 	}
 
 out:
-	/* Make sure ACS will be enabled during PCI probe */
-	pci_request_acs();
+	if (!amd_iommu_disabled) {
+		/* Make sure ACS will be enabled during PCI probe */
+		pci_request_acs();
+	}

Instead of checking amd_iommu_disabled here it is better to move the pci_request_acs() call to early_amd_iommu_init(). This function is only called when amd_iommu_disabled is false and runs still before PCI probing.

Regards,

Joerg

author
#3 lore raw

Re: [PATCH v2 1/1] iommu/amd: Enable PCIe ACS only if AMD IOMMU is on

Quoted 16 lines · Jörg Rödel
Quoted 16 lines

To preserve PCIe performance, ACS is enabled only when AMD IOMMU is not disabled.

---
 drivers/iommu/amd/init.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/iommu/amd/init.c +0 -0
index f2991c11867c..38e8c38c5f10 100644
@@ -3314,8 +3314,10 @@ static bool __init detect_ivrs(void)
 	}
 
Quoted 11 lines

drivers/iommu/amd/init.c static bool __init detect_ivrs(void) · line 3320

Quoted 7 lines
drivers/iommu/amd/init.c +4 -2
 out:
-	/* Make sure ACS will be enabled during PCI probe */
-	pci_request_acs();
+	if (!amd_iommu_disabled) {
+		/* Make sure ACS will be enabled during PCI probe */
+		pci_request_acs();
+	}

Instead of checking amd_iommu_disabled here it is better to move the pci_request_acs() call to early_amd_iommu_init(). This function is only called when amd_iommu_disabled is false and runs still before PCI probing.

A previous attempt (https://lore.kernel.org/all/[email protected]/)
fails when interrupt-remapping is disabled via CONFIG_IRQ_REMAP=n or intremap=off.

With interrupt remapping off, early_amd_iommu_init() is deferred to rootfs_initcall(pci_iommu_init), which runs after subsys_initcall(acpi_init) and therefore after pci_enable_acs().

Keep pci_request_acs() in detect_ivrs() to set pci_acs_enable before any PCI device is added, regardless of the interrupt-remap setting.

PCI devices probe
---
subsys_initcall(acpi_init);
acpi_scan_init()
acpi_bus_scan()
acpi_bus_attach()

    acpi_scan_attach_handler()
     handler->attach()
      acpi_pci_root_add()
       pci_acpi_scan_root()
        acpi_pci_root_create()
         pci_scan_child_bus()
          pci_scan_child_bus_extend()
           pci_scan_slot()
            pci_scan_single_device()
             pci_device_add()
              pci_init_capabilities()
               pci_acs_init()
                pci_enable_acs()

AMD IOMMU initialize
---
rootfs_initcall(pci_iommu_init);
x86_init.iommu.iommu_init()
amd_iommu_init()
iommu_go_to_state(IOMMU_INITIALIZED)
state_next()
early_amd_iommu_init()

Regards,
Jinhui