On Wed, 14 May 2025, Zhao Liu wrote:
The QOM type of PefGuest is declared by OBJECT_DECLARE_SIMPLE_TYPE,
which means it doesn't need the class!
Therefore, use OBJECT_DEFINE_SIMPLE_TYPE_WITH_INTERFACES to implement
the type, then there's no need for class definition.
Cc: Nicholas Piggin <npig...@gmail.com>
Cc: Daniel Henrique Barboza <danielhb...@gmail.com>
Cc: Harsh Prateek Bora <hars...@linux.ibm.com>
Cc: qemu-...@nongnu.org
Signed-off-by: Zhao Liu <zhao1....@intel.com>
---
hw/ppc/pef.c | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
diff --git a/hw/ppc/pef.c b/hw/ppc/pef.c
index 254f5707876f..1832791ee533 100644
--- a/hw/ppc/pef.c
+++ b/hw/ppc/pef.c
@@ -20,11 +20,6 @@
OBJECT_DECLARE_SIMPLE_TYPE(PefGuest, PEF_GUEST)
typedef struct PefGuest PefGuest;
-typedef struct PefGuestClass PefGuestClass;
-
-struct PefGuestClass {
- ConfidentialGuestSupportClass parent_class;
-};
/**
* PefGuest:
@@ -121,12 +116,12 @@ static int pef_kvm_reset(ConfidentialGuestSupport *cgs,
Error **errp)
return kvmppc_svm_off(errp);
}
-OBJECT_DEFINE_TYPE_WITH_INTERFACES(PefGuest,
- pef_guest,
- PEF_GUEST,
- CONFIDENTIAL_GUEST_SUPPORT,
- { TYPE_USER_CREATABLE },
- { NULL })
+OBJECT_DEFINE_SIMPLE_TYPE_WITH_INTERFACES(PefGuest,
+ pef_guest,
+ PEF_GUEST,
+ CONFIDENTIAL_GUEST_SUPPORT,
+ { TYPE_USER_CREATABLE },
+ { NULL })
Maybe also change the name while at it because the WITH_INTERFACES macros
usually allow to pass an interfaces list instead of the single hardcoded
USER_CREATABLE interface here so if such variant is added it would clash.
Better call this something that shows this is PEF specific or just use the
appropriate macro from qemu/object.h to define it.
Regards,
BALATON Zoltan
static void pef_guest_class_init(ObjectClass *oc, const void *data)
{