[PATCH v1 8/8] virtio-balloon: Add tracking of the virtio guest feature bits

Maxim Davydov posted 8 patches 4 years, 5 months ago
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>, Laurent Vivier <lvivier@redhat.com>, Hanna Reitz <hreitz@redhat.com>, Eduardo Habkost <ehabkost@redhat.com>, Jason Wang <jasowang@redhat.com>, Raphael Norwitz <raphael.norwitz@nutanix.com>, Paolo Bonzini <pbonzini@redhat.com>, Gerd Hoffmann <kraxel@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>, David Hildenbrand <david@redhat.com>, Amit Shah <amit@kernel.org>, Fam Zheng <fam@euphon.net>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, Kevin Wolf <kwolf@redhat.com>
[PATCH v1 8/8] virtio-balloon: Add tracking of the virtio guest feature bits
Posted by Maxim Davydov 4 years, 5 months ago
Add tracking of the bits acknowledged by the guest

Signed-off-by: Maxim Davydov <maxim.davydov@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