The IORT doc defines "Number of IDs" ("id_count" in the virt-acpi-build) to be "the number of IDs in the range minus one". Otherwise, Linux kernel reports "conflicting mapping for input ID" FW_BUG at the overlapped ID.
Fixes: 42e0f050e3a5 ("hw/arm/virt-acpi-build: Add IORT support to bypass SMMUv3") Signed-off-by: Nicolin Chen <nicol...@nvidia.com> --- hw/arm/virt-acpi-build.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index c3ccfef026..b9343dde0f 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -243,7 +243,8 @@ iort_host_bridges(Object *obj, void *opaque) AcpiIortIdMapping idmap = { .input_base = min_bus << 8, - .id_count = (max_bus - min_bus + 1) << 8, + /* id_count is the number of IDs in the range minus one */ + .id_count = ((max_bus - min_bus + 1) << 8) - 1, }; g_array_append_val(idmap_blob, idmap); } @@ -298,7 +299,9 @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) idmap = &g_array_index(smmu_idmaps, AcpiIortIdMapping, i); if (next_range.input_base < idmap->input_base) { + /* id_count is the number of IDs in the range minus one */ next_range.id_count = idmap->input_base - next_range.input_base; + next_range.id_count -= 1; g_array_append_val(its_idmaps, next_range); } -- 2.43.0