mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
devices: serial: Expect an identifier upon device creation
This identifier is chosen from the DeviceManager so that it will manage all identifiers across the VM, which will ensure uniqueness. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
committed by
Rob Bradford
parent
06487131f9
commit
9ab4bb1ae2
@@ -73,6 +73,7 @@ const MMIO_LEN: u64 = 0x1000;
|
||||
const VFIO_DEVICE_NAME_PREFIX: &str = "vfio";
|
||||
|
||||
const IOAPIC_DEVICE_NAME: &str = "ioapic";
|
||||
const SERIAL_DEVICE_NAME_PREFIX: &str = "serial";
|
||||
|
||||
const CONSOLE_DEVICE_NAME: &str = "console";
|
||||
const DISK_DEVICE_NAME_PREFIX: &str = "disk";
|
||||
@@ -1060,6 +1061,8 @@ impl DeviceManager {
|
||||
// Serial is tied to IRQ #4
|
||||
let serial_irq = 4;
|
||||
|
||||
let id = String::from(SERIAL_DEVICE_NAME_PREFIX);
|
||||
|
||||
let interrupt_group = interrupt_manager
|
||||
.create_group(LegacyIrqGroupConfig {
|
||||
irq: serial_irq as InterruptIndex,
|
||||
@@ -1067,6 +1070,7 @@ impl DeviceManager {
|
||||
.map_err(DeviceManagerError::CreateInterruptGroup)?;
|
||||
|
||||
let serial = Arc::new(Mutex::new(devices::legacy::Serial::new(
|
||||
id,
|
||||
interrupt_group,
|
||||
serial_writer,
|
||||
)));
|
||||
|
||||
Reference in New Issue
Block a user