Skip to contentSkip to conversation

xen/amd/iommu: Skip IO-APICs missing from the IVRS in shared IRT mode

PATCH In review Stefano Stabellini 3 participants 3 messages Oct 20 – Oct 26

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/amd/iommu: Skip IO-APICs missing from the IVRS in shared IRT mode

When an IO-APIC with entries isn't described by the IVRS, ioapic_id_to_index() returns MAX_IO_APICS. With per-device interrupt remapping tables this is fatal, but in shared mode parse_ivrs_table() only logs it and then uses MAX_IO_APICS as an index, reading and writing one past the end of ioapic_sbdf[].

Skip such an IO-APIC instead. It is left without interrupt remapping, which is what the rest of the code already assumes for an IO-APIC with no index.

---
 xen/drivers/passthrough/amd/iommu_acpi.c | 1 +
 1 file changed, 1 insertion(+)
xen/drivers/passthrough/amd/iommu_acpi.c +1 -0
index 39ae637959..4688908824 100644
@@ -1132,6 +1132,7 @@ static int __init cf_check parse_ivrs_table(struct acpi_table_header *table)
                    IO_APIC_ID(apic));
             if ( amd_iommu_perdev_intremap )
                 return -ENXIO;
+            continue;
         }
 
         /* SB IO-APIC is always on this device in AMD systems. */
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw

Le 21/10/2026 à 00:02, Stefano Stabellini a écrit :

Quoted 20 lines

When an IO-APIC with entries isn't described by the IVRS, ioapic_id_to_index() returns MAX_IO_APICS. With per-device interrupt remapping tables this is fatal, but in shared mode parse_ivrs_table() only logs it and then uses MAX_IO_APICS as an index, reading and writing one past the end of ioapic_sbdf[].

Skip such an IO-APIC instead. It is left without interrupt remapping, which is what the rest of the code already assumes for an IO-APIC with no index.

---
  xen/drivers/passthrough/amd/iommu_acpi.c | 1 +
  1 file changed, 1 insertion(+)
xen/drivers/passthrough/amd/iommu_acpi.c +0 -0
index 39ae637959..4688908824 100644

xen/drivers/passthrough/amd/iommu_acpi.c static int __init cf_check parse_ivrs_table(struct acpi_table_header *table) · line 1138

Quoted 7 lines
xen/drivers/passthrough/amd/iommu_acpi.c +1 -0
@@ -1132,6 +1132,7 @@ static int __init cf_check parse_ivrs_table(struct acpi_table_header *table)
                     IO_APIC_ID(apic));
              if ( amd_iommu_perdev_intremap )
                  return -ENXIO;
+            continue;
          }
 
          /* SB IO-APIC is always on this device in AMD systems. */

Teddy

Acked-by
#2 lore raw
Quoted 7 lines · Teddy Astie

Le 21/10/2026 à 00:02, Stefano Stabellini a écrit :

Quoted 6 lines

When an IO-APIC with entries isn't described by the IVRS, ioapic_id_to_index() returns MAX_IO_APICS. With per-device interrupt remapping tables this is fatal, but in shared mode parse_ivrs_table() only logs it and then uses MAX_IO_APICS as an index, reading and writing one past the end of ioapic_sbdf[].

Quoted 7 lines
Quoted 5 lines

Skip such an IO-APIC instead. It is left without interrupt remapping, which is what the rest of the code already assumes for an IO-APIC with no index.