vmm: device_manager: Store legacy interrupt manager

In anticipation for accessing the legacy interrupt manager from the
function creating a VFIO PCI device, we store it as part of the
DeviceManager, to make it available for all methods.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf 2021-02-09 09:17:29 +01:00 committed by Rob Bradford
parent 8008aad545
commit b5450ca72c

View File

@ -834,6 +834,9 @@ pub struct DeviceManager {
// MSI Interrupt Manager // MSI Interrupt Manager
msi_interrupt_manager: Arc<dyn InterruptManager<GroupConfig = MsiIrqGroupConfig>>, msi_interrupt_manager: Arc<dyn InterruptManager<GroupConfig = MsiIrqGroupConfig>>,
// Legacy Interrupt Manager
legacy_interrupt_manager: Option<Arc<dyn InterruptManager<GroupConfig = LegacyIrqGroupConfig>>>,
// Passthrough device handle // Passthrough device handle
passthrough_device: Option<Arc<dyn hypervisor::Device>>, passthrough_device: Option<Arc<dyn hypervisor::Device>>,
@ -941,6 +944,7 @@ impl DeviceManager {
device_id_cnt: Wrapping(0), device_id_cnt: Wrapping(0),
pci_bus: None, pci_bus: None,
msi_interrupt_manager, msi_interrupt_manager,
legacy_interrupt_manager: None,
passthrough_device: None, passthrough_device: None,
iommu_device: None, iommu_device: None,
pci_devices_up: 0, pci_devices_up: 0,
@ -1044,6 +1048,8 @@ impl DeviceManager {
self.console = self.add_console_device(&legacy_interrupt_manager, &mut virtio_devices)?; self.console = self.add_console_device(&legacy_interrupt_manager, &mut virtio_devices)?;
self.legacy_interrupt_manager = Some(legacy_interrupt_manager);
virtio_devices.append(&mut self.make_virtio_devices()?); virtio_devices.append(&mut self.make_virtio_devices()?);
self.add_pci_devices(virtio_devices.clone())?; self.add_pci_devices(virtio_devices.clone())?;