mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-01-03 03:15:20 +00:00
pci: vfio: Don't assume MSI-X is enabled
The fixup_msix_region() function added in
a718716831
made the assumption that MSI-X was always available. This is the case
with many VFIO devices and all our virtio devices but created regression
with MSI devices.
Simply return the existing region size if MSI-X is not supported by the
device.
Fixes: #5649
Signed-off-by: Rob Bradford <rbradford@rivosinc.com>
This commit is contained in:
parent
a00d29867c
commit
363b478040
@ -505,7 +505,7 @@ impl VfioCommon {
|
||||
/// In case msix table offset is not page size aligned, we need do some fixup to achive it.
|
||||
/// Becuse we don't want the MMIO RW region and trap region overlap each other.
|
||||
fn fixup_msix_region(&mut self, bar_id: u32, region_size: u64) -> u64 {
|
||||
let msix = self.interrupt.msix.as_mut().unwrap();
|
||||
if let Some(msix) = self.interrupt.msix.as_mut() {
|
||||
let msix_cap = &mut msix.cap;
|
||||
|
||||
// Suppose table_bir equals to pba_bir here. Am I right?
|
||||
@ -523,6 +523,10 @@ impl VfioCommon {
|
||||
msix_cap.pba_set_offset((size / 2 + pba_offset - table_offset) as u32);
|
||||
|
||||
size
|
||||
} else {
|
||||
// MSI-X not supported for this device
|
||||
region_size
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn allocate_bars(
|
||||
|
Loading…
Reference in New Issue
Block a user