ioapic: Rely fully on the InterruptSourceGroup to manage interrupts

This commit relies on the interrupt manager and the resulting interrupt
source group to abstract the knowledge about KVM and how interrupts are
updated and delivered.

This allows the entire "devices" crate to be freed from kvm_ioctls and
kvm_bindings dependencies.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf
2020-01-22 23:45:27 +01:00
committed by Rob Bradford
parent 2dca959084
commit 0042f1de75
5 changed files with 69 additions and 54 deletions

View File

@@ -451,8 +451,7 @@ impl DeviceManager {
None,
));
let ioapic =
DeviceManager::add_ioapic(vm_info, &address_manager, ioapic_interrupt_manager)?;
let ioapic = DeviceManager::add_ioapic(&address_manager, ioapic_interrupt_manager)?;
// Creation of the global interrupt manager, which can take a hold onto
// the brand new Ioapic.
@@ -698,13 +697,12 @@ impl DeviceManager {
}
fn add_ioapic(
vm_info: &VmInfo,
address_manager: &Arc<AddressManager>,
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, interrupt_manager)
ioapic::Ioapic::new(APIC_START, interrupt_manager)
.map_err(DeviceManagerError::CreateIoapic)?,
));