aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandru Elisei <alexandru.elisei@arm.com>2020-04-14 15:39:39 +0100
committerWill Deacon <will@kernel.org>2020-04-15 16:27:17 +0100
commit84998f21b3c758233e7d8b3d1681d69f9d65ce14 (patch)
tree50a1e166fa7b9c5bcf14fa10db1801c33e99d306
parented01a603ddd2dc6c35130ef9b73dc8b68fc3302d (diff)
downloadkvmtool-84998f21b3c758233e7d8b3d1681d69f9d65ce14.tar.gz
vfio/pci: Don't assume that only even numbered BARs are 64bit
Not all devices have the bottom 32 bits of a 64 bit BAR in an even numbered BAR. For example, on an NVIDIA Quadro P400, BARs 1 and 3 are 64bit. Remove this assumption. Reviewed-by: Andre Przywara <andre.przywara@arm.com> Signed-off-by: Alexandru Elisei <alexandru.elisei@arm.com> Signed-off-by: Will Deacon <will@kernel.org>
-rw-r--r--vfio/pci.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/vfio/pci.c b/vfio/pci.c
index bbb8469c..1bdc2003 100644
--- a/vfio/pci.c
+++ b/vfio/pci.c
@@ -920,8 +920,10 @@ static int vfio_pci_configure_dev_regions(struct kvm *kvm,
for (i = VFIO_PCI_BAR0_REGION_INDEX; i <= VFIO_PCI_BAR5_REGION_INDEX; ++i) {
/* Ignore top half of 64-bit BAR */
- if (i % 2 && is_64bit)
+ if (is_64bit) {
+ is_64bit = false;
continue;
+ }
ret = vfio_pci_configure_bar(kvm, vdev, i);
if (ret)