diff --git a/vmm/src/interrupt.rs b/vmm/src/interrupt.rs index a6d09cbe9..960b79c7a 100644 --- a/vmm/src/interrupt.rs +++ b/vmm/src/interrupt.rs @@ -103,24 +103,24 @@ impl InterruptRoute { } } -struct RoutingEntry { +pub struct RoutingEntry { route: E, masked: bool, } type KvmRoutingEntry = RoutingEntry; -struct MsiInterruptGroup { +pub struct MsiInterruptGroup { vm_fd: Arc, gsi_msi_routes: Arc>>>, irq_routes: HashMap, } -trait MsiInterruptGroupOps { +pub trait MsiInterruptGroupOps { fn set_gsi_routes(&self) -> Result<()>; } -trait RoutingEntryExt { +pub trait RoutingEntryExt { fn make_entry(gsi: u32, config: &InterruptSourceConfig) -> Result>; } @@ -387,7 +387,12 @@ impl InterruptManager for LegacyUserspaceInterruptManager { } } -impl InterruptManager for KvmMsiInterruptManager { +impl InterruptManager for MsiInterruptManager +where + E: Send + Sync + 'static, + RoutingEntry: RoutingEntryExt, + MsiInterruptGroup: MsiInterruptGroupOps, +{ type GroupConfig = MsiIrqGroupConfig; fn create_group( @@ -401,7 +406,7 @@ impl InterruptManager for KvmMsiInterruptManager { irq_routes.insert(i, InterruptRoute::new(&mut allocator)?); } - Ok(Arc::new(Box::new(KvmMsiInterruptGroup::new( + Ok(Arc::new(Box::new(MsiInterruptGroup::new( self.vm_fd.clone(), self.gsi_msi_routes.clone(), irq_routes,