Skip to content

iommu/amd: Preserve x2APIC and MSI support when amd_iommu=off

Adrian Huang (Lenovo) linux-iommu lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2iommu/amd: Keep x2apic enabled when appending amd_iommu=offdrivers/iommu/amd/amd_iommu.h drivers/iommu/amd/init.c drivers/iommu/amd/iommu.c+61 -101 reply
2/2iommu/amd: Register PCI bus notifier when appending amd_iommu=offdrivers/iommu/amd/init.c+25 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] iommu/amd: Preserve x2APIC and MSI support when amd_iommu=off

[Overview]
This patch series modifies the behavior of the amd_iommu=off kernel parameter to ensure that x2APIC and MSI domain allocation remain functional, even when DMA translation is disabled.

Currently, on AMD systems, specifying amd_iommu=off completely shuts down the IOMMU subsystem. This causes the system to disable x2APIC and fall back to physical flat mode, which limits the system to 255 APIC IDs. On high-core-count systems (e.g., 448 cores), this results in a significant number of CPUs failing to bring up. Furthermore, dynamically added PCI devices (such as SR-IOV VFs) fail to associate with the correct MSI domain, leading to IOMMU fault events and kernel warnings.

[Motivation]
On Intel platforms, intel_iommu=off only disables DMA translation while keeping the necessary interrupt remapping infrastructure active to support x2APIC and high CPU counts. This series brings the AMD IOMMU driver in line with this behavior, ensuring stability on modern, large-scale hardware.

[Patch Summary]
Patch 1: Adjusts the amd_iommu=off semantics to keep x2APIC enabled. It ensures that the kernel can bring up all available CPUs on large systems by maintaining x2APIC ops instead of falling back to physical flat mode.

Patch 2: With applying "Patch 1", patch 2 ensures the PCI bus notifier is registered even when amd_iommu=off is used. This allows hotplugged devices or SR-IOV VFs to be correctly assigned to the IOMMU interrupt remapping domain, preventing INVALID_DEVICE_REQUEST faults and MSI activation failures.

[Verification]
Testing was performed on a 448-core Lenovo ThinkSystem server. All 448 CPUs are successfully initialized; SR-IOV VFs are created and assigned interrupts without faults.

Adrian Huang (Lenovo) (2):
iommu/amd: Keep x2apic enabled when appending amd_iommu=off iommu/amd: Register PCI bus notifier when appending amd_iommu=off

 drivers/iommu/amd/amd_iommu.h |  1 +
 drivers/iommu/amd/init.c      | 81 ++++++++++++++++++++++++++++++-----
 drivers/iommu/amd/iommu.c     | 14 ++++++
 3 files changed, 86 insertions(+), 10 deletions(-)
Signature · 1 line
2.47.3