mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: Create an InterruptManager dedicated to IOAPIC
By introducing a new InterruptManager dedicated to the IOAPIC, we don't have to solve the chicken and eggs problem about which of the InterruptManager or the Ioapic should be created first. It's also totally fine to have two interrupt manager instances as they both share the same list of GSI routes and the same allocator. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
committed by
Rob Bradford
parent
29e668c302
commit
52800a871a
@@ -276,7 +276,7 @@ pub struct KvmInterruptManager {
|
||||
allocator: Arc<Mutex<SystemAllocator>>,
|
||||
vm_fd: Arc<VmFd>,
|
||||
gsi_msi_routes: Arc<Mutex<HashMap<u32, KvmRoutingEntry>>>,
|
||||
ioapic: Arc<Mutex<ioapic::Ioapic>>,
|
||||
ioapic: Option<Arc<Mutex<ioapic::Ioapic>>>,
|
||||
}
|
||||
|
||||
impl KvmInterruptManager {
|
||||
@@ -284,7 +284,7 @@ impl KvmInterruptManager {
|
||||
allocator: Arc<Mutex<SystemAllocator>>,
|
||||
vm_fd: Arc<VmFd>,
|
||||
gsi_msi_routes: Arc<Mutex<HashMap<u32, KvmRoutingEntry>>>,
|
||||
ioapic: Arc<Mutex<ioapic::Ioapic>>,
|
||||
ioapic: Option<Arc<Mutex<ioapic::Ioapic>>>,
|
||||
) -> Self {
|
||||
KvmInterruptManager {
|
||||
allocator,
|
||||
@@ -311,10 +311,17 @@ impl InterruptManager for KvmInterruptManager {
|
||||
));
|
||||
}
|
||||
|
||||
Arc::new(Box::new(LegacyUserspaceInterruptGroup::new(
|
||||
self.ioapic.clone(),
|
||||
base as u32,
|
||||
)))
|
||||
if let Some(ioapic) = &self.ioapic {
|
||||
Arc::new(Box::new(LegacyUserspaceInterruptGroup::new(
|
||||
ioapic.clone(),
|
||||
base as u32,
|
||||
)))
|
||||
} else {
|
||||
return Err(io::Error::new(
|
||||
io::ErrorKind::Other,
|
||||
"No IOAPIC configured, cannot create legacy interrupt group",
|
||||
));
|
||||
}
|
||||
}
|
||||
PCI_MSI_IRQ => {
|
||||
let mut allocator = self.allocator.lock().unwrap();
|
||||
|
||||
Reference in New Issue
Block a user