mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +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:
committed by
Sebastien Boeuf
parent
9ac967e3d8
commit
2f4de81175
@@ -210,8 +210,8 @@ pub fn get_win_size() -> (u16, u16) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub struct DeviceManager {
|
pub struct DeviceManager {
|
||||||
pub io_bus: devices::Bus,
|
io_bus: devices::Bus,
|
||||||
pub mmio_bus: devices::Bus,
|
mmio_bus: devices::Bus,
|
||||||
|
|
||||||
// Serial port on 0x3f8
|
// Serial port on 0x3f8
|
||||||
pub serial: Option<Arc<Mutex<devices::legacy::Serial>>>,
|
pub serial: Option<Arc<Mutex<devices::legacy::Serial>>>,
|
||||||
@@ -229,7 +229,7 @@ pub struct DeviceManager {
|
|||||||
pub reset_evt: EventFd,
|
pub reset_evt: EventFd,
|
||||||
|
|
||||||
// IOAPIC
|
// IOAPIC
|
||||||
pub ioapic: Option<Arc<Mutex<ioapic::Ioapic>>>,
|
ioapic: Option<Arc<Mutex<ioapic::Ioapic>>>,
|
||||||
|
|
||||||
// PCI root
|
// PCI root
|
||||||
pci: Arc<Mutex<PciConfigIo>>,
|
pci: Arc<Mutex<PciConfigIo>>,
|
||||||
@@ -943,6 +943,18 @@ impl DeviceManager {
|
|||||||
|
|
||||||
Ok(())
|
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 {
|
impl Drop for DeviceManager {
|
||||||
|
|||||||
+3
-3
@@ -956,9 +956,9 @@ impl<'a> Vm<'a> {
|
|||||||
let vcpu_thread_barrier = Arc::new(Barrier::new((vcpu_count + 1) as usize));
|
let vcpu_thread_barrier = Arc::new(Barrier::new((vcpu_count + 1) as usize));
|
||||||
|
|
||||||
for cpu_id in 0..vcpu_count {
|
for cpu_id in 0..vcpu_count {
|
||||||
let io_bus = self.devices.io_bus.clone();
|
let io_bus = self.devices.io_bus().clone();
|
||||||
let mmio_bus = self.devices.mmio_bus.clone();
|
let mmio_bus = self.devices.mmio_bus().clone();
|
||||||
let ioapic = if let Some(ioapic) = &self.devices.ioapic {
|
let ioapic = if let Some(ioapic) = &self.devices.ioapic() {
|
||||||
Some(ioapic.clone())
|
Some(ioapic.clone())
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
|||||||
Reference in New Issue
Block a user