mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-07-07 10:15:45 +00:00
vmm: interrupt: generify KvmMsiInterruptManager
The observation is only the route entry is hypervisor dependent. Keep a definition of KvmMsiInterruptManager to avoid too much code churn. Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
parent
d5149e95cb
commit
0ec39da90c
@ -320,19 +320,21 @@ pub struct LegacyUserspaceInterruptManager {
|
||||
ioapic: Arc<Mutex<dyn InterruptController>>,
|
||||
}
|
||||
|
||||
pub struct KvmMsiInterruptManager {
|
||||
pub struct MsiInterruptManager<E> {
|
||||
allocator: Arc<Mutex<SystemAllocator>>,
|
||||
vm_fd: Arc<dyn hypervisor::Vm>,
|
||||
gsi_msi_routes: Arc<Mutex<HashMap<u32, KvmRoutingEntry>>>,
|
||||
gsi_msi_routes: Arc<Mutex<HashMap<u32, RoutingEntry<E>>>>,
|
||||
}
|
||||
|
||||
pub type KvmMsiInterruptManager = MsiInterruptManager<kvm_irq_routing_entry>;
|
||||
|
||||
impl LegacyUserspaceInterruptManager {
|
||||
pub fn new(ioapic: Arc<Mutex<dyn InterruptController>>) -> Self {
|
||||
LegacyUserspaceInterruptManager { ioapic }
|
||||
}
|
||||
}
|
||||
|
||||
impl KvmMsiInterruptManager {
|
||||
impl<E> MsiInterruptManager<E> {
|
||||
pub fn new(allocator: Arc<Mutex<SystemAllocator>>, vm_fd: Arc<dyn hypervisor::Vm>) -> Self {
|
||||
// Create a shared list of GSI that can be shared through all PCI
|
||||
// devices. This way, we can maintain the full list of used GSI,
|
||||
@ -340,7 +342,7 @@ impl KvmMsiInterruptManager {
|
||||
// another one.
|
||||
let gsi_msi_routes = Arc::new(Mutex::new(HashMap::new()));
|
||||
|
||||
KvmMsiInterruptManager {
|
||||
MsiInterruptManager {
|
||||
allocator,
|
||||
vm_fd,
|
||||
gsi_msi_routes,
|
||||
|
Loading…
Reference in New Issue
Block a user