mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +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:
@@ -356,6 +356,7 @@ pub(crate) struct VfioCommon {
|
|||||||
pub(crate) mmio_regions: Vec<MmioRegion>,
|
pub(crate) mmio_regions: Vec<MmioRegion>,
|
||||||
pub(crate) interrupt: Interrupt,
|
pub(crate) interrupt: Interrupt,
|
||||||
pub(crate) msi_interrupt_manager: Arc<dyn InterruptManager<GroupConfig = MsiIrqGroupConfig>>,
|
pub(crate) msi_interrupt_manager: Arc<dyn InterruptManager<GroupConfig = MsiIrqGroupConfig>>,
|
||||||
|
pub(crate) legacy_interrupt_group: Option<Arc<dyn InterruptSourceGroup>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl VfioCommon {
|
impl VfioCommon {
|
||||||
@@ -757,7 +758,6 @@ impl VfioCommon {
|
|||||||
|
|
||||||
pub(crate) fn initialize_legacy_interrupt(
|
pub(crate) fn initialize_legacy_interrupt(
|
||||||
&mut self,
|
&mut self,
|
||||||
legacy_interrupt_group: Option<Arc<dyn InterruptSourceGroup>>,
|
|
||||||
wrapper: &dyn Vfio,
|
wrapper: &dyn Vfio,
|
||||||
) -> Result<(), VfioPciError> {
|
) -> Result<(), VfioPciError> {
|
||||||
if let Some(irq_info) = wrapper.get_irq_info(VFIO_PCI_INTX_IRQ_INDEX) {
|
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 {
|
self.interrupt.intx = Some(VfioIntx {
|
||||||
interrupt_source_group,
|
interrupt_source_group,
|
||||||
enabled: false,
|
enabled: false,
|
||||||
@@ -1028,10 +1028,11 @@ impl VfioPciDevice {
|
|||||||
msix: None,
|
msix: None,
|
||||||
},
|
},
|
||||||
msi_interrupt_manager,
|
msi_interrupt_manager,
|
||||||
|
legacy_interrupt_group,
|
||||||
};
|
};
|
||||||
|
|
||||||
common.parse_capabilities(&vfio_wrapper, bdf);
|
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 {
|
let vfio_pci_device = VfioPciDevice {
|
||||||
id,
|
id,
|
||||||
|
|||||||
@@ -105,11 +105,12 @@ impl VfioUserPciDevice {
|
|||||||
msix: None,
|
msix: None,
|
||||||
},
|
},
|
||||||
msi_interrupt_manager,
|
msi_interrupt_manager,
|
||||||
|
legacy_interrupt_group,
|
||||||
};
|
};
|
||||||
|
|
||||||
common.parse_capabilities(&vfio_wrapper, bdf);
|
common.parse_capabilities(&vfio_wrapper, bdf);
|
||||||
common
|
common
|
||||||
.initialize_legacy_interrupt(legacy_interrupt_group, &vfio_wrapper)
|
.initialize_legacy_interrupt(&vfio_wrapper)
|
||||||
.map_err(VfioUserPciDeviceError::InitializeLegacyInterrupts)?;
|
.map_err(VfioUserPciDeviceError::InitializeLegacyInterrupts)?;
|
||||||
|
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
|
|||||||
Reference in New Issue
Block a user