mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-22 03:12:27 +00:00
pci: Store legacy interrupt manager in VfioCommon
Extend VfioCommon structure to own the legacy interrupt manager. This will be useful for implementing the restore code path. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
parent
eb6daa2fc3
commit
e6aa792c01
@ -356,6 +356,7 @@ pub(crate) struct VfioCommon {
|
||||
pub(crate) mmio_regions: Vec<MmioRegion>,
|
||||
pub(crate) interrupt: Interrupt,
|
||||
pub(crate) msi_interrupt_manager: Arc<dyn InterruptManager<GroupConfig = MsiIrqGroupConfig>>,
|
||||
pub(crate) legacy_interrupt_group: Option<Arc<dyn InterruptSourceGroup>>,
|
||||
}
|
||||
|
||||
impl VfioCommon {
|
||||
@ -757,7 +758,6 @@ impl VfioCommon {
|
||||
|
||||
pub(crate) fn initialize_legacy_interrupt(
|
||||
&mut self,
|
||||
legacy_interrupt_group: Option<Arc<dyn InterruptSourceGroup>>,
|
||||
wrapper: &dyn Vfio,
|
||||
) -> Result<(), VfioPciError> {
|
||||
if let Some(irq_info) = wrapper.get_irq_info(VFIO_PCI_INTX_IRQ_INDEX) {
|
||||
@ -768,7 +768,7 @@ impl VfioCommon {
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(interrupt_source_group) = legacy_interrupt_group {
|
||||
if let Some(interrupt_source_group) = self.legacy_interrupt_group.clone() {
|
||||
self.interrupt.intx = Some(VfioIntx {
|
||||
interrupt_source_group,
|
||||
enabled: false,
|
||||
@ -1028,10 +1028,11 @@ impl VfioPciDevice {
|
||||
msix: None,
|
||||
},
|
||||
msi_interrupt_manager,
|
||||
legacy_interrupt_group,
|
||||
};
|
||||
|
||||
common.parse_capabilities(&vfio_wrapper, bdf);
|
||||
common.initialize_legacy_interrupt(legacy_interrupt_group, &vfio_wrapper)?;
|
||||
common.initialize_legacy_interrupt(&vfio_wrapper)?;
|
||||
|
||||
let vfio_pci_device = VfioPciDevice {
|
||||
id,
|
||||
|
@ -105,11 +105,12 @@ impl VfioUserPciDevice {
|
||||
msix: None,
|
||||
},
|
||||
msi_interrupt_manager,
|
||||
legacy_interrupt_group,
|
||||
};
|
||||
|
||||
common.parse_capabilities(&vfio_wrapper, bdf);
|
||||
common
|
||||
.initialize_legacy_interrupt(legacy_interrupt_group, &vfio_wrapper)
|
||||
.initialize_legacy_interrupt(&vfio_wrapper)
|
||||
.map_err(VfioUserPciDeviceError::InitializeLegacyInterrupts)?;
|
||||
|
||||
Ok(Self {
|
||||
|
Loading…
x
Reference in New Issue
Block a user