[PATCH 5/7] kvmtool: uses mmio for legacy bar 0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hmm.  Doesn't match virtio spec.
But easy to check and handle.

Signed-off-by: Gerd Hoffmann <kraxel@xxxxxxxxxx>
---
 src/hw/virtio-pci.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/hw/virtio-pci.c b/src/hw/virtio-pci.c
index 6df5194..465deb9 100644
--- a/src/hw/virtio-pci.c
+++ b/src/hw/virtio-pci.c
@@ -267,9 +267,14 @@ void vp_init_simple(struct vp_device *vp, struct pci_device *pci)
         dprintf(1, "pci dev %x:%x using legacy (0.9.5) virtio mode\n",
                 pci_bdf_to_bus(pci->bdf), pci_bdf_to_dev(pci->bdf));
         vp->legacy.bar = 0;
-        vp->legacy.addr = pci_config_readl(pci->bdf, PCI_BASE_ADDRESS_0) &
-            PCI_BASE_ADDRESS_IO_MASK;
-        vp->legacy.is_io = 1;
+        addr = pci_config_readl(pci->bdf, PCI_BASE_ADDRESS_0);
+        if (addr & PCI_BASE_ADDRESS_SPACE_IO) {
+            vp->legacy.addr = addr & PCI_BASE_ADDRESS_IO_MASK;
+            vp->legacy.is_io = 1;
+        } else {
+            vp->legacy.addr = addr & PCI_BASE_ADDRESS_MEM_MASK;
+            vp->legacy.is_io = 0;
+        }
     }
 
     vp_reset(vp);
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux