mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-01-03 11:25:20 +00:00
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:
parent
7edc46f492
commit
05b5115e67
@ -411,7 +411,7 @@ impl DeviceManager {
|
|||||||
|
|
||||||
let pci = Arc::new(Mutex::new(pci));
|
let pci = Arc::new(Mutex::new(pci));
|
||||||
|
|
||||||
Ok(DeviceManager {
|
let mut dm = DeviceManager {
|
||||||
io_bus,
|
io_bus,
|
||||||
mmio_bus,
|
mmio_bus,
|
||||||
console,
|
console,
|
||||||
@ -421,7 +421,11 @@ impl DeviceManager {
|
|||||||
ioapic,
|
ioapic,
|
||||||
pci,
|
pci,
|
||||||
mmap_regions,
|
mmap_regions,
|
||||||
})
|
};
|
||||||
|
|
||||||
|
dm.register_devices()?;
|
||||||
|
|
||||||
|
Ok(dm)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn make_virtio_devices(
|
fn make_virtio_devices(
|
||||||
@ -911,7 +915,7 @@ impl DeviceManager {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn register_devices(&mut self) -> DeviceManagerResult<()> {
|
fn register_devices(&mut self) -> DeviceManagerResult<()> {
|
||||||
if self.console.serial.is_some() {
|
if self.console.serial.is_some() {
|
||||||
// Insert serial device
|
// Insert serial device
|
||||||
self.io_bus
|
self.io_bus
|
||||||
|
@ -936,10 +936,6 @@ impl<'a> Vm<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn start(&mut self, entry_addr: GuestAddress) -> Result<ExitBehaviour> {
|
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 vcpu_count = u8::from(&self.config.cpus);
|
||||||
|
|
||||||
// let vcpus: Vec<thread::JoinHandle<()>> = Vec::with_capacity(vcpu_count as usize);
|
// let vcpus: Vec<thread::JoinHandle<()>> = Vec::with_capacity(vcpu_count as usize);
|
||||||
|
Loading…
Reference in New Issue
Block a user