qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH v2 20/22] virtio: use version 1.0 if available (flip


From: Gerd Hoffmann
Subject: [Qemu-devel] [PATCH v2 20/22] virtio: use version 1.0 if available (flip the big switch)
Date: Tue, 30 Jun 2015 10:39:11 +0200

Signed-off-by: Gerd Hoffmann <address@hidden>
---
 src/hw/virtio-pci.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/src/hw/virtio-pci.c b/src/hw/virtio-pci.c
index f8f9c4e..1186603 100644
--- a/src/hw/virtio-pci.c
+++ b/src/hw/virtio-pci.c
@@ -261,16 +261,19 @@ struct vp_device *vp_init_simple(struct pci_device *pci)
     }
 
     if (vp->common.cap && vp->notify.cap && vp->isr.cap && vp->device.cap) {
-        dprintf(1, "pci dev %x:%x supports virtio 1.0\n",
+        dprintf(1, "pci dev %x:%x using modern (1.0) virtio mode\n",
                 pci_bdf_to_bus(pci->bdf), pci_bdf_to_dev(pci->bdf));
+        vp->use_modern = 1;
+    } else {
+        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;
+        vp->ioaddr = vp->legacy.addr; /* temporary */
     }
 
-    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;
-    vp->ioaddr = vp->legacy.addr; /* temporary */
-
     vp_reset(vp);
     pci_config_maskw(pci->bdf, PCI_COMMAND, 0, PCI_COMMAND_MASTER);
     vp_set_status(vp, VIRTIO_CONFIG_S_ACKNOWLEDGE |
-- 
1.8.3.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]