vmm, main: make PCI BDF configurable for ConsoleConfig

Add common PCI device configuration to the virtio-console device
configuration. This allows setting the device ID (the name), ID, the
PCI segment, and the PCI device ID (BDF), which were previously not
configurable for the virtio-console device.

This gives management software, such as libvirt, more control over PCI
resource assignment and aligns virtio-console with other devices that
already support this functionality [0].

[0] https://github.com/cloud-hypervisor/cloud-hypervisor/issues/8175

On-behalf-of: Philipp Schuster <philipp.schuster@sap.com>
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
This commit is contained in:
Philipp Schuster
2026-05-11 16:11:48 +02:00
committed by Rob Bradford
parent 36a3369802
commit e793353bfb
6 changed files with 70 additions and 33 deletions

View File

@@ -1025,7 +1025,7 @@ mod unit_tests {
mode: ConsoleOutputMode::Tty,
socket: None,
},
iommu: false,
pci_common: PciDeviceCommonConfig::default(),
},
#[cfg(target_arch = "x86_64")]
debug_console: DebugConsoleConfig::default(),
@@ -1693,10 +1693,12 @@ mod unit_tests {
"--serial",
"null",
"--console",
"tty",
"tty,pci_segment=1,pci_device_id=7",
],
r#"{
"payload": {"kernel": "/path/to/kernel"}
"payload": {"kernel": "/path/to/kernel"},
"serial": {"mode": "Null"},
"console": {"mode": "Tty", "iommu": false, "pci_segment": 1, "pci_device_id": 7}
}"#,
true,
),