diff mbox series

[v1,7/8] virtio-blk: Add tracking of the virtio guest feature bits

Message ID 20210901090804.7139-8-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 bits acknowledged by the guests

Signed-off-by: Maxim Davydov <maxim.davydov@virtuozzo.com>
---
 hw/block/virtio-blk.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
index f139cd7..552b86c 100644
--- a/hw/block/virtio-blk.c
+++ b/hw/block/virtio-blk.c
@@ -1287,11 +1287,13 @@  static Property virtio_blk_properties[] = {
     DEFINE_BLOCK_ERROR_PROPERTIES(VirtIOBlock, conf.conf),
     DEFINE_BLOCK_CHS_PROPERTIES(VirtIOBlock, conf.conf),
     DEFINE_PROP_STRING("serial", VirtIOBlock, conf.serial),
-    DEFINE_PROP_BIT64("config-wce", VirtIOBlock, host_features,
-                      VIRTIO_BLK_F_CONFIG_WCE, true),
+    DEFINE_VIRTIO_FEATURE_BIT64("config-wce", VirtIOBlock, host_features,
+                                parent_obj.guest_features,
+                                VIRTIO_BLK_F_CONFIG_WCE, true),
 #ifdef __linux__
-    DEFINE_PROP_BIT64("scsi", VirtIOBlock, host_features,
-                      VIRTIO_BLK_F_SCSI, false),
+    DEFINE_VIRTIO_FEATURE_BIT64("scsi", VirtIOBlock, host_features,
+                                parent_obj.guest_features,
+                                VIRTIO_BLK_F_SCSI, false),
 #endif
     DEFINE_PROP_BIT("request-merging", VirtIOBlock, conf.request_merging, 0,
                     true),
@@ -1301,12 +1303,14 @@  static Property virtio_blk_properties[] = {
     DEFINE_PROP_BOOL("seg-max-adjust", VirtIOBlock, conf.seg_max_adjust, true),
     DEFINE_PROP_LINK("iothread", VirtIOBlock, conf.iothread, TYPE_IOTHREAD,
                      IOThread *),
-    DEFINE_PROP_BIT64("discard", VirtIOBlock, host_features,
-                      VIRTIO_BLK_F_DISCARD, true),
+    DEFINE_VIRTIO_FEATURE_BIT64("discard", VirtIOBlock, host_features,
+                                parent_obj.guest_features,
+                                VIRTIO_BLK_F_DISCARD, true),
     DEFINE_PROP_BOOL("report-discard-granularity", VirtIOBlock,
                      conf.report_discard_granularity, true),
-    DEFINE_PROP_BIT64("write-zeroes", VirtIOBlock, host_features,
-                      VIRTIO_BLK_F_WRITE_ZEROES, true),
+    DEFINE_VIRTIO_FEATURE_BIT64("write-zeroes", VirtIOBlock, host_features,
+                                parent_obj.guest_features,
+                                VIRTIO_BLK_F_WRITE_ZEROES, true),
     DEFINE_PROP_UINT32("max-discard-sectors", VirtIOBlock,
                        conf.max_discard_sectors, BDRV_REQUEST_MAX_SECTORS),
     DEFINE_PROP_UINT32("max-write-zeroes-sectors", VirtIOBlock,