Convert the OnOffSplit property from manual visitor-based callbacks to property_add_qapi_enum().
Signed-off-by: Marc-André Lureau <[email protected]> --- accel/hvf/hvf-all.c | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/accel/hvf/hvf-all.c b/accel/hvf/hvf-all.c index 946dbca59d0..982072d17ea 100644 --- a/accel/hvf/hvf-all.c +++ b/accel/hvf/hvf-all.c @@ -11,6 +11,7 @@ #include "qemu/osdep.h" #include "qemu/error-report.h" #include "qapi/error.h" +#include "qapi/qapi-type-infos-common.h" #include "qapi/qapi-visit-common.h" #include "accel/accel-ops.h" #include "exec/cpu-common.h" @@ -233,18 +234,12 @@ static int hvf_gdbstub_sstep_flags(AccelState *as) return SSTEP_ENABLE | SSTEP_NOIRQ; } -static void hvf_set_kernel_irqchip(Object *obj, Visitor *v, - const char *name, void *opaque, +static void hvf_set_kernel_irqchip(Object *obj, int value, Error **errp) { - OnOffSplit mode; - hvf_kernel_irqchip_override = true; - if (!visit_type_OnOffSplit(v, name, &mode, errp)) { - return; - } - switch (mode) { + switch (value) { case ON_OFF_SPLIT_ON: #ifdef HOST_X86_64 /* macOS 12 onwards exposes an HVF virtual APIC. */ @@ -264,11 +259,7 @@ static void hvf_set_kernel_irqchip(Object *obj, Visitor *v, break; default: - /* - * The value was checked in visit_type_OnOffSplit() above. If - * we get here, then something is wrong in QEMU. - */ - abort(); + g_assert_not_reached(); } } @@ -281,11 +272,13 @@ static void hvf_accel_class_init(ObjectClass *oc, const void *data) ac->gdbstub_supported_sstep_flags = hvf_gdbstub_sstep_flags; hvf_kernel_irqchip_override = false; hvf_kernel_irqchip = false; - object_class_property_add(oc, "kernel-irqchip", "on|off|split", - NULL, hvf_set_kernel_irqchip, - NULL, NULL); - object_class_property_set_description(oc, "kernel-irqchip", - "Configure HVF irqchip"); + + object_class_property_add_qapi_enum(oc, QAPI_ENUM_PROP( + .name = "kernel-irqchip", + .qapi_type = &OnOffSplit_type_info, + .set = hvf_set_kernel_irqchip, + .description = "Configure HVF irqchip", + )); } static const TypeInfo hvf_accel_type = { -- 2.54.0
