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] c9374d87ac

Signed-off-by: Bo Chen <bchen@crusoe.ai>
This commit is contained in:
Bo Chen
2026-01-02 23:18:48 +00:00
parent 01d711e893
commit 11edb28069

View File

@@ -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