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
@@ -550,21 +550,22 @@ impl VfioPciDevice {
|
||||
|
||||
fn update_msix_capabilities(&mut self, offset: u64, data: &[u8]) -> Result<()> {
|
||||
match self.interrupt.update_msix(offset, data) {
|
||||
Some(InterruptUpdateAction::EnableMsix) => match self.enable_irq_fds() {
|
||||
Ok(fds) => {
|
||||
if let Err(e) = self.device.enable_msix(fds) {
|
||||
Some(InterruptUpdateAction::EnableMsix) => {
|
||||
if let Some(msix) = &self.interrupt.msix {
|
||||
let mut irq_fds: Vec<&EventFd> = Vec::new();
|
||||
for r in msix.bar.irq_routes.iter() {
|
||||
irq_fds.push(&r.irq_fd);
|
||||
}
|
||||
|
||||
if let Err(e) = self.device.enable_msix(irq_fds) {
|
||||
warn!("Could not enable MSI-X: {}", e);
|
||||
}
|
||||
}
|
||||
Err(e) => warn!("Could not get IRQ fds: {}", e),
|
||||
},
|
||||
}
|
||||
Some(InterruptUpdateAction::DisableMsix) => {
|
||||
if let Err(e) = self.device.disable_msix() {
|
||||
warn!("Could not disable MSI-X: {}", e);
|
||||
}
|
||||
if let Err(e) = self.disable_irq_fds() {
|
||||
warn!("Could not disable MSI: {}", e);
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user