vmm: Call DeviceManager's register_devices() on creation

Rather than calling it at the very start of the VM execution (i.e. when
the VCPUs are created) do it as part of the DeviceManager creation.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford 2019-09-10 17:48:21 +01:00 committed by Samuel Ortiz
parent 7edc46f492
commit 05b5115e67
2 changed files with 7 additions and 7 deletions

View File

@ -411,7 +411,7 @@ impl DeviceManager {
let pci = Arc::new(Mutex::new(pci));
Ok(DeviceManager {
let mut dm = DeviceManager {
io_bus,
mmio_bus,
console,
@ -421,7 +421,11 @@ impl DeviceManager {
ioapic,
pci,
mmap_regions,
})
};
dm.register_devices()?;
Ok(dm)
}
fn make_virtio_devices(
@ -911,7 +915,7 @@ impl DeviceManager {
Ok(())
}
pub fn register_devices(&mut self) -> DeviceManagerResult<()> {
fn register_devices(&mut self) -> DeviceManagerResult<()> {
if self.console.serial.is_some() {
// Insert serial device
self.io_bus

View File

@ -936,10 +936,6 @@ impl<'a> Vm<'a> {
}
pub fn start(&mut self, entry_addr: GuestAddress) -> Result<ExitBehaviour> {
self.devices
.register_devices()
.map_err(Error::DeviceManager)?;
let vcpu_count = u8::from(&self.config.cpus);
// let vcpus: Vec<thread::JoinHandle<()>> = Vec::with_capacity(vcpu_count as usize);