iommu/amd: Skip the southbridge IOAPIC PCI class check in guests
Subsystems (3)
PATCH 1/1 iommu/amd: Skip the southbridge IOAPIC PCI class check in guests
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.
--- drivers/iommu/amd/init.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/iommu/amd/init.c +8 -0
@@ -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
Signature · 1 line
2.51.0
Quoted 15 lines · Wei Wang
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.
Quoted 5 lines
Fixes 16f52863b2ec ("iommu/amd: Dynamically verify Southbridge IOAPIC via PCI config space")Reported-by Artem Anisimov <[email protected]>Signed-off-by Wei Wang <[email protected]>
Applied. Thanks!
-Vasant