From 11edb280699657b917cc1188214a214bfce51784 Mon Sep 17 00:00:00 2001 From: Bo Chen Date: Fri, 2 Jan 2026 23:18:48 +0000 Subject: [PATCH] vmm: acpi: Clarify device ID partitioning in IORT table The IORT table's ID mapping uses a 256-ID offset per PCI segment to ensure unique device IDs across all segments. This partitioning scheme (output_base = 256 * segment_id) must match the device ID encoding used in KVM MSI routing configuration [1]. This mapping assumes one bus per PCI segment, and supports up to 256 PCI segments in the system. [1] https://github.com/cloud-hypervisor/cloud-hypervisor/commit/c9374d87ac453d49185aa7b734df089444166484 Signed-off-by: Bo Chen --- vmm/src/acpi.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/vmm/src/acpi.rs b/vmm/src/acpi.rs index b2da91e08..563a5f2e1 100644 --- a/vmm/src/acpi.rs +++ b/vmm/src/acpi.rs @@ -582,7 +582,12 @@ fn create_iort_table(pci_segments: &[PciSegment]) -> Sdt { // 1 (bus) x 32 (devices) x 8 (functions) = 256 // Note: Currently only 1 bus is supported in a segment. iort.write(mapping_offset + 4, (255_u32).to_le()); - // The lowest value in the output range + // Output base maps to ITS device IDs which must match the + // device ID encoding used in KVM MSI routing setup, which + // shares the same limitation - only 1 bus per segment and + // up to 256 segments. + // See: https://github.com/cloud-hypervisor/cloud-hypervisor/commit/c9374d87ac453d49185aa7b734df089444166484 + assert!(segment.id < 256, "Up to 256 PCI segments are supported."); iort.write(mapping_offset + 8, ((256 * segment.id) as u32).to_le()); // id_mapping_array_output_reference should be // the ITS group node (the first node) if no SMMU