mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-22 03:12:27 +00:00
vmm: Access ioapic/io_bus/mmio_bus from DeviceManager via accessor
This paves the way for introducing a trait for the DeviceManager. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
9ac967e3d8
commit
2f4de81175
@ -210,8 +210,8 @@ pub fn get_win_size() -> (u16, u16) {
|
||||
}
|
||||
|
||||
pub struct DeviceManager {
|
||||
pub io_bus: devices::Bus,
|
||||
pub mmio_bus: devices::Bus,
|
||||
io_bus: devices::Bus,
|
||||
mmio_bus: devices::Bus,
|
||||
|
||||
// Serial port on 0x3f8
|
||||
pub serial: Option<Arc<Mutex<devices::legacy::Serial>>>,
|
||||
@ -229,7 +229,7 @@ pub struct DeviceManager {
|
||||
pub reset_evt: EventFd,
|
||||
|
||||
// IOAPIC
|
||||
pub ioapic: Option<Arc<Mutex<ioapic::Ioapic>>>,
|
||||
ioapic: Option<Arc<Mutex<ioapic::Ioapic>>>,
|
||||
|
||||
// PCI root
|
||||
pci: Arc<Mutex<PciConfigIo>>,
|
||||
@ -943,6 +943,18 @@ impl DeviceManager {
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn io_bus(&self) -> &devices::Bus{
|
||||
&self.io_bus
|
||||
}
|
||||
|
||||
pub fn mmio_bus(&self) ->&devices::Bus {
|
||||
&self.mmio_bus
|
||||
}
|
||||
|
||||
pub fn ioapic(&self) -> &Option<Arc<Mutex<ioapic::Ioapic>>> {
|
||||
&self.ioapic
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for DeviceManager {
|
||||
|
@ -956,9 +956,9 @@ impl<'a> Vm<'a> {
|
||||
let vcpu_thread_barrier = Arc::new(Barrier::new((vcpu_count + 1) as usize));
|
||||
|
||||
for cpu_id in 0..vcpu_count {
|
||||
let io_bus = self.devices.io_bus.clone();
|
||||
let mmio_bus = self.devices.mmio_bus.clone();
|
||||
let ioapic = if let Some(ioapic) = &self.devices.ioapic {
|
||||
let io_bus = self.devices.io_bus().clone();
|
||||
let mmio_bus = self.devices.mmio_bus().clone();
|
||||
let ioapic = if let Some(ioapic) = &self.devices.ioapic() {
|
||||
Some(ioapic.clone())
|
||||
} else {
|
||||
None
|
||||
|
Loading…
x
Reference in New Issue
Block a user