Shameer, On 2/26/26 11:50 AM, Shameer Kolothum wrote: > Add an "identifier" property to the SMMUv3 device and use it when > building the ACPI IORT SMMUv3 node Identifier field. > > This avoids relying on device enumeration order and provides a stable > per-device identifier. A subsequent patch will use the same identifier > when generating the DSDT description for Tegra241 CMDQV, ensuring that > the IORT and DSDT entries refer to the same SMMUv3 instance. > > No functional change intended. besides changes the IORT table > > Reviewed-by: Nicolin Chen <[email protected]> > Signed-off-by: Shameer Kolothum <[email protected]> > --- > include/hw/arm/smmuv3.h | 1 + > hw/arm/smmuv3.c | 2 ++ > hw/arm/virt-acpi-build.c | 4 +++- > hw/arm/virt.c | 3 +++ > 4 files changed, 9 insertions(+), 1 deletion(-) > > diff --git a/include/hw/arm/smmuv3.h b/include/hw/arm/smmuv3.h > index 648412cafc..73b8f39aaa 100644 > --- a/include/hw/arm/smmuv3.h > +++ b/include/hw/arm/smmuv3.h > @@ -63,6 +63,7 @@ struct SMMUv3State { > qemu_irq irq[4]; > QemuMutex mutex; > char *stage; > + uint8_t identifier; > > /* SMMU has HW accelerator support for nested S1 + s2 */ > bool accel; > diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c > index 468135bb24..c1f84bedd4 100644 > --- a/hw/arm/smmuv3.c > +++ b/hw/arm/smmuv3.c > @@ -2109,6 +2109,8 @@ static const Property smmuv3_properties[] = { > * Defaults to stage 1 > */ > DEFINE_PROP_STRING("stage", SMMUv3State, stage), > + /* Identifier used for ACPI IORT SMMUv3 (and DSDT for CMDQV) generation > */ > + DEFINE_PROP_UINT8("identifier", SMMUv3State, identifier, 0), > DEFINE_PROP_BOOL("accel", SMMUv3State, accel, false), > /* GPA of MSI doorbell, for SMMUv3 accel use. */ > DEFINE_PROP_UINT64("msi-gpa", SMMUv3State, msi_gpa, 0), > diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c > index ae78e9b9e0..20605185c5 100644 > --- a/hw/arm/virt-acpi-build.c > +++ b/hw/arm/virt-acpi-build.c > @@ -342,6 +342,7 @@ static int iort_idmap_compare(gconstpointer a, > gconstpointer b) > typedef struct AcpiIortSMMUv3Dev { > int irq; > hwaddr base; > + uint8_t id; > GArray *rc_smmu_idmaps; > /* Offset of the SMMUv3 IORT Node relative to the start of the IORT */ > size_t offset; > @@ -404,6 +405,7 @@ static int populate_smmuv3_dev(GArray *sdev_blob, > VirtMachineState *vms) > &error_abort)); > sdev.accel = object_property_get_bool(obj, "accel", &error_abort); > sdev.ats = object_property_get_bool(obj, "ats", &error_abort); > + sdev.id = object_property_get_uint(obj, "identifier", &error_abort); > pbus = PLATFORM_BUS_DEVICE(vms->platform_bus_dev); > sbdev = SYS_BUS_DEVICE(obj); > sdev.base = platform_bus_get_mmio_addr(pbus, sbdev, 0); > @@ -630,7 +632,7 @@ build_iort(GArray *table_data, BIOSLinker *linker, > VirtMachineState *vms) > (ID_MAPPING_ENTRY_SIZE * smmu_mapping_count); > build_append_int_noprefix(table_data, node_size, 2); /* Length */ > build_append_int_noprefix(table_data, 4, 1); /* Revision */ > - build_append_int_noprefix(table_data, id++, 4); /* Identifier */ > + build_append_int_noprefix(table_data, sdev->id, 4); /* Identifier */ > /* Number of ID mappings */ > build_append_int_noprefix(table_data, smmu_mapping_count, 4); > /* Reference to ID Array */ > diff --git a/hw/arm/virt.c b/hw/arm/virt.c > index c75a8d6e9e..44c6b99c96 100644 > --- a/hw/arm/virt.c > +++ b/hw/arm/virt.c > @@ -3138,6 +3138,7 @@ static void virt_memory_plug(HotplugHandler > *hotplug_dev, > } > } > > +static uint8_t smmuv3_dev_id; nit: I would rather put that at the top of the file > static void virt_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev, > DeviceState *dev, Error **errp) > { > @@ -3196,6 +3197,8 @@ static void > virt_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev, > OBJECT(vms->sysmem), NULL); > object_property_set_link(OBJECT(dev), "secure-memory", > OBJECT(vms->secure_sysmem), NULL); > + object_property_set_uint(OBJECT(dev), "identifier", > smmuv3_dev_id++, > + NULL); > } > if (object_property_get_bool(OBJECT(dev), "accel", &error_abort)) { > hwaddr db_start = 0; Reviewed-by: Eric Auger <[email protected]>
Eric
