From ade904e3565b54a28b127572a5c396ceed307131 Mon Sep 17 00:00:00 2001 From: Wei Liu Date: Sat, 27 Jun 2020 16:15:08 +0000 Subject: [PATCH] vmm: interrupt: generify impl InterruptSourceGroup for MsiInterruptGroup At this point we can use the same logic for all hypervisor implementations. Signed-off-by: Wei Liu --- vmm/src/interrupt.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/vmm/src/interrupt.rs b/vmm/src/interrupt.rs index 01769f71a..a6d09cbe9 100644 --- a/vmm/src/interrupt.rs +++ b/vmm/src/interrupt.rs @@ -200,7 +200,12 @@ impl MsiInterruptGroupOps for KvmMsiInterruptGroup { } } -impl InterruptSourceGroup for KvmMsiInterruptGroup { +impl InterruptSourceGroup for MsiInterruptGroup +where + E: Send + Sync, + RoutingEntry: RoutingEntryExt, + MsiInterruptGroup: MsiInterruptGroupOps, +{ fn enable(&self) -> Result<()> { for (_, route) in self.irq_routes.iter() { route.enable(&self.vm_fd)?; @@ -238,7 +243,7 @@ impl InterruptSourceGroup for KvmMsiInterruptGroup { fn update(&self, index: InterruptIndex, config: InterruptSourceConfig) -> Result<()> { if let Some(route) = self.irq_routes.get(&index) { - let entry = KvmRoutingEntry::make_entry(route.gsi, &config)?; + let entry = RoutingEntry::<_>::make_entry(route.gsi, &config)?; self.gsi_msi_routes .lock() .unwrap()