Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EB7E2606A325 for ; Sun, 1 Nov 2026 20:20:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=gCiqlL91 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xNbzl-0004uU-Dd; Sun, 01 Nov 2026 15:17:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xNbzi-0004tB-Lo for qemu-devel@nongnu.org; Sun, 01 Nov 2026 15:17:34 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xNbzd-0007Av-H1 for qemu-devel@nongnu.org; Sun, 01 Nov 2026 15:17:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1793564248; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9Ye8Vqw7ZABF63+yTTHX2yboLgVofgzBaL3iuZaloCM=; b=gCiqlL913ATsjTFfB16aU3Ajr9wojogM8l4OUDw63g7Y6uyLffg15mhRr1IsWZ1sBn5qIW dj5vqYnf3BOPojjvQRZeVP7IO1eu4Tj3dc/8CW6dn+pPXdNaJRSFPFF/OiFA37yinAxm+5 rBRSJFE/wWeGrNf8sL7RPfqHYyFwt58= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-688-6SLNW9WMOPCiVa89q-cxyw-1; Sun, 01 Nov 2026 15:17:27 -0500 X-MC-Unique: 6SLNW9WMOPCiVa89q-cxyw-1 X-Mimecast-MFC-AGG-ID: 6SLNW9WMOPCiVa89q-cxyw_1793564246 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 426071800612 for ; Sun, 1 Nov 2026 20:17:26 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.44.22.2]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id BD13218004D2 for ; Sun, 1 Nov 2026 20:17:25 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id EC22421E6898; Sun, 01 Nov 2026 21:17:17 +0100 (CET) From: Markus Armbruster To: qemu-devel@nongnu.org Cc: marcandre.lureau@redhat.com, pbonzini@redhat.com, berrange@redhat.com Subject: [PATCH v8 20/56] x86: convert OnOffAuto properties to QAPI-aware registration Date: Sun, 1 Nov 2026 21:16:41 +0100 Message-ID: <20261101201717.3911097-21-armbru@redhat.com> In-Reply-To: <20261101201717.3911097-1-armbru@redhat.com> References: <20261101201717.3911097-1-armbru@redhat.com> X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 Received-SPF: pass client-ip=170.10.133.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 From: Marc-André Lureau Convert the smm, acpi, pit, and pic OnOffAuto properties from manual visitor-based callbacks to object_class_property_add_enum(). Signed-off-by: Marc-André Lureau Signed-off-by: Markus Armbruster --- hw/i386/x86.c | 84 ++++++++++++++++++++------------------------------- 1 file changed, 33 insertions(+), 51 deletions(-) diff --git a/hw/i386/x86.c b/hw/i386/x86.c index 1b7740a97e..3416df13ab 100644 --- a/hw/i386/x86.c +++ b/hw/i386/x86.c @@ -24,7 +24,7 @@ #include "qemu/error-report.h" #include "qemu/units.h" #include "qapi/error.h" -#include "qapi/qapi-visit-common.h" +#include "qapi/qapi-type-infos-common.h" #include "qapi/qapi-visit-machine.h" #include "qapi/visitor.h" #include "system/qtest.h" @@ -188,21 +188,16 @@ bool x86_machine_is_smm_enabled(const X86MachineState *x86ms) return false; } -static void x86_machine_get_smm(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) +static int x86_machine_get_smm(Object *obj, Error **errp) { X86MachineState *x86ms = X86_MACHINE(obj); - OnOffAuto smm = x86ms->smm; - - visit_type_OnOffAuto(v, name, &smm, errp); + return x86ms->smm; } -static void x86_machine_set_smm(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) +static void x86_machine_set_smm(Object *obj, int value, Error **errp) { X86MachineState *x86ms = X86_MACHINE(obj); - - visit_type_OnOffAuto(v, name, &x86ms->smm, errp); + x86ms->smm = value; } bool x86_machine_is_acpi_enabled(const X86MachineState *x86ms) @@ -213,55 +208,40 @@ bool x86_machine_is_acpi_enabled(const X86MachineState *x86ms) return true; } -static void x86_machine_get_acpi(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) +static int x86_machine_get_acpi(Object *obj, Error **errp) { X86MachineState *x86ms = X86_MACHINE(obj); - OnOffAuto acpi = x86ms->acpi; - - visit_type_OnOffAuto(v, name, &acpi, errp); + return x86ms->acpi; } -static void x86_machine_set_acpi(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) +static void x86_machine_set_acpi(Object *obj, int value, Error **errp) { X86MachineState *x86ms = X86_MACHINE(obj); - - visit_type_OnOffAuto(v, name, &x86ms->acpi, errp); + x86ms->acpi = value; } -static void x86_machine_get_pit(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) +static int x86_machine_get_pit(Object *obj, Error **errp) { X86MachineState *x86ms = X86_MACHINE(obj); - OnOffAuto pit = x86ms->pit; - - visit_type_OnOffAuto(v, name, &pit, errp); + return x86ms->pit; } -static void x86_machine_set_pit(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) +static void x86_machine_set_pit(Object *obj, int value, Error **errp) { X86MachineState *x86ms = X86_MACHINE(obj); - - visit_type_OnOffAuto(v, name, &x86ms->pit, errp); + x86ms->pit = value; } -static void x86_machine_get_pic(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) +static int x86_machine_get_pic(Object *obj, Error **errp) { X86MachineState *x86ms = X86_MACHINE(obj); - OnOffAuto pic = x86ms->pic; - - visit_type_OnOffAuto(v, name, &pic, errp); + return x86ms->pic; } -static void x86_machine_set_pic(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) +static void x86_machine_set_pic(Object *obj, int value, Error **errp) { X86MachineState *x86ms = X86_MACHINE(obj); - - visit_type_OnOffAuto(v, name, &x86ms->pic, errp); + x86ms->pic = value; } static char *x86_machine_get_oem_id(Object *obj, Error **errp) @@ -391,29 +371,31 @@ static void x86_machine_class_init(ObjectClass *oc, const void *data) mc->kvm_type = x86_kvm_type; nc->raise_nmi = x86_nmi; - object_class_property_add(oc, X86_MACHINE_SMM, "OnOffAuto", NULL, - x86_machine_get_smm, x86_machine_set_smm, - NULL, NULL); + object_class_property_add_enum(oc, X86_MACHINE_SMM, "OnOffAuto", + &OnOffAuto_type_info, NULL, + x86_machine_get_smm, + x86_machine_set_smm); object_class_property_set_description(oc, X86_MACHINE_SMM, "Enable SMM"); - object_class_property_add(oc, X86_MACHINE_ACPI, "OnOffAuto", NULL, - x86_machine_get_acpi, x86_machine_set_acpi, - NULL, NULL); + object_class_property_add_enum(oc, X86_MACHINE_ACPI, "OnOffAuto", + &OnOffAuto_type_info, NULL, + x86_machine_get_acpi, + x86_machine_set_acpi); object_class_property_set_description(oc, X86_MACHINE_ACPI, "Enable ACPI"); - object_class_property_add(oc, X86_MACHINE_PIT, "OnOffAuto", NULL, - x86_machine_get_pit, - x86_machine_set_pit, - NULL, NULL); + object_class_property_add_enum(oc, X86_MACHINE_PIT, "OnOffAuto", + &OnOffAuto_type_info, NULL, + x86_machine_get_pit, + x86_machine_set_pit); object_class_property_set_description(oc, X86_MACHINE_PIT, "Enable i8254 PIT"); - object_class_property_add(oc, X86_MACHINE_PIC, "OnOffAuto", NULL, - x86_machine_get_pic, - x86_machine_set_pic, - NULL, NULL); + object_class_property_add_enum(oc, X86_MACHINE_PIC, "OnOffAuto", + &OnOffAuto_type_info, NULL, + x86_machine_get_pic, + x86_machine_set_pic); object_class_property_set_description(oc, X86_MACHINE_PIC, "Enable i8259 PIC"); -- 2.55.0