From patchwork Tue Jul 2 05:00:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 809023 Delivered-To: patch@linaro.org Received: by 2002:adf:a199:0:b0:367:895a:4699 with SMTP id u25csp43675wru; Mon, 1 Jul 2024 22:02:17 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUdVfuKhXkHB3E8z774pEuNnjlFXJn8UEUHerDsEBVbNqW1pBbPh1tdy458wn/0nMFO48BR3KhAY5DFOvYLE9+4 X-Google-Smtp-Source: AGHT+IGGpHPj6OlSV3g5xisztb/OgmdsMf/roSDIoZjh14G+sa/eadw9JXgZXFp6+C+27W/S9Ooq X-Received: by 2002:ad4:5942:0:b0:6b0:7ea7:4189 with SMTP id 6a1803df08f44-6b5b71486afmr73721886d6.42.1719896537711; Mon, 01 Jul 2024 22:02:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719896537; cv=none; d=google.com; s=arc-20160816; b=ZaSDSi7Rl9R6bJzgAlck2smEbmu6Bzpnk1JN0u2UB0XR/rl4hA8PzaX+O6sIcI8KE0 Q8D8ys5LWBrPiOw0+BW2/Ueuj5ebX+eI6oSy0T41MWxGuanN/rv8Q549H6M/vcQPae2Z 19JR8q0HwJ0nOk72ninBqqRGjZjzVBp+1tz0n9Wujy5QdGJpI/sYcS9heCbr0QbelsLD qA+jCZoOPqa4U7jtJoxElm5I7eHy4hjCgE+I5VnMqMEJskFoUn7ESwVFoA8nKaBoIqoI 8o3kG3OpI5XUDnRzG25DZxzsCPhnkPs8VLsO5SAVy4pfbfxEYzvc0HvqZN/aDGwSxrPB 1OCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yjoCJaWMopGjgFAzmTclEaniscPXZHqfmSK68jrTLyM=; fh=B/0b1FThncQQQALBQMKdmnM3E+nS03h1GE8Rgi7aa2k=; b=DK4/DHxdDpfMc7yuZlgRqJWscwP8qb75OJf2c5U+zmKHHe8xh5jUuN0/v54S1GYMVA k9bJ9rN+3Eubkgvwrx8kjZmeJxWtazgfdE6TJz/h1YVreay7oSmeG0+46DXeYHl69FkT 1VwKmDYgdskiEKujV6UFxwHwsNSiRYdxd1ZvAOnJzXWRHBoiIqoN5GyfOKGsRyUqads+ uNW7iOtcS8EueGIuLbv3YQVqjhlBMRkZ4ex5MO+gZ/oMy/04MTJ3wxAl1GiDtstW9Vye hFOFSxCGORZOSJx+2KuI/MYNOJPGQLZIAcvqiqha2FbtmWWyNIhWHVE1T6Cyot2dS5Ch azeQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tC7dyutb; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6b59e36c258si96970916d6.149.2024.07.01.22.02.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 01 Jul 2024 22:02:17 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tC7dyutb; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOVeQ-0007Ib-ND; Tue, 02 Jul 2024 01:01:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sOVeN-0007Hq-Qa for qemu-devel@nongnu.org; Tue, 02 Jul 2024 01:01:55 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sOVeL-0006mY-VL for qemu-devel@nongnu.org; Tue, 02 Jul 2024 01:01:55 -0400 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-356c4e926a3so2165123f8f.1 for ; Mon, 01 Jul 2024 22:01:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719896512; x=1720501312; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=yjoCJaWMopGjgFAzmTclEaniscPXZHqfmSK68jrTLyM=; b=tC7dyutbH5JHqfsRbdsPQY5DIzUZhaVwxcovDr6/gtlronkHa0guRwqBzeI/ze6YR+ EgE69iMhfO3Y/t8vRrkB+Orqlo7Vx0LFjxnE0mfcEb+UtWVjRmtkFNjPOm09fsl47yJy 47e25ig+m3xRa+v4D7/MATMTJMZnSFO1BWynsVhkDpL2NRDG0LmUTSFS5uimsWv6iB00 HMzysAedDTaZ+mnioIzJQP7YFYjtUJYbga8OOvd4k8EvjiGGUw2ImBhnHoPDoyjuNx6l ktpGt87OyY//ljzzGUQudFiahCeyH1qJ/ymTgoDIhVRvVfSN/5mPBELDn0A56YGhELxn PqrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719896512; x=1720501312; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yjoCJaWMopGjgFAzmTclEaniscPXZHqfmSK68jrTLyM=; b=X5o7a3ekLe21bl8/0LewguQKBBonzbk5neWiFpkMHCSiIfXpzoVOLAVxBXbv8YXLNv MAGh7JLxGIGdY0mDkCngZoHaSW5y/1REhFKJ4Jreij0avEFlxVegRfN5z9A9kG+3pfIV QMYW6KLQQOLlD5BZDcg2RECQhbvL7pLuusdEoJznmik8TTwXvtK0GzOn9F2fgmb16UmB ewCS2csAP63sJnEXl1uJneGHW7V3zw1A6+Iv5CgPm6v2chy23yeOXcJ7j9SoMxBxKgQ1 RfTBd+U/45amFwOJ/g/STfS/AISXPcYQfPyHu1OswVA8QwrqnmRCCOUPoOmUEz1siYCq KQuw== X-Gm-Message-State: AOJu0Yx++MvDKy7Rqe4EhAY0HklU2cH05V53el+uHsNHpcvSc9I+QZY2 iGVxhhLwpeDAwhSv9sTcaLJ4WuahpwBPMUwYzBxvGp/pVXO/Ob/xao9W1MpGRCW9IxRdMu6usbE U X-Received: by 2002:a5d:6c66:0:b0:366:e991:b9ac with SMTP id ffacd0b85a97d-367756a3423mr4193492f8f.14.1719896512188; Mon, 01 Jul 2024 22:01:52 -0700 (PDT) Received: from m1x-phil.lan ([176.187.209.58]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a0e141esm11844150f8f.58.2024.07.01.22.01.50 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 01 Jul 2024 22:01:51 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 06/22] hw/m68k: convert 'virt' machine definitions to use new macros Date: Tue, 2 Jul 2024 07:00:56 +0200 Message-ID: <20240702050112.35907-7-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240702050112.35907-1-philmd@linaro.org> References: <20240702050112.35907-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=philmd@linaro.org; helo=mail-wr1-x435.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Daniel P. Berrangé 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é Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20240620165742.1711389-6-berrange@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- hw/m68k/virt.c | 55 ++++++++++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 24 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) type_init(virt_machine_register_types) -#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 = MACHINE_CLASS(oc); \ - virt_machine_##major##_##minor##_options(mc); \ - mc->desc = "QEMU " # major "." # minor " M68K Virtual Machine"; \ + MACHINE_VER_SYM(options, virt, __VA_ARGS__)(mc); \ + mc->desc = "QEMU " MACHINE_VER_STR(__VA_ARGS__) " M68K Virtual Machine"; \ if (latest) { \ mc->alias = "virt"; \ } \ } \ - static const TypeInfo machvirt_##major##_##minor##_info = { \ - .name = MACHINE_TYPE_NAME("virt-" # major "." # minor), \ - .parent = MACHINE_TYPE_NAME("virt"), \ - .class_init = virt_##major##_##minor##_class_init, \ - }; \ - static void machvirt_machine_##major##_##minor##_init(void) \ + static const TypeInfo MACHINE_VER_SYM(info, virt, __VA_ARGS__) = \ { \ - type_register_static(&machvirt_##major##_##minor##_info); \ + .name = MACHINE_VER_TYPE_NAME("virt", __VA_ARGS__), \ + .parent = MACHINE_TYPE_NAME("virt"), \ + .class_init = MACHINE_VER_SYM(class_init, virt, __VA_ARGS__), \ + }; \ + static void MACHINE_VER_SYM(register, virt, __VA_ARGS__)(void) \ + { \ + 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) static void virt_machine_9_1_options(MachineClass *mc) { } -DEFINE_VIRT_MACHINE(9, 1, true) +DEFINE_VIRT_MACHINE_AS_LATEST(9, 1) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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)