pci: vfio: Preserve prefetchable BAR flag

If the BAR for the VFIO device is marked as prefetchable on the
underlying device ensure that the BAR exposed through PciConfiguration
is also marked as prefetchable.

Fixes problem where NVIDIA devices are not usable with PCI VFIO
passthrough. See related NVIDIA kernel driver bug:
 https://github.com/NVIDIA/open-gpu-kernel-modules/issues/344.

Fixes: #4451

Signed-off-by: Steven Dake <sdake@lambdal.com>
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Steven Dake
2022-08-08 05:23:04 +00:00
committed by Rob Bradford
parent 62f1b6bc61
commit 868d1f6902
2 changed files with 21 additions and 3 deletions
+6
View File
@@ -999,6 +999,12 @@ impl PciBarConfiguration {
self
}
#[must_use]
pub fn set_prefetchable(mut self, prefetchable: PciBarPrefetchable) -> Self {
self.prefetchable = prefetchable;
self
}
pub fn idx(&self) -> usize {
self.idx
}