mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
msix: Perform interrupt enabling/disabling
In order to factorize one step further, we let MsixConfig perform the interrupt enabling/disabling. This is done by registering/unregistering the KVM irq_fds of all GSI routes related to this device. And now that MsixConfig is in charge of the irq_fds, vfio-pci must rely on it to retrieve them and provide them to the vfio driver. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
committed by
Samuel Ortiz
parent
19aeac40c9
commit
1e5e02801f
@@ -113,6 +113,12 @@ impl MsixConfig {
|
||||
let mut gsi_msi_routes = self.gsi_msi_routes.lock().unwrap();
|
||||
if self.enabled && !self.masked {
|
||||
for (idx, table_entry) in self.table_entries.iter().enumerate() {
|
||||
if !old_enabled || old_masked {
|
||||
if let Err(e) = self.irq_routes[idx].enable(&self.vm_fd) {
|
||||
error!("Failed enabling irq_fd: {:?}", e);
|
||||
}
|
||||
}
|
||||
|
||||
// Ignore MSI-X vector if masked.
|
||||
if table_entry.masked() {
|
||||
continue;
|
||||
@@ -134,6 +140,12 @@ impl MsixConfig {
|
||||
}
|
||||
} else {
|
||||
for route in self.irq_routes.iter() {
|
||||
if old_enabled || !old_masked {
|
||||
if let Err(e) = route.disable(&self.vm_fd) {
|
||||
error!("Failed disabling irq_fd: {:?}", e);
|
||||
}
|
||||
}
|
||||
|
||||
gsi_msi_routes.remove(&route.gsi);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user