Skip to contentSkip to conversation

virtio-blk: add msi support.

PATCH In review Gerd Hoffmann 3 participants 4 messages Aug 12, 2009 – Sep 8, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 virtio-blk: add msi support.

---
 hw/pc.c         |    4 ++++
 hw/virtio-pci.c |    8 ++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)
hw/pc.c +4 -0
index cc6e7e8..cccb865 100644
@@ -1487,6 +1487,10 @@ static QEMUMachine pc_machine_v0_10 = {
             .driver   = "virtio-net-pci",
             .property = "vectors",
             .value    = stringify(0),
+        },{
+            .driver   = "virtio-blk-pci",
+            .property = "vectors",
+            .value    = stringify(0),
         },
         { /* end of list */ }
     },
hw/virtio-pci.c +6 -2
index 8b57dfc..e95700a 100644
@@ -437,10 +437,13 @@ static void virtio_blk_init_pci(PCIDevice *pci_dev)
         fprintf(stderr, "drive property not set\n");
     }
     vdev = virtio_blk_init(&pci_dev->qdev, proxy->dinfo);
+    vdev->nvectors = proxy->nvectors;
     virtio_init_pci(proxy, vdev,
                     PCI_VENDOR_ID_REDHAT_QUMRANET,
                     PCI_DEVICE_ID_VIRTIO_BLOCK,
                     proxy->class_code, 0x00);
+    /* make the actual value visible */
+    proxy->nvectors = vdev->nvectors;
 }
 
 static void virtio_console_init_pci(PCIDevice *pci_dev)
@@ -504,6 +507,7 @@ static PCIDeviceInfo virtio_info[] = {
         .qdev.props = (Property[]) {
             DEFINE_PROP_HEX32("class", VirtIOPCIProxy, class_code, 0),
             DEFINE_PROP_DRIVE("drive", VirtIOPCIProxy, dinfo),
+            DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 2),
             DEFINE_PROP_END_OF_LIST(),
         },
     },{
@@ -511,8 +515,8 @@ static PCIDeviceInfo virtio_info[] = {
         .qdev.size  = sizeof(VirtIOPCIProxy),
         .init       = virtio_net_init_pci,
         .qdev.props = (Property[]) {
-            DEFINE_PROP_HEX32("vectors", VirtIOPCIProxy, nvectors,
-                              NIC_NVECTORS_UNSPECIFIED),
+            DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors,
+                               NIC_NVECTORS_UNSPECIFIED),
             DEFINE_PROP_END_OF_LIST(),
         },
     },{
Signature · 1 line
1.6.2.5
#1 lore raw

Ah nice, I was just about to start doing this. It's worth mentioning that this gives an about 5% speedup for workloads with small I/O sizes.

#2 lore raw
In reply to Gerd Hoffmann
Quoted 11 lines · Gerd Hoffmann
---
 hw/pc.c         |    4 ++++
 hw/virtio-pci.c |    8 ++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)
hw/pc.c +0 -0
index cc6e7e8..cccb865 100644

hw/pc.c static QEMUMachine pc_machine_v0_10 = { · line 1493

Quoted 7 lines
hw/pc.c +4 -0
@@ -1487,6 +1487,10 @@ static QEMUMachine pc_machine_v0_10 = {
             .driver   = "virtio-net-pci",
             .property = "vectors",
             .value    = stringify(0),
+        },{
+            .driver   = "virtio-blk-pci",
+            .property = "vectors",
+            .value    = stringify(0),

This means that MSI is enabled for virtio-blk with the pc-0.11 machine type.

Shouldn't we add a pc-0.12 machine type and disable MSI for pc-0.11?

Cheers,
Mark.

#3 lore raw
Quoted 23 lines · Mark McLoughlin
Quoted 11 lines · Gerd Hoffmann
---
  hw/pc.c         |    4 ++++
  hw/virtio-pci.c |    8 ++++++--
  2 files changed, 10 insertions(+), 2 deletions(-)
hw/pc.c +0 -0
index cc6e7e8..cccb865 100644

hw/pc.c static QEMUMachine pc_machine_v0_10 = { · line 1493

Quoted 7 lines
hw/pc.c +4 -0
@@ -1487,6 +1487,10 @@ static QEMUMachine pc_machine_v0_10 = {
              .driver   = "virtio-net-pci",
              .property = "vectors",
              .value    = stringify(0),
+        },{
+            .driver   = "virtio-blk-pci",
+            .property = "vectors",
+            .value    = stringify(0),

This means that MSI is enabled for virtio-blk with the pc-0.11 machine type.

Quoted 1 line

Shouldn't we add a pc-0.12 machine type and disable MSI for pc-0.11?

Either that or apply the virtio-blk msi patch to the stable-0.11 branch.

cheers,
Gerd