[libvirt] [PATCH 1/2] qemu: add capabilities flags related to SG_IO

Laine Stump laine at laine.org
Thu Dec 22 18:39:31 UTC 2011


This patch adds two capabilities flags to deal with various aspects
of supporting SG_IO commands on virtio-blk-pci devices:

  QEMU_CAPS_VIRTIO_BLK_SCSI
    set if -device virtio-blk-pci accepts the scsi="on|off" option
    When present, this is on by default, but can be set to off to disable
    SG_IO functions.

  QEMU_CAPS_VIRTIO_BLK_SG_IO
    set if SG_IO commands are supported in the virtio-blk-pci driver
    (present since qemu 0.11 according to a qemu developer, if I
     understood correctly)
---
 src/qemu/qemu_capabilities.c |    8 ++++++++
 src/qemu/qemu_capabilities.h |    3 +++
 2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 43c7578..6842cfe 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -144,6 +144,9 @@ VIR_ENUM_IMPL(qemuCaps, QEMU_CAPS_LAST,
               "ich9-ahci",
               "no-acpi",
               "fsdev-readonly",
+
+              "virtio-blk-pci.scsi",
+              "blk-sg-io",
     );
 
 struct qemu_feature_flags {
@@ -1149,6 +1152,9 @@ qemuCapsComputeCmdFlags(const char *help,
     if (version >= 10000)
         qemuCapsSet(flags, QEMU_CAPS_0_10);
 
+    if (version >= 11000)
+        qemuCapsSet(flags, QEMU_CAPS_VIRTIO_BLK_SG_IO);
+
     /* While JSON mode was available in 0.12.0, it was too
      * incomplete to contemplate using. The 0.13.0 release
      * is good enough to use, even though it lacks one or
@@ -1386,6 +1392,8 @@ qemuCapsParseDeviceStr(const char *str, virBitmapPtr flags)
         qemuCapsSet(flags, QEMU_CAPS_VIRTIO_BLK_EVENT_IDX);
     if (strstr(str, "virtio-net-pci.event_idx"))
         qemuCapsSet(flags, QEMU_CAPS_VIRTIO_NET_EVENT_IDX);
+    if (strstr(str, "virtio-blk-pci.scsi"))
+        qemuCapsSet(flags, QEMU_CAPS_VIRTIO_BLK_SCSI);
 
     return 0;
 }
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index c759baf..d47177c 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -118,6 +118,9 @@ enum qemuCapsFlags {
     QEMU_CAPS_NO_ACPI		= 78, /* -no-acpi */
     QEMU_CAPS_FSDEV_READONLY    =79, /* -fsdev readonly supported */
 
+    QEMU_CAPS_VIRTIO_BLK_SCSI    = 80, /* virtio-blk-pci.scsi */
+    QEMU_CAPS_VIRTIO_BLK_SG_IO   = 81, /* support for SG_IO commands, reportedly added in 0.11 */
+
     QEMU_CAPS_LAST,                   /* this must always be the last item */
 };
 
-- 
1.7.7.4




More information about the libvir-list mailing list