[PATCH] iommu/amd: Skip the southbridge IOAPIC PCI class check in guests

From: Wei Wang

Date: Tue Dec 01 2026 - 02:54:23 EST


Linux 7.3 hangs during boot in a VMware ESXi 7.0U3 guest with the virtual
IOMMU enabled. IVRS reports 00:14.0 as the source ID for the southbridge
IOAPIC, but reading the PCI class at that address returns 0xffff. The PCI
class check therefore rejects a valid mapping, causing Linux to disable
interrupt remapping.

On bare metal, the PCI class provides a sanity check that the source ID
corresponds to a southbridge function. In a VM, the VMM typically supplies
both the IVRS mapping and the source ID used by the emulated IOAPIC. That
ID need not correspond to a guest-visible PCI function.

Skip the PCI class check when the CPU advertises a hypervisor. The driver
still requires a source-ID mapping for each IOAPIC. With the check skipped,
the guest boots with interrupt remapping enabled.

Fixes: 16f52863b2ec ("iommu/amd: Dynamically verify Southbridge IOAPIC via PCI config space")
Reported-by: Artem Anisimov <artem.anisimov.255@xxxxxxxxx>
Closes: https://lore.kernel.org/r/d5646630-9f56-4b29-b0e5-56f5052f9f75@xxxxxxxxx
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Wei Wang <wei.w.wang@xxxxxxxxxxx>
---
drivers/iommu/amd/init.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c
index 69f38ca8ff87..a7f7e9e7e96c 100644
--- a/drivers/iommu/amd/init.c
+++ b/drivers/iommu/amd/init.c
@@ -3208,6 +3208,14 @@ static bool __init check_sb_ioapic(int devid)
u8 devfn = devid & 0xff;
u16 val;

+ /*
+ * A virtual IOAPIC may use a source ID with no corresponding PCI
+ * function. Skip the PCI class check in guests and accept the source
+ * ID from IVRS.
+ */
+ if (boot_cpu_has(X86_FEATURE_HYPERVISOR))
+ return true;
+
val = read_pci_config_16(bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
PCI_CLASS_DEVICE);


base-commit: 253f86660c1f882fbf554db5eaa34bc5d66dc7e8
--
2.51.0