diff mbox series

[v1,6/8] scsi: Add tracking of the acknowledged feature bits

Message ID 20210901090804.7139-7-maxim.davydov@virtuozzo.com (mailing list archive)
State New, archived
Headers show
Series Virtio features acknowledged by guest | expand

Commit Message

Maxim Davydov Sept. 1, 2021, 9:08 a.m. UTC
Add tracking of the VIRTIO_SCSI_F_HOTPLUG, VIRTIO_SCSI_F_CHANGE and
VIRTIO_SCSI_F_T10_PI bits acknowledged by the guest

Signed-off-by: Maxim Davydov <maxim.davydov@virtuozzo.com>
---
 hw/scsi/vhost-scsi.c      |  6 +++---
 hw/scsi/vhost-user-scsi.c | 18 +++++++++---------
 hw/scsi/virtio-scsi.c     | 10 ++++++----
 3 files changed, 18 insertions(+), 16 deletions(-)
diff mbox series

Patch

diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c
index 8c611bf..4530295 100644
--- a/hw/scsi/vhost-scsi.c
+++ b/hw/scsi/vhost-scsi.c
@@ -277,9 +277,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_VIRTIO_FEATURE_BIT64("t10_pi", VHostSCSICommon,
+                                host_features, dev.acked_features,
+                                VIRTIO_SCSI_F_T10_PI, false),
     DEFINE_PROP_BOOL("migratable", VHostSCSICommon, migratable, false),
     DEFINE_PROP_END_OF_LIST(),
 };
diff --git a/hw/scsi/vhost-user-scsi.c b/hw/scsi/vhost-user-scsi.c
index 1b2f7ee..40f885d 100644
--- a/hw/scsi/vhost-user-scsi.c
+++ b/hw/scsi/vhost-user-scsi.c
@@ -168,15 +168,15 @@  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", VHostSCSICommon, host_features,
-                                                  VIRTIO_SCSI_F_HOTPLUG,
-                                                  true),
-    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_VIRTIO_FEATURE_BIT64("hotplug", VHostSCSICommon,
+                                host_features, dev.acked_features,
+                                VIRTIO_SCSI_F_HOTPLUG, true),
+    DEFINE_VIRTIO_FEATURE_BIT64("param_change", VHostSCSICommon,
+                                host_features, dev.acked_features,
+                                VIRTIO_SCSI_F_CHANGE, true),
+    DEFINE_VIRTIO_FEATURE_BIT64("t10_pi", VHostSCSICommon,
+                                host_features, dev.acked_features,
+                                VIRTIO_SCSI_F_T10_PI, false),
     DEFINE_PROP_END_OF_LIST(),
 };
 
diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
index 6d80730..8f7dd14 100644
--- a/hw/scsi/virtio-scsi.c
+++ b/hw/scsi/virtio-scsi.c
@@ -1061,10 +1061,12 @@  static Property virtio_scsi_properties[] = {
                                                   0xFFFF),
     DEFINE_PROP_UINT32("cmd_per_lun", VirtIOSCSI, parent_obj.conf.cmd_per_lun,
                                                   128),
-    DEFINE_PROP_BIT("hotplug", VirtIOSCSI, host_features,
-                                           VIRTIO_SCSI_F_HOTPLUG, true),
-    DEFINE_PROP_BIT("param_change", VirtIOSCSI, host_features,
-                                                VIRTIO_SCSI_F_CHANGE, true),
+    DEFINE_VIRTIO_FEATURE_BIT("hotplug", VirtIOSCSI, host_features,
+                              parent_obj.parent_obj.guest_features,
+                              VIRTIO_SCSI_F_HOTPLUG, true),
+    DEFINE_VIRTIO_FEATURE_BIT("param_change", VirtIOSCSI, host_features,
+                              parent_obj.parent_obj.guest_features,
+                              VIRTIO_SCSI_F_CHANGE, true),
     DEFINE_PROP_LINK("iothread", VirtIOSCSI, parent_obj.conf.iothread,
                      TYPE_IOTHREAD, IOThread *),
     DEFINE_PROP_END_OF_LIST(),