pci: Improve MSI-X code to let VFIO rely on it

This commit enhances the current msi-x code hosted in the pci crate
in order to be reused by the vfio crate. Specifically, it creates
several useful methods for the MsixCap structure that can simplify
the caller's code.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf
2019-07-16 17:19:21 -07:00
parent 29878956bd
commit 72007f016a
3 changed files with 60 additions and 16 deletions

View File

@@ -354,6 +354,7 @@ impl VirtioPciDevice {
settings_bar,
self.msix_num,
MSIX_TABLE_BAR_OFFSET as u32,
settings_bar,
MSIX_PBA_BAR_OFFSET as u32,
);
self.configuration
@@ -401,7 +402,7 @@ impl PciDevice for VirtioPciDevice {
// device should not inject the interrupt.
// Instead, the Pending Bit Array table is updated to reflect there
// is a pending interrupt for this specific vector.
if config.is_masked() || entry.is_masked() {
if config.masked() || entry.masked() {
config.set_pba_bit(queue.vector, false);
return Ok(());
}