mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-08-20 15:01:16 +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>>,
|
ioapic: Arc<Mutex<dyn InterruptController>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct KvmMsiInterruptManager {
|
pub struct MsiInterruptManager<E> {
|
||||||
allocator: Arc<Mutex<SystemAllocator>>,
|
allocator: Arc<Mutex<SystemAllocator>>,
|
||||||
vm_fd: Arc<dyn hypervisor::Vm>,
|
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 {
|
impl LegacyUserspaceInterruptManager {
|
||||||
pub fn new(ioapic: Arc<Mutex<dyn InterruptController>>) -> Self {
|
pub fn new(ioapic: Arc<Mutex<dyn InterruptController>>) -> Self {
|
||||||
LegacyUserspaceInterruptManager { ioapic }
|
LegacyUserspaceInterruptManager { ioapic }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl KvmMsiInterruptManager {
|
impl<E> MsiInterruptManager<E> {
|
||||||
pub fn new(allocator: Arc<Mutex<SystemAllocator>>, vm_fd: Arc<dyn hypervisor::Vm>) -> Self {
|
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
|
// 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,
|
// devices. This way, we can maintain the full list of used GSI,
|
||||||
@ -340,7 +342,7 @@ impl KvmMsiInterruptManager {
|
|||||||
// another one.
|
// another one.
|
||||||
let gsi_msi_routes = Arc::new(Mutex::new(HashMap::new()));
|
let gsi_msi_routes = Arc::new(Mutex::new(HashMap::new()));
|
||||||
|
|
||||||
KvmMsiInterruptManager {
|
MsiInterruptManager {
|
||||||
allocator,
|
allocator,
|
||||||
vm_fd,
|
vm_fd,
|
||||||
gsi_msi_routes,
|
gsi_msi_routes,
|
||||||
|
Loading…
Reference in New Issue
Block a user