From 0ec39da90cd1da7d11901a7a7ad7fecdc5229f8b Mon Sep 17 00:00:00 2001 From: Wei Liu Date: Sat, 27 Jun 2020 15:28:53 +0000 Subject: [PATCH] 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 --- vmm/src/interrupt.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/vmm/src/interrupt.rs b/vmm/src/interrupt.rs index f482fc74f..202233be7 100644 --- a/vmm/src/interrupt.rs +++ b/vmm/src/interrupt.rs @@ -320,19 +320,21 @@ pub struct LegacyUserspaceInterruptManager { ioapic: Arc>, } -pub struct KvmMsiInterruptManager { +pub struct MsiInterruptManager { allocator: Arc>, vm_fd: Arc, - gsi_msi_routes: Arc>>, + gsi_msi_routes: Arc>>>, } +pub type KvmMsiInterruptManager = MsiInterruptManager; + impl LegacyUserspaceInterruptManager { pub fn new(ioapic: Arc>) -> Self { LegacyUserspaceInterruptManager { ioapic } } } -impl KvmMsiInterruptManager { +impl MsiInterruptManager { pub fn new(allocator: Arc>, vm_fd: Arc) -> 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,