diff mbox

[2/3] vhost/scsi: Add VIRTIO_SCSI_F_T10_PI host_feature bit

Message ID 1422606950-25291-3-git-send-email-nab@daterainc.com (mailing list archive)
State New, archived
Headers show

Commit Message

Nicholas A. Bellinger Jan. 30, 2015, 8:35 a.m. UTC
From: Nicholas Bellinger <nab@linux-iscsi.org>

Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
---
 hw/scsi/vhost-scsi.c            |  1 +
 hw/scsi/virtio-scsi.c           |  3 +++
 hw/virtio/virtio-pci.c          |  2 ++
 include/hw/i386/pc.h            | 13 ++++++++++++-
 include/hw/virtio/virtio-scsi.h |  5 ++++-
 5 files changed, 22 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c
index dcb2bc5..95f7b99 100644
--- a/hw/scsi/vhost-scsi.c
+++ b/hw/scsi/vhost-scsi.c
@@ -31,6 +31,7 @@  static const int kernel_feature_bits[] = {
     VIRTIO_RING_F_INDIRECT_DESC,
     VIRTIO_RING_F_EVENT_IDX,
     VIRTIO_SCSI_F_HOTPLUG,
+    VIRTIO_SCSI_F_T10_PI,
     VHOST_INVALID_FEATURE_BIT
 };
 
diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
index 9e2c718..61e9988 100644
--- a/hw/scsi/virtio-scsi.c
+++ b/hw/scsi/virtio-scsi.c
@@ -887,6 +887,9 @@  static void virtio_scsi_device_realize(DeviceState *dev, Error **errp)
         return;
     }
 
+    /* Protection information is not supported yet.  */
+    vdev->guest_features &= ~VIRTIO_SCSI_F_T10_PI;
+
     scsi_bus_new(&s->bus, sizeof(s->bus), dev,
                  &virtio_scsi_scsi_info, vdev->bus_name);
     /* override default SCSI bus hotplug-handler, with virtio-scsi's one */
diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
index 5127efb..861ec95 100644
--- a/hw/virtio/virtio-pci.c
+++ b/hw/virtio/virtio-pci.c
@@ -1200,6 +1200,8 @@  static Property vhost_scsi_pci_properties[] = {
                        DEV_NVECTORS_UNSPECIFIED),
     DEFINE_PROP_BIT("hotplug", VirtIOPCIProxy, host_features,
                        VIRTIO_SCSI_F_HOTPLUG, true),
+    DEFINE_PROP_BIT("prot_info", VirtIOPCIProxy, host_features,
+		    VIRTIO_SCSI_F_T10_PI, true),
     DEFINE_PROP_END_OF_LIST(),
 };
 
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 69d9cf8..c81e2e9 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -315,7 +315,18 @@  bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
             .driver   = "virtio-scsi-pci",\
             .property = "any_layout",\
             .value    = "off",\
-        },{\
+        },\
+        {\
+            .driver   = "virtio-scsi-pci",\
+            .property = "prot_info",\
+            .value    = "off",\
+        },\
+        {\
+            .driver   = "vhost-scsi-pci",\
+            .property = "prot_info",\
+            .value    = "off",\
+        },\
+        {\
             .driver   = "PIIX4_PM",\
             .property = "memory-hotplug-support",\
             .value    = "off",\
diff --git a/include/hw/virtio/virtio-scsi.h b/include/hw/virtio/virtio-scsi.h
index bf17cc9..08bc54a 100644
--- a/include/hw/virtio/virtio-scsi.h
+++ b/include/hw/virtio/virtio-scsi.h
@@ -36,6 +36,7 @@ 
 #define VIRTIO_SCSI_F_INOUT                    0
 #define VIRTIO_SCSI_F_HOTPLUG                  1
 #define VIRTIO_SCSI_F_CHANGE                   2
+#define VIRTIO_SCSI_F_T10_PI                   3
 
 #define VIRTIO_SCSI_VQ_SIZE     128
 #define VIRTIO_SCSI_CDB_SIZE    32
@@ -258,7 +259,9 @@  QEMU_BUILD_BUG_ON(offsetof(VirtIOSCSIReq, req.cdb) !=
     DEFINE_PROP_BIT("hotplug", _state, _feature_field, VIRTIO_SCSI_F_HOTPLUG,  \
                                                        true),                  \
     DEFINE_PROP_BIT("param_change", _state, _feature_field,                    \
-                                            VIRTIO_SCSI_F_CHANGE, true)
+                                            VIRTIO_SCSI_F_CHANGE, true),       \
+    DEFINE_PROP_BIT("prot_info", _state, _feature_field,                       \
+                                            VIRTIO_SCSI_F_T10_PI, true)
 
 typedef void (*HandleOutput)(VirtIODevice *, VirtQueue *);