expose VIRTIO_SCSI_F_T10_PI for vhost-scsi and vhost-user-scsi
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
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
@@ -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
@@ -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
@@ -30,7 +30,6 @@typedef struct VHostUserSCSI {VHostSCSICommon parent_obj; -uint64_t host_features;VhostUserState *vhost_user; }VHostUserSCSI ;
Signature · 1 line
2.17.1
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
Signed-off-by Greg Edwards <[email protected]>---
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(-)
PATCH 2/3 vhost-scsi: unify vhost-scsi get_features implementations
In reply to Greg EdwardsMove 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
@@ -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
@@ -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
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 ofhost_features.
Quoted 5 lines
Signed-off-by Greg Edwards <[email protected]>---
hw/scsi/vhost-scsi-common.c| 3 +++hw/scsi/vhost-user-scsi.c| 14 +-------------2 files changed, 4 insertions(+), 13 deletions(-)
PATCH 3/3 vhost-scsi: expose 't10_pi' property for VIRTIO_SCSI_F_T10_PI
In reply to Greg EdwardsAllow 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
@@ -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
@@ -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
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_PIfeature bit for both vhost-scsi and vhost-user-scsi devices.Signed-off-by Greg Edwards <[email protected]>---
hw/scsi/vhost-scsi.c| 3 +++hw/scsi/vhost-user-scsi.c| 3 +++2 files changed, 6 insertions(+)
Quoted 9 lines · Greg Edwards
Unify the
get_featuresfunctions for vhost-scsi and vhost-user-scsi, including their use ofhost_features, and expose a new 't10_pi' property to enable negotiation of theVIRTIO_SCSI_F_T10_PIfeature bit with the backend.Greg Edwards (3):
vhost-user-scsi: movehost_featuresinto VHostSCSICommon
vhost-scsi: unify vhost-scsiget_featuresimplementations
vhost-scsi: expose 't10_pi' property forVIRTIO_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(-)
Paolo Bonzini
AppliedQuoted 9 lines · Greg Edwards
Unify the
get_featuresfunctions for vhost-scsi and vhost-user-scsi, including their use ofhost_features, and expose a new 't10_pi' property to enable negotiation of theVIRTIO_SCSI_F_T10_PIfeature bit with the backend.Greg Edwards (3):
vhost-user-scsi: movehost_featuresinto VHostSCSICommon
vhost-scsi: unify vhost-scsiget_featuresimplementations
vhost-scsi: expose 't10_pi' property forVIRTIO_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