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

Stefano Stabellini posted 1 patch 1 month ago
xen/drivers/passthrough/amd/iommu_acpi.c | 1 +
1 file changed, 1 insertion(+)
[PATCH] xen/amd/iommu: Skip IO-APICs missing from the IVRS in shared IRT mode
Posted by Stefano Stabellini 1 month ago
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.

Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
---
 xen/drivers/passthrough/amd/iommu_acpi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/drivers/passthrough/amd/iommu_acpi.c b/xen/drivers/passthrough/amd/iommu_acpi.c
index 39ae637959..4688908824 100644
--- a/xen/drivers/passthrough/amd/iommu_acpi.c
+++ b/xen/drivers/passthrough/amd/iommu_acpi.c
@@ -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. */
-- 
2.43.0
Re: [PATCH] xen/amd/iommu: Skip IO-APICs missing from the IVRS in shared IRT mode
Posted by Teddy Astie 1 month ago
Le 21/10/2026 à 00:02, Stefano Stabellini a écrit :
> 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.
> 
> Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
> ---
>   xen/drivers/passthrough/amd/iommu_acpi.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/xen/drivers/passthrough/amd/iommu_acpi.c b/xen/drivers/passthrough/amd/iommu_acpi.c
> index 39ae637959..4688908824 100644
> --- a/xen/drivers/passthrough/amd/iommu_acpi.c
> +++ b/xen/drivers/passthrough/amd/iommu_acpi.c
> @@ -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. */

Reviewed-by: Teddy Astie <teddy.astie@vates.tech>

Teddy
Re: [PATCH] xen/amd/iommu: Skip IO-APICs missing from the IVRS in shared IRT mode
Posted by Jan Beulich 4 weeks ago
On 21.10.2026 10:51, Teddy Astie wrote:
> Le 21/10/2026 à 00:02, Stefano Stabellini a écrit :
>> 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.
>>
>> Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
> 
> Reviewed-by: Teddy Astie <teddy.astie@vates.tech>

Acked-by: Jan Beulich <jbeulich@suse.com>