Skip to contentSkip to conversation

expose VIRTIO_SCSI_F_T10_PI for vhost-scsi and vhost-user-scsi

PATCH Applied Greg Edwards 4 participants 9 messages Aug 8, 2018 – Aug 20, 2018

lore
Share & tools
lore
#0 lore raw

cover expose VIRTIO_SCSI_F_T10_PI for vhost-scsi and vhost-user-scsi

Unify the get_features functions for vhost-scsi and vhost-user-scsi, including their use of host_features, and expose a new 't10_pi' property to enable negotiation of the VIRTIO_SCSI_F_T10_PI feature bit with the backend.

Greg Edwards (3):
vhost-user-scsi: move host_features into VHostSCSICommon
vhost-scsi: unify vhost-scsi get_features implementations
vhost-scsi: expose 't10_pi' property for VIRTIO_SCSI_F_T10_PI

 hw/scsi/vhost-scsi-common.c           |  3 +++
 hw/scsi/vhost-scsi.c                  |  3 +++
 hw/scsi/vhost-user-scsi.c             | 28 ++++++++++-----------------
 include/hw/virtio/vhost-scsi-common.h |  1 +
 include/hw/virtio/vhost-user-scsi.h   |  1 -
 5 files changed, 17 insertions(+), 19 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/3 vhost-user-scsi: move host_features into VHostSCSICommon

In preparation for having vhost-scsi also make use of host_features, move it from struct VHostUserSCSI into struct VHostSCSICommon.

---
 hw/scsi/vhost-user-scsi.c             | 15 ++++++++-------
 include/hw/virtio/vhost-scsi-common.h |  1 +
 include/hw/virtio/vhost-user-scsi.h   |  1 -
 3 files changed, 9 insertions(+), 8 deletions(-)
hw/scsi/vhost-user-scsi.c +8 -7
index 9355cfdf07f9..694cb801209a 100644
@@ -141,9 +141,10 @@ static uint64_t vhost_user_scsi_get_features(VirtIODevice *vdev,
                                              uint64_t features, Error **errp)
 {
     VHostUserSCSI *s = VHOST_USER_SCSI(vdev);
+    VHostSCSICommon *vsc = VHOST_SCSI_COMMON(s);
 
     /* Turn on predefined features supported by this device */
-    features |= s->host_features;
+    features |= vsc->host_features;
 
     return vhost_scsi_common_get_features(vdev, features, errp);
 }
@@ -157,12 +158,12 @@ static Property vhost_user_scsi_properties[] = {
     DEFINE_PROP_UINT32("max_sectors", VirtIOSCSICommon, conf.max_sectors,
                        0xFFFF),
     DEFINE_PROP_UINT32("cmd_per_lun", VirtIOSCSICommon, conf.cmd_per_lun, 128),
-    DEFINE_PROP_BIT64("hotplug", VHostUserSCSI, host_features,
-                                                VIRTIO_SCSI_F_HOTPLUG,
-                                                true),
-    DEFINE_PROP_BIT64("param_change", VHostUserSCSI, host_features,
-                                                     VIRTIO_SCSI_F_CHANGE,
-                                                     true),
+    DEFINE_PROP_BIT64("hotplug", VHostSCSICommon, host_features,
+                                                  VIRTIO_SCSI_F_HOTPLUG,
+                                                  true),
+    DEFINE_PROP_BIT64("param_change", VHostSCSICommon, host_features,
+                                                       VIRTIO_SCSI_F_CHANGE,
+                                                       true),
     DEFINE_PROP_END_OF_LIST(),
 };
 
include/hw/virtio/vhost-scsi-common.h +1 -0
index 4553be4bc378..57fb1d87b51d 100644
@@ -35,6 +35,7 @@ typedef struct VHostSCSICommon {
     int channel;
     int target;
     int lun;
+    uint64_t host_features;
 } VHostSCSICommon;
 
 int vhost_scsi_common_start(VHostSCSICommon *vsc);
include/hw/virtio/vhost-user-scsi.h +0 -1
index 3ec34ae867ab..e429cacd8e06 100644
@@ -30,7 +30,6 @@
 
 typedef struct VHostUserSCSI {
     VHostSCSICommon parent_obj;
-    uint64_t host_features;
     VhostUserState *vhost_user;
 } VHostUserSCSI;
 
Signature · 1 line
2.17.1
Reviewed-by on v1 1/3
#2 lore raw

Re: [Qemu-devel] [PATCH 1/3] vhost-user-scsi: move host_features into VHostSCSICommon

Quoted 6 lines · Greg Edwards

In preparation for having vhost-scsi also make use of host_features, move it from struct VHostUserSCSI into struct VHostSCSICommon.

Quoted 7 lines

---

hw/scsi/vhost-user-scsi.c             | 15 ++++++++-------
include/hw/virtio/vhost-scsi-common.h |  1 +
include/hw/virtio/vhost-user-scsi.h   |  1 -
3 files changed, 9 insertions(+), 8 deletions(-)
#3 lore raw

PATCH 2/3 vhost-scsi: unify vhost-scsi get_features implementations

In reply to Greg Edwards

Move the enablement of preset host features into the common vhost_scsi_common_get_features() function. This is in preparation for having vhost-scsi also make use of host_features.

---
 hw/scsi/vhost-scsi-common.c |  3 +++
 hw/scsi/vhost-user-scsi.c   | 14 +-------------
 2 files changed, 4 insertions(+), 13 deletions(-)
hw/scsi/vhost-scsi-common.c +3 -0
index e2a5828af137..b7fbab65dd17 100644
@@ -96,6 +96,9 @@ uint64_t vhost_scsi_common_get_features(VirtIODevice *vdev, uint64_t features,
 {
     VHostSCSICommon *vsc = VHOST_SCSI_COMMON(vdev);
 
+    /* Turn on predefined features supported by this device */
+    features |= vsc->host_features;
+
     return vhost_get_features(&vsc->dev, vsc->feature_bits, features);
 }
 
hw/scsi/vhost-user-scsi.c +1 -13
index 694cb801209a..26491daaa0bf 100644
@@ -137,18 +137,6 @@ static void vhost_user_scsi_unrealize(DeviceState *dev, Error **errp)
     }
 }
 
-static uint64_t vhost_user_scsi_get_features(VirtIODevice *vdev,
-                                             uint64_t features, Error **errp)
-{
-    VHostUserSCSI *s = VHOST_USER_SCSI(vdev);
-    VHostSCSICommon *vsc = VHOST_SCSI_COMMON(s);
-
-    /* Turn on predefined features supported by this device */
-    features |= vsc->host_features;
-
-    return vhost_scsi_common_get_features(vdev, features, errp);
-}
-
 static Property vhost_user_scsi_properties[] = {
     DEFINE_PROP_CHR("chardev", VirtIOSCSICommon, conf.chardev),
     DEFINE_PROP_UINT32("boot_tpgt", VirtIOSCSICommon, conf.boot_tpgt, 0),
@@ -188,7 +176,7 @@ static void vhost_user_scsi_class_init(ObjectClass *klass, void *data)
     set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
     vdc->realize = vhost_user_scsi_realize;
     vdc->unrealize = vhost_user_scsi_unrealize;
-    vdc->get_features = vhost_user_scsi_get_features;
+    vdc->get_features = vhost_scsi_common_get_features;
     vdc->set_config = vhost_scsi_common_set_config;
     vdc->set_status = vhost_user_scsi_set_status;
     fwc->get_dev_path = vhost_scsi_common_get_fw_dev_path;
Signature · 1 line
2.17.1
Reviewed-by on v1 2/3
#4 lore raw

Re: [Qemu-devel] [PATCH 2/3] vhost-scsi: unify vhost-scsi get_features implementations

Quoted 7 lines · Greg Edwards

Move the enablement of preset host features into the common vhost_scsi_common_get_features() function. This is in preparation for having vhost-scsi also make use of host_features.

Quoted 5 lines

---
hw/scsi/vhost-scsi-common.c | 3 +++
hw/scsi/vhost-user-scsi.c | 14 +-------------

2 files changed, 4 insertions(+), 13 deletions(-)
#5 lore raw

PATCH 3/3 vhost-scsi: expose 't10_pi' property for VIRTIO_SCSI_F_T10_PI

In reply to Greg Edwards

Allow toggling on/off the VIRTIO_SCSI_F_T10_PI feature bit for both vhost-scsi and vhost-user-scsi devices.

---
 hw/scsi/vhost-scsi.c      | 3 +++
 hw/scsi/vhost-user-scsi.c | 3 +++
 2 files changed, 6 insertions(+)
hw/scsi/vhost-scsi.c +3 -0
index 9c1bea8ff327..becf55008553 100644
@@ -238,6 +238,9 @@ static Property vhost_scsi_properties[] = {
     DEFINE_PROP_UINT32("max_sectors", VirtIOSCSICommon, conf.max_sectors,
                        0xFFFF),
     DEFINE_PROP_UINT32("cmd_per_lun", VirtIOSCSICommon, conf.cmd_per_lun, 128),
+    DEFINE_PROP_BIT64("t10_pi", VHostSCSICommon, host_features,
+                                                 VIRTIO_SCSI_F_T10_PI,
+                                                 false),
     DEFINE_PROP_END_OF_LIST(),
 };
 
hw/scsi/vhost-user-scsi.c +3 -0
index 26491daaa0bf..2e1ba4a87bb1 100644
@@ -152,6 +152,9 @@ static Property vhost_user_scsi_properties[] = {
     DEFINE_PROP_BIT64("param_change", VHostSCSICommon, host_features,
                                                        VIRTIO_SCSI_F_CHANGE,
                                                        true),
+    DEFINE_PROP_BIT64("t10_pi", VHostSCSICommon, host_features,
+                                                 VIRTIO_SCSI_F_T10_PI,
+                                                 false),
     DEFINE_PROP_END_OF_LIST(),
 };
 
Signature · 1 line
2.17.1
Reviewed-by on v1 3/3
#6 lore raw

Re: [Qemu-devel] [PATCH 3/3] vhost-scsi: expose 't10_pi' property for VIRTIO_SCSI_F_T10_PI

Quoted 11 lines · Greg Edwards

Allow toggling on/off the VIRTIO_SCSI_F_T10_PI feature bit for both vhost-scsi and vhost-user-scsi devices.

---
hw/scsi/vhost-scsi.c | 3 +++
hw/scsi/vhost-user-scsi.c | 3 +++

2 files changed, 6 insertions(+)
Reviewed-by on the v1 series
#7 lore raw
In reply to Greg Edwards
Quoted 9 lines · Greg Edwards

Unify the get_features functions for vhost-scsi and vhost-user-scsi, including their use of host_features, and expose a new 't10_pi' property to enable negotiation of the VIRTIO_SCSI_F_T10_PI feature bit with the backend.

Greg Edwards (3):
vhost-user-scsi: move host_features into VHostSCSICommon
vhost-scsi: unify vhost-scsi get_features implementations
vhost-scsi: expose 't10_pi' property for VIRTIO_SCSI_F_T10_PI

Quoted 6 lines
 hw/scsi/vhost-scsi-common.c           |  3 +++
 hw/scsi/vhost-scsi.c                  |  3 +++
 hw/scsi/vhost-user-scsi.c             | 28 ++++++++++-----------------
 include/hw/virtio/vhost-scsi-common.h |  1 +
 include/hw/virtio/vhost-user-scsi.h   |  1 -
 5 files changed, 17 insertions(+), 19 deletions(-)
#8 lore raw
In reply to Greg Edwards
Quoted 9 lines · Greg Edwards

Unify the get_features functions for vhost-scsi and vhost-user-scsi, including their use of host_features, and expose a new 't10_pi' property to enable negotiation of the VIRTIO_SCSI_F_T10_PI feature bit with the backend.

Greg Edwards (3):
vhost-user-scsi: move host_features into VHostSCSICommon
vhost-scsi: unify vhost-scsi get_features implementations
vhost-scsi: expose 't10_pi' property for VIRTIO_SCSI_F_T10_PI

Quoted 7 lines
 hw/scsi/vhost-scsi-common.c           |  3 +++
 hw/scsi/vhost-scsi.c                  |  3 +++
 hw/scsi/vhost-user-scsi.c             | 28 ++++++++++-----------------
 include/hw/virtio/vhost-scsi-common.h |  1 +
 include/hw/virtio/vhost-user-scsi.h   |  1 -
 5 files changed, 17 insertions(+), 19 deletions(-)

Queued, thanks.

Paolo