Add tracking of the bits acknowledged by the guest

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

diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
index 4b5d9e5..61575b7 100644
--- a/hw/virtio/virtio-balloon.c
+++ b/hw/virtio/virtio-balloon.c
@@ -1029,14 +1029,18 @@ static const VMStateDescription vmstate_virtio_balloon 
= {
 };
 
 static Property virtio_balloon_properties[] = {
-    DEFINE_PROP_BIT("deflate-on-oom", VirtIOBalloon, host_features,
-                    VIRTIO_BALLOON_F_DEFLATE_ON_OOM, false),
-    DEFINE_PROP_BIT("free-page-hint", VirtIOBalloon, host_features,
-                    VIRTIO_BALLOON_F_FREE_PAGE_HINT, false),
-    DEFINE_PROP_BIT("page-poison", VirtIOBalloon, host_features,
-                    VIRTIO_BALLOON_F_PAGE_POISON, true),
-    DEFINE_PROP_BIT("free-page-reporting", VirtIOBalloon, host_features,
-                    VIRTIO_BALLOON_F_REPORTING, false),
+    DEFINE_VIRTIO_FEATURE_BIT("deflate-on-oom", VirtIOBalloon, host_features,
+                              parent_obj.guest_features,
+                              VIRTIO_BALLOON_F_DEFLATE_ON_OOM, false),
+    DEFINE_VIRTIO_FEATURE_BIT("free-page-hint", VirtIOBalloon, host_features,
+                              parent_obj.guest_features,
+                              VIRTIO_BALLOON_F_FREE_PAGE_HINT, false),
+    DEFINE_VIRTIO_FEATURE_BIT("page-poison", VirtIOBalloon, host_features,
+                              parent_obj.guest_features,
+                              VIRTIO_BALLOON_F_PAGE_POISON, true),
+    DEFINE_VIRTIO_FEATURE_BIT("free-page-reporting", VirtIOBalloon,
+                              host_features, parent_obj.guest_features,
+                              VIRTIO_BALLOON_F_REPORTING, false),
     /* QEMU 4.0 accidentally changed the config size even when free-page-hint
      * is disabled, resulting in QEMU 3.1 migration incompatibility.  This
      * property retains this quirk for QEMU 4.1 machine types.
-- 
1.8.3.1


Reply via email to