From patchwork Fri Mar 15 13:08:51 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: 780503 Delivered-To: patch@linaro.org Received: by 2002:a5d:46c1:0:b0:33e:7753:30bd with SMTP id g1csp194365wrs; Fri, 15 Mar 2024 06:19:44 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXpKzVDV5AVBU063VRwFfnORkfF82HjI0V0pq7qdQEoCWTCqvwYt1tWEI7q3bVeS4z1ye96FBThGB+mUr2kr+Gx X-Google-Smtp-Source: AGHT+IEWaylX3z1WNHR3Z0MOYbk3M++d3ALZ+nfQ3ZTVm8oV1pU4rmZUbPjNllcouRKger8vAV70 X-Received: by 2002:a9d:7749:0:b0:6e5:319:3a19 with SMTP id t9-20020a9d7749000000b006e503193a19mr5205844otl.24.1710508783988; Fri, 15 Mar 2024 06:19:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710508783; cv=none; d=google.com; s=arc-20160816; b=s5gZQ1VN9XtggRp4aPvtFisX+sw9OWGFWta9Etch5EH7IopL2zHDtvtMlUoX+kbWFX rFa9bjUYvpvYe0KQvZLGFkXoYwKS59Swryjp3kkIlSiD1NxfIyEa3yqn83cslZyfupVS Hxor1A6P6gYeZmrOQWN9T9KNikvdgYJ7i1nkx/UcFmJwnEVHhLrl15dIn2jw+kmb5KZf 1gFoueHhWC/zNSbYAqLNkuN6wuGNabdUlKkjrHq35eRUXptmZk7jem9tGN8/Ijr0nHyu 0xxAcPiPdOXPijcyIUYZKfTpK7BMIRVUy52KQDtLXVWcen9bMxaME+YpBQHEC4LORNe/ WnkA== 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=QXR+KoDyjF3DzCtPRlneMC/cDzpoxSokp1VWknBDtAc=; fh=p5Jsywvh0HlF/zmTgHQajT3V6107Umb8gJEfVX/nN3w=; b=Cnzpxm84qd54u/zD34GUnNDIKTHTT+bujf5weJ2a8aLX+DlEXYjlZnjsMrrOEwloGs alnN4mySmrjo0JCDljnAjEKXQYcyIf3U9lgwWzXN4MNjaxRcbSJ4SzX6CWJM0eH3sJdR +a4oLlIkYLTeWxuiPOqfAVpb2cZgtpeDQfXWIQcQO7PvG2fjH/Ji+OtYq4s440b5n5ga MAN7j1V3/iqlPA3u/N1xjYOXur2oQKotdd24Pl8KOJUoGMG7cfpV84mbgITwJ7Jcg4rA Hn52o4M3dpAOugfdYRmEdWJzAVu9oQ/71szpESRMRYKEga45PUqPTb5yXMipXQDCWi2Y 0vnw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OIKG7UBb; 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 p14-20020a05620a056e00b007886f252dedsi3530100qkp.391.2024.03.15.06.19.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 Mar 2024 06:19:43 -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=OIKG7UBb; 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 1rl7Jr-0006Cy-Et; Fri, 15 Mar 2024 09:09:55 -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 1rl7Jb-0005eP-Sn for qemu-devel@nongnu.org; Fri, 15 Mar 2024 09:09:40 -0400 Received: from mail-ed1-x532.google.com ([2a00:1450:4864:20::532]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rl7JY-0007dV-1R for qemu-devel@nongnu.org; Fri, 15 Mar 2024 09:09:39 -0400 Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-5658082d2c4so2805491a12.1 for ; Fri, 15 Mar 2024 06:09:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710508174; x=1711112974; 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=QXR+KoDyjF3DzCtPRlneMC/cDzpoxSokp1VWknBDtAc=; b=OIKG7UBbSegyL5K4xTc8cRKmFmd3w+Kh8zZMEqL33VJK1NazutogQCSSnilz8hXtoN 8Pw6pY2voj9Sz13mo4rIdXScYcCjgwc8aubTIG3mmaK8pczHsMYV/J7ER79ByRcwb0qv 6Md90/UyQKaN92DJttmyvCqADnE1AAygbh+hD7OOGAgULOgHDhD7sHHnpAEVmZGo7bm3 +v3aJtumfpjULMF+NvbLRBHUnowuUSTPpnY1Iifb15rKSuNjPgdRt2r+AR24VEj6fXE6 02lSwobYUP7cTFMiG6hKRWknhkYwBIKf9m7NyjUW8cbX9s2+Z32h37hna6n3d59hRi52 THdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710508174; x=1711112974; 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=QXR+KoDyjF3DzCtPRlneMC/cDzpoxSokp1VWknBDtAc=; b=s5p8qui8W+SkKdgNZZHBv4jyr1087ncPh7G8IWnrFMhMZGFAtaUnTk7wujNLdOmIHh 1JIEZqXJRqQYRyPKYe9k8FODiDmbnO6xyNAQl+AgglEP36yNuLtt8W86XpceicRlu3re 2gEvi4P5u5c6Yj8WGv6F2LamTXn8l7VKaHCw6wHGBmzsc3RaBgMP5ZNTahS/VzVBPpuk rMv+t4C1Kv7upOHd32BrSQh75kwuWf+2a+ZQhK8LIQVNWr1q8nIvGyRi1z/sCWsSsNI8 OrYF+XP/9+ngy0jym3UThHBhhHRkJoX0KilVKzCNy3ezkeKBzL3OXqijkfCfLWI+Nx2g /6Kg== X-Gm-Message-State: AOJu0YzcFbNNs/7FhHCk1iYk7d5MtSrH9PX2SzZ8yMEMytDkvAGRlzAj wIkc7vIibTDte5AgGG3FYzYJ346sLS/A/d8IHuAOJU+im5sSbn4fMaO+r1VWmDgAAdM5jAje9Pf i X-Received: by 2002:a17:906:c30f:b0:a46:2a85:b37b with SMTP id s15-20020a170906c30f00b00a462a85b37bmr2902264ejz.51.1710508173970; Fri, 15 Mar 2024 06:09:33 -0700 (PDT) Received: from m1x-phil.lan ([176.176.145.26]) by smtp.gmail.com with ESMTPSA id v23-20020a1709067d9700b00a461a7ba686sm1707470ejo.75.2024.03.15.06.09.31 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 15 Mar 2024 06:09:33 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Markus Armbruster Cc: qemu-riscv@nongnu.org, Anton Johansson , qemu-s390x@nongnu.org, qemu-ppc@nongnu.org, =?utf-8?q?Daniel_P_=2E_Berrang?= =?utf-8?q?=C3=A9?= , Paolo Bonzini , Eduardo Habkost , Claudio Fontana , Richard Henderson , Peter Maydell , =?utf-8?q?Alex_Benn=C3=A9e?= , Manos Pitsidianakis , Zhao Liu , qemu-arm@nongnu.org, Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Nicholas Piggin , Daniel Henrique Barboza Subject: [PATCH-for-9.1 03/21] target/ppc: Declare CPU QOM types using DEFINE_TYPES() macro Date: Fri, 15 Mar 2024 14:08:51 +0100 Message-ID: <20240315130910.15750-4-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240315130910.15750-1-philmd@linaro.org> References: <20240315130910.15750-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::532; envelope-from=philmd@linaro.org; helo=mail-ed1-x532.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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 When multiple QOM types are registered in the same file, it is simpler to use the the DEFINE_TYPES() macro. In particular because type array declared with such macro are easier to review. In few commits we are going to add more types, so replace the type_register_static() to ease further reviews. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20231013140116.255-16-philmd@linaro.org> Reviewed-by: Zhao Liu --- target/ppc/cpu_init.c | 52 +++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 29 deletions(-) diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c index 7e65f08147..d5e227a6fb 100644 --- a/target/ppc/cpu_init.c +++ b/target/ppc/cpu_init.c @@ -7432,39 +7432,34 @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data) #endif /* CONFIG_TCG */ } -static const TypeInfo ppc_cpu_type_info = { - .name = TYPE_POWERPC_CPU, - .parent = TYPE_CPU, - .instance_size = sizeof(PowerPCCPU), - .instance_align = __alignof__(PowerPCCPU), - .instance_init = ppc_cpu_instance_init, - .instance_finalize = ppc_cpu_instance_finalize, - .abstract = true, - .class_size = sizeof(PowerPCCPUClass), - .class_init = ppc_cpu_class_init, +static const TypeInfo ppc_cpu_types[] = { + { + .name = TYPE_POWERPC_CPU, + .parent = TYPE_CPU, + .abstract = true, + .instance_size = sizeof(PowerPCCPU), + .instance_align = __alignof__(PowerPCCPU), + .instance_init = ppc_cpu_instance_init, + .instance_finalize = ppc_cpu_instance_finalize, + .class_size = sizeof(PowerPCCPUClass), + .class_init = ppc_cpu_class_init, #ifndef CONFIG_USER_ONLY - .interfaces = (InterfaceInfo[]) { - { TYPE_INTERRUPT_STATS_PROVIDER }, - { } + .interfaces = (InterfaceInfo[]) { + { TYPE_INTERRUPT_STATS_PROVIDER }, + { } + }, +#endif + }, +#ifndef CONFIG_USER_ONLY + { + .name = TYPE_PPC_VIRTUAL_HYPERVISOR, + .parent = TYPE_INTERFACE, + .class_size = sizeof(PPCVirtualHypervisorClass), }, #endif }; -#ifndef CONFIG_USER_ONLY -static const TypeInfo ppc_vhyp_type_info = { - .name = TYPE_PPC_VIRTUAL_HYPERVISOR, - .parent = TYPE_INTERFACE, - .class_size = sizeof(PPCVirtualHypervisorClass), -}; -#endif - -static void ppc_cpu_register_types(void) -{ - type_register_static(&ppc_cpu_type_info); -#ifndef CONFIG_USER_ONLY - type_register_static(&ppc_vhyp_type_info); -#endif -} +DEFINE_TYPES(ppc_cpu_types) void ppc_cpu_dump_state(CPUState *cs, FILE *f, int flags) { @@ -7658,4 +7653,3 @@ void ppc_cpu_dump_state(CPUState *cs, FILE *f, int flags) #undef RGPL #undef RFPL } -type_init(ppc_cpu_register_types)