From 65504478fe44f6dd8b61907efa4eaeba5b79cbf5 Mon Sep 17 00:00:00 2001 From: Patrick Rudolph Date: Thu, 20 Mar 2025 13:51:58 +0100 Subject: [PATCH] emulation: qemu-sbsa: Fill in correct ITS ID The ACPI IORT and ACPI MADT needs to use the same IDs when referencing GIC ITS. The GIC-v3 ITS driver uses dev_seq(dev) to generate a unique ID for the MADT, but qemu sbsa-ref hardcodes it. Currently it's not the same ID, breaking interrupt routing on the OS. Don't assume it's 0 and fetch it from the device instead. TEST: Fixes non working IRQs in QEMU sbsa-ref. Signed-off-by: Patrick Rudolph --- board/emulation/qemu-sbsa/acpi.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/board/emulation/qemu-sbsa/acpi.c b/board/emulation/qemu-sbsa/acpi.c index ba85e08fc7d..2e518f2f03f 100644 --- a/board/emulation/qemu-sbsa/acpi.c +++ b/board/emulation/qemu-sbsa/acpi.c @@ -10,9 +10,9 @@ #include #include #include -#include #include -#include "qemu-sbsa.h" +#include +#include #define SBSAQEMU_MADT_GIC_VBASE 0x2c020000 #define SBSAQEMU_MADT_GIC_HBASE 0x2c010000 @@ -45,13 +45,18 @@ int acpi_fill_iort(struct acpi_ctx *ctx) { u32 its_offset, smmu_offset; - u64 gic_its_base = 0; - - smc_get_gic_its_base(&gic_its_base); - if (gic_its_base == 0) - return 0; + struct udevice *dev; + int ret; + + ret = uclass_get_device_by_driver(UCLASS_IRQ, + DM_DRIVER_GET(arm_gic_v3_its), &dev); + if (ret) { + pr_err("%s: failed to get %s irq device\n", __func__, + DM_DRIVER_GET(arm_gic_v3_its)->name); + return ret; + } - u32 identifiers[] = { 0 }; + u32 identifiers[] = { dev_seq(dev) }; its_offset = acpi_iort_add_its_group(ctx, ARRAY_SIZE(identifiers), identifiers); -- 2.39.5