From 348a1bc30e03f63258cd0f03b6de877ab2fe24cd Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Wed, 20 Nov 2019 14:16:14 +0000 Subject: [PATCH] vmm: cpu: Allocate I/O port for the CPU manager The CPU manager uses an I/O port and to prevent potential clashes with assignment for PCI devices ensure that it is allocated by the allocator. Signed-off-by: Rob Bradford --- vmm/src/cpu.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/vmm/src/cpu.rs b/vmm/src/cpu.rs index 6ef835bcd..88c44d623 100644 --- a/vmm/src/cpu.rs +++ b/vmm/src/cpu.rs @@ -113,6 +113,9 @@ pub enum Error { /// Cannot add legacy device to Bus. BusError(devices::BusError), + + /// Failed to allocate IO port + AllocateIOPort, } pub type Result = result::Result; @@ -405,6 +408,13 @@ impl CpuManager { selected_cpu: 0, })); + device_manager + .allocator() + .lock() + .unwrap() + .allocate_io_addresses(Some(GuestAddress(0x0cd8)), 0x8, None) + .ok_or(Error::AllocateIOPort)?; + cpu_manager .lock() .unwrap()