pci: Fix MSI-X table and PBA offsets

The offsets returned by the table_offset() and pba_offset() function
were wrong as they were shifting the value by 3 bits. The MSI-X spec
defines the MSI-X table and PBA offsets as being defined on 3-31 bits,
but this does not mean it has to be shifted. Instead, the address is
still on 32 bits and assumes the LSB bits 0-2 are set to 0.

VFIO was working fine with devices were the MSI-X offset were 0x0, but
the bug was found on a device where the offset was non-null.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf 2019-08-01 21:39:01 -07:00 committed by Samuel Ortiz
parent baec27698e
commit a548a01423

View File

@ -359,11 +359,11 @@ impl MsixCap {
}
pub fn table_offset(&self) -> u32 {
self.table >> 3
self.table & 0xffff_fff8
}
pub fn pba_offset(&self) -> u32 {
self.pba >> 3
self.pba & 0xffff_fff8
}
pub fn table_bir(&self) -> u32 {