ioapic: Create the InterruptSourceGroup from InterruptManager

The interrupt manager is passed to the IOAPIC creation, and the IOAPIC
now creates an InterruptSourceGroup for MSI interrupts based on it.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf
2020-01-22 22:55:02 +01:00
committed by Rob Bradford
parent 52800a871a
commit 2dca959084
2 changed files with 29 additions and 8 deletions

View File

@@ -189,6 +189,9 @@ pub enum DeviceManagerError {
/// Failed to update interrupt source group.
UpdateInterruptGroup(io::Error),
/// Failed creating IOAPIC.
CreateIoapic(ioapic::Error),
}
pub type DeviceManagerResult<T> = result::Result<T, DeviceManagerError>;
@@ -697,13 +700,13 @@ impl DeviceManager {
fn add_ioapic(
vm_info: &VmInfo,
address_manager: &Arc<AddressManager>,
_ioapic_interrupt_manager: Arc<dyn InterruptManager>,
interrupt_manager: Arc<dyn InterruptManager>,
) -> DeviceManagerResult<Arc<Mutex<ioapic::Ioapic>>> {
// Create IOAPIC
let ioapic = Arc::new(Mutex::new(ioapic::Ioapic::new(
vm_info.vm_fd.clone(),
APIC_START,
)));
let ioapic = Arc::new(Mutex::new(
ioapic::Ioapic::new(vm_info.vm_fd.clone(), APIC_START, interrupt_manager)
.map_err(DeviceManagerError::CreateIoapic)?,
));
address_manager
.mmio_bus