]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: add capabilities flags related to SG_IO
authorLaine Stump <laine@laine.org>
Tue, 29 Nov 2011 18:37:27 +0000 (13:37 -0500)
committerLaine Stump <laine@laine.org>
Mon, 9 Jan 2012 15:55:44 +0000 (10:55 -0500)
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
src/qemu/qemu_capabilities.h

index 43c75787d63722106335eb8236ca2dbf36844782..6842cfefc9631e80622e97a7bd34d9c46562e021 100644 (file)
@@ -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;
 }
index c759baf0e260e51a75df44de9e20f5684eb0126e..d47177cf75f92b9d22f941bb4a80d2117f53f3b1 100644 (file)
@@ -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 */
 };