Add tracking of the bits acknowledged by the guests

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

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,
-- 
1.8.3.1


Reply via email to