Instance properties make introspection hard and are not shown by
"-object ...,help".  Convert them to class properties.

Signed-off-by: Eduardo Habkost <ehabk...@redhat.com>
---
Cc: Paolo Bonzini <pbonz...@redhat.com>
Cc: Richard Henderson <r...@twiddle.net>
Cc: Eduardo Habkost <ehabk...@redhat.com>
Cc: qemu-devel@nongnu.org
---
 target/i386/sev.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/target/i386/sev.c b/target/i386/sev.c
index 93c4d60b82..d1c9247c14 100644
--- a/target/i386/sev.c
+++ b/target/i386/sev.c
@@ -298,6 +298,19 @@ sev_guest_class_init(ObjectClass *oc, void *data)
                                   sev_guest_set_session_file);
     object_class_property_set_description(oc, "session-file",
             "guest owners session parameters (encoded with base64)");
+
+    object_class_property_add_uint32_ptr(oc, "policy",
+                                         offsetof(SevGuestState, policy),
+                                         OBJ_PROP_FLAG_READWRITE);
+    object_class_property_add_uint32_ptr(oc, "handle",
+                                         offsetof(SevGuestState, handle),
+                                         OBJ_PROP_FLAG_READWRITE);
+    object_class_property_add_uint32_ptr(oc, "cbitpos",
+                                         offsetof(SevGuestState, cbitpos),
+                                         OBJ_PROP_FLAG_READWRITE);
+    object_class_property_add_uint32_ptr(oc, "reduced-phys-bits",
+                                         offsetof(SevGuestState, 
reduced_phys_bits),
+                                         OBJ_PROP_FLAG_READWRITE);
 }
 
 static void
@@ -307,15 +320,6 @@ sev_guest_instance_init(Object *obj)
 
     sev->sev_device = g_strdup(DEFAULT_SEV_DEVICE);
     sev->policy = DEFAULT_GUEST_POLICY;
-    object_property_add_uint32_ptr(obj, "policy", &sev->policy,
-                                   OBJ_PROP_FLAG_READWRITE);
-    object_property_add_uint32_ptr(obj, "handle", &sev->handle,
-                                   OBJ_PROP_FLAG_READWRITE);
-    object_property_add_uint32_ptr(obj, "cbitpos", &sev->cbitpos,
-                                   OBJ_PROP_FLAG_READWRITE);
-    object_property_add_uint32_ptr(obj, "reduced-phys-bits",
-                                   &sev->reduced_phys_bits,
-                                   OBJ_PROP_FLAG_READWRITE);
 }
 
 /* sev guest info */
-- 
2.26.2


Reply via email to