From nobody Thu Sep 19 01:08:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1718902881212769.4269333043126; Thu, 20 Jun 2024 10:01:21 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 1DCD71080; Thu, 20 Jun 2024 13:01:20 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 31B2812E5; Thu, 20 Jun 2024 12:59:13 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id CF793D12; Thu, 20 Jun 2024 12:59:08 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id B6DD41313 for ; Thu, 20 Jun 2024 12:58:42 -0400 (EDT) Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-517--EY-h88KO6iH_uXLpO2WVQ-1; Thu, 20 Jun 2024 12:58:40 -0400 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 130B219560B0; Thu, 20 Jun 2024 16:58:37 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.42.28.69]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id CD58B19560AF; Thu, 20 Jun 2024 16:58:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: *** X-Spam-Status: No, score=3.0 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,RCVD_IN_SBL_CSS,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718902722; 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=edYIAQPsyNTqsiVIVNO+4eC3DTlCCk5x2IKeT2Ev60Q=; b=Iiu3ompuNaQVr3yzZyL6uVv4uinyuCrLlakctir6OYGn9X7HI7VvPibM2AmiNhbI7CE+7W rz2c/xVfWEfUxPUzmvX9oR9tkYJfy1ufi3PYHVA9vt5uAe77E7GsTGG0BbNUslzHAE9u4E JeExVNLWcH0jHHpJXb8BOBDuB3jBycE= X-MC-Unique: -EY-h88KO6iH_uXLpO2WVQ-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 05/14] hw/m68k: convert 'virt' machine definitions to use new macros Date: Thu, 20 Jun 2024 17:57:33 +0100 Message-ID: <20240620165742.1711389-6-berrange@redhat.com> In-Reply-To: <20240620165742.1711389-1-berrange@redhat.com> References: <20240620165742.1711389-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: QEDDHAC2GXJJSEVI4WEYMIQWCY2HJKL3 X-Message-ID-Hash: QEDDHAC2GXJJSEVI4WEYMIQWCY2HJKL3 X-MailFrom: berrange@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: Halil Pasic , devel@lists.libvirt.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , qemu-s390x@nongnu.org, Richard Henderson , Nicholas Piggin , David Hildenbrand , Ilya Leoshkevich , David Gibson , qemu-arm@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Harsh Prateek Bora , Yanan Wang , Eduardo Habkost , Peter Maydell , Daniel Henrique Barboza , Thomas Huth , Paolo Bonzini , Marcel Apfelbaum , Christian Borntraeger , Laurent Vivier , qemu-ppc@nongnu.org X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1718902881973100001 Content-Type: text/plain; charset="utf-8" This changes the DEFINE_VIRT_MACHINE macro to use the common helpers for constructing versioned symbol names and strings, bringing greater consistency across targets. A DEFINE_VIRT_MACHINE_AS_LATEST helper is added so that it is not required to pass 'false' for every single historical machine type. Reviewed-by: Thomas Huth Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/m68k/virt.c | 51 ++++++++++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/hw/m68k/virt.c b/hw/m68k/virt.c index 09bc9bdfef..cd6ee692f7 100644 --- a/hw/m68k/virt.c +++ b/hw/m68k/virt.c @@ -335,99 +335,106 @@ static void virt_machine_register_types(void) =20 type_init(virt_machine_register_types) =20 -#define DEFINE_VIRT_MACHINE(major, minor, latest) \ - static void virt_##major##_##minor##_class_init(ObjectClass *oc, \ - void *data) \ +#define DEFINE_VIRT_MACHINE_IMPL(latest, ...) \ + static void MACHINE_VER_SYM(class_init, virt, __VA_ARGS__)( \ + ObjectClass *oc, \ + void *data) \ { \ MachineClass *mc =3D MACHINE_CLASS(oc); \ - virt_machine_##major##_##minor##_options(mc); \ - mc->desc =3D "QEMU " # major "." # minor " M68K Virtual Machine"; \ + MACHINE_VER_SYM(options, virt, __VA_ARGS__)(mc); \ + mc->desc =3D "QEMU " MACHINE_VER_STR(__VA_ARGS__) " M68K Virtual M= achine"; \ if (latest) { \ mc->alias =3D "virt"; \ } \ } \ - static const TypeInfo machvirt_##major##_##minor##_info =3D { \ - .name =3D MACHINE_TYPE_NAME("virt-" # major "." # minor), \ + static const TypeInfo MACHINE_VER_SYM(info, virt, __VA_ARGS__) =3D \ + { \ + .name =3D MACHINE_VER_TYPE_NAME("virt", __VA_ARGS__), \ .parent =3D MACHINE_TYPE_NAME("virt"), \ - .class_init =3D virt_##major##_##minor##_class_init, \ + .class_init =3D MACHINE_VER_SYM(class_init, virt, __VA_ARGS__), \ }; \ - static void machvirt_machine_##major##_##minor##_init(void) \ + static void MACHINE_VER_SYM(register, virt, __VA_ARGS__)(void) \ { \ - type_register_static(&machvirt_##major##_##minor##_info); \ + type_register_static(&MACHINE_VER_SYM(info, virt, __VA_ARGS__)); \ } \ - type_init(machvirt_machine_##major##_##minor##_init); + type_init(MACHINE_VER_SYM(register, virt, __VA_ARGS__)); + +#define DEFINE_VIRT_MACHINE_AS_LATEST(major, minor) \ + DEFINE_VIRT_MACHINE_IMPL(true, major, minor) +#define DEFINE_VIRT_MACHINE(major, minor) \ + DEFINE_VIRT_MACHINE_IMPL(false, major, minor) =20 static void virt_machine_9_1_options(MachineClass *mc) { } -DEFINE_VIRT_MACHINE(9, 1, true) +DEFINE_VIRT_MACHINE_AS_LATEST(9, 1) =20 static void virt_machine_9_0_options(MachineClass *mc) { virt_machine_9_1_options(mc); compat_props_add(mc->compat_props, hw_compat_9_0, hw_compat_9_0_len); } -DEFINE_VIRT_MACHINE(9, 0, false) +DEFINE_VIRT_MACHINE(9, 0) =20 static void virt_machine_8_2_options(MachineClass *mc) { virt_machine_9_0_options(mc); compat_props_add(mc->compat_props, hw_compat_8_2, hw_compat_8_2_len); } -DEFINE_VIRT_MACHINE(8, 2, false) +DEFINE_VIRT_MACHINE(8, 2) =20 static void virt_machine_8_1_options(MachineClass *mc) { virt_machine_8_2_options(mc); compat_props_add(mc->compat_props, hw_compat_8_1, hw_compat_8_1_len); } -DEFINE_VIRT_MACHINE(8, 1, false) +DEFINE_VIRT_MACHINE(8, 1) =20 static void virt_machine_8_0_options(MachineClass *mc) { virt_machine_8_1_options(mc); compat_props_add(mc->compat_props, hw_compat_8_0, hw_compat_8_0_len); } -DEFINE_VIRT_MACHINE(8, 0, false) +DEFINE_VIRT_MACHINE(8, 0) =20 static void virt_machine_7_2_options(MachineClass *mc) { virt_machine_8_0_options(mc); compat_props_add(mc->compat_props, hw_compat_7_2, hw_compat_7_2_len); } -DEFINE_VIRT_MACHINE(7, 2, false) +DEFINE_VIRT_MACHINE(7, 2) =20 static void virt_machine_7_1_options(MachineClass *mc) { virt_machine_7_2_options(mc); compat_props_add(mc->compat_props, hw_compat_7_1, hw_compat_7_1_len); } -DEFINE_VIRT_MACHINE(7, 1, false) +DEFINE_VIRT_MACHINE(7, 1) =20 static void virt_machine_7_0_options(MachineClass *mc) { virt_machine_7_1_options(mc); compat_props_add(mc->compat_props, hw_compat_7_0, hw_compat_7_0_len); } -DEFINE_VIRT_MACHINE(7, 0, false) +DEFINE_VIRT_MACHINE(7, 0) =20 static void virt_machine_6_2_options(MachineClass *mc) { virt_machine_7_0_options(mc); compat_props_add(mc->compat_props, hw_compat_6_2, hw_compat_6_2_len); } -DEFINE_VIRT_MACHINE(6, 2, false) +DEFINE_VIRT_MACHINE(6, 2) =20 static void virt_machine_6_1_options(MachineClass *mc) { virt_machine_6_2_options(mc); compat_props_add(mc->compat_props, hw_compat_6_1, hw_compat_6_1_len); } -DEFINE_VIRT_MACHINE(6, 1, false) +DEFINE_VIRT_MACHINE(6, 1) =20 static void virt_machine_6_0_options(MachineClass *mc) { virt_machine_6_1_options(mc); compat_props_add(mc->compat_props, hw_compat_6_0, hw_compat_6_0_len); } -DEFINE_VIRT_MACHINE(6, 0, false) +DEFINE_VIRT_MACHINE(6, 0) --=20 2.43.0