From nobody Wed May 15 23:22:58 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1710508207; cv=none; d=zohomail.com; s=zohoarc; b=AGhyqCv4pG7QiSnMQCxADS/PKEPKKlea3dCjb2j/z64wgcM84MvmNMUlxTP9w4zCQMpGZpnAUAfPh4PVmC3z8ZVOHYqn6GXnwmCkF1Ek05mRXdioPPTXKh4equA8dQ8/j64rUfFlya7GOXPf4+RYXtntyJIQhp4LpULcj8WIPcc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710508207; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=NCfHsLOktJnJk/FrjkYW88SQD28CKLAyjY7rSKM5rcw=; b=etN1DQUANYxq0Zybl4OY8blaPveg0o/d1cCkn66FmDvbZ5NJACeIBmBYI/thuEN4C63CYr/mNmuFqOWdtct5HG3ii0+rwVusjW682A2XGEb2/BOWLYVh68cM9++QN7qV3ECyc1MKn2dmxFwzmI5uJbS0GH0yyXLWi3yQu8qWjqo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17105082076991013.0774180993253; Fri, 15 Mar 2024 06:10:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rl7Jd-0005kx-Jq; Fri, 15 Mar 2024 09:09:41 -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 1rl7JS-0005cT-E5 for qemu-devel@nongnu.org; Fri, 15 Mar 2024 09:09:31 -0400 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rl7JL-0007Yl-9H for qemu-devel@nongnu.org; Fri, 15 Mar 2024 09:09:25 -0400 Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-5689b7e8387so2720653a12.2 for ; Fri, 15 Mar 2024 06:09:22 -0700 (PDT) Received: from m1x-phil.lan ([176.176.145.26]) by smtp.gmail.com with ESMTPSA id g12-20020a17090613cc00b00a45ff1fe8dasm1693781ejc.115.2024.03.15.06.09.18 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 15 Mar 2024 06:09:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710508161; x=1711112961; 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=NCfHsLOktJnJk/FrjkYW88SQD28CKLAyjY7rSKM5rcw=; b=ODJzEgTewYBjA1vbFoVLXqCZ/dmX12nggcch+wbY2JIpDZ7la337XjSWIPaem4ny5X GjBb4zdyTaBRk8GBL4lcjQHisbgN+KzSLDGEL8unHJ4/WoJJwfKbFYGgui6i+GlcsoGd mJtsgMnOXDOysu8GsEcvziGvAbQt7oHQah5A0P2x99BpnJUb6VIhRcdsUv25HgIEd7by FN+OdZmERQcQnCJjHSfre4uYTEAdGtK+37jzUaUnxnEu7M8E0HZM/r8OJX2djlpF6V1c MzcSmoyOqp92pk2mdGlZf0pnPFiLFRGwv7vivJy7qGwhYe84ztuIs26nslSLADNrrUdf cKnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710508161; x=1711112961; 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=NCfHsLOktJnJk/FrjkYW88SQD28CKLAyjY7rSKM5rcw=; b=mzmn1h/ot9nlqeHtGHXGxvXOQdk8hAT37N0RV3nGf6GxnlFch47nmIjCYxyJGPZ1yq xluKHHUeekSLgFAUb4b5M9LemAJkuwFykzxJY9/Tlauid3z4QNVRweYBxc3TroHSY0we np2gpNcC6LCV78INhMPFf6HcGMz6B9XRvoSNjs8C/qQ2Y06lm7N2ocqx/iEz0mYCC6Ty 7vvfzw5IekzHHXqHlv0Km9Jh6fHfJjf1fl58kM4vQWG0au5CHbZVsfXYeoFSmCPkwyvO 8Lp0HXWxNvjc3ME0tObm90FHDPkcQR7LUz4Wqp+agADQGhOZQam+y/SrWXyK/W82KHyn hnAw== X-Gm-Message-State: AOJu0YxiBhv21HFJbmldzmib81P+MjNv7lwM532P831C86N6Lqz3UcKZ YGXLHTVktchtPC3XxRafhAhy8Z6R9QfQs4bUcmsks135yqlb6drftXnRlNzRsSsNwX5+MsNbdw2 z X-Google-Smtp-Source: AGHT+IEIqbu+dkyYORdlV0Gte9UybiujX61BXzptaCyYsWEUuL7ULvFX0eVwlBjaCfc67LjfUoRRVg== X-Received: by 2002:a17:906:360a:b0:a46:9a13:362c with SMTP id q10-20020a170906360a00b00a469a13362cmr291836ejb.52.1710508160915; Fri, 15 Mar 2024 06:09:20 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-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=20P=20=2E=20Berrang=C3=A9?= , Paolo Bonzini , Eduardo Habkost , Claudio Fontana , Richard Henderson , Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Manos Pitsidianakis , Zhao Liu , qemu-arm@nongnu.org, Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-9.1 01/21] target/i386: Declare CPU QOM types using DEFINE_TYPES() macro Date: Fri, 15 Mar 2024 14:08:49 +0100 Message-ID: <20240315130910.15750-2-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::530; envelope-from=philmd@linaro.org; helo=mail-ed1-x530.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1710508209150100003 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=C3=A9 Reviewed-by: Richard Henderson Reviewed-by: Zhao Liu Message-Id: <20231013140116.255-14-philmd@linaro.org> --- target/i386/cpu.c | 50 ++++++++++++++++++++++------------------------- 1 file changed, 23 insertions(+), 27 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 9a210d8d92..ebf555f50f 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -4991,13 +4991,6 @@ static void max_x86_cpu_initfn(Object *obj) &error_abort); } =20 -static const TypeInfo max_x86_cpu_type_info =3D { - .name =3D X86_CPU_TYPE_NAME("max"), - .parent =3D TYPE_X86_CPU, - .instance_init =3D max_x86_cpu_initfn, - .class_init =3D max_x86_cpu_class_init, -}; - static char *feature_word_description(FeatureWordInfo *f, uint32_t bit) { assert(f->type =3D=3D CPUID_FEATURE_WORD || f->type =3D=3D MSR_FEATURE= _WORD); @@ -8041,19 +8034,6 @@ static void x86_cpu_common_class_init(ObjectClass *o= c, void *data) } } =20 -static const TypeInfo x86_cpu_type_info =3D { - .name =3D TYPE_X86_CPU, - .parent =3D TYPE_CPU, - .instance_size =3D sizeof(X86CPU), - .instance_align =3D __alignof(X86CPU), - .instance_init =3D x86_cpu_initfn, - .instance_post_init =3D x86_cpu_post_initfn, - - .abstract =3D true, - .class_size =3D sizeof(X86CPUClass), - .class_init =3D x86_cpu_common_class_init, -}; - /* "base" CPU model, used by query-cpu-model-expansion */ static void x86_cpu_base_class_init(ObjectClass *oc, void *data) { @@ -8065,22 +8045,38 @@ static void x86_cpu_base_class_init(ObjectClass *oc= , void *data) xcc->ordering =3D 8; } =20 -static const TypeInfo x86_base_cpu_type_info =3D { - .name =3D X86_CPU_TYPE_NAME("base"), - .parent =3D TYPE_X86_CPU, - .class_init =3D x86_cpu_base_class_init, +static const TypeInfo x86_cpu_types[] =3D { + { + .name =3D TYPE_X86_CPU, + .parent =3D TYPE_CPU, + .abstract =3D true, + .instance_size =3D sizeof(X86CPU), + .instance_align =3D __alignof(X86CPU), + .instance_init =3D x86_cpu_initfn, + .instance_post_init =3D x86_cpu_post_initfn, + .class_size =3D sizeof(X86CPUClass), + .class_init =3D x86_cpu_common_class_init, + }, { + .name =3D X86_CPU_TYPE_NAME("base"), + .parent =3D TYPE_X86_CPU, + .class_init =3D x86_cpu_base_class_init, + }, { + .name =3D X86_CPU_TYPE_NAME("max"), + .parent =3D TYPE_X86_CPU, + .instance_init =3D max_x86_cpu_initfn, + .class_init =3D max_x86_cpu_class_init, + } }; =20 +DEFINE_TYPES(x86_cpu_types) + static void x86_cpu_register_types(void) { int i; =20 - type_register_static(&x86_cpu_type_info); for (i =3D 0; i < ARRAY_SIZE(builtin_x86_defs); i++) { x86_register_cpudef_types(&builtin_x86_defs[i]); } - type_register_static(&max_x86_cpu_type_info); - type_register_static(&x86_base_cpu_type_info); } =20 type_init(x86_cpu_register_types) --=20 2.41.0 From nobody Wed May 15 23:22:58 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1710508446; cv=none; d=zohomail.com; s=zohoarc; b=YLQqmzVTR3WjtroXGUA0MAHAKFZZRVzfva1TLpBIhheYnLQxJz8yZTGOZxnQc6gNm4iVUY/qA8Mn44KGz93V4MtWGsezstR1L4l8QilFY9KUD/2qTGcB8e0SDSRAa8gzmJccvEY9lifRmI/c4Keh920SPb8QwylbM4o7MSFSb2w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710508446; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=38DwNqP/w4iyE7cU/eTej+AEZTmllcOjbkkM5XAd0Sw=; b=IJs47nDCuV3EdIscAXFQWjOjN2GTI6B9SnhwUNVGKsq5XSLMR24siNXDd7SHiyXxYsH1mFuPFQba58miqv3nCjOYy0UdH1Rfbx6C6PJciNyC+g/wI5RSYmPMsQM8vBdr2MFeCQ89MNmdYApYQ+9uJ3g23zDTSzJ7DnaRSFFRXqw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1710508446714440.2733493968774; Fri, 15 Mar 2024 06:14:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rl7Jn-0005wf-Sb; Fri, 15 Mar 2024 09:09:51 -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 1rl7JY-0005e6-AS for qemu-devel@nongnu.org; Fri, 15 Mar 2024 09:09:40 -0400 Received: from mail-lj1-x22b.google.com ([2a00:1450:4864:20::22b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rl7JV-0007bn-R6 for qemu-devel@nongnu.org; Fri, 15 Mar 2024 09:09:36 -0400 Received: by mail-lj1-x22b.google.com with SMTP id 38308e7fff4ca-2d228a132acso28949641fa.0 for ; Fri, 15 Mar 2024 06:09:31 -0700 (PDT) Received: from m1x-phil.lan ([176.176.145.26]) by smtp.gmail.com with ESMTPSA id qs28-20020a170906459c00b00a45efdfdd1esm1685202ejc.40.2024.03.15.06.09.25 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 15 Mar 2024 06:09:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710508169; x=1711112969; 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=38DwNqP/w4iyE7cU/eTej+AEZTmllcOjbkkM5XAd0Sw=; b=XB5H0U5l83wIbjQjpuYrC5o12zfap5fgJx3f06O+MSzwOlneioTk6FoIpJ4t2tDHN6 8t+1D5KldGYyL1Nm7TIUFScpsoHQj2+miWpenx2W8ytiCpcs++dukYTLuNdXpNCz8tJZ 5aB5zoFCSHB/f7ah2CmUk0ZFEYxlRpOMp+jd6fqH9S+/Ea3rk6m1qd2g/1h50qyRmmIy Zdzwgk5doM//rWBzrUkHlquT7/eexJnaT+NaN5BgJ7vEdZr6Ly5fcxPTkRvUvOah8ARC 2L8h7GCTyL6oorUJ3ceF9qnT4Pu3tz0CeNwW6uHfRqIlY0vqzOih5we19mXj2jIMqai6 nsEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710508169; x=1711112969; 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=38DwNqP/w4iyE7cU/eTej+AEZTmllcOjbkkM5XAd0Sw=; b=PuSfKsenRCYK65/5vM4h7+c0+fhY9PxaLdFFNMax1a3X4hwE4CFfQeXkRmCvacbVd6 C6dn8tTJLLnAQLhOr1Dk7HHzg0Sdfg88iqYSzu/5UxvAjvxBVBFjoOi5dJRPso3cS0yx 6g6y/1+1/l+XXNs2ziUf1MJLOfxLn0ppS0mnih62rxhvCfixw4J/17/qqGbicN0mqmsK A8E/2K5vf9qhsAgiZ2usDiMLOgX3qfFCkWZc2lSzNqLUkf10tTGq0u1BPvLJA3fZr/fZ i9GetKZH4q0kZNJbvf4yVxmRv6CVyQbN7IXzciie+MZEh2bb0knqmETOcs0bf3qeh87J W9KQ== X-Gm-Message-State: AOJu0YzOaPB2EIkR5ImK9XCLI7jjG+6TVpW7nTsdkZnA+21sa5yVDHtR TG8UGIOSVUvfSHUtSU6VJAjDuxAlpHRNpR0RhfDNe2yV0wkWXtwfVwhAyo2fGSq0G6dHfrkTdY8 9 X-Google-Smtp-Source: AGHT+IGUqlgwpBs0iVH+nA4YB8mpndxs+sUNctHnYtgA2NyEqcGCBN6lT+1elp7U+umu/qoGxw6VQg== X-Received: by 2002:a2e:9850:0:b0:2d4:7829:4d13 with SMTP id e16-20020a2e9850000000b002d478294d13mr2977270ljj.50.1710508167582; Fri, 15 Mar 2024 06:09:27 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-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=20P=20=2E=20Berrang=C3=A9?= , Paolo Bonzini , Eduardo Habkost , Claudio Fontana , Richard Henderson , Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Manos Pitsidianakis , Zhao Liu , qemu-arm@nongnu.org, Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Aurelien Jarno , Jiaxun Yang , Aleksandar Rikalo Subject: [PATCH-for-9.1 02/21] target/mips: Declare CPU QOM types using DEFINE_TYPES() macro Date: Fri, 15 Mar 2024 14:08:50 +0100 Message-ID: <20240315130910.15750-3-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::22b; envelope-from=philmd@linaro.org; helo=mail-lj1-x22b.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1710508449032100003 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=C3=A9 Reviewed-by: Richard Henderson Message-Id: <20231013140116.255-15-philmd@linaro.org> Reviewed-by: Zhao Liu --- target/mips/cpu.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/target/mips/cpu.c b/target/mips/cpu.c index 8d8f690a53..c096d97fe3 100644 --- a/target/mips/cpu.c +++ b/target/mips/cpu.c @@ -594,17 +594,21 @@ static void mips_cpu_class_init(ObjectClass *c, void = *data) #endif /* CONFIG_TCG */ } =20 -static const TypeInfo mips_cpu_type_info =3D { - .name =3D TYPE_MIPS_CPU, - .parent =3D TYPE_CPU, - .instance_size =3D sizeof(MIPSCPU), - .instance_align =3D __alignof(MIPSCPU), - .instance_init =3D mips_cpu_initfn, - .abstract =3D true, - .class_size =3D sizeof(MIPSCPUClass), - .class_init =3D mips_cpu_class_init, +static const TypeInfo mips_cpu_types[] =3D { + { + .name =3D TYPE_MIPS_CPU, + .parent =3D TYPE_CPU, + .instance_size =3D sizeof(MIPSCPU), + .instance_align =3D __alignof(MIPSCPU), + .instance_init =3D mips_cpu_initfn, + .abstract =3D true, + .class_size =3D sizeof(MIPSCPUClass), + .class_init =3D mips_cpu_class_init, + } }; =20 +DEFINE_TYPES(mips_cpu_types) + static void mips_cpu_cpudef_class_init(ObjectClass *oc, void *data) { MIPSCPUClass *mcc =3D MIPS_CPU_CLASS(oc); @@ -629,7 +633,6 @@ static void mips_cpu_register_types(void) { int i; =20 - type_register_static(&mips_cpu_type_info); for (i =3D 0; i < mips_defs_number; i++) { mips_register_cpudef_type(&mips_defs[i]); } --=20 2.41.0 From nobody Wed May 15 23:22:58 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1710508784; cv=none; d=zohomail.com; s=zohoarc; b=QOa0KNhlRdS4gmW9qRGbTOEftizAf4v+xKvN60F1iKvL5spyTIUQ0IM+TcblgfA4OhOMCaT0MynE2mi7blWBKfuwrHSH5Zjjj9diED1G+wXgTnxHmU+gpL/SQTpdmasvy70/eefU2ArtB7q6ptlIYj8biL8xfbrN9+oAfzjDLZQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710508784; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=QXR+KoDyjF3DzCtPRlneMC/cDzpoxSokp1VWknBDtAc=; b=YsGwZ6SxW5j8qu263+8PSjRJNt9nUq9GMC2wNqM8g6yy7KxV9bBJsZ59ceWeBa/NK5yriYrqpEiS0JccswEtrMifa1z4/XEaJvr/483bD8tpppp5uMMnV59u09AVfYeNiz7AEf9n6TaLDFcO87lkR6WFDOlLFvCz8ULal3B7dXc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1710508784667956.9110140922585; Fri, 15 Mar 2024 06:19:44 -0700 (PDT) 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) 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) 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-Google-Smtp-Source: AGHT+IHzBClF6y3leG9X1IH7huHpryichprPqecACIGO7r5xFYMO3bWZ334I3If9L1+1vr9CkQSmGw== 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) From: =?UTF-8?q?Philippe=20Mathieu-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=20P=20=2E=20Berrang=C3=A9?= , Paolo Bonzini , Eduardo Habkost , Claudio Fontana , Richard Henderson , Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Manos Pitsidianakis , Zhao Liu , qemu-arm@nongnu.org, Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1710508786279100003 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=C3=A9 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, voi= d *data) #endif /* CONFIG_TCG */ } =20 -static const TypeInfo ppc_cpu_type_info =3D { - .name =3D TYPE_POWERPC_CPU, - .parent =3D TYPE_CPU, - .instance_size =3D sizeof(PowerPCCPU), - .instance_align =3D __alignof__(PowerPCCPU), - .instance_init =3D ppc_cpu_instance_init, - .instance_finalize =3D ppc_cpu_instance_finalize, - .abstract =3D true, - .class_size =3D sizeof(PowerPCCPUClass), - .class_init =3D ppc_cpu_class_init, +static const TypeInfo ppc_cpu_types[] =3D { + { + .name =3D TYPE_POWERPC_CPU, + .parent =3D TYPE_CPU, + .abstract =3D true, + .instance_size =3D sizeof(PowerPCCPU), + .instance_align =3D __alignof__(PowerPCCPU), + .instance_init =3D ppc_cpu_instance_init, + .instance_finalize =3D ppc_cpu_instance_finalize, + .class_size =3D sizeof(PowerPCCPUClass), + .class_init =3D ppc_cpu_class_init, #ifndef CONFIG_USER_ONLY - .interfaces =3D (InterfaceInfo[]) { - { TYPE_INTERRUPT_STATS_PROVIDER }, - { } + .interfaces =3D (InterfaceInfo[]) { + { TYPE_INTERRUPT_STATS_PROVIDER }, + { } + }, +#endif + }, +#ifndef CONFIG_USER_ONLY + { + .name =3D TYPE_PPC_VIRTUAL_HYPERVISOR, + .parent =3D TYPE_INTERFACE, + .class_size =3D sizeof(PPCVirtualHypervisorClass), }, #endif }; =20 -#ifndef CONFIG_USER_ONLY -static const TypeInfo ppc_vhyp_type_info =3D { - .name =3D TYPE_PPC_VIRTUAL_HYPERVISOR, - .parent =3D TYPE_INTERFACE, - .class_size =3D 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) =20 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 fl= ags) #undef RGPL #undef RFPL } -type_init(ppc_cpu_register_types) --=20 2.41.0 From nobody Wed May 15 23:22:58 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1710508239; cv=none; d=zohomail.com; s=zohoarc; b=dViBDPOsTQidOI3T+2Mha3a5/hjyQPAH+pbucRJxwiIe2iQI4aRspdrnh9GEZPMBWWza+HOYToIgKyHmIFIjz555MiPubs0sKJaqcInPta9CYJWNbMLcuIRBoqRo0Vg/wGYC2jB1G57TsOGs59odKl15Akm19zRBL1qLnZyF/s8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710508239; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=xkGMjK1G9yFAmyZjfysW+oy0VEwc0DxCtLcyXCgX4n0=; b=ncNXz3heQEmLbMjdBwi22w0739Ldr4qzInzJI0iNwWu3BM8yqNJy9gUCzrzJqU9QobUhg6csRUPxw1s/bQ+qjEah8zUIKXTlrb05MdS6oSty3ubmaIxILnfsWPpgRzRbyHe4lGvSoqW8kZSHUGzEpaZ0DQHBVra4Fz2qtiZ0ysU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1710508239447951.3723872060356; Fri, 15 Mar 2024 06:10:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rl7KG-0006h4-MP; Fri, 15 Mar 2024 09:10:21 -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 1rl7Jk-0005s9-NV for qemu-devel@nongnu.org; Fri, 15 Mar 2024 09:09:49 -0400 Received: from mail-lf1-x12d.google.com ([2a00:1450:4864:20::12d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rl7Jf-0007gn-HG for qemu-devel@nongnu.org; Fri, 15 Mar 2024 09:09:48 -0400 Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-512f54fc2dbso2208720e87.1 for ; Fri, 15 Mar 2024 06:09:42 -0700 (PDT) Received: from m1x-phil.lan ([176.176.145.26]) by smtp.gmail.com with ESMTPSA id cx14-20020a05640222ae00b00568af798c9esm578595edb.90.2024.03.15.06.09.38 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 15 Mar 2024 06:09:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710508180; x=1711112980; 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=xkGMjK1G9yFAmyZjfysW+oy0VEwc0DxCtLcyXCgX4n0=; b=yUX8BfrdzWIXnQVwrJ/GAdj+x14bLcAEJvOqHioGfnhC4XZzV0SmGMjlsDC45KxErx dXmhfMEoobwbHvcbyK7oSzpfbV2tBHYzLY7dHSIzm4ADfra8rXl5u7dZjceKKXh9YSSc GxTDAdk7cDtCE4Twb7yL4abIKcNTLtDV31QPEJ9frz9E3846pAzm2gi+lxz3bAT9dmnA dTj1RvsIne6pT9ieXHwHvB6w2YAsUmctyY5qQVFUXjHho4C/shBinwDSSWfiUrMQmbNl NcpWpsRgJRW6vyQTUUjKYLzqPiTXjzTk33YTH/cF4OKPJu7JvaWmMrStTJXq2aJ3dF86 ywYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710508180; x=1711112980; 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=xkGMjK1G9yFAmyZjfysW+oy0VEwc0DxCtLcyXCgX4n0=; b=eNZ7Qbutk0gJhGalEBKzP5ekJoAxFxA+oVaNdL4H38XZzrDzkE562PLI3YSafPWe+V 5bJ1je+EGdb+vScKaOVwYxzyfHy0Czmq54qyJMwmvG1jDNkUQtAYekC4t/tbX5lH5ufp 8kJYo1WSQKFXzS6jx73fOTmUjchyAkk1K1hcmhsIM9Y3E2XxUmbIPESNw6/rl3DnoXjE sSOQl0xxKATI6nasBMvlkqg+lmNLmFvX9SFfJoyXNsTAY9p2q4Cja4wvaaP/6pnoYnXP tgaXPJHHrzRGS4KBQSAcUGeB0gFlB7S3MVpl7L3hdyKGJBAGj+yDaNAueRcBaPgZ149o Wthg== X-Gm-Message-State: AOJu0YzLUbK3wWlX9nhgltOBG28rEd0Af5DDL17OsaU1luAYjXYjw+aY 8UrRnJrln2hXPSmOKcYP/RGWPtXLV4eh3i+zLuFCk8OgojEk4MFIlS2VO15IbFb03bTwT7nGWtB b X-Google-Smtp-Source: AGHT+IHpHtbKvMjVVyy3n1oFAdNafsLrOa9Ad04r6RdA8Gsvr4YycfqtkVPsX2+fpJ/zynsRUwxdAw== X-Received: by 2002:a2e:808e:0:b0:2d2:a38c:d706 with SMTP id i14-20020a2e808e000000b002d2a38cd706mr3159290ljg.17.1710508180605; Fri, 15 Mar 2024 06:09:40 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-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=20P=20=2E=20Berrang=C3=A9?= , Paolo Bonzini , Eduardo Habkost , Claudio Fontana , Richard Henderson , Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Manos Pitsidianakis , Zhao Liu , qemu-arm@nongnu.org, Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Mark Cave-Ayland , Artyom Tarasenko Subject: [PATCH-for-9.1 04/21] target/sparc: Declare CPU QOM types using DEFINE_TYPES() macro Date: Fri, 15 Mar 2024 14:08:52 +0100 Message-ID: <20240315130910.15750-5-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::12d; envelope-from=philmd@linaro.org; helo=mail-lf1-x12d.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, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1710508241236100003 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=C3=A9 Reviewed-by: Richard Henderson Reviewed-by: Mark Cave-Ayland Message-Id: <20231013140116.255-17-philmd@linaro.org> Reviewed-by: Zhao Liu --- target/sparc/cpu.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index dc9ead21fc..42b13ab63f 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -949,17 +949,21 @@ static void sparc_cpu_class_init(ObjectClass *oc, voi= d *data) cc->tcg_ops =3D &sparc_tcg_ops; } =20 -static const TypeInfo sparc_cpu_type_info =3D { - .name =3D TYPE_SPARC_CPU, - .parent =3D TYPE_CPU, - .instance_size =3D sizeof(SPARCCPU), - .instance_align =3D __alignof(SPARCCPU), - .instance_init =3D sparc_cpu_initfn, - .abstract =3D true, - .class_size =3D sizeof(SPARCCPUClass), - .class_init =3D sparc_cpu_class_init, +static const TypeInfo sparc_cpu_types[] =3D { + { + .name =3D TYPE_SPARC_CPU, + .parent =3D TYPE_CPU, + .instance_size =3D sizeof(SPARCCPU), + .instance_align =3D __alignof(SPARCCPU), + .instance_init =3D sparc_cpu_initfn, + .abstract =3D true, + .class_size =3D sizeof(SPARCCPUClass), + .class_init =3D sparc_cpu_class_init, + } }; =20 +DEFINE_TYPES(sparc_cpu_types) + static void sparc_cpu_cpudef_class_init(ObjectClass *oc, void *data) { SPARCCPUClass *scc =3D SPARC_CPU_CLASS(oc); @@ -984,7 +988,6 @@ static void sparc_cpu_register_types(void) { int i; =20 - type_register_static(&sparc_cpu_type_info); for (i =3D 0; i < ARRAY_SIZE(sparc_defs); i++) { sparc_register_cpudef_type(&sparc_defs[i]); } --=20 2.41.0 From nobody Wed May 15 23:22:58 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1710508340; cv=none; d=zohomail.com; s=zohoarc; b=NcvdTmrnsdy7K3gUy5O/G6gvh5YclKixL0PSFKulsFxWXPk6pOT5/6rWB7aqmtSqKtB1ZWvDgUtZxu09dkO9SkO3h6wF7Z66pGiD7mGSWkLxLaesxj910hRRhXSztQBvqPEImzkhWr9DtbLjAOgjajD5GDVTSl67fl9HaB9taAI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710508340; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=7ztA/s++99kJlJQVkkhi5KVYRPW5VID21TBVzyIGr2Y=; b=koNVgmXBFlSkfOosim6SRRSvoWSiTP832ulq/ID+DVOn59Tr/Eytm0lG+XE0g1UEikM6XRFTbT8zSg2mbpGP9riJYSM2Cwoo5SEn/qbHs9Moyh7DhaXL/qtIniE+VvJEUT5WEbGZyeEhzbMGMGtNNHL8nqrjkPzxkBos0FT3AHw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1710508340318632.0885677381856; Fri, 15 Mar 2024 06:12:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rl7KK-0006mh-Cr; Fri, 15 Mar 2024 09:10:24 -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 1rl7Jo-0005yH-0T for qemu-devel@nongnu.org; Fri, 15 Mar 2024 09:09:52 -0400 Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rl7Jk-0007kM-P3 for qemu-devel@nongnu.org; Fri, 15 Mar 2024 09:09:50 -0400 Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-a36126ee41eso254024766b.2 for ; Fri, 15 Mar 2024 06:09:48 -0700 (PDT) Received: from m1x-phil.lan ([176.176.145.26]) by smtp.gmail.com with ESMTPSA id f23-20020a1709067f9700b00a466a265ffcsm1722093ejr.145.2024.03.15.06.09.45 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 15 Mar 2024 06:09:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710508187; x=1711112987; 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=7ztA/s++99kJlJQVkkhi5KVYRPW5VID21TBVzyIGr2Y=; b=jiGT8GrZ9igAjQoCC815i0lvzx2CR+1zxy8vL2gf9kgM5JRISixm7OQ3P1GuqzBu/g 0b3grywW7QiWjM8vgXTcp3EaDAINKBXocmKH5Y8v0kogi5pWwHZrflfO/B32TUYMo6V+ CMTkw5qh1pWpDfZlJc/iXBYaGBVoDWokXpiFA9W5oojGQ5u5vQ7w8aSGaJeMS/0l/B8M ND8Dss8NO+p3oHwxsW8N9gjSGeiRC6suG7esXapi/yKNAlsuUDkXuhfrQxlU9OGUWeCN yfcFuqC7VpwCTSZmWtTvNDgTK9Bc7gzyeNuTCFdwPSs6KCm/lxjJ4Zxyl8ghJ0+xrsmv sLMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710508187; x=1711112987; 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=7ztA/s++99kJlJQVkkhi5KVYRPW5VID21TBVzyIGr2Y=; b=rag2LlJ3wEvZjvc7vpBhrejK0tUtqsd/wS7hYBg+dUP/WyBb0pGH7FZ+1MH3uKDxOV hfmy1WlU2N0kGslKXXbwWhjktokVLeqyP6khJRF+wGaQ6X5R/IBwqK6Wkz04hOUFNQNS uDMyc0kvsHfV5NG+8vKenDlHkm26Yp4zJdCJl/7GmdR8h9giQVgOvk6JW9RoFFdwrnt+ Qqxr+DMR2XY7SHHEjYzP6aD9+FUg/TSieqvH0At5jrIykr7YHDfIvMkNRTw7FD2TrueU sbNbzdOp/p0wPOD8IQGHg1SMrMOhA+q+kK5jJMmbjvmLPhNwhRrmgQDfn7eAL7JflEgl eUXw== X-Gm-Message-State: AOJu0YxAyOpGWa3BbtPL43iH3ZZpasa3LodoK0W+fKEbuu/lWU/KTwOj rm1oJwRA56lpiqJv0SHwtmqaK3FT5cmszDn6ByABIsWeeK/ug46y9LwUKB8Rr+IqeMVrfJOSR3P E X-Google-Smtp-Source: AGHT+IHGdVDgE0BV4E6ET1vnyKOiNgQutr60WkuR7/igTVB/b/2IuiYcgezn/mIAKkIya0Cm/N2Kbw== X-Received: by 2002:a17:906:6bc8:b0:a46:800a:6358 with SMTP id t8-20020a1709066bc800b00a46800a6358mr1492199ejs.15.1710508187195; Fri, 15 Mar 2024 06:09:47 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-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=20P=20=2E=20Berrang=C3=A9?= , Paolo Bonzini , Eduardo Habkost , Claudio Fontana , Richard Henderson , Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Manos Pitsidianakis , Zhao Liu , qemu-arm@nongnu.org, Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , Yanan Wang Subject: [PATCH-for-9.1 05/21] cpus: Open code OBJECT_DECLARE_TYPE() in OBJECT_DECLARE_CPU_TYPE() Date: Fri, 15 Mar 2024 14:08:53 +0100 Message-ID: <20240315130910.15750-6-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::633; envelope-from=philmd@linaro.org; helo=mail-ej1-x633.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1710508341672100003 Since the OBJECT_DECLARE_CPU_TYPE() macro uses the abstract ArchCPU type, when declaring multiple CPUs of the same ArchCPU type we get an error related to the indirect G_DEFINE_AUTOPTR_CLEANUP_FUNC() use within OBJECT_DECLARE_TYPE(): target/mips/cpu-qom.h:31:1: error: redefinition of 'glib_autoptr_clear_Ar= chCPU' OBJECT_DECLARE_CPU_TYPE(MIPS64CPU, MIPSCPUClass, MIPS64_CPU) ^ include/hw/core/cpu.h:82:5: note: expanded from macro 'OBJECT_DECLARE_CPU= _TYPE' OBJECT_DECLARE_TYPE(ArchCPU, CpuClassType, CPU_MODULE_OBJ_NAME); ^ include/qom/object.h:237:5: note: expanded from macro 'OBJECT_DECLARE_TYP= E' G_DEFINE_AUTOPTR_CLEANUP_FUNC(InstanceType, object_unref) \ ^ /usr/include/glib-2.0/glib/gmacros.h:1371:3: note: expanded from macro 'G= _DEFINE_AUTOPTR_CLEANUP_FUNC' _GLIB_DEFINE_AUTOPTR_CLEANUP_FUNCS(TypeName, TypeName, func) ^ /usr/include/glib-2.0/glib/gmacros.h:1354:36: note: expanded from macro '= _GLIB_DEFINE_AUTOPTR_CLEANUP_FUNCS' static G_GNUC_UNUSED inline void _GLIB_AUTOPTR_CLEAR_FUNC_NAME(TypeName= ) (TypeName *_ptr) \ ^ /usr/include/glib-2.0/glib/gmacros.h:1338:49: note: expanded from macro '= _GLIB_AUTOPTR_CLEAR_FUNC_NAME' #define _GLIB_AUTOPTR_CLEAR_FUNC_NAME(TypeName) glib_autoptr_clear_##Type= Name ^ :54:1: note: expanded from here glib_autoptr_clear_ArchCPU ^ target/mips/cpu-qom.h:30:1: note: previous definition is here OBJECT_DECLARE_CPU_TYPE(MIPS32CPU, MIPSCPUClass, MIPS32_CPU) ^ Avoid that problem by expanding the OBJECT_DECLARE_TYPE() macro within OBJECT_DECLARE_CPU_TYPE(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Richard Henderson --- TODO: check rth comment: What about adding an OBJECT_DECLARE_CPU_SUBTYPE that omits half the stuff i= nstead? We don't need another object typedef at all, for instance. --- include/hw/core/cpu.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index ec14f74ce5..4c2e5095bf 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -78,7 +78,12 @@ DECLARE_CLASS_CHECKERS(CPUClass, CPU, */ #define OBJECT_DECLARE_CPU_TYPE(CpuInstanceType, CpuClassType, CPU_MODULE_= OBJ_NAME) \ typedef struct ArchCPU CpuInstanceType; \ - OBJECT_DECLARE_TYPE(ArchCPU, CpuClassType, CPU_MODULE_OBJ_NAME); + typedef struct CpuClassType CpuClassType; \ + \ + G_DEFINE_AUTOPTR_CLEANUP_FUNC(CpuInstanceType, object_unref) \ + \ + DECLARE_OBJ_CHECKERS(CpuInstanceType, CpuClassType, \ + CPU_MODULE_OBJ_NAME, TYPE_##CPU_MODULE_OBJ_NAME) =20 typedef enum MMUAccessType { MMU_DATA_LOAD =3D 0, --=20 2.41.0 From nobody Wed May 15 23:22:58 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1710508576; cv=none; d=zohomail.com; s=zohoarc; b=fYOVJldtbNdE6OzSfED3+o+Yv/5IuXiIgayZdT0X36yg55oNl3AALbHnW6qdxSBvBlJY48JXBH8ZTrJXj+Kl9RC2LrIBgu6N8etG4POvvbvHo0Lv6N4JhOYd3Ja+iGdvQchzaP+CQV0cCfqS/KvyXg6ICZmTTGMmCoexVsOjxRI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710508576; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ySG/dFK2HZQD+JLMFszQWRBPaJ0ef+Mlaqjr0ZCyRnE=; b=fw8GfRVAruu8HixxqWfWCEM2X4ZqOaEYeW6NCvmAEZMpspEsIrvtVUHaWhFpz3EUFmfAEn5sEMNeHhgrA7DSPu3jB7DSzyuf6tnDNoKpjMG9ZROGXegDbRawoaBrQzv6rmWzHB3wS5+bJe480QRq0jwBVnJcPGEfJFsocuuVsps= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1710508576420584.454108163534; Fri, 15 Mar 2024 06:16:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rl7Kq-0007sJ-T8; Fri, 15 Mar 2024 09:10:57 -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 1rl7Ju-0006GH-Nz for qemu-devel@nongnu.org; Fri, 15 Mar 2024 09:09:59 -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 1rl7Jr-0007oa-Ee for qemu-devel@nongnu.org; Fri, 15 Mar 2024 09:09:58 -0400 Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-568b8e0f94fso119577a12.0 for ; Fri, 15 Mar 2024 06:09:54 -0700 (PDT) Received: from m1x-phil.lan ([176.176.145.26]) by smtp.gmail.com with ESMTPSA id 6-20020a0564021f4600b005682a0e915fsm1675523edz.76.2024.03.15.06.09.51 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 15 Mar 2024 06:09:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710508194; x=1711112994; 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=ySG/dFK2HZQD+JLMFszQWRBPaJ0ef+Mlaqjr0ZCyRnE=; b=tuqz9HFZlx17dZBgoNJXeIqQekDWSLeSnWaxNzUh2kPjqhh2NI6iM0awgV3ecbynib Bem2/FOZH82gSms8U3TLKflZIPYjNZiEQIaMGhMjt5K/ZDZi/owwQC5ZUIdNO2eWTKNj ba3OU8Joeq7FlwAXszCr7CR0ReNDX+lqABOKd1RORKMAry7J06OHE+hG64GmQqZpMI5R VzpFQynQbfNZL/bquJl7/Xez0Yr+eJ4Qru9X1jII2f0vImtEmjY9eb1XCo5XOd9i9w+T lUaex0zTN7ZbT1BT2f7d6RUcHsdvLQOZFYt2kATeoccRlkTkajGZoqdCGLSh67JYQuDR ImDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710508194; x=1711112994; 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=ySG/dFK2HZQD+JLMFszQWRBPaJ0ef+Mlaqjr0ZCyRnE=; b=TOjc3hXiiRrYNHfeJGebj0XzWGCqCe2HCxblcyfQiD4kvNpkC0GgTvLRLDrfa9QeYh xgEsK/QfYnbv3MhxLNvcsOR3xN5pslW0KtU7dGQAE+HoUtDNB66GS0Np41deCUaGSaqP FOcTKrrDNBnWh9mnCVzje6asIHxtNr0hI6LUhOiibMSJYS1JaCaPVtX1PD00GLdA3oYr 8gZscSpV5odigkTzH+TSU1Qyrs06yv3D4+D9xRMMEVziCA9v7iwSu/omM0/WyNzmvS+U 3pMaCIWYRCEPKQSZw0p2hFIYSV0YABoizjgyE7UfBD+xQVcAGxQIMMzzygW/9MuYDc4J 3g0g== X-Gm-Message-State: AOJu0YzAtANgifugijgfR/Gl4MeMoJNIGDTCAUaMbKj8umPlOGs5X0gb 5lV72wp14faSkluGRxKEuH7w6QC6lurbvSfeM/IZ+4UItbMx2aaDgqh3i32n53kAZM5R/ta1e8b f X-Google-Smtp-Source: AGHT+IExmkLmMqoSeV72lixftAHxYOtVn4ReIk8rzurrdOHIVhJgEKO7oZjURsJA9vDI1+WjYK1UFA== X-Received: by 2002:a05:6402:c50:b0:568:93bb:d0c2 with SMTP id cs16-20020a0564020c5000b0056893bbd0c2mr4363087edb.20.1710508193742; Fri, 15 Mar 2024 06:09:53 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-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=20P=20=2E=20Berrang=C3=A9?= , Paolo Bonzini , Eduardo Habkost , Claudio Fontana , Richard Henderson , Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Manos Pitsidianakis , Zhao Liu , qemu-arm@nongnu.org, Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Laurent Vivier Subject: [PATCH-for-9.1 06/21] target/i386: Make X86_CPU common to new I386_CPU / X86_64_CPU types Date: Fri, 15 Mar 2024 14:08:54 +0100 Message-ID: <20240315130910.15750-7-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1710508577489100003 "target/foo/cpu-qom.h" can not use any target specific definitions. Currently "target/i386/cpu-qom.h" defines TYPE_X86_CPU depending on the i386/x86_64 build type. This doesn't scale in a heterogeneous context where we need to access both types concurrently. In order to do that, introduce the new I386_CPU / X86_64_CPU types, both inheriting a common TYPE_X86_CPU base type. Keep the current "base" and "max" CPU types as 32 or 64-bit, depending on the binary built. Adapt the cpu-plug-test, since the 'base' architecture is now common to both 32/64-bit x86 targets. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Richard Henderson --- target/i386/cpu-qom.h | 16 ++++++++++------ target/i386/cpu.c | 20 ++++++++++++++++++-- tests/qtest/cpu-plug-test.c | 2 +- 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/target/i386/cpu-qom.h b/target/i386/cpu-qom.h index d4e216d000..de28d7ea20 100644 --- a/target/i386/cpu-qom.h +++ b/target/i386/cpu-qom.h @@ -1,5 +1,5 @@ /* - * QEMU x86 CPU + * QEMU x86 CPU QOM header (target agnostic) * * Copyright (c) 2012 SUSE LINUX Products GmbH * @@ -22,14 +22,18 @@ =20 #include "hw/core/cpu.h" =20 -#ifdef TARGET_X86_64 -#define TYPE_X86_CPU "x86_64-cpu" -#else -#define TYPE_X86_CPU "i386-cpu" -#endif +#define TYPE_X86_CPU "x86-cpu" +#define TYPE_I386_CPU "i386-cpu" +#define TYPE_X86_64_CPU "x86_64-cpu" =20 OBJECT_DECLARE_CPU_TYPE(X86CPU, X86CPUClass, X86_CPU) =20 +OBJECT_DECLARE_CPU_TYPE(I386CPU, X86CPUClass, I386_CPU) +OBJECT_DECLARE_CPU_TYPE(X86_64CPU, X86CPUClass, X86_64_CPU) + +#define X86_CPU_TYPE_SUFFIX "-" TYPE_X86_CPU +#define X86_CPU_TYPE_NAME(name) (name X86_CPU_TYPE_SUFFIX) + #define X86_CPU_TYPE_SUFFIX "-" TYPE_X86_CPU #define X86_CPU_TYPE_NAME(name) (name X86_CPU_TYPE_SUFFIX) =20 diff --git a/target/i386/cpu.c b/target/i386/cpu.c index ebf555f50f..07f64c1ea5 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -8057,12 +8057,28 @@ static const TypeInfo x86_cpu_types[] =3D { .class_size =3D sizeof(X86CPUClass), .class_init =3D x86_cpu_common_class_init, }, { - .name =3D X86_CPU_TYPE_NAME("base"), + .name =3D TYPE_I386_CPU, .parent =3D TYPE_X86_CPU, + .abstract =3D true, + }, { + .name =3D TYPE_X86_64_CPU, + .parent =3D TYPE_X86_CPU, + .abstract =3D true, + }, { + .name =3D X86_CPU_TYPE_NAME("base"), +#ifdef TARGET_X86_64 + .parent =3D TYPE_X86_64_CPU, +#else + .parent =3D TYPE_I386_CPU, +#endif .class_init =3D x86_cpu_base_class_init, }, { .name =3D X86_CPU_TYPE_NAME("max"), - .parent =3D TYPE_X86_CPU, +#ifdef TARGET_X86_64 + .parent =3D TYPE_X86_64_CPU, +#else + .parent =3D TYPE_I386_CPU, +#endif .instance_init =3D max_x86_cpu_initfn, .class_init =3D max_x86_cpu_class_init, } diff --git a/tests/qtest/cpu-plug-test.c b/tests/qtest/cpu-plug-test.c index 7f5dd5f85a..97316d131f 100644 --- a/tests/qtest/cpu-plug-test.c +++ b/tests/qtest/cpu-plug-test.c @@ -90,7 +90,7 @@ static void add_pc_test_case(const char *mname) data->machine =3D g_strdup(mname); data->cpu_model =3D "Haswell"; /* 1.3+ theoretically */ data->device_model =3D g_strdup_printf("%s-%s-cpu", data->cpu_model, - qtest_get_arch()); + qtest_get_base_arch()); data->sockets =3D 1; data->cores =3D 3; data->threads =3D 2; --=20 2.41.0 From nobody Wed May 15 23:22:58 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1710508751; cv=none; d=zohomail.com; s=zohoarc; b=ZQYLV2LHtoVz4yvnWYswHEt+5qgIwiUZiMRdNVQUD1AArkLk+2PumigtqeKJOGITlvnx608+95RWzTKeJXSdA70t+JnO8btnD3ROghjxEI87NWDll71lVDOjGAP7/a4DBVdZ+TVa5yCRfyfYrRKHXT+PNZCAnW3e84cXCqTneDs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710508751; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=fQB6SJNy6yiy7zdv0lmI6ciVyOB2Uy024AmMoGafIwE=; b=KmTLyD1nW4URRxzHm1UgyHDvIj4iBf7x7VMnnZ4wXqX4R7PzqzN64gF9OE5ZEIRxIOBHOasMR45lZhdSyRVBhYVLRdl9vblEYFt05iSZUp9EY/H3YKgn+C+nWNFG5opuHmzmp9EGI3Hm8D1+Uqp2Jz1Zy2Bq4FfkLExM9fhVwxU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1710508751894357.5405848230657; Fri, 15 Mar 2024 06:19:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rl7Kr-0007y2-VM; Fri, 15 Mar 2024 09:10: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 1rl7K1-0006NK-Gq for qemu-devel@nongnu.org; Fri, 15 Mar 2024 09:10:07 -0400 Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rl7Jy-0007rc-Kp for qemu-devel@nongnu.org; Fri, 15 Mar 2024 09:10:04 -0400 Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-56845954fffso1900392a12.3 for ; Fri, 15 Mar 2024 06:10:02 -0700 (PDT) Received: from m1x-phil.lan ([176.176.145.26]) by smtp.gmail.com with ESMTPSA id q10-20020aa7d44a000000b005689d0a97d1sm1657891edr.24.2024.03.15.06.09.58 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 15 Mar 2024 06:10:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710508200; x=1711113000; 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=fQB6SJNy6yiy7zdv0lmI6ciVyOB2Uy024AmMoGafIwE=; b=D5Yow0ZKecc+XgV8kl3Fxp2klHV9pOvF/G2+ZI/Djby9UEMTStT24gk1yvGump1MJl MKkrD+pkP5pgDTJKhudDNevRLhRgSs8PL4pZTd9G2sUePI8EJeOlCBlHwT3IYYF4ZRs6 JhCpKZMNSbP+/r3huUOKAf4M65t39X3AXyvKeobTfq26PlElFA8WMhLT78gKOOx6o8f6 +bOlu3ydmRnzoSTUxtJZ5ZxmQukqNdodiuZZr1d3hf09n1YlCzoUgbAErfivYRvpS0Ry AFY6o61+Hnh5gRH9HeSGysOrs0zqx8bQd3t/Yar2vGrzZh5JGovLdA6puQxfIqt+cJNy 9t0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710508200; x=1711113000; 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=fQB6SJNy6yiy7zdv0lmI6ciVyOB2Uy024AmMoGafIwE=; b=wA1Q06FQydF8JKpdbbJbtDNth5nHHsAEPR6LxXv2+0KdnJtQXJIYmeZjZc9ANkPhdh IAcnML/fnAKkzzJ7RicTogA7oHVMH+kmolD0QZE1gexSQlIkQFnSHKqwuY1+z0pZrefE v1uUDRZQb4PQ2otGN4aXcw+7yKb7MN5DadKLV3XLENfPhth/EdS502Pn2dETK+FrCSks eXmLEA21i4v7bb9Ecd/rDejIIMQPxeBFiYQ1HZNclYh64CDztqcMSX1QPOK+l1lsDbZV NukM4eUR7W43HxFhYbX7GNLqlhkKwvSGD0ohI0tHlIZjRdD4gaiM9I6gWs0FiUoa+OCL F85Q== X-Gm-Message-State: AOJu0YwRshe073NO21WeonKAJ5m7Th7pwTIrjqHFmQtkTuOJMPN9zIYa sF559hWTs+LkcO0gzpvuD7G1lIxpd/gnsxU3X1oEn12Ti5YvdidJauAfo1wlS1lABrrZbNpdIAD c X-Google-Smtp-Source: AGHT+IERNJD9BeD1ZTNKcgjKR1YrxbrTZMT90NVR2wKIdl/tZTRzhcTVHamLl8tpd/LjDM8xLQUvNQ== X-Received: by 2002:aa7:dd0f:0:b0:565:b456:435d with SMTP id i15-20020aa7dd0f000000b00565b456435dmr2931558edv.17.1710508200588; Fri, 15 Mar 2024 06:10:00 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-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=20P=20=2E=20Berrang=C3=A9?= , Paolo Bonzini , Eduardo Habkost , Claudio Fontana , Richard Henderson , Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Manos Pitsidianakis , Zhao Liu , qemu-arm@nongnu.org, Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Aurelien Jarno , Jiaxun Yang , Aleksandar Rikalo , Huacai Chen Subject: [PATCH-for-9.1 07/21] target/mips: Make MIPS_CPU common to new MIPS32_CPU / MIPS64_CPU types Date: Fri, 15 Mar 2024 14:08:55 +0100 Message-ID: <20240315130910.15750-8-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::52e; envelope-from=philmd@linaro.org; helo=mail-ed1-x52e.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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1710508752133100001 "target/foo/cpu-qom.h" can not use any target specific definitions. Currently "target/mips/cpu-qom.h" defines TYPE_MIPS_CPU depending on the mips(32)/mips64 build type. This doesn't scale in a heterogeneous context where we need to access both types concurrently. In order to do that, introduce the new MIPS32_CPU / MIPS64_CPU types, both inheriting a common TYPE_MIPS_CPU base type. Keep the current CPU types registered in mips_register_cpudef_type() as 32 or 64-bit, but instead of depending on the binary built being targeting 32/64-bit, check whether the CPU is 64-bit by looking at the CPU_MIPS64 bit. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- target/mips/cpu-qom.h | 13 +++++++------ target/mips/cpu.c | 11 ++++++++++- target/mips/sysemu/mips-qmp-cmds.c | 26 ++------------------------ 3 files changed, 19 insertions(+), 31 deletions(-) diff --git a/target/mips/cpu-qom.h b/target/mips/cpu-qom.h index 0eea2a2598..bf464f16b6 100644 --- a/target/mips/cpu-qom.h +++ b/target/mips/cpu-qom.h @@ -1,5 +1,5 @@ /* - * QEMU MIPS CPU + * QEMU MIPS CPU QOM header (target agnostic) * * Copyright (c) 2012 SUSE LINUX Products GmbH * @@ -22,14 +22,15 @@ =20 #include "hw/core/cpu.h" =20 -#ifdef TARGET_MIPS64 -#define TYPE_MIPS_CPU "mips64-cpu" -#else -#define TYPE_MIPS_CPU "mips-cpu" -#endif +#define TYPE_MIPS_CPU "mips-cpu" +#define TYPE_MIPS32_CPU "mips32-cpu" +#define TYPE_MIPS64_CPU "mips64-cpu" =20 OBJECT_DECLARE_CPU_TYPE(MIPSCPU, MIPSCPUClass, MIPS_CPU) =20 +OBJECT_DECLARE_CPU_TYPE(MIPS32CPU, MIPSCPUClass, MIPS32_CPU) +OBJECT_DECLARE_CPU_TYPE(MIPS64CPU, MIPSCPUClass, MIPS64_CPU) + #define MIPS_CPU_TYPE_SUFFIX "-" TYPE_MIPS_CPU #define MIPS_CPU_TYPE_NAME(model) model MIPS_CPU_TYPE_SUFFIX =20 diff --git a/target/mips/cpu.c b/target/mips/cpu.c index c096d97fe3..f3ea6175f2 100644 --- a/target/mips/cpu.c +++ b/target/mips/cpu.c @@ -604,6 +604,14 @@ static const TypeInfo mips_cpu_types[] =3D { .abstract =3D true, .class_size =3D sizeof(MIPSCPUClass), .class_init =3D mips_cpu_class_init, + }, { + .name =3D TYPE_MIPS32_CPU, + .parent =3D TYPE_MIPS_CPU, + .abstract =3D true, + }, { + .name =3D TYPE_MIPS64_CPU, + .parent =3D TYPE_MIPS_CPU, + .abstract =3D true, } }; =20 @@ -620,7 +628,8 @@ static void mips_register_cpudef_type(const struct mips= _def_t *def) char *typename =3D mips_cpu_type_name(def->name); TypeInfo ti =3D { .name =3D typename, - .parent =3D TYPE_MIPS_CPU, + .parent =3D def->insn_flags & CPU_MIPS64 + ? TYPE_MIPS64_CPU : TYPE_MIPS32_CPU, .class_init =3D mips_cpu_cpudef_class_init, .class_data =3D (void *)def, }; diff --git a/target/mips/sysemu/mips-qmp-cmds.c b/target/mips/sysemu/mips-q= mp-cmds.c index 7340ac70ba..329db3a028 100644 --- a/target/mips/sysemu/mips-qmp-cmds.c +++ b/target/mips/sysemu/mips-qmp-cmds.c @@ -8,31 +8,9 @@ =20 #include "qemu/osdep.h" #include "qapi/qapi-commands-machine-target.h" -#include "cpu.h" - -static void mips_cpu_add_definition(gpointer data, gpointer user_data) -{ - ObjectClass *oc =3D data; - CpuDefinitionInfoList **cpu_list =3D user_data; - CpuDefinitionInfo *info; - const char *typename; - - typename =3D object_class_get_name(oc); - info =3D g_malloc0(sizeof(*info)); - info->name =3D cpu_model_from_type(typename); - info->q_typename =3D g_strdup(typename); - - QAPI_LIST_PREPEND(*cpu_list, info); -} +#include "qapi/commands-target-compat.h" =20 CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) { - CpuDefinitionInfoList *cpu_list =3D NULL; - GSList *list; - - list =3D object_class_get_list(TYPE_MIPS_CPU, false); - g_slist_foreach(list, mips_cpu_add_definition, &cpu_list); - g_slist_free(list); - - return cpu_list; + return generic_query_cpu_definitions(errp); } --=20 2.41.0 From nobody Wed May 15 23:22:58 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1710508719; cv=none; d=zohomail.com; s=zohoarc; b=WEI9QhgT+2hEKQrJJ/j1eo8lu2zHpnMZ8pELCOZ9gqYKAklWmIQv9vrQqOGTYKX6SqcAe3eTJu80uOdW1KKla/HF7Jl/FO2jkYrH/nmkh6wWLuBECvE2GrLmBVzl+gn+UQV66u/TSuUEQ2/VuqFhb4EhEvPgrlezum3t6nL3eYk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710508719; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=qDIsKXjb1Jl9yBqR7T/u0FWdWtcs/rDVYwZEhcpoxew=; b=kx3l+fcT71W/YbIZo7DVUb9x0gFnCX/1fR8XRNO24QilrXNOCaYqzxWGmAYhTqaW0dUKSJGCfGLn8fSv37xByLLhb8tnYKzBSSyEGaBrocGA//P1uj1j6M3O5u69UKV2rnvPN+Qlr+KO4k07tRZFMxkLWEQ1SuYlTJ9+8YssEcI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1710508719521439.08843677962705; Fri, 15 Mar 2024 06:18:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rl7Kt-00088q-9J; Fri, 15 Mar 2024 09:10:59 -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 1rl7KO-0006yq-5z for qemu-devel@nongnu.org; Fri, 15 Mar 2024 09:10:29 -0400 Received: from mail-ed1-x531.google.com ([2a00:1450:4864:20::531]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rl7K6-0007wU-Mw for qemu-devel@nongnu.org; Fri, 15 Mar 2024 09:10:26 -0400 Received: by mail-ed1-x531.google.com with SMTP id 4fb4d7f45d1cf-5688eaf1165so3196598a12.1 for ; Fri, 15 Mar 2024 06:10:10 -0700 (PDT) Received: from m1x-phil.lan ([176.176.145.26]) by smtp.gmail.com with ESMTPSA id dk4-20020a0564021d8400b0056706105abesm1689843edb.33.2024.03.15.06.10.05 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 15 Mar 2024 06:10:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710508208; x=1711113008; 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=qDIsKXjb1Jl9yBqR7T/u0FWdWtcs/rDVYwZEhcpoxew=; b=nloCUCPnHdJsTMOe5mB56ubaQqAIRf8Nt8dSaGwx8ZgJNLgL4o5fs/vibYlSdxwQDu 77pUt1NYKxQkxq1Rrm7sDRFClixlech/srG5DqOIi/nd/017iu8LLJ0+iKSFRs4KCZlq mug7V1dobjrxLy02cXPiKoc3tzth37HV5ebQK+vCrC96s54SXJKS38dqAU9nMyMDLglG zjD8vQGdL7FSIneCIPz5NYhk4SkTgKWhTDj+m9DxScoMthRTVLkSQjXugFCbyVfsjeTU kaw2GVYGa+8j7am6YPiBU+E5Z12b2AhtlPRjAYjLvD/+8YflBQPRsmNcEwFhX0mhb0aD spFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710508208; x=1711113008; 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=qDIsKXjb1Jl9yBqR7T/u0FWdWtcs/rDVYwZEhcpoxew=; b=PEtxakO3ZJ9ZxNL+wQxLTU7tfr7OllaGyksgF2VsYh1WQF+FNwE/hPBA8+2xmadxxN NIJXF99K3RBYi7yABwtWJKej15Lb7l07nHOm9t8zwZhDADRO36q+meW7J+RETrP40cyh 7DaPhIh4aYIKeAnBFoWY3FRyDtH/XV0oemIculxVVb/NH23zNW7t2wtazjAAQGVOTvEv 5fRbmfMIboI1nDxlN5krlHTQkSrl6QOv65ZcR0ySEq5dgb8Ubgj5C388iYg8Pdg8hg4n +DiLePoCTO0OIgTOfBlGvL0SIAZgPH7YMHLmuy7u4k3NHoOGGb5HTubAMna5QZvJl/xG 1ENg== X-Gm-Message-State: AOJu0YwsMS7uELZvQABsnYb+he8EP2l7UhwniQ72i+kZpsKKfJlCAWID +I+kwQ2Uxe/apyicdm9spjCUMoNvZkBDsRaYgSbbtdW+C+cSl2kl+Efl/yLE6VOD7m+r4YnKg5t P X-Google-Smtp-Source: AGHT+IHz6vQYIeOBcjGc+xE2c8P3SUzSTmtoEr2FLDXsqrRWBjGskKgF5u0V0+3R6przXpowCYuWpA== X-Received: by 2002:a05:6402:5512:b0:568:9c6b:eb0f with SMTP id fi18-20020a056402551200b005689c6beb0fmr3550192edb.21.1710508207999; Fri, 15 Mar 2024 06:10:07 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-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=20P=20=2E=20Berrang=C3=A9?= , Paolo Bonzini , Eduardo Habkost , Claudio Fontana , Richard Henderson , Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Manos Pitsidianakis , Zhao Liu , qemu-arm@nongnu.org, Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Mark Cave-Ayland , Artyom Tarasenko Subject: [PATCH-for-9.1 08/21] target/sparc: Make SPARC_CPU common to new SPARC32_CPU/SPARC64_CPU types Date: Fri, 15 Mar 2024 14:08:56 +0100 Message-ID: <20240315130910.15750-9-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::531; envelope-from=philmd@linaro.org; helo=mail-ed1-x531.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1710508720085100002 "target/foo/cpu-qom.h" can not use any target specific definitions. Currently "target/sparc/cpu-qom.h" defines TYPE_SPARC_CPU depending on the sparc(32)/sparc64 build type. This doesn't scale in a heterogeneous context where we need to access both types concurrently. In order to do that, introduce the new SPARC32_CPU / SPARC64_CPU types, both inheriting a common TYPE_SPARC_CPU base type. Keep the current CPU types registered in sparc_register_cpudef_type() as 32 or 64-bit, depending on the binary built. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Mark Cave-Ayland --- target/sparc/cpu-qom.h | 9 +++++---- target/sparc/cpu.c | 12 +++++++++++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/target/sparc/cpu-qom.h b/target/sparc/cpu-qom.h index a86331bd58..6ad283506e 100644 --- a/target/sparc/cpu-qom.h +++ b/target/sparc/cpu-qom.h @@ -22,14 +22,15 @@ =20 #include "hw/core/cpu.h" =20 -#ifdef TARGET_SPARC64 -#define TYPE_SPARC_CPU "sparc64-cpu" -#else #define TYPE_SPARC_CPU "sparc-cpu" -#endif +#define TYPE_SPARC32_CPU "sparc32-cpu" +#define TYPE_SPARC64_CPU "sparc64-cpu" =20 OBJECT_DECLARE_CPU_TYPE(SPARCCPU, SPARCCPUClass, SPARC_CPU) =20 +OBJECT_DECLARE_CPU_TYPE(SPARC32CPU, SPARCCPUClass, SPARC32_CPU) +OBJECT_DECLARE_CPU_TYPE(SPARC64CPU, SPARCCPUClass, SPARC64_CPU) + #define SPARC_CPU_TYPE_SUFFIX "-" TYPE_SPARC_CPU #define SPARC_CPU_TYPE_NAME(model) model SPARC_CPU_TYPE_SUFFIX =20 diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index 42b13ab63f..9e27e16b75 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -959,6 +959,12 @@ static const TypeInfo sparc_cpu_types[] =3D { .abstract =3D true, .class_size =3D sizeof(SPARCCPUClass), .class_init =3D sparc_cpu_class_init, + }, { + .name =3D TYPE_SPARC32_CPU, + .parent =3D TYPE_SPARC_CPU, + }, { + .name =3D TYPE_SPARC64_CPU, + .parent =3D TYPE_SPARC_CPU, } }; =20 @@ -975,7 +981,11 @@ static void sparc_register_cpudef_type(const struct sp= arc_def_t *def) char *typename =3D sparc_cpu_type_name(def->name); TypeInfo ti =3D { .name =3D typename, - .parent =3D TYPE_SPARC_CPU, +#ifdef TARGET_SPARC64 + .parent =3D TYPE_SPARC64_CPU, +#else + .parent =3D TYPE_SPARC32_CPU, +#endif .class_init =3D sparc_cpu_cpudef_class_init, .class_data =3D (void *)def, }; --=20 2.41.0 From nobody Wed May 15 23:22:58 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1710508467; cv=none; d=zohomail.com; s=zohoarc; b=N3kIqK8rqIKZZcdhXglPw1EFIv6NyKWVULOzLlxzLXRr6xgqcb21rNFhjyplVGaMiuNNMwsMK6HFQDbXb/OfWbYfdHcCy/XRSAB1koeFykBvuS7M5QiDYRYjvlbvx6xF2m/yGWoKH4onPvhUeFdG804F7Cv07/7Lf1MFemnHhzI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710508467; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=501a0naqlbNKu8avIdgSMPglnIX/rNjXROgIt46X+30=; b=Ako37hkyKoaJlbK4eUms5BlgVlYLNx+zEGel+2zhWIViJwMl4dXFj/H1q8D7PTf2tqQ8hGgSqhk02YGzSZPbpYhB0QGyeoGR0S1qMOPhV+ljc+In2wr1vKHKmaBrHlmeKFRpFU1PDTJIgAj69mW3AwK8Jla9tK63bvqJU8SY2/8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1710508467571640.0429577576243; Fri, 15 Mar 2024 06:14:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rl7L1-0000Q3-SI; Fri, 15 Mar 2024 09:11:07 -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 1rl7KL-0006um-Sx for qemu-devel@nongnu.org; Fri, 15 Mar 2024 09:10:25 -0400 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rl7KF-0007zU-46 for qemu-devel@nongnu.org; Fri, 15 Mar 2024 09:10:24 -0400 Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-a44665605f3so224498666b.2 for ; Fri, 15 Mar 2024 06:10:17 -0700 (PDT) Received: from m1x-phil.lan ([176.176.145.26]) by smtp.gmail.com with ESMTPSA id gq25-20020a170906e25900b00a453123b111sm1698649ejb.120.2024.03.15.06.10.12 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 15 Mar 2024 06:10:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710508215; x=1711113015; 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=501a0naqlbNKu8avIdgSMPglnIX/rNjXROgIt46X+30=; b=YQ7VCtbRMI1CGPT6Te7UzRL5zSlTy9LEfn6mbecoPaacg6NZ4M83CnqZK/nucC0q0r hET/PWwtxFRqBMA45uXoliL0Xle2iO3s0DRfp+SFk+KoqmmgMaM79In/YlRFTkyOXBWk aFXUJapWPWznMepGNDgUlW7zOAdUoDY3L7eV7X1cTL7aMWTOIemQWwya+JpBhSnwux45 OVRLe7w7sBSgzwfeX3RxddVqtzCsW5WRUjKFcalRVeWRBTqhxx0gCyS6DSG4pqF+brjB MmiOPmoboXDFZKsQ+YMGhQA9PoYypqSdk90X3twMf8oc4whcpa/EuSaJ49NyxJJ+mwCB swbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710508215; x=1711113015; 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=501a0naqlbNKu8avIdgSMPglnIX/rNjXROgIt46X+30=; b=Y2Es69Giqqetd/GFdAHpXXkIAQn37TJh7Qp2ObFmKfVDPduHpFnQkkzxP4CrmzmdiS zgEOSXQdrOoeU5pyZrFK5HAPl/4T4huzP9+incn3XLRM+Irj6wLGeEjX9wyj/Uz3b3sy bUTAjFr9iFxiLO5Ve9MN+kBV3RsffTJbzhxw48vDhnYjTWL7L69iA29YkhijMsI0A+uj 940xkRSGaXzXaRAObITPR+V4+FfwLhjIi+rjvsBv3KQ2dF7nEDXk8M6A3TGQCPr7WoGt Zj7mcEga69TnSZgNSCAeA+7dHfY8VFQT+Av3Yu0DgwC3SW7TqX2WFsgLmsMXvqCaXLm/ OT+Q== X-Gm-Message-State: AOJu0YxG4gRiFmQCSK2It9dO4ETlDxi04Y7oe4QoJjyJccapJN35j73J OVaJiS21zbKYcs6UuFop39clLDCISeths4kGRI8nXNCXg7cgS6KzUPtRevstGQwG21yRDpARh8N t X-Google-Smtp-Source: AGHT+IFXUOZ0DXU9TFe7eErBIR0hjw1JRtYP9W4z0ySb0FEWd+FLxscB84jJYmFd0YaJKmhT8vL6Mw== X-Received: by 2002:a17:906:2655:b0:a46:2a47:6f4c with SMTP id i21-20020a170906265500b00a462a476f4cmr1311867ejc.60.1710508215147; Fri, 15 Mar 2024 06:10:15 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-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=20P=20=2E=20Berrang=C3=A9?= , Paolo Bonzini , Eduardo Habkost , Claudio Fontana , Richard Henderson , Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Manos Pitsidianakis , Zhao Liu , qemu-arm@nongnu.org, Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , Yanan Wang , Eric Blake , Michael Roth , David Hildenbrand , Ilya Leoshkevich Subject: [PATCH-for-9.1 09/21] qapi: Merge machine-common.json with qapi/machine.json Date: Fri, 15 Mar 2024 14:08:57 +0100 Message-ID: <20240315130910.15750-10-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::62f; envelope-from=philmd@linaro.org; helo=mail-ej1-x62f.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1710508468978100003 machine-common.json declares a single type, which isn't restricted to a particular target. Move this type in machine.json. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- MAINTAINERS | 1 - qapi/machine-common.json | 21 --------------------- qapi/machine-target.json | 2 +- qapi/machine.json | 13 ++++++++++++- qapi/qapi-schema.json | 1 - target/s390x/cpu.h | 2 +- qapi/meson.build | 1 - 7 files changed, 14 insertions(+), 27 deletions(-) delete mode 100644 qapi/machine-common.json diff --git a/MAINTAINERS b/MAINTAINERS index a3130f64fd..ed98814398 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1889,7 +1889,6 @@ F: hw/core/null-machine.c F: hw/core/numa.c F: hw/cpu/cluster.c F: qapi/machine.json -F: qapi/machine-common.json F: qapi/machine-target.json F: include/hw/boards.h F: include/hw/core/cpu.h diff --git a/qapi/machine-common.json b/qapi/machine-common.json deleted file mode 100644 index fa6bd71d12..0000000000 --- a/qapi/machine-common.json +++ /dev/null @@ -1,21 +0,0 @@ -# -*- Mode: Python -*- -# vim: filetype=3Dpython -# -# This work is licensed under the terms of the GNU GPL, version 2 or later. -# See the COPYING file in the top-level directory. - -## -# =3D Machines S390 data types -## - -## -# @CpuS390Entitlement: -# -# An enumeration of CPU entitlements that can be assumed by a virtual -# S390 CPU -# -# Since: 8.2 -## -{ 'enum': 'CpuS390Entitlement', - 'prefix': 'S390_CPU_ENTITLEMENT', - 'data': [ 'auto', 'low', 'medium', 'high' ] } diff --git a/qapi/machine-target.json b/qapi/machine-target.json index 519adf3220..5f17b25d50 100644 --- a/qapi/machine-target.json +++ b/qapi/machine-target.json @@ -4,7 +4,7 @@ # This work is licensed under the terms of the GNU GPL, version 2 or later. # See the COPYING file in the top-level directory. =20 -{ 'include': 'machine-common.json' } +{ 'include': 'machine.json' } =20 ## # @CpuModelInfo: diff --git a/qapi/machine.json b/qapi/machine.json index bb5a178909..4bc38e86fd 100644 --- a/qapi/machine.json +++ b/qapi/machine.json @@ -9,7 +9,6 @@ ## =20 { 'include': 'common.json' } -{ 'include': 'machine-common.json' } =20 ## # @SysEmuTarget: @@ -50,6 +49,18 @@ 'prefix': 'S390_CPU_STATE', 'data': [ 'uninitialized', 'stopped', 'check-stop', 'operating', 'load' = ] } =20 +## +# @CpuS390Entitlement: +# +# An enumeration of CPU entitlements that can be assumed by a virtual +# S390 CPU +# +# Since: 8.2 +## +{ 'enum': 'CpuS390Entitlement', + 'prefix': 'S390_CPU_ENTITLEMENT', + 'data': [ 'auto', 'low', 'medium', 'high' ] } + ## # @CpuInfoS390: # diff --git a/qapi/qapi-schema.json b/qapi/qapi-schema.json index 8304d45625..2c82a49bae 100644 --- a/qapi/qapi-schema.json +++ b/qapi/qapi-schema.json @@ -67,7 +67,6 @@ { 'include': 'introspect.json' } { 'include': 'qom.json' } { 'include': 'qdev.json' } -{ 'include': 'machine-common.json' } { 'include': 'machine.json' } { 'include': 'machine-target.json' } { 'include': 'replay.json' } diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h index 43a46a5a06..b46339bd7c 100644 --- a/target/s390x/cpu.h +++ b/target/s390x/cpu.h @@ -29,7 +29,7 @@ #include "cpu_models.h" #include "exec/cpu-defs.h" #include "qemu/cpu-float.h" -#include "qapi/qapi-types-machine-common.h" +#include "qapi/qapi-types-machine.h" =20 #define ELF_MACHINE_UNAME "S390X" =20 diff --git a/qapi/meson.build b/qapi/meson.build index 375d564277..90047dae1c 100644 --- a/qapi/meson.build +++ b/qapi/meson.build @@ -37,7 +37,6 @@ qapi_all_modules =3D [ 'error', 'introspect', 'job', - 'machine-common', 'machine', 'machine-target', 'migration', --=20 2.41.0 From nobody Wed May 15 23:22:58 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1710508479; cv=none; d=zohomail.com; s=zohoarc; b=LUVKoc9DmP1Kz3CHD5AMwLwAhWP2Gf1uyUcF5YerTt3VOq5fS4+W5gNViOuexeRn3jpJ5wdurwlxrOzC5dFCZLczaL+PZfy5JquxukNt/XuUwTzz0QOnB8xTy8tFHANviWOOBr5rTvtZ//qzro+1iH0OXjrWBmq+Gcuog+uCRyw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710508479; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=juKrFHTenueZGgaczYCixm7yTPX2XVgDuiXA1GdKgho=; b=Av3fynpTYSB+vM24N8ZE/oQWoHHTtiUjvRWzoS9TjTo5KFoOYT0rx7bsu9nXMyDHxnHfkcTtW6Jcs9e9hU8p5JgY/D9flJoZZWsLwYiI27j24X6C0QIHkQyqlncHb6OgcTT8AV4CaL0vLQfOruvwl7m2rn0mEiMxj3z1Cb9YUSI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1710508479121984.184654503898; Fri, 15 Mar 2024 06:14:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rl7LL-0001Wl-1g; Fri, 15 Mar 2024 09:11:28 -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 1rl7KT-00079Z-AL for qemu-devel@nongnu.org; Fri, 15 Mar 2024 09:10:34 -0400 Received: from mail-lf1-x12f.google.com ([2a00:1450:4864:20::12f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rl7KJ-000836-TT for qemu-devel@nongnu.org; Fri, 15 Mar 2024 09:10:32 -0400 Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-513cfd48224so2914829e87.2 for ; Fri, 15 Mar 2024 06:10:23 -0700 (PDT) Received: from m1x-phil.lan ([176.176.145.26]) by smtp.gmail.com with ESMTPSA id s11-20020a170906bc4b00b00a4671d37717sm1605908ejv.52.2024.03.15.06.10.19 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 15 Mar 2024 06:10:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710508222; x=1711113022; 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=juKrFHTenueZGgaczYCixm7yTPX2XVgDuiXA1GdKgho=; b=nvfjlwjpj1j6AGq1kErWVZXNMSIghtLCXx8EqZADOAVKOwYClTex9UNbeeJW8EthQy xT01/1h+LZMIN61eu2D+NA3vkmbWeS81w2WoJF79CRfA6N16ROrilpzHZhMkxvK/MjGg zez1N+rT33T15Gyn+wIwzKtFdmrndHfllg0mxY6NniCbXEcShuLFXO/dPbdRiVPNtumU U9egae0Mkt9vdfB/Qcop8cHfpJrZMOBpv9Xb1zbRH39o03HaQH7/UZQpKMizlHo4qo3E IhjUYSJ+Dudx8pp+4qIw+4K5lmpfQgvN6XZdHfBy6L9++mLPAPIwqancZV9/IPHbcXWW k0sA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710508222; x=1711113022; 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=juKrFHTenueZGgaczYCixm7yTPX2XVgDuiXA1GdKgho=; b=THTh51O4jwuLo7pQfTwqAlta/Bd0Cj60VAhHbqIf/RK9mjbEYhtZrBA+/m+/l2XOoz wvFVWhA5i7QfB7TU5h9C+u1ZX+vLmKzVoLbXQVHN7l4Q+bccw1Knn6q5k7YuMWvx0CAQ 5So2uozf2jJZPrNSlPGd6KSU8XSSIvOcLZnwtEjnNcEc7dC5qq+VKHWPfOeH24SDy7T4 iKjdswt6EFiVpxptzfKzZ63Gh3NRuAJOWSAfMnZ+ML0eOeeikoxtc9IokzVw7dK23kK4 K0uDNx0+S50BpggjH8/Oo8222AEpE/qHet82IjtqO926XxjOzQNyDaYP9twCYBPQ4Uoi kOag== X-Gm-Message-State: AOJu0YyaQve91zbuyoUpzd7JWF8ow8XTUQg0a0OJyMTYZhVBOSRt9qq8 DSIOyp6+175iChpqWAUqCGhFkundFrctq8aM9JYJ9aMthDpsmllJf602Ud5qUi4egoektvlPKIq M X-Google-Smtp-Source: AGHT+IG/fkrm3CO2MahErI9fFc2gtBPFkzwyIu619VO5D+ezRzl3dqx8ZqO1u+VaQLLAaFAD47y0KA== X-Received: by 2002:a19:f807:0:b0:513:2bea:d0e0 with SMTP id a7-20020a19f807000000b005132bead0e0mr2965749lff.62.1710508221669; Fri, 15 Mar 2024 06:10:21 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-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=20P=20=2E=20Berrang=C3=A9?= , Paolo Bonzini , Eduardo Habkost , Claudio Fontana , Richard Henderson , Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Manos Pitsidianakis , Zhao Liu , qemu-arm@nongnu.org, Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eric Blake , Marcel Apfelbaum , Yanan Wang Subject: [PATCH-for-9.1 10/21] qapi: Make CpuModel* definitions target agnostic Date: Fri, 15 Mar 2024 14:08:58 +0100 Message-ID: <20240315130910.15750-11-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::12f; envelope-from=philmd@linaro.org; helo=mail-lf1-x12f.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1710508481134100003 CpuModelInfo, CpuModelExpansionType and CpuModelCompareResult are not restricted to any particular target. Define them in machine.json to generate them once. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- qapi/machine-target.json | 78 --------------------------------------- qapi/machine.json | 79 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+), 78 deletions(-) diff --git a/qapi/machine-target.json b/qapi/machine-target.json index 5f17b25d50..0412400df3 100644 --- a/qapi/machine-target.json +++ b/qapi/machine-target.json @@ -6,84 +6,6 @@ =20 { 'include': 'machine.json' } =20 -## -# @CpuModelInfo: -# -# Virtual CPU model. -# -# A CPU model consists of the name of a CPU definition, to which delta -# changes are applied (e.g. features added/removed). Most magic values -# that an architecture might require should be hidden behind the name. -# However, if required, architectures can expose relevant properties. -# -# @name: the name of the CPU definition the model is based on -# -# @props: a dictionary of QOM properties to be applied -# -# Since: 2.8 -## -{ 'struct': 'CpuModelInfo', - 'data': { 'name': 'str', - '*props': 'any' } } - -## -# @CpuModelExpansionType: -# -# An enumeration of CPU model expansion types. -# -# @static: Expand to a static CPU model, a combination of a static -# base model name and property delta changes. As the static base -# model will never change, the expanded CPU model will be the -# same, independent of QEMU version, machine type, machine -# options, and accelerator options. Therefore, the resulting -# model can be used by tooling without having to specify a -# compatibility machine - e.g. when displaying the "host" model. -# The @static CPU models are migration-safe. -# -# @full: Expand all properties. The produced model is not guaranteed -# to be migration-safe, but allows tooling to get an insight and -# work with model details. -# -# Note: When a non-migration-safe CPU model is expanded in static -# mode, some features enabled by the CPU model may be omitted, -# because they can't be implemented by a static CPU model -# definition (e.g. cache info passthrough and PMU passthrough in -# x86). If you need an accurate representation of the features -# enabled by a non-migration-safe CPU model, use @full. If you -# need a static representation that will keep ABI compatibility -# even when changing QEMU version or machine-type, use @static -# (but keep in mind that some features may be omitted). -# -# Since: 2.8 -## -{ 'enum': 'CpuModelExpansionType', - 'data': [ 'static', 'full' ] } - -## -# @CpuModelCompareResult: -# -# An enumeration of CPU model comparison results. The result is -# usually calculated using e.g. CPU features or CPU generations. -# -# @incompatible: If model A is incompatible to model B, model A is not -# guaranteed to run where model B runs and the other way around. -# -# @identical: If model A is identical to model B, model A is -# guaranteed to run where model B runs and the other way around. -# -# @superset: If model A is a superset of model B, model B is -# guaranteed to run where model A runs. There are no guarantees -# about the other way. -# -# @subset: If model A is a subset of model B, model A is guaranteed to -# run where model B runs. There are no guarantees about the other -# way. -# -# Since: 2.8 -## -{ 'enum': 'CpuModelCompareResult', - 'data': [ 'incompatible', 'identical', 'superset', 'subset' ] } - ## # @CpuModelBaselineInfo: # diff --git a/qapi/machine.json b/qapi/machine.json index 4bc38e86fd..65702c2c78 100644 --- a/qapi/machine.json +++ b/qapi/machine.json @@ -10,6 +10,85 @@ =20 { 'include': 'common.json' } =20 +## +# @CpuModelInfo: +# +# Virtual CPU model. +# +# A CPU model consists of the name of a CPU definition, to which delta +# changes are applied (e.g. features added/removed). Most magic values +# that an architecture might require should be hidden behind the name. +# However, if required, architectures can expose relevant properties. +# +# @name: the name of the CPU definition the model is based on +# +# @props: a dictionary of QOM properties to be applied +# +# Since: 2.8 +## +{ 'struct': 'CpuModelInfo', + 'data': { 'name': 'str', + '*props': 'any' } +} + +## +# @CpuModelExpansionType: +# +# An enumeration of CPU model expansion types. +# +# @static: Expand to a static CPU model, a combination of a static +# base model name and property delta changes. As the static base +# model will never change, the expanded CPU model will be the +# same, independent of QEMU version, machine type, machine +# options, and accelerator options. Therefore, the resulting +# model can be used by tooling without having to specify a +# compatibility machine - e.g. when displaying the "host" model. +# The @static CPU models are migration-safe. +# +# @full: Expand all properties. The produced model is not guaranteed +# to be migration-safe, but allows tooling to get an insight and +# work with model details. +# +# Note: When a non-migration-safe CPU model is expanded in static +# mode, some features enabled by the CPU model may be omitted, +# because they can't be implemented by a static CPU model +# definition (e.g. cache info passthrough and PMU passthrough in +# x86). If you need an accurate representation of the features +# enabled by a non-migration-safe CPU model, use @full. If you +# need a static representation that will keep ABI compatibility +# even when changing QEMU version or machine-type, use @static +# (but keep in mind that some features may be omitted). +# +# Since: 2.8 +## +{ 'enum': 'CpuModelExpansionType', + 'data': [ 'static', 'full' ] } + +## +# @CpuModelCompareResult: +# +# An enumeration of CPU model comparison results. The result is +# usually calculated using e.g. CPU features or CPU generations. +# +# @incompatible: If model A is incompatible to model B, model A is not +# guaranteed to run where model B runs and the other way around. +# +# @identical: If model A is identical to model B, model A is +# guaranteed to run where model B runs and the other way around. +# +# @superset: If model A is a superset of model B, model B is +# guaranteed to run where model A runs. There are no guarantees +# about the other way. +# +# @subset: If model A is a subset of model B, model A is guaranteed to +# run where model B runs. There are no guarantees about the other +# way. +# +# Since: 2.8 +## +{ 'enum': 'CpuModelCompareResult', + 'data': [ 'incompatible', 'identical', 'superset', 'subset' ] } + ## # @SysEmuTarget: # --=20 2.41.0 From nobody Wed May 15 23:22:58 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1710508719; cv=none; d=zohomail.com; s=zohoarc; b=f1+ZzHajetbWG6XBsDqSybfDJ8BVf8wG/Clkz04/hSQ5fKUAP0gsr0po0e9q88yu8g6YLAWnCPgATz+h7akrK+vIkWi8aNXS3VXcAOpM1OShTnVkgCwleW4NK7UNjcdsWFrr1Y2fi4cPWmeFhIc8Td0pgepAwaDPP2ugFowf5FA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710508719; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=3PuQ6WSEYLWnTCNPDldZo+Ppk/XGMtRnTbQuxwxDUsU=; b=JyJ2KNV060JrptICHJuGtynu/QSnvhEXLlC6frfEK6w9nYxpJb/ha65i3RbCPQgpZA3zpsCplJ4sPy94nH+v2Bo28UlwzDw7S//1TD1S1FcOgommkuIEdwSrsMeUMEUVTi8l8js4ZhJpHXbFs1grdUmiMjZdbiDr5zR3+7e6LNU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1710508719513972.1677353257752; Fri, 15 Mar 2024 06:18:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rl7LN-0001l5-It; Fri, 15 Mar 2024 09:11:29 -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 1rl7KW-0007Hv-OB for qemu-devel@nongnu.org; Fri, 15 Mar 2024 09:10:37 -0400 Received: from mail-ej1-x631.google.com ([2a00:1450:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rl7KQ-00089U-Cr for qemu-devel@nongnu.org; Fri, 15 Mar 2024 09:10:36 -0400 Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-a468616ed70so87817766b.3 for ; Fri, 15 Mar 2024 06:10:29 -0700 (PDT) Received: from m1x-phil.lan ([176.176.145.26]) by smtp.gmail.com with ESMTPSA id jl27-20020a17090775db00b00a45c9945251sm1696627ejc.192.2024.03.15.06.10.26 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 15 Mar 2024 06:10:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710508228; x=1711113028; 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=3PuQ6WSEYLWnTCNPDldZo+Ppk/XGMtRnTbQuxwxDUsU=; b=N8uBIKKOFTKMTS2NhbYeYgKi9oxDwQ82f1F/hTkHPOKcQrXxY2o+Ar74bgtCAG++33 afYmL6YtPS+Dl7GLQ1swVJ8qMN7WDvjoLCknXnWrNBuItICyvI6oC3RrDdS69t9zF/7w 2F/5ROMzWcySpVTOkrpFHY/mUQrAYEWhLdMJb2a83DNE1o6NarOao0o0QVNz4YzzhtFu 3PwdTOOq4Nsl6Kkyw7CS8iqgTvTJbfp0tknt5avEvdfkq3xoLnlP6WdHcQB4+iDcVopZ 6MhduNeaSoNnCkgr51EDrLu0kMs5ivZ4jLFnOjCwuu2lqLWrzFNgdfrFuDVKisjEBule PwbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710508228; x=1711113028; 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=3PuQ6WSEYLWnTCNPDldZo+Ppk/XGMtRnTbQuxwxDUsU=; b=tY63dYRMP1LsTPo+LzONT1daiyomZU8iyLdYmaNVf26xQFY//U4gjorETa6pxaF3NP jQHgbkbHvsWNx4fS6O1fX0q3JbuTxbPCMA3leiitFVeDy8RZHalC46qUiiSbmV9QDZco tGOu7fG+ItKiyE4opk+iU2WCxi/urXNLOKqugCUjJHf4XuVEZouHrgYgldX2im6eUJ4c tP7dSd03g/R58xKjn46NnqAZdf+DnFWvnmJqrK0YcKpDGMfMWv/VQ/9dlN+5FBSBXvR0 mkEVtWOREiboR8fL0AoKbe9IBU3skVcyFWJZklbf6tNPPtt68cdIShoIat/Nt2xeH9he qiYw== X-Gm-Message-State: AOJu0Yyp21e8g8jPcrOy6hZZdHh+bR/fv3iDU35mktc7djTPlage7DxR KIe+8FIMR3AwxOZw/CE2CHSIZ/yRv/wua1WyaAGQTxkc0z7sSmTVDPWTBuWmI1T8wUT42+jpr+w 0 X-Google-Smtp-Source: AGHT+IHgeAMf1+cGAIhix5rGRpA+zqYrLpk7WoUtK15pKAlNv3sQvH3L0f0P3bef1BLZ9RiIeTQhug== X-Received: by 2002:a17:906:f845:b0:a3e:8300:1af3 with SMTP id ks5-20020a170906f84500b00a3e83001af3mr3107382ejb.30.1710508228508; Fri, 15 Mar 2024 06:10:28 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-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=20P=20=2E=20Berrang=C3=A9?= , Paolo Bonzini , Eduardo Habkost , Claudio Fontana , Richard Henderson , Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Manos Pitsidianakis , Zhao Liu , qemu-arm@nongnu.org, Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eric Blake , Marcel Apfelbaum , Yanan Wang Subject: [PATCH-for-9.1 11/21] qapi: Make CpuDefinitionInfo target agnostic Date: Fri, 15 Mar 2024 14:08:59 +0100 Message-ID: <20240315130910.15750-12-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::631; envelope-from=philmd@linaro.org; helo=mail-ej1-x631.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1710508720130100004 Generate the CpuDefinitionInfo type once for all targets. In few commits @query-cpu-definitions will become generic and all target will return their CPUs list. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- qapi/machine-target.json | 69 ---------------------------------------- qapi/machine.json | 63 ++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 69 deletions(-) diff --git a/qapi/machine-target.json b/qapi/machine-target.json index 0412400df3..7480921d33 100644 --- a/qapi/machine-target.json +++ b/qapi/machine-target.json @@ -212,75 +212,6 @@ 'TARGET_LOONGARCH64', 'TARGET_RISCV' ] } } =20 -## -# @CpuDefinitionInfo: -# -# Virtual CPU definition. -# -# @name: the name of the CPU definition -# -# @migration-safe: whether a CPU definition can be safely used for -# migration in combination with a QEMU compatibility machine when -# migrating between different QEMU versions and between hosts with -# different sets of (hardware or software) capabilities. If not -# provided, information is not available and callers should not -# assume the CPU definition to be migration-safe. (since 2.8) -# -# @static: whether a CPU definition is static and will not change -# depending on QEMU version, machine type, machine options and -# accelerator options. A static model is always migration-safe. -# (since 2.8) -# -# @unavailable-features: List of properties that prevent the CPU model -# from running in the current host. (since 2.8) -# -# @typename: Type name that can be used as argument to -# @device-list-properties, to introspect properties configurable -# using -cpu or -global. (since 2.9) -# -# @alias-of: Name of CPU model this model is an alias for. The target -# of the CPU model alias may change depending on the machine type. -# Management software is supposed to translate CPU model aliases -# in the VM configuration, because aliases may stop being -# migration-safe in the future (since 4.1) -# -# @deprecated: If true, this CPU model is deprecated and may be -# removed in in some future version of QEMU according to the QEMU -# deprecation policy. (since 5.2) -# -# @unavailable-features is a list of QOM property names that represent -# CPU model attributes that prevent the CPU from running. If the QOM -# property is read-only, that means there's no known way to make the -# CPU model run in the current host. Implementations that choose not -# to provide specific information return the property name "type". If -# the property is read-write, it means that it MAY be possible to run -# the CPU model in the current host if that property is changed. -# Management software can use it as hints to suggest or choose an -# alternative for the user, or just to generate meaningful error -# messages explaining why the CPU model can't be used. If -# @unavailable-features is an empty list, the CPU model is runnable -# using the current host and machine-type. If @unavailable-features -# is not present, runnability information for the CPU is not -# available. -# -# Since: 1.2 -## -{ 'struct': 'CpuDefinitionInfo', - 'data': { 'name': 'str', - '*migration-safe': 'bool', - 'static': 'bool', - '*unavailable-features': [ 'str' ], - 'typename': 'str', - '*alias-of' : 'str', - 'deprecated' : 'bool' }, - 'if': { 'any': [ 'TARGET_PPC', - 'TARGET_ARM', - 'TARGET_I386', - 'TARGET_S390X', - 'TARGET_MIPS', - 'TARGET_LOONGARCH64', - 'TARGET_RISCV' ] } } - ## # @query-cpu-definitions: # diff --git a/qapi/machine.json b/qapi/machine.json index 65702c2c78..9c44b8fa82 100644 --- a/qapi/machine.json +++ b/qapi/machine.json @@ -10,6 +10,69 @@ =20 { 'include': 'common.json' } =20 +## +# @CpuDefinitionInfo: +# +# Virtual CPU definition. +# +# @name: the name of the CPU definition +# +# @migration-safe: whether a CPU definition can be safely used for +# migration in combination with a QEMU compatibility machine when +# migrating between different QEMU versions and between hosts with +# different sets of (hardware or software) capabilities. If not +# provided, information is not available and callers should not +# assume the CPU definition to be migration-safe. (since 2.8) +# +# @static: whether a CPU definition is static and will not change +# depending on QEMU version, machine type, machine options and +# accelerator options. A static model is always migration-safe. +# (since 2.8) +# +# @unavailable-features: List of properties that prevent the CPU model +# from running in the current host. (since 2.8) +# +# @typename: Type name that can be used as argument to +# @device-list-properties, to introspect properties configurable +# using -cpu or -global. (since 2.9) +# +# @alias-of: Name of CPU model this model is an alias for. The target +# of the CPU model alias may change depending on the machine type. +# Management software is supposed to translate CPU model aliases +# in the VM configuration, because aliases may stop being +# migration-safe in the future (since 4.1) +# +# @deprecated: If true, this CPU model is deprecated and may be +# removed in in some future version of QEMU according to the QEMU +# deprecation policy. (since 5.2) +# +# @unavailable-features is a list of QOM property names that represent +# CPU model attributes that prevent the CPU from running. If the QOM +# property is read-only, that means there's no known way to make the +# CPU model run in the current host. Implementations that choose not +# to provide specific information return the property name "type". If +# the property is read-write, it means that it MAY be possible to run +# the CPU model in the current host if that property is changed. +# Management software can use it as hints to suggest or choose an +# alternative for the user, or just to generate meaningful error +# messages explaining why the CPU model can't be used. If +# @unavailable-features is an empty list, the CPU model is runnable +# using the current host and machine-type. If @unavailable-features +# is not present, runnability information for the CPU is not +# available. +# +# Since: 1.2 +## +{ 'struct': 'CpuDefinitionInfo', + 'data': { 'name': 'str', + '*migration-safe': 'bool', + 'static': 'bool', + '*unavailable-features': [ 'str' ], + 'typename': 'str', + '*alias-of' : 'str', + 'deprecated' : 'bool' } +} + ## # @CpuModelInfo: # --=20 2.41.0 From nobody Wed May 15 23:22:58 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1710508526; cv=none; d=zohomail.com; s=zohoarc; b=XMdrihIFpVcWNC/YxPNMQjVlSrXdA0//tRXqF4N844VMzqE1vs2ZDb0WMYDLlrAgkCPunhQ2kTrDDehjBDEUkG+u2fXjAWtt+2jH0h14WcdxbftYIp+4C23F/bMfGvtYYgFoM78z2vFTFrnwD4k1hHRaf5eDzlNncH1IAZLt06Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710508526; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Ziq2wowWWC1u1AFoZqkoU9Vq9nlm9ySbjwCpiWVML/s=; b=e4CmqiNp3MgzMOTWty8UolfIQYIDXdQ38k1rjrcKB2K789AMkE+RTsNuHsW/N6gxTgaAWIH9bAlHlMs4TiPNbYvUNHG/L8A/SO7GVznQFCA2/a95OTdc0+8p1svB52LhmGUkh4vFs6um9ELKqiNSJijDm6LlZYakixJbxx2Xwas= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1710508526490621.9331041140077; Fri, 15 Mar 2024 06:15:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rl7Kx-00008n-EV; Fri, 15 Mar 2024 09:11:03 -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 1rl7Kh-0007ZW-7K for qemu-devel@nongnu.org; Fri, 15 Mar 2024 09:10:49 -0400 Received: from mail-ej1-x62d.google.com ([2a00:1450:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rl7KX-0008CX-Lu for qemu-devel@nongnu.org; Fri, 15 Mar 2024 09:10:44 -0400 Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-a36126ee41eso254168366b.2 for ; Fri, 15 Mar 2024 06:10:36 -0700 (PDT) Received: from m1x-phil.lan ([176.176.145.26]) by smtp.gmail.com with ESMTPSA id c19-20020a170906341300b00a462736feedsm1691257ejb.62.2024.03.15.06.10.33 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 15 Mar 2024 06:10:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710508235; x=1711113035; 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=Ziq2wowWWC1u1AFoZqkoU9Vq9nlm9ySbjwCpiWVML/s=; b=op75yWP2kBjzzxO4AdYFmO4Wwo0v7v88JOe1Ykk8tAKJ0uI0EFjvxmuiLe0nmavjWX MJVkOvgR18oqw+jMCWtIu7E5CruYbj5uTFZiOdFfOZ37VzhYmpwLTJXyJYO0JCTmlKnJ Czkzl93KzuaVFic86Yf2+OYELIHTTNMivoaIe527tsfKkbf5YkKgEfn1ZZ0Cxp2AuNLh Gu44qFgAQXlZg3lk25436nEktmosFjajJCT5A3HXGkgQJs0XM1Jm12dAf+CyJG9IXyZB yBYDGRgL3AUXmRIgzQ6CtU3pXGijOhy1IhNy2GvuJpP4yOI1M/BL2QJiw737yDPN+QyL csmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710508235; x=1711113035; 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=Ziq2wowWWC1u1AFoZqkoU9Vq9nlm9ySbjwCpiWVML/s=; b=Ofc1QXKuSjB6OC2rkBmZna/4I8ds7WF6Va33wI9XmguVB1B51qaS1u2924gSJ1ebj1 422PErMmRWGDi57/saNSSTCPfBTTnXiyaey89aWONa0jnfXBmG9+ZJYmxFeR5MCtjgAB lT5lIreGZkN4e3R25qofp0Svtv4H4EXv3FSUB9Dg2maMN9U9HinIj9WYMZjfHwUB7dl/ vko2M3NTg7BfWkGK0dRi0SjCI4iv8zYZQjkwEQGgaeNuohgNq7D3Xx9+ZEYvw34J8jua SFHsmhEPMGDqFK1ALnD7KJd3iFL6Xz8mZ+0+Sa4YcGc6/qcJ69HojardylvL4RsTEZOh M2cg== X-Gm-Message-State: AOJu0Yyc74U8eUjvGETCbCaoHAx3ZT09u2Po07c34QZcSXf5dCUEGdyJ mwhrL3SCkmqddQIVUn96xy1zFKg6XBaOeEepHzEDrGePwVEfWyncgklOnRRC8R4SVYR6mBcdvQu v X-Google-Smtp-Source: AGHT+IGM9lKIGYFKaZaCihcgLpVmcmySzlNiRx+Vc9T9AfUSHHHR2fR0Hvp2VtpFFpo3dT3QgLPrVA== X-Received: by 2002:a17:906:40ca:b0:a45:2e21:c776 with SMTP id a10-20020a17090640ca00b00a452e21c776mr3334104ejk.3.1710508235156; Fri, 15 Mar 2024 06:10:35 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-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=20P=20=2E=20Berrang=C3=A9?= , Paolo Bonzini , Eduardo Habkost , Claudio Fontana , Richard Henderson , Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Manos Pitsidianakis , Zhao Liu , qemu-arm@nongnu.org, Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-9.1 12/21] system: Introduce QemuArchBit enum Date: Fri, 15 Mar 2024 14:09:00 +0100 Message-ID: <20240315130910.15750-13-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::62d; envelope-from=philmd@linaro.org; helo=mail-ej1-x62d.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, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=0.01, UPPERCASE_50_75=0.008 autolearn=no 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1710508527276100005 Current QEMU_ARCH_foo definitions are used as masks. Extract the bit values, so we can easily iterate over. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/sysemu/arch_init.h | 69 ++++++++++++++++++++++++++------------ 1 file changed, 47 insertions(+), 22 deletions(-) diff --git a/include/sysemu/arch_init.h b/include/sysemu/arch_init.h index 8850cb1a14..cf597c40a3 100644 --- a/include/sysemu/arch_init.h +++ b/include/sysemu/arch_init.h @@ -1,30 +1,55 @@ #ifndef QEMU_ARCH_INIT_H #define QEMU_ARCH_INIT_H =20 +typedef enum QemuArchBit { + QEMU_ARCH_BIT_ALPHA =3D 0, + QEMU_ARCH_BIT_ARM =3D 1, + QEMU_ARCH_BIT_CRIS =3D 2, + QEMU_ARCH_BIT_I386 =3D 3, + QEMU_ARCH_BIT_M68K =3D 4, + QEMU_ARCH_BIT_MICROBLAZE =3D 6, + QEMU_ARCH_BIT_MIPS =3D 7, + QEMU_ARCH_BIT_PPC =3D 8, + QEMU_ARCH_BIT_S390X =3D 9, + QEMU_ARCH_BIT_SH4 =3D 10, + QEMU_ARCH_BIT_SPARC =3D 11, + QEMU_ARCH_BIT_XTENSA =3D 12, + QEMU_ARCH_BIT_OPENRISC =3D 13, + QEMU_ARCH_BIT_TRICORE =3D 16, + QEMU_ARCH_BIT_NIOS2 =3D 17, + QEMU_ARCH_BIT_HPPA =3D 18, + QEMU_ARCH_BIT_RISCV =3D 19, + QEMU_ARCH_BIT_RX =3D 20, + QEMU_ARCH_BIT_AVR =3D 21, + QEMU_ARCH_BIT_HEXAGON =3D 22, + QEMU_ARCH_BIT_LOONGARCH =3D 23, =20 -enum { + QEMU_ARCH_BIT_LAST =3D QEMU_ARCH_BIT_LOONGARCH +} QemuArchBit; + +enum QemuArchMask { QEMU_ARCH_ALL =3D -1, - QEMU_ARCH_ALPHA =3D (1 << 0), - QEMU_ARCH_ARM =3D (1 << 1), - QEMU_ARCH_CRIS =3D (1 << 2), - QEMU_ARCH_I386 =3D (1 << 3), - QEMU_ARCH_M68K =3D (1 << 4), - QEMU_ARCH_MICROBLAZE =3D (1 << 6), - QEMU_ARCH_MIPS =3D (1 << 7), - QEMU_ARCH_PPC =3D (1 << 8), - QEMU_ARCH_S390X =3D (1 << 9), - QEMU_ARCH_SH4 =3D (1 << 10), - QEMU_ARCH_SPARC =3D (1 << 11), - QEMU_ARCH_XTENSA =3D (1 << 12), - QEMU_ARCH_OPENRISC =3D (1 << 13), - QEMU_ARCH_TRICORE =3D (1 << 16), - QEMU_ARCH_NIOS2 =3D (1 << 17), - QEMU_ARCH_HPPA =3D (1 << 18), - QEMU_ARCH_RISCV =3D (1 << 19), - QEMU_ARCH_RX =3D (1 << 20), - QEMU_ARCH_AVR =3D (1 << 21), - QEMU_ARCH_HEXAGON =3D (1 << 22), - QEMU_ARCH_LOONGARCH =3D (1 << 23), + QEMU_ARCH_ALPHA =3D (1 << QEMU_ARCH_BIT_ALPHA), + QEMU_ARCH_ARM =3D (1 << QEMU_ARCH_BIT_ARM), + QEMU_ARCH_CRIS =3D (1 << QEMU_ARCH_BIT_CRIS), + QEMU_ARCH_I386 =3D (1 << QEMU_ARCH_BIT_I386), + QEMU_ARCH_M68K =3D (1 << QEMU_ARCH_BIT_M68K), + QEMU_ARCH_MICROBLAZE =3D (1 << QEMU_ARCH_BIT_MICROBLAZE), + QEMU_ARCH_MIPS =3D (1 << QEMU_ARCH_BIT_MIPS), + QEMU_ARCH_PPC =3D (1 << QEMU_ARCH_BIT_PPC), + QEMU_ARCH_S390X =3D (1 << QEMU_ARCH_BIT_S390X), + QEMU_ARCH_SH4 =3D (1 << QEMU_ARCH_BIT_SH4), + QEMU_ARCH_SPARC =3D (1 << QEMU_ARCH_BIT_SPARC), + QEMU_ARCH_XTENSA =3D (1 << QEMU_ARCH_BIT_XTENSA), + QEMU_ARCH_OPENRISC =3D (1 << QEMU_ARCH_BIT_OPENRISC), + QEMU_ARCH_TRICORE =3D (1 << QEMU_ARCH_BIT_TRICORE), + QEMU_ARCH_NIOS2 =3D (1 << QEMU_ARCH_BIT_NIOS2), + QEMU_ARCH_HPPA =3D (1 << QEMU_ARCH_BIT_HPPA), + QEMU_ARCH_RISCV =3D (1 << QEMU_ARCH_BIT_RISCV), + QEMU_ARCH_RX =3D (1 << QEMU_ARCH_BIT_RX), + QEMU_ARCH_AVR =3D (1 << QEMU_ARCH_BIT_AVR), + QEMU_ARCH_HEXAGON =3D (1 << QEMU_ARCH_BIT_HEXAGON), + QEMU_ARCH_LOONGARCH =3D (1 << QEMU_ARCH_BIT_LOONGARCH), }; =20 extern const uint32_t arch_type; --=20 2.41.0 From nobody Wed May 15 23:22:58 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1710508354; cv=none; d=zohomail.com; s=zohoarc; b=bknjupIQps4p0YORKHUkLtXWI3sdp5nApd9wQks8I71QT8buzj4W4YDW3pZn9ZYHGc/QQine1f+zFUS9P6i4ipOs73/Wo62vultZOM5uGASP9mGgrvLernxoryu0Ri6B2E1FsT+6RKOxIkkPxqk3VaDbT6ufynTICRtoD/Zimi8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710508354; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=J25HPqsyrmOQ1iioSn9g7nmBc+Xq8CsuJB3WGvQV87Y=; b=kZCe881cVnswCfs3XCbn/I0ec2WJ1a0B/VDC/tKSWNx3KEfTxmLycniXeLfvZZhZ3T0+PWOr5AC64MLt1Zh0ZRRjbCkZ2WGOS8shWwIOpqym3uAWep2twrTEFMx662pBHCcabBPXPJvdTgOq21Y/CTTosSIarXxBGl+Qh8/3GVI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1710508354852142.76635457477607; Fri, 15 Mar 2024 06:12:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rl7L9-0000ko-JW; Fri, 15 Mar 2024 09:11:15 -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 1rl7Kq-0007pM-4r for qemu-devel@nongnu.org; Fri, 15 Mar 2024 09:10:56 -0400 Received: from mail-lj1-x231.google.com ([2a00:1450:4864:20::231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rl7Kh-0008OW-N5 for qemu-devel@nongnu.org; Fri, 15 Mar 2024 09:10:51 -0400 Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-2d2505352e6so23328061fa.3 for ; Fri, 15 Mar 2024 06:10:43 -0700 (PDT) Received: from m1x-phil.lan ([176.176.145.26]) by smtp.gmail.com with ESMTPSA id l23-20020a1709065a9700b00a460040a102sm1670235ejq.124.2024.03.15.06.10.39 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 15 Mar 2024 06:10:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710508242; x=1711113042; 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=J25HPqsyrmOQ1iioSn9g7nmBc+Xq8CsuJB3WGvQV87Y=; b=Vi27EO75DlJiqo/Ja2Yu1gvvOfJoqPZMmfBJWXQZ3xQJKEN6K9Z5xtpRzuOOApi9h+ CQJkzAFktpzv/Fl9+xFPFNLFbdnZn9FLP95wbAXYGylB9/NMv+6c4tkbW0DgYPFr4Z4R 2Jql/IoxdTqS9Wu/VRFxLwFBUKVdt3mTzQCQ8dMl88PBUm5XlaTy2NnwwmJ9BZF2QDT6 WvBI4wJiwxcXMvcenhJChApo1Hsy403pKwo06V2fnRnEaMG4jXi/bCFredKo+aqrh5pd rGgITL0wuytDWPo04vs7YUdH7+t77tTkKnbaj6Z3KaADvwE+kWCeB3ACpq0PyT33VEM+ jCgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710508242; x=1711113042; 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=J25HPqsyrmOQ1iioSn9g7nmBc+Xq8CsuJB3WGvQV87Y=; b=hl/8wJX9axlKx3V/lWGGLIgcXUS59Zg39Zkv7XfW8Y8fW6azhdVZZ1yunWBSvQoa9k 27Zhw3GOk8tP9qeK0zQdoVP2SBtZUqhz7r4aYDIGosrrPB4WI7BFqxTIuILSJNFOIHIw dAOoO1+/PgSvksaWfzIh+GRC62bHkZTbv53JnFjmthQKgL3K1UjClKzvf3BrGSUV8YmN qUwT/8Kkn3nZbKRKcDD60+IR5hFL5lmiJdbRNzMxfpKl1h1kt8OD/nBsja5cNgGVnvPZ V3kvUCPoXs0wWJ+thaJFtbZ9boga6G3sG8L0kJxwWasuVA3Trb0h3iTPFTND7ZvNBUoV sbVg== X-Gm-Message-State: AOJu0YwAYoi6MYLeY97i1kh8wKVQKba8P7RpBnURRV7M0vSwWx0/FXpU Q49nZcoVn/RuGa0KByFIpeSAqHotv6Fpf3hmnaOgMknWlAaEYwiDFwX9yfq9t/1oMVL73eQnbhi Y X-Google-Smtp-Source: AGHT+IEv3LwWoidfawbI4h9yAjYbFyjy4RfVu/IFC9ezcLGHzfJWoWogtJbH4nZ9k43Uxgvez5OUAA== X-Received: by 2002:a05:651c:23a:b0:2d3:3b37:db78 with SMTP id z26-20020a05651c023a00b002d33b37db78mr2967826ljn.16.1710508241796; Fri, 15 Mar 2024 06:10:41 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-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=20P=20=2E=20Berrang=C3=A9?= , Paolo Bonzini , Eduardo Habkost , Claudio Fontana , Richard Henderson , Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Manos Pitsidianakis , Zhao Liu , qemu-arm@nongnu.org, Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-9.1 13/21] system: Introduce cpu_typename_by_arch_bit() Date: Fri, 15 Mar 2024 14:09:01 +0100 Message-ID: <20240315130910.15750-14-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::231; envelope-from=philmd@linaro.org; helo=mail-lj1-x231.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1710508355684100001 Introduce a helper to return the CPU type name given a QemuArchBit. The TYPE_PPC_CPU target have different 32/64-bit definitions so we can not include it yet. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- --- MAINTAINERS | 1 + include/sysemu/arch_init.h | 2 ++ system/cpu-qom-helpers.c | 58 ++++++++++++++++++++++++++++++++++++++ system/meson.build | 1 + 4 files changed, 62 insertions(+) create mode 100644 system/cpu-qom-helpers.c diff --git a/MAINTAINERS b/MAINTAINERS index ed98814398..af27490243 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -148,6 +148,7 @@ M: Richard Henderson R: Paolo Bonzini S: Maintained F: system/cpus.c +F: system/cpu-qom-helpers.c F: system/watchpoint.c F: cpu-common.c F: cpu-target.c diff --git a/include/sysemu/arch_init.h b/include/sysemu/arch_init.h index cf597c40a3..1874f18e67 100644 --- a/include/sysemu/arch_init.h +++ b/include/sysemu/arch_init.h @@ -27,6 +27,8 @@ typedef enum QemuArchBit { QEMU_ARCH_BIT_LAST =3D QEMU_ARCH_BIT_LOONGARCH } QemuArchBit; =20 +const char *cpu_typename_by_arch_bit(QemuArchBit arch_bit); + enum QemuArchMask { QEMU_ARCH_ALL =3D -1, QEMU_ARCH_ALPHA =3D (1 << QEMU_ARCH_BIT_ALPHA), diff --git a/system/cpu-qom-helpers.c b/system/cpu-qom-helpers.c new file mode 100644 index 0000000000..0d402ee3a0 --- /dev/null +++ b/system/cpu-qom-helpers.c @@ -0,0 +1,58 @@ +/* + * Helpers for CPU QOM types + * + * SPDX-FileCopyrightText: 2024 Linaro Ltd. + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "sysemu/arch_init.h" + +#include "target/alpha/cpu-qom.h" +#include "target/arm/cpu-qom.h" +#include "target/avr/cpu-qom.h" +#include "target/cris/cpu-qom.h" +#include "target/hexagon/cpu-qom.h" +#include "target/hppa/cpu-qom.h" +#include "target/i386/cpu-qom.h" +#include "target/loongarch/cpu-qom.h" +#include "target/m68k/cpu-qom.h" +#include "target/microblaze/cpu-qom.h" +#include "target/mips/cpu-qom.h" +#include "target/nios2/cpu-qom.h" +#include "target/openrisc/cpu-qom.h" +#include "target/riscv/cpu-qom.h" +#include "target/rx/cpu-qom.h" +#include "target/s390x/cpu-qom.h" +#include "target/sparc/cpu-qom.h" +#include "target/sh4/cpu-qom.h" +#include "target/tricore/cpu-qom.h" +#include "target/xtensa/cpu-qom.h" + +const char *cpu_typename_by_arch_bit(QemuArchBit arch_bit) +{ + static const char *cpu_bit_to_typename[QEMU_ARCH_BIT_LAST + 1] =3D { + [QEMU_ARCH_BIT_ALPHA] =3D TYPE_ALPHA_CPU, + [QEMU_ARCH_BIT_ARM] =3D TYPE_ARM_CPU, + [QEMU_ARCH_BIT_CRIS] =3D TYPE_CRIS_CPU, + [QEMU_ARCH_BIT_I386] =3D TYPE_I386_CPU, + [QEMU_ARCH_BIT_M68K] =3D TYPE_M68K_CPU, + [QEMU_ARCH_BIT_MICROBLAZE] =3D TYPE_MICROBLAZE_CPU, + [QEMU_ARCH_BIT_MIPS] =3D TYPE_MIPS_CPU, + /* TODO: TYPE_PPC_CPU */ + [QEMU_ARCH_BIT_S390X] =3D TYPE_S390_CPU, + [QEMU_ARCH_BIT_SH4] =3D TYPE_SUPERH_CPU, + [QEMU_ARCH_BIT_SPARC] =3D TYPE_SPARC_CPU, + [QEMU_ARCH_BIT_XTENSA] =3D TYPE_XTENSA_CPU, + [QEMU_ARCH_BIT_OPENRISC] =3D TYPE_OPENRISC_CPU, + [QEMU_ARCH_BIT_TRICORE] =3D TYPE_TRICORE_CPU, + [QEMU_ARCH_BIT_NIOS2] =3D TYPE_NIOS2_CPU, + [QEMU_ARCH_BIT_HPPA] =3D TYPE_HPPA_CPU, + [QEMU_ARCH_BIT_RISCV] =3D TYPE_RISCV_CPU, + [QEMU_ARCH_BIT_RX] =3D TYPE_RX_CPU, + [QEMU_ARCH_BIT_AVR] =3D TYPE_AVR_CPU, + [QEMU_ARCH_BIT_HEXAGON] =3D TYPE_HEXAGON_CPU, + [QEMU_ARCH_BIT_LOONGARCH] =3D TYPE_LOONGARCH_CPU, + }; + return cpu_bit_to_typename[arch_bit]; +} diff --git a/system/meson.build b/system/meson.build index 25e2117250..c6ee97e3b2 100644 --- a/system/meson.build +++ b/system/meson.build @@ -10,6 +10,7 @@ system_ss.add(files( 'balloon.c', 'bootdevice.c', 'cpus.c', + 'cpu-qom-helpers.c', 'cpu-throttle.c', 'cpu-timers.c', 'datadir.c', --=20 2.41.0 From nobody Wed May 15 23:22:58 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1710508436; cv=none; d=zohomail.com; s=zohoarc; b=CXYBt+8b66rC2qUpbi0MJ/F0HYFb4q0tv9VM8BBjffcQ6B1rxMEBdP18c7F9Olrox7c+GXhf3ZO+gUfc3Ivb9B4465pN6s1DDU7/mrOUgTTaT0TcqcrqbvvLTerWTMdLkbhd5JInuAoeLx+Wr9gXwVdyynvqgb5CxAtDf9BLLKY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710508436; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=H3LBH1Jf2Bo2/j/14kl9+1lHNfd8WjvuONiFN4gQJjI=; b=iH6j/FVT2i1RQPnvC2dFTWxR17nyGe8Le9nuMiMsvSvo1DC5zEOXNxqdENDR8rFCQ2eUVzKP46spsvVyQcKoYOh48tpQpYswBdfxIvQHcNiJwl3rN0jByPltlICfh5Ujgyhltxa8OTp3L+livqdNdTY7VIdGhiAVjnvdrxk24bI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1710508436670695.37975557529; Fri, 15 Mar 2024 06:13:56 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rl7LR-000200-GO; Fri, 15 Mar 2024 09:11:33 -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 1rl7Kq-0007qa-Ar for qemu-devel@nongnu.org; Fri, 15 Mar 2024 09:10:56 -0400 Received: from mail-ej1-x62b.google.com ([2a00:1450:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rl7Kl-0008Pu-JA for qemu-devel@nongnu.org; Fri, 15 Mar 2024 09:10:55 -0400 Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-a44f2d894b7so231494766b.1 for ; Fri, 15 Mar 2024 06:10:50 -0700 (PDT) Received: from m1x-phil.lan ([176.176.145.26]) by smtp.gmail.com with ESMTPSA id gx27-20020a1709068a5b00b00a465fd3977esm1730440ejc.143.2024.03.15.06.10.46 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 15 Mar 2024 06:10:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710508249; x=1711113049; 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=H3LBH1Jf2Bo2/j/14kl9+1lHNfd8WjvuONiFN4gQJjI=; b=v7clIY/q2s1P/Qy1D4Nt55qouMyVa3D5qnVsqZPiZ1UwOkqaDWch3UMiVrSrGr0wWc eJSU/bxY+cBZ4Zk+cq0MZcdBCmCNeWUsXg4DHwmWY6YH4Hv2CEo4R7iFX+AekeNTE+eR bKvGasWoIAaz7elcMJeIzWLG9d9oAkG+X5iwmLEI2NmEyiJhN8R7sErv9rINnI534Zui SHFIZnIe4sPz8SIxcWrskg34ESHMbuzumS5Y8mxyjo5ML+CWMyuQ8PyCi065OnzJMKLX 6rM4Q24TKjiILm7hwwnUg89/CDplEhnsgIq+UkddG8hQsuW1LWM+1JUpHe1A3kSVD0V3 SH+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710508249; x=1711113049; 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=H3LBH1Jf2Bo2/j/14kl9+1lHNfd8WjvuONiFN4gQJjI=; b=Xg5abXaJ+u7436+jM3lTjweqtoKocbDABtHt4upyGjh7OApCaU1h55OQlSLaJUYp4I vXjQ8EcOTtc5T0QatMLhJF4aqScrbs+P31tH8BCq6xjUMt48mA1cKUMwZKIU2G5K9pxf t1hbfLpUP3ka5UaKAIbO8zv4Ndgrj+fAxs8zu7rDYr7R3MDk6hSrthnw31Vbucb1W+Q7 n89t69uU70HS4vVYeslXkvPAMAUsqyaea9iLWKQP5Ph0L+S3GrFJpKaCfCu4sHlUZG5y 1mBOmOVsPqE27tttBrRZW8zj+0vkYAEF7GjeYVz8O/1AR4SgMAk+FeNvFypLjr7/Bch6 /ZbQ== X-Gm-Message-State: AOJu0Ywm2K4Ovjeg75LIO1KhJ3sP4VBrmsapAIStzJA7MxflMQnMWBA0 MprRfculUGRrOtVXmPot77R2iRc9njtw7vLoGWmFMAi2MQfZgLZjrW63txveHeKSx0yvtW/Etpp S X-Google-Smtp-Source: AGHT+IHT0ljMv+ZylpuooIW3Z37sPNxE+a2hhO+L1RZyKrqkhraPNn7FD79q/JmglujaaRO/o6TY3g== X-Received: by 2002:a17:907:7d8f:b0:a46:98a5:ba58 with SMTP id oz15-20020a1709077d8f00b00a4698a5ba58mr459522ejc.40.1710508248931; Fri, 15 Mar 2024 06:10:48 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-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=20P=20=2E=20Berrang=C3=A9?= , Paolo Bonzini , Eduardo Habkost , Claudio Fontana , Richard Henderson , Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Manos Pitsidianakis , Zhao Liu , qemu-arm@nongnu.org, Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Michael Roth Subject: [RFC PATCH-for-9.1 14/21] system: Introduce QMP generic_query_cpu_definitions() Date: Fri, 15 Mar 2024 14:09:02 +0100 Message-ID: <20240315130910.15750-15-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::62b; envelope-from=philmd@linaro.org; helo=mail-ej1-x62b.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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1710508436923100001 Each target use a common template for qmp_query_cpu_definitions(). Extract it as generic_query_cpu_definitions(), keeping the target-specific implementations as the following SysemuCPUOps handlers: - cpu_list_compare() - add_definition() - add_alias_definitions() Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- MAINTAINERS | 2 + include/hw/core/sysemu-cpu-ops.h | 14 ++++++ include/qapi/commands-target-compat.h | 14 ++++++ system/cpu-qmp-cmds.c | 71 +++++++++++++++++++++++++++ system/meson.build | 1 + 5 files changed, 102 insertions(+) create mode 100644 include/qapi/commands-target-compat.h create mode 100644 system/cpu-qmp-cmds.c diff --git a/MAINTAINERS b/MAINTAINERS index af27490243..39d7c14d98 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -148,6 +148,7 @@ M: Richard Henderson R: Paolo Bonzini S: Maintained F: system/cpus.c +F: system/cpu-qmp-cmds.c F: system/cpu-qom-helpers.c F: system/watchpoint.c F: cpu-common.c @@ -1894,6 +1895,7 @@ F: qapi/machine-target.json F: include/hw/boards.h F: include/hw/core/cpu.h F: include/hw/cpu/cluster.h +F: include/qapi/commands-target-compat.h F: include/sysemu/numa.h F: tests/unit/test-smp-parse.c T: git https://gitlab.com/ehabkost/qemu.git machine-next diff --git a/include/hw/core/sysemu-cpu-ops.h b/include/hw/core/sysemu-cpu-= ops.h index 24d003fe04..2173226e97 100644 --- a/include/hw/core/sysemu-cpu-ops.h +++ b/include/hw/core/sysemu-cpu-ops.h @@ -11,6 +11,7 @@ #define SYSEMU_CPU_OPS_H =20 #include "hw/core/cpu.h" +#include "qapi/qapi-types-machine.h" =20 /* * struct SysemuCPUOps: System operations specific to a CPU class @@ -81,6 +82,19 @@ typedef struct SysemuCPUOps { */ bool (*virtio_is_big_endian)(CPUState *cpu); =20 + /** + * @cpu_list_compare: Sort alphabetically by type name, + * respecting CPUClass::ordering. + */ + gint (*cpu_list_compare)(gconstpointer cpu_class_a, gconstpointer cpu_= class_b); + /** + * @add_definition: Add the @cpu_class definition to @cpu_list. + */ + void (*add_definition)(gpointer cpu_class, gpointer cpu_list); + /** + * @add_alias_definitions: Add CPU alias definitions to @cpu_list. + */ + void (*add_alias_definitions)(CpuDefinitionInfoList **cpu_list); /** * @legacy_vmsd: Legacy state for migration. * Do not use in new targets, use #DeviceClass::vmsd ins= tead. diff --git a/include/qapi/commands-target-compat.h b/include/qapi/commands-= target-compat.h new file mode 100644 index 0000000000..86d45d8fcc --- /dev/null +++ b/include/qapi/commands-target-compat.h @@ -0,0 +1,14 @@ +/* + * QAPI helpers for target specific QMP commands + * + * SPDX-FileCopyrightText: 2024 Linaro Ltd. + * SPDX-License-Identifier: GPL-2.0-or-later + */ +#ifndef QAPI_COMPAT_TARGET_H +#define QAPI_COMPAT_TARGET_H + +#include "qapi/qapi-types-machine.h" + +CpuDefinitionInfoList *generic_query_cpu_definitions(Error **errp); + +#endif diff --git a/system/cpu-qmp-cmds.c b/system/cpu-qmp-cmds.c new file mode 100644 index 0000000000..daeb131159 --- /dev/null +++ b/system/cpu-qmp-cmds.c @@ -0,0 +1,71 @@ +/* + * QAPI helpers for target specific QMP commands + * + * SPDX-FileCopyrightText: 2024 Linaro Ltd. + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "qom/object.h" +#include "qapi/commands-target-compat.h" +#include "sysemu/arch_init.h" +#include "hw/core/cpu.h" +#include "hw/core/sysemu-cpu-ops.h" + +static void cpu_common_add_definition(gpointer data, gpointer user_data) +{ + ObjectClass *oc =3D data; + CpuDefinitionInfoList **cpu_list =3D user_data; + CpuDefinitionInfo *info; + const char *typename; + + typename =3D object_class_get_name(oc); + info =3D g_malloc0(sizeof(*info)); + info->name =3D cpu_model_from_type(typename); + info->q_typename =3D g_strdup(typename); + + QAPI_LIST_PREPEND(*cpu_list, info); +} + +static void arch_add_cpu_definitions(CpuDefinitionInfoList **cpu_list, + const char *cpu_typename) +{ + ObjectClass *oc; + GSList *list; + const struct SysemuCPUOps *ops; + + oc =3D object_class_by_name(cpu_typename); + if (!oc) { + return; + } + ops =3D CPU_CLASS(oc)->sysemu_ops; + + list =3D object_class_get_list(cpu_typename, false); + if (ops->cpu_list_compare) { + list =3D g_slist_sort(list, ops->cpu_list_compare); + } + g_slist_foreach(list, ops->add_definition ? : cpu_common_add_definitio= n, + cpu_list); + g_slist_free(list); + + if (ops->add_alias_definitions) { + ops->add_alias_definitions(cpu_list); + } +} + +CpuDefinitionInfoList *generic_query_cpu_definitions(Error **errp) +{ + CpuDefinitionInfoList *cpu_list =3D NULL; + + for (unsigned i =3D 0; i <=3D QEMU_ARCH_BIT_LAST; i++) { + const char *cpu_typename; + + cpu_typename =3D cpu_typename_by_arch_bit(i); + if (!cpu_typename) { + continue; + } + arch_add_cpu_definitions(&cpu_list, cpu_typename); + } + + return cpu_list; +} diff --git a/system/meson.build b/system/meson.build index c6ee97e3b2..dd78caa9b7 100644 --- a/system/meson.build +++ b/system/meson.build @@ -10,6 +10,7 @@ system_ss.add(files( 'balloon.c', 'bootdevice.c', 'cpus.c', + 'cpu-qmp-cmds.c', 'cpu-qom-helpers.c', 'cpu-throttle.c', 'cpu-timers.c', --=20 2.41.0 From nobody Wed May 15 23:22:58 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1710508713; cv=none; d=zohomail.com; s=zohoarc; b=WaQ94xEnVhM85sljrXOsCjjCIIFLbf3k76YVF+TS6gQv8R2v92toT3LO4kjSJGIh9hi8qJM3EuRQXtISVzDPUdAxUkFT7Jy1G5YLpSwL7lL8V/YcOV581K4ZCcpPY1UmM0rjvFZsb5zlXo/P4lEFldgEO1ShijQS5BA6CxCZv2Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710508713; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=XKSoPbdfR84sDrdE++VJn8/NPQXAflULbgNG03R7vOs=; b=RhwHkT0SOahln0HXgG6KcrbsoB6VSEDCp1b/GGVBiNKm982t15Qx1mTSqyj7hqEpCmou3Z+27EjH4Uqv+ge6F/OcpQAHFOXHmX1ve5ZUBmXQnr3khviX71k5EH0+VdQEQ4YIXxmH9OWSNyRqmJt846SH0Gv0mqb+5UX+i2L8+sU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 171050871378064.20151071062605; Fri, 15 Mar 2024 06:18:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rl7LT-000259-UV; Fri, 15 Mar 2024 09:11:35 -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 1rl7Ku-0008JC-Cd for qemu-devel@nongnu.org; Fri, 15 Mar 2024 09:11:00 -0400 Received: from mail-ed1-x52f.google.com ([2a00:1450:4864:20::52f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rl7Kr-0008S2-Bi for qemu-devel@nongnu.org; Fri, 15 Mar 2024 09:10:59 -0400 Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-565c6cf4819so5313618a12.1 for ; Fri, 15 Mar 2024 06:10:56 -0700 (PDT) Received: from m1x-phil.lan ([176.176.145.26]) by smtp.gmail.com with ESMTPSA id sa15-20020a1709076d0f00b00a45bbeeea9asm1681047ejc.167.2024.03.15.06.10.53 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 15 Mar 2024 06:10:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710508255; x=1711113055; 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=XKSoPbdfR84sDrdE++VJn8/NPQXAflULbgNG03R7vOs=; b=GJdmN5QdeNlSHjlc1eKHQ7df0nIAbPKjenT+oX55U5TcaLNyjnHeQP/mf2mcoNgefV 3/0N5Gq9dp5+q73f8R90qT5BtgchnGqcvGsrYsntQBibTnpNB5kiGKZtSRwa/CF/ZhKF gnZqEJ/ER1wySAZ3pXE5H8htSt3QVSzQYKFkWazihql/bvkK8lU7VwuXPgBN2Gd/BhRE +K/31cInbp7bBSTKIRL+i3ArrwMr93NkjnyDHtrd88JtCFGRr2wgggocnB2pbSQYL5aK dVmEQD7R10hMyhcYj+HeoXKB/cyQLM2PD3sv5s5o2bgsf1Rhx93zmJJ3/5oLbJbH9HJB IcKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710508255; x=1711113055; 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=XKSoPbdfR84sDrdE++VJn8/NPQXAflULbgNG03R7vOs=; b=atZchh4oiajVyyjjNYzsEr582si7DREMC0BORHzZvKgYiOOpO96teAPL04sJ8JBgFB yaeeIEZBLWJBOemvBCODirfHe0aFkJMtWakx0KN9oEiyJiZCkU5opR9kRZRK3vNJOihc G5JlV/sMYKSjUKVDAakIahY4HFyD6hq+5fUeQZwEG7ycKjZ+HnBar+tNYB0iHks/auCf up4FCtK3FIKbyskZ88Baw6s8ffc4iWVQHffIxeNLVoDT+wx2H2YtggCLdxopRgtLi+iv 9s2HwhJEiseQhUzSO36/3oAWVlSqzD/b9s3k03zkf7fuLpcbtJyheuWPawfVQhh26YyB 6tOA== X-Gm-Message-State: AOJu0YyzbGrwGr53DX8HcUqVfImSijciP4Kq3GKTtmPCh4wM4t4OLMOr pKcseIHKaESa7iqJS1w3jzS+9J+DrC8yi/3eSlhoYmITgJeg17qVnmGHOG/9matPWyC65Z1tfHw h X-Google-Smtp-Source: AGHT+IHYyeLEfVVgN9kci+ZeRoPz5G6i50JiPnnqzD2jONHSLkszD0RljwqLECh5RRITNdvEpl0ANg== X-Received: by 2002:a17:906:5a95:b0:a46:74fe:9177 with SMTP id l21-20020a1709065a9500b00a4674fe9177mr3636958ejq.21.1710508255621; Fri, 15 Mar 2024 06:10:55 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-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=20P=20=2E=20Berrang=C3=A9?= , Paolo Bonzini , Eduardo Habkost , Claudio Fontana , Richard Henderson , Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Manos Pitsidianakis , Zhao Liu , qemu-arm@nongnu.org, Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [RFC PATCH-for-9.1 15/21] target/arm: Use QMP generic_query_cpu_definitions() Date: Fri, 15 Mar 2024 14:09:03 +0100 Message-ID: <20240315130910.15750-16-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::52f; envelope-from=philmd@linaro.org; helo=mail-ed1-x52f.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1710508716024100003 Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- target/arm/arm-qmp-cmds.c | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/target/arm/arm-qmp-cmds.c b/target/arm/arm-qmp-cmds.c index 3cc8cc738b..c5091e64ec 100644 --- a/target/arm/arm-qmp-cmds.c +++ b/target/arm/arm-qmp-cmds.c @@ -28,6 +28,7 @@ #include "qapi/qobject-input-visitor.h" #include "qapi/qapi-commands-machine-target.h" #include "qapi/qapi-commands-misc-target.h" +#include "qapi/commands-target-compat.h" #include "qapi/qmp/qdict.h" #include "qom/qom-qobject.h" =20 @@ -220,29 +221,7 @@ CpuModelExpansionInfo *qmp_query_cpu_model_expansion(C= puModelExpansionType type, return expansion_info; } =20 -static void arm_cpu_add_definition(gpointer data, gpointer user_data) -{ - ObjectClass *oc =3D data; - CpuDefinitionInfoList **cpu_list =3D user_data; - CpuDefinitionInfo *info; - const char *typename; - - typename =3D object_class_get_name(oc); - info =3D g_malloc0(sizeof(*info)); - info->name =3D cpu_model_from_type(typename); - info->q_typename =3D g_strdup(typename); - - QAPI_LIST_PREPEND(*cpu_list, info); -} - CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) { - CpuDefinitionInfoList *cpu_list =3D NULL; - GSList *list; - - list =3D object_class_get_list(TYPE_ARM_CPU, false); - g_slist_foreach(list, arm_cpu_add_definition, &cpu_list); - g_slist_free(list); - - return cpu_list; + return generic_query_cpu_definitions(errp); } --=20 2.41.0 From nobody Wed May 15 23:22:58 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1710508326; cv=none; d=zohomail.com; s=zohoarc; b=fpx7y4SiWjL+vpxZYPiD7OwV4wydjuC5sopiP98Vth9+YFCRlpZssn0cVHZ3H76kxyjLvLw/34BZMRqJDbz+tjXnXAu4poxVPoDpeAc3QKzzDUlok5U7c0NyugzqiLSZcLh3pszyV5v6d2f50DvFxCHeGi1hXVHt1nGRjJvfYFA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710508326; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=9q6xaVyoPJIMQfl186LF5IP9vgj5sXw3ui9Yz0YXC2Q=; b=Jg9w+Mu9iKXhf4Uom0JWw/0nd0sNirZxnQOUfpCW2i5Q5uPKNP1NNOyQ4WDvxV9EGotKg1RQsQZXYim1AQkOT1xODwkRFl8U8stO/MRt7fMFsdrwC2HlFIwvDTUTGS7+eMVY3QS09MJxqWXKOPmZF9Lx4lbK0PXd4+QVv+whW3Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1710508325952779.7528451440729; Fri, 15 Mar 2024 06:12:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rl7LG-00013U-FN; Fri, 15 Mar 2024 09:11:22 -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 1rl7L1-0000LC-12 for qemu-devel@nongnu.org; Fri, 15 Mar 2024 09:11:07 -0400 Received: from mail-lj1-x229.google.com ([2a00:1450:4864:20::229]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rl7Ky-0008UE-3L for qemu-devel@nongnu.org; Fri, 15 Mar 2024 09:11:06 -0400 Received: by mail-lj1-x229.google.com with SMTP id 38308e7fff4ca-2d48d75ab70so7099441fa.0 for ; Fri, 15 Mar 2024 06:11:03 -0700 (PDT) Received: from m1x-phil.lan ([176.176.145.26]) by smtp.gmail.com with ESMTPSA id d4-20020aa7d5c4000000b0056711540692sm1656538eds.79.2024.03.15.06.11.00 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 15 Mar 2024 06:11:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710508262; x=1711113062; 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=9q6xaVyoPJIMQfl186LF5IP9vgj5sXw3ui9Yz0YXC2Q=; b=TMVOa6AS5DHcYj9w4EjFpStIyqMpbkGn81Fb5r7+qlYyQ4rTH+i+rSeLABMphE+KLN 8Zao5q1pbPFsXliXcmAMyRqM6/W+iBlnktK4DvSz6Is9eElfCqt6N0rxUZ6GXfTDGent p+oJjqjfasjEUcD/J2jrd6JmA5wyD6mAhYebqHmsc2fQd+1GSe4PGghlP6tWyc5DAAwQ WCJHKy32JsDYdxb1D8clU3ws1TSBnI652+pNexEzEnFoOzyzj68k2KkQzDp66anCz1ib a2q26oyfKaBKfJSl/sWZwWrlAvBfS4EIs/nRE8tlC4fw3vAhS1A+xeXAGr2aOLPwzj/q ilWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710508262; x=1711113062; 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=9q6xaVyoPJIMQfl186LF5IP9vgj5sXw3ui9Yz0YXC2Q=; b=bxOEOBysOmNRDl6Hr+dCiHYGNwnxKk/veOg0SnX5HVGtfBmU03zObsUcLfJ7o84tYb jRf2aLXFnJw1QjBnP3FdxQL0mIIYUpvs8znlFL6cV+7937KZD0F7pgEXZsrqMw5ucBPS +vKNY9zh3+qz2KWCehcm50rrJ8LkNSAvhXiXo8fB9oUSlrUcd2u1s/v6b7A6zUGXZVT+ AUITwPMRbmB1FOAo+d6TOYvAZsZ9Q0gp4ZqTc02OPgY7d9ad2/fGLl4eM4EawHujZ9U8 y39I4J1jWkYt4lP3xqHURHNyZ/rRiklFMAktSq4AC09rk9GX/++QAuZ0/JLcrgVO/EDJ HyFA== X-Gm-Message-State: AOJu0Ywk303jt0gu7O0AvDY4r1kySdDld22xgLFhat8ALICrPXIXpVoc zZasMcfOkDEG2Mz998Ro9Py9XRAMYVY+pcVY36Sx7sBXJX2rKbwtC/eQwJCPMOsaVK4Cpnq3cEB K X-Google-Smtp-Source: AGHT+IGug9mMTyD+ClS5FiGdRLYqtGhTbiwMx2zP8ulnJSipWbsuMSAlqPeuMtp7D26lqxqXlTB4Zw== X-Received: by 2002:a2e:a9a6:0:b0:2d2:65b9:b420 with SMTP id x38-20020a2ea9a6000000b002d265b9b420mr4153813ljq.1.1710508262292; Fri, 15 Mar 2024 06:11:02 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-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=20P=20=2E=20Berrang=C3=A9?= , Paolo Bonzini , Eduardo Habkost , Claudio Fontana , Richard Henderson , Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Manos Pitsidianakis , Zhao Liu , qemu-arm@nongnu.org, Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Song Gao Subject: [RFC PATCH-for-9.1 16/21] target/loongarch: Use QMP generic_query_cpu_definitions() Date: Fri, 15 Mar 2024 14:09:04 +0100 Message-ID: <20240315130910.15750-17-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::229; envelope-from=philmd@linaro.org; helo=mail-lj1-x229.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1710508327586100003 Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- target/loongarch/loongarch-qmp-cmds.c | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/target/loongarch/loongarch-qmp-cmds.c b/target/loongarch/loong= arch-qmp-cmds.c index 8721a5eb13..ef5aedc1cd 100644 --- a/target/loongarch/loongarch-qmp-cmds.c +++ b/target/loongarch/loongarch-qmp-cmds.c @@ -9,34 +9,15 @@ #include "qemu/osdep.h" #include "qapi/error.h" #include "qapi/qapi-commands-machine-target.h" +#include "qapi/commands-target-compat.h" #include "cpu.h" #include "qapi/qmp/qdict.h" #include "qapi/qobject-input-visitor.h" #include "qom/qom-qobject.h" =20 -static void loongarch_cpu_add_definition(gpointer data, gpointer user_data) -{ - ObjectClass *oc =3D data; - CpuDefinitionInfoList **cpu_list =3D user_data; - CpuDefinitionInfo *info =3D g_new0(CpuDefinitionInfo, 1); - const char *typename =3D object_class_get_name(oc); - - info->name =3D cpu_model_from_type(typename); - info->q_typename =3D g_strdup(typename); - - QAPI_LIST_PREPEND(*cpu_list, info); -} - CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) { - CpuDefinitionInfoList *cpu_list =3D NULL; - GSList *list; - - list =3D object_class_get_list(TYPE_LOONGARCH_CPU, false); - g_slist_foreach(list, loongarch_cpu_add_definition, &cpu_list); - g_slist_free(list); - - return cpu_list; + return generic_query_cpu_definitions(errp); } =20 static const char *cpu_model_advertised_features[] =3D { --=20 2.41.0 From nobody Wed May 15 23:22:58 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1710508754; cv=none; d=zohomail.com; s=zohoarc; b=JFzc73jxxf9iV3aq5TJMP7tNvX6EUeQsjAhACW8t//SH32whdK7UAazAWlqiz5dEreiTwYZK00RwdWtnc/Qg19GFRmLD3ximDk74Vc8bviAWYIWY1JHuEhNWPjYggn+o34szttDa6gz/SyxH6YGXgltZX4gpUfWLj9qeaB76DNA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710508754; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=oFQX8aoXPy4f67f4Z4hL1RP4Zt/8Mcsow7bhGPOckjM=; b=UIa6lfwufheSbZc4VGY+kC06Cvi69eVlYXqW6Za2Aq+1k2g9FJgQLoaPQQr1wPMMC0rbDdcIiDlH/dzntB5SR11ADJcN5Onmg1WzSqHFeip6yvCOHeLT7+1mjrOkXx0j6d+FSUYsK2GwdcNH0nxh12YZT//iW5+EKJnY4qm7SLQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1710508754269800.0277667891386; Fri, 15 Mar 2024 06:19:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rl7LN-0001jo-8l; Fri, 15 Mar 2024 09:11:29 -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 1rl7L9-0000jH-7E for qemu-devel@nongnu.org; Fri, 15 Mar 2024 09:11:15 -0400 Received: from mail-ej1-x632.google.com ([2a00:1450:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rl7L6-0008VV-Cn for qemu-devel@nongnu.org; Fri, 15 Mar 2024 09:11:14 -0400 Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-a450bedffdfso240670766b.3 for ; Fri, 15 Mar 2024 06:11:10 -0700 (PDT) Received: from m1x-phil.lan ([176.176.145.26]) by smtp.gmail.com with ESMTPSA id a23-20020a1709066d5700b00a467a129104sm1183953ejt.173.2024.03.15.06.11.06 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 15 Mar 2024 06:11:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710508269; x=1711113069; 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=oFQX8aoXPy4f67f4Z4hL1RP4Zt/8Mcsow7bhGPOckjM=; b=kQwSSy5rpT0flCZWWWbRGYuLlc/QRK/FgdbQ27xmWyr8w2G7ZnNyVIYSXZtjJBEyby QZtPx2JijZQpSu3QvZtr5F/tjsKzZOhq9cTzX35je+SAmxewa1OAbWcLpKdhz2Kx7mFp Tc6xtt8uGxp4M20U7QrBFDb1ZI8k6mIv+AER+9C2UfK8ASMyCkIgOgVyCHcRZJ+p5eOA tgnZVpYtlmMtd7NUPSwn6asYgfx0W9G/i9b3JaQPFv9wyHT33xL0xR5VMi10P5Y8BQci pXCUZ0/kct3BCAHxcE0JxGwqlBUOKXy+AvFooh9J/UDlpTdsOxXw7tMpAyGjurUBsY1i KRIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710508269; x=1711113069; 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=oFQX8aoXPy4f67f4Z4hL1RP4Zt/8Mcsow7bhGPOckjM=; b=B8pKq5wh6ije87PNztwoGtoVVu++QobZpgwTZVLb4dUuCq0Vuq8T9lRWZ55iDQHxAb V57iuHaq09g/OD4XcA8vvLxPCS2IZPsM+n4si8Y1W3dyHN2P8Y7hl7lHaeUTXKo+e26Q yPr6nYYgdpBpXtFYXr6u6eJFWKHNAV8F0xtvcUusdx64hEirLbtSykixKG7rAwCx7lVY 4GKLE2HRhK/B4wWQPk1jNEVmXOrSf9glDjj0mbdx3AFGudvfGpRKpAmXIJ4Ud8N9V/2n ROgXMhsvZXgQrUipiXGJyL/nD/iS2sT5H/agRLoDbmDcnqhQObMtIjZG3fSErFKn+PgO zBfg== X-Gm-Message-State: AOJu0Yw/MsjPrUK/wqMot3jBKnnvH5g8a20UVtFjFNBGHCRsatQG03DX e3Xb1waIDYAwmiEbsz20TFa8Rg7EQFkGQkcasr+83sv5JvNXUt+tTdYO8vMWOlf+eqxcxExSTmW G X-Google-Smtp-Source: AGHT+IF+MuEc059bBpNi8Z/N4PGDT98KYLptzGgGl6UNuatWgPqddtvCqzOiCyAHdP8HEfeppGnxnA== X-Received: by 2002:a17:906:4a10:b0:a46:8ca9:eb2e with SMTP id w16-20020a1709064a1000b00a468ca9eb2emr932738eju.38.1710508269218; Fri, 15 Mar 2024 06:11:09 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-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=20P=20=2E=20Berrang=C3=A9?= , Paolo Bonzini , Eduardo Habkost , Claudio Fontana , Richard Henderson , Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Manos Pitsidianakis , Zhao Liu , qemu-arm@nongnu.org, Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Palmer Dabbelt , Alistair Francis , Bin Meng , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei Subject: [RFC PATCH-for-9.1 17/21] target/riscv: Use QMP generic_query_cpu_definitions() Date: Fri, 15 Mar 2024 14:09:05 +0100 Message-ID: <20240315130910.15750-18-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::632; envelope-from=philmd@linaro.org; helo=mail-ej1-x632.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1710508756090100013 Expose riscv_cpu_add_definition() and use it as add_definition() handler, then use the QMP generic_query_cpu_definitions() method. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- target/riscv/cpu.h | 2 ++ target/riscv/cpu.c | 1 + target/riscv/riscv-qmp-cmds.c | 11 +++-------- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index 3b1a02b944..15fc287680 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -824,4 +824,6 @@ void riscv_cpu_register_gdb_regs_for_features(CPUState = *cs); uint8_t satp_mode_max_from_map(uint32_t map); const char *satp_mode_str(uint8_t satp_mode, bool is_32_bit); =20 +void riscv_cpu_add_definition(gpointer data, gpointer user_data); + #endif /* RISCV_CPU_H */ diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index c160b9216b..2da9364335 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -2341,6 +2341,7 @@ static int64_t riscv_get_arch_id(CPUState *cs) #include "hw/core/sysemu-cpu-ops.h" =20 static const struct SysemuCPUOps riscv_sysemu_ops =3D { + .add_definition =3D riscv_cpu_add_definition, .get_phys_page_debug =3D riscv_cpu_get_phys_page_debug, .write_elf64_note =3D riscv_cpu_write_elf64_note, .write_elf32_note =3D riscv_cpu_write_elf32_note, diff --git a/target/riscv/riscv-qmp-cmds.c b/target/riscv/riscv-qmp-cmds.c index d363dc318d..45adc90d3b 100644 --- a/target/riscv/riscv-qmp-cmds.c +++ b/target/riscv/riscv-qmp-cmds.c @@ -26,6 +26,7 @@ =20 #include "qapi/error.h" #include "qapi/qapi-commands-machine-target.h" +#include "qapi/commands-target-compat.h" #include "qapi/qmp/qbool.h" #include "qapi/qmp/qdict.h" #include "qapi/qobject-input-visitor.h" @@ -36,7 +37,7 @@ #include "cpu-qom.h" #include "cpu.h" =20 -static void riscv_cpu_add_definition(gpointer data, gpointer user_data) +void riscv_cpu_add_definition(gpointer data, gpointer user_data) { ObjectClass *oc =3D data; CpuDefinitionInfoList **cpu_list =3D user_data; @@ -55,13 +56,7 @@ static void riscv_cpu_add_definition(gpointer data, gpoi= nter user_data) =20 CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) { - CpuDefinitionInfoList *cpu_list =3D NULL; - GSList *list =3D object_class_get_list(TYPE_RISCV_CPU, false); - - g_slist_foreach(list, riscv_cpu_add_definition, &cpu_list); - g_slist_free(list); - - return cpu_list; + return generic_query_cpu_definitions(errp); } =20 static void riscv_check_if_cpu_available(RISCVCPU *cpu, Error **errp) --=20 2.41.0 From nobody Wed May 15 23:22:58 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1710508309; cv=none; d=zohomail.com; s=zohoarc; b=lrgfwMUqZAlAIhEvq1X0qcdjt4QzzijwdUNy5HsjVo5CCOzF6MaN3YDG9LXhyzL/9fI5AsMh8LOgH1oy+/E1kriLoTJRFde+JUIgAuV4eAwEjXMLki9LUAJjDkmcYTeww53xSr3LhAilXI2V15E5Y+tNQemaP370K0HpaaTkxOY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710508309; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=+0JRGXmaH9yCo1gEGbOzPrdlVZvoU4tW4IJan5xxXVU=; b=FCs953s6TtD+BIAX9+MhKm1vb0JUHqc8zq5JygOLPuWgEpsolRdAbqAnGqWJrS2D08iT4IrKEpY3RZBFNI351Jdb9aZmQlbfvwBvriBTYCk0E0OdZlLXnqMkQ0xsh6DoynIXv2ePXGsZi53OckOCD8JN9Zbpp7jdREGvBA9mhgI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1710508309575603.7561368631654; Fri, 15 Mar 2024 06:11:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rl7LJ-0001Jo-7R; Fri, 15 Mar 2024 09:11:25 -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 1rl7LG-00013c-8d for qemu-devel@nongnu.org; Fri, 15 Mar 2024 09:11:22 -0400 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rl7LD-000057-IC for qemu-devel@nongnu.org; Fri, 15 Mar 2024 09:11:21 -0400 Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-a4682272ff6so89356666b.2 for ; Fri, 15 Mar 2024 06:11:17 -0700 (PDT) Received: from m1x-phil.lan ([176.176.145.26]) by smtp.gmail.com with ESMTPSA id dt22-20020a170906b79600b00a4669f6c2e2sm1672024ejb.44.2024.03.15.06.11.13 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 15 Mar 2024 06:11:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710508276; x=1711113076; 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=+0JRGXmaH9yCo1gEGbOzPrdlVZvoU4tW4IJan5xxXVU=; b=dpSYf7EoNPRPNeSq2HIQBoHLvFQ2UGcH1RvNBtHwGT/soD+2Dlic7r908QHtOndpA/ Zrb8pkasLpcIIZUv7MwWCdF7mYHXpu9ikJp2Toop3c3q1wC6isOM19NrA+nbbDFoZapX WJ76pBVlSC74QPoPDN4hiBosYmkTHQphJ8CuiDqQsrJc96sk+uOOuOV44kaZ+85kgbPK F+bw56lqdzyar5CPVtEzO7McUXQfGttVLEOi1KG61itplUWLtPWdmVXkhtDsEC7noLLF bQFyRHYCZdQ5Jv3nfuejymu3wbZWkg2tyISHT7HhDXCzLmc5TViLOvv0eUUWvJwcvgW6 jK0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710508276; x=1711113076; 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=+0JRGXmaH9yCo1gEGbOzPrdlVZvoU4tW4IJan5xxXVU=; b=HAa0nnhUUCtGxTgQ27bIEdsl5NwYo1StE4IHXquk+NPr7ysSwyD3IDmz0lBWs8JQUF UpkvDcVNwmB4Oma4NQuZ5rhYd6pSNxn61Ur/cBdXsWRyacQYEQ8Cz801cUKTDahAlahI 7w7ms+/XDSqO005mXs7P5mdpdfT3+UX3rXMNMef/+Qc5becQjIRGU9UkzSHkjBlz+KDC am9zW37s+wZ3nomXUIGn6bTh5Ed9dW6vyN7u3MGmDAnQ3cU4uTUnl7DJHf7DRhT9eVBT wUCqbcAGqj4J/wJuh98NngJFQrPZmGFyMLhdY1zbOem6OnKx4VGPbkLD2T+NtSJL5iN2 7joQ== X-Gm-Message-State: AOJu0Yxy/CwVoo04QD2dotWyO8YATPlc3ISTjOtihy07k7IJ9Ul/nW/A EhrXrkVBWW7nbNuKwt82uMavvQQRtzKbvPvNBjWKE9U29EKauARQ4F6SftZcnDRQDZ+/8ZO16fO j X-Google-Smtp-Source: AGHT+IH8DC/lPhj5k3DkFaXoEv+D5iiSC1Us/4T3OryunIMlcb3vrVAMN7YjcE7wkczxqJzYpIahqA== X-Received: by 2002:a17:906:29d6:b0:a46:bb:c4e3 with SMTP id y22-20020a17090629d600b00a4600bbc4e3mr2733759eje.32.1710508275761; Fri, 15 Mar 2024 06:11:15 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-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=20P=20=2E=20Berrang=C3=A9?= , Paolo Bonzini , Eduardo Habkost , Claudio Fontana , Richard Henderson , Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Manos Pitsidianakis , Zhao Liu , qemu-arm@nongnu.org, Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [RFC PATCH-for-9.1 18/21] target/i386: Use QMP generic_query_cpu_definitions() Date: Fri, 15 Mar 2024 14:09:06 +0100 Message-ID: <20240315130910.15750-19-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::636; envelope-from=philmd@linaro.org; helo=mail-ej1-x636.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1710508311510100003 Register x86_cpu_definition_entry() and x86_cpu_list_compare() as handler so we can use the QMP generic_query_cpu_definitions() method. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- target/i386/cpu.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 07f64c1ea5..e5dbd307d8 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -38,6 +38,7 @@ #ifndef CONFIG_USER_ONLY #include "sysemu/reset.h" #include "qapi/qapi-commands-machine-target.h" +#include "qapi/commands-target-compat.h" #include "exec/address-spaces.h" #include "hw/boards.h" #include "hw/i386/sgx-epc.h" @@ -5667,11 +5668,7 @@ static void x86_cpu_definition_entry(gpointer data, = gpointer user_data) =20 CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) { - CpuDefinitionInfoList *cpu_list =3D NULL; - GSList *list =3D get_sorted_cpu_model_list(); - g_slist_foreach(list, x86_cpu_definition_entry, &cpu_list); - g_slist_free(list); - return cpu_list; + return generic_query_cpu_definitions(errp); } =20 #endif /* !CONFIG_USER_ONLY */ @@ -7937,6 +7934,8 @@ static Property x86_cpu_properties[] =3D { #include "hw/core/sysemu-cpu-ops.h" =20 static const struct SysemuCPUOps i386_sysemu_ops =3D { + .add_definition =3D x86_cpu_definition_entry, + .cpu_list_compare =3D x86_cpu_list_compare, .get_memory_mapping =3D x86_cpu_get_memory_mapping, .get_paging_enabled =3D x86_cpu_get_paging_enabled, .get_phys_page_attrs_debug =3D x86_cpu_get_phys_page_attrs_debug, --=20 2.41.0 From nobody Wed May 15 23:22:58 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1710508424; cv=none; d=zohomail.com; s=zohoarc; b=UY9JdPelZgYpKi+voWk6u8PhgEADoMkUtLRo++bOMj9chbkJtx5rDFV/f6Hdg7ggKlomKkl0c6mnTSLE0UgQiYd/LOf/6sZgvzBiwJb3UcbuYSPItuu835vKsVwVBrLSPAEp6nA5BgxOKEGqIikMvDQvSst66mJvlTwlHVe5pgA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710508424; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=JlSnNkdCGhkGJY+zh070ayuUxIbMNrgyLxLLZYypnXY=; b=X1MkN0QGx/TlShXxQ155BUXwpb1cvSQk0tfQDhWgGyFATHD201ddtWfsMkPezLe7uqtzl2NB9tM0hZm1P9gK8l6uCvJRPPp1HiZs9IM7lyq2+dcAktO2myp8LuaR5ZmidNRq2/KyW/Qe0/Ist1Fl6DllEPTTGl2aUJfS2nYtCvU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1710508424349523.1759313882422; Fri, 15 Mar 2024 06:13:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rl7La-0002dV-Cj; Fri, 15 Mar 2024 09:11:42 -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 1rl7LM-0001Y8-6F for qemu-devel@nongnu.org; Fri, 15 Mar 2024 09:11:28 -0400 Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rl7LI-000073-HM for qemu-devel@nongnu.org; Fri, 15 Mar 2024 09:11:26 -0400 Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-566e869f631so2383325a12.0 for ; Fri, 15 Mar 2024 06:11:23 -0700 (PDT) Received: from m1x-phil.lan ([176.176.145.26]) by smtp.gmail.com with ESMTPSA id er18-20020a056402449200b0056899fc9a94sm1673226edb.12.2024.03.15.06.11.20 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 15 Mar 2024 06:11:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710508282; x=1711113082; 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=JlSnNkdCGhkGJY+zh070ayuUxIbMNrgyLxLLZYypnXY=; b=yx8CFeUcg5ujfCaMKT3THBflLS7I4ltCCOI+0Mpd+ZL8cVVLbQ431Y96W/IvF3+cf5 m1JcXoknKpWaYT6rJrvJe+3ZS1tLB3ZnRhMTlw8UkqX2dAyOHI2P5c11g2jaMCC5iEzm b3zLWtqGm3H+wJtlK2mJaJAAjOydrgqNmRyWxQ57li2pUYa3xQUGWL81A2hJOOaeNhyH +tX9QJ36aXlA7qNGw3kQeeJ8KAe7OfNWIQ61dlMpMX9wgWtnLlOEdeVuEwLrQpNLthzD fR6s9+Z0eKGt9SnFXnLeHa91YINZkJad0foQ/a22J0ON/wl3EdYW+fxvoVkoFU3ilYSL aQdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710508282; x=1711113082; 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=JlSnNkdCGhkGJY+zh070ayuUxIbMNrgyLxLLZYypnXY=; b=BEYhneevTCYokAvDVSo+f9Ly8bC6tA10e7ZIBVwwLkdnHH1VQsBfATVWgjWC9ifz1h q1mIRpzg9etDW2K7gLiyC6ZAFiPNuboVB//e8wB+rwPuOxzZjnj8rd9xUTPi667lTtmN nsTFaUm1VUiv2rJIebkmBYmnFUYIWjNRZDlLiygq01arnkj2GeXQqgo9iatb50GTW/ld Royva0Lbk3YWQuG68e2LNiODFesKlvorzPbUZvVJ2Jtjl+kcWII8uwB0+6GLgK0QWSYW PsJ3iWLXppr7gAb5K25UR2YAh3yFWX9GcAVD8Yoy/pWjK3CPWqIvgg2xFxITGTAr6qGJ HnXA== X-Gm-Message-State: AOJu0YwEGh9CQRCKlGgNUkFbTgpio0d3qLURZfBELa+x+zoxrFcEUJPr KieKvI4XRa8Qqvix2CCqkRj559VTa2u+Sk2qr76YmYhMWnVwemPFaxBnFLIWY8P6nJ3A49ErZJ8 Q X-Google-Smtp-Source: AGHT+IFr5RaqknL50rJ/ULGqKtzSQvYODwR3uxqq5WvgAEMCCYd8EWNHRLvED+eSeGFqUTaVtHbaiA== X-Received: by 2002:a05:6402:3819:b0:566:ff31:7974 with SMTP id es25-20020a056402381900b00566ff317974mr2662833edb.34.1710508282572; Fri, 15 Mar 2024 06:11:22 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-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=20P=20=2E=20Berrang=C3=A9?= , Paolo Bonzini , Eduardo Habkost , Claudio Fontana , Richard Henderson , Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Manos Pitsidianakis , Zhao Liu , qemu-arm@nongnu.org, Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Nicholas Piggin , Daniel Henrique Barboza Subject: [PATCH-for-9.1 19/21] target/ppc: Factor ppc_add_alias_definitions() out Date: Fri, 15 Mar 2024 14:09:07 +0100 Message-ID: <20240315130910.15750-20-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::536; envelope-from=philmd@linaro.org; helo=mail-ed1-x536.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1710508424884100001 Factor ppc_add_alias_definitions() out of qmp_query_cpu_definitions() to clearly see the generic pattern used in all targets. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Nicholas Piggin --- target/ppc/cpu-models.h | 4 ++++ target/ppc/ppc-qmp-cmds.c | 26 +++++++++++++++----------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/target/ppc/cpu-models.h b/target/ppc/cpu-models.h index 0229ef3a9a..89a5e232b7 100644 --- a/target/ppc/cpu-models.h +++ b/target/ppc/cpu-models.h @@ -21,6 +21,8 @@ #ifndef TARGET_PPC_CPU_MODELS_H #define TARGET_PPC_CPU_MODELS_H =20 +#include "qapi/qapi-types-machine.h" + /** * PowerPCCPUAlias: * @alias: The alias name. @@ -480,4 +482,6 @@ enum { POWERPC_SVR_8641D =3D 0x80900121, }; =20 +void ppc_add_alias_definitions(CpuDefinitionInfoList **cpu_list); + #endif diff --git a/target/ppc/ppc-qmp-cmds.c b/target/ppc/ppc-qmp-cmds.c index a25d86a8d1..528cc3e4af 100644 --- a/target/ppc/ppc-qmp-cmds.c +++ b/target/ppc/ppc-qmp-cmds.c @@ -189,17 +189,9 @@ static void ppc_cpu_defs_entry(gpointer data, gpointer= user_data) QAPI_LIST_PREPEND(*first, info); } =20 -CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) +void ppc_add_alias_definitions(CpuDefinitionInfoList **cpu_list) { - CpuDefinitionInfoList *cpu_list =3D NULL; - GSList *list; - int i; - - list =3D object_class_get_list(TYPE_POWERPC_CPU, false); - g_slist_foreach(list, ppc_cpu_defs_entry, &cpu_list); - g_slist_free(list); - - for (i =3D 0; ppc_cpu_aliases[i].alias !=3D NULL; i++) { + for (unsigned i =3D 0; ppc_cpu_aliases[i].alias !=3D NULL; i++) { PowerPCCPUAlias *alias =3D &ppc_cpu_aliases[i]; ObjectClass *oc; CpuDefinitionInfo *info; @@ -213,8 +205,20 @@ CpuDefinitionInfoList *qmp_query_cpu_definitions(Error= **errp) info->name =3D g_strdup(alias->alias); info->q_typename =3D g_strdup(object_class_get_name(oc)); =20 - QAPI_LIST_PREPEND(cpu_list, info); + QAPI_LIST_PREPEND(*cpu_list, info); } +} + +CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) +{ + CpuDefinitionInfoList *cpu_list =3D NULL; + GSList *list; + + list =3D object_class_get_list(TYPE_POWERPC_CPU, false); + g_slist_foreach(list, ppc_cpu_defs_entry, &cpu_list); + g_slist_free(list); + + ppc_add_alias_definitions(&cpu_list); =20 return cpu_list; } --=20 2.41.0 From nobody Wed May 15 23:22:58 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1710508659; cv=none; d=zohomail.com; s=zohoarc; b=XbLOApgJfnP2DpLGCHnWQNt7ozUhtxtu0Ji7Jmb4cYJXadmccWODKCM9bVtEM2Sh3ZXpKXUveMn3XLSMfhdV46bIkTd0IcBrL3rFyC2OphWNaVcs5300YNHYtCnh5GgBtujazNuBRifr8verITC1wykjxDOUo1ZRlrEaRAXWXY0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710508659; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=7krNd92WPqJ39NLap53W9GJe07xrMw6PHe3R7xrqxWM=; b=KOiTVaJUL1Mrvx+optNhkVsetESkNuDONFodzpqOToErr9lmSLrnOyP6muhsEqrQUO02lu1lw9x2gA/9xMBp3UbIpHfF3xDK2c3d8nyyn2xx/t7PnDiMCCe1HcGhHFR8g2Nr2T9eHDL+e+61zhfPWvbnJTek9O7DsfKL8nOdhfw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1710508659605797.0486882560199; Fri, 15 Mar 2024 06:17:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rl7Lc-0002lt-CK; Fri, 15 Mar 2024 09:11:44 -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 1rl7LS-00023b-Sm for qemu-devel@nongnu.org; Fri, 15 Mar 2024 09:11:35 -0400 Received: from mail-ed1-x52c.google.com ([2a00:1450:4864:20::52c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rl7LQ-0000AV-Pz for qemu-devel@nongnu.org; Fri, 15 Mar 2024 09:11:34 -0400 Received: by mail-ed1-x52c.google.com with SMTP id 4fb4d7f45d1cf-565c6cf4819so5314645a12.1 for ; Fri, 15 Mar 2024 06:11:31 -0700 (PDT) Received: from m1x-phil.lan ([176.176.145.26]) by smtp.gmail.com with ESMTPSA id p15-20020a05640243cf00b00566a461e1ecsm1656368edc.73.2024.03.15.06.11.26 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 15 Mar 2024 06:11:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710508289; x=1711113089; 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=7krNd92WPqJ39NLap53W9GJe07xrMw6PHe3R7xrqxWM=; b=BWnjLFnXXlmJu70EwoZx5utFUbZESrOWOKiu08nol76WHKVaL0Gd+0+gxcYRBmdpZX Aa+cuIf1Zu+5IE/d1GUglvhw7IzgVhzSyZJDqU+FKkhPFPdhgPOIrsjYzmD5FvLlUp/8 8coccDli3PEfCoLmdaa1YcKwLeDuK//3SP00SeZhtYlONgQoGAgrKvpUiStJKxPhkArd sG5PIXxmEMVrkOHxmQq8ZY82EMQCGR7qXNHKd3Z2yX2WoWzDgam4BZci4ymtnH3TemCu lHlbnj9SmBmhlRlZb5S8XPGldKGYtduBRbTAURJCBu/tgvgLn3ol1d/pEyhq6Bm8jq4S hmRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710508289; x=1711113089; 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=7krNd92WPqJ39NLap53W9GJe07xrMw6PHe3R7xrqxWM=; b=DLFThhRPGJdS98pybXp6VRILLfpElPLLxsXQZbugfB/l1DmPbi6lT8eBf6+1r21eO4 5bJMomunkIkMkGxiwHxRheajLEGZU80WOvCyAzM6PfsaH95fkVr4KCzy5yCkSCJknxWu Oqy+Z4q2GszKY8QYpRq/9A8FDomcpRe1LuTdpUtAV22b+4+aVQ6Ub1yw5R8V0G8K+M2Y owVhwx1s2fMbYLXsDmjnMW8MQXGIEokwKh3U+LRaVLJnlEFPzZz3NG3NHcIKMJogJvIb Z7V3P614mXeU38DpD8cFl/Q4TSpWXj8NMUhaWdvFx9os+z79tXn5I2Jo+k4EGH1WeonF IQPw== X-Gm-Message-State: AOJu0YxDnRSJAeSFZH6nsj+ABwiyPeS5cQ+8QQprE9bbN8HLGoePs7K7 49FosOCc4qPjmsSmzXL39NnPw9m7rF9aDVOwFEZNx8hoLEq1c3ZqdSi3VWfwSmtftd8kWrDAgf5 b X-Google-Smtp-Source: AGHT+IEb42cna/x04lM5DiSdhs0k3LjaIjnT6Wg5Bf0xjqY0TjKqIhJx4flZw37llsIVeEyPObqtng== X-Received: by 2002:a50:8e03:0:b0:566:1952:afc4 with SMTP id 3-20020a508e03000000b005661952afc4mr8530918edw.6.1710508289058; Fri, 15 Mar 2024 06:11:29 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-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=20P=20=2E=20Berrang=C3=A9?= , Paolo Bonzini , Eduardo Habkost , Claudio Fontana , Richard Henderson , Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Manos Pitsidianakis , Zhao Liu , qemu-arm@nongnu.org, Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Nicholas Piggin , Daniel Henrique Barboza Subject: [RFC PATCH-for-9.1 20/21] target/ppc: Use QMP generic_query_cpu_definitions() Date: Fri, 15 Mar 2024 14:09:08 +0100 Message-ID: <20240315130910.15750-21-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::52c; envelope-from=philmd@linaro.org; helo=mail-ed1-x52c.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1710508659827100001 Register ppc_add_alias_definitions() as handler so we can use the QMP generic_query_cpu_definitions() method. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- target/ppc/cpu_init.c | 1 + target/ppc/ppc-qmp-cmds.c | 26 ++------------------------ 2 files changed, 3 insertions(+), 24 deletions(-) diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c index d5e227a6fb..3b500c95a4 100644 --- a/target/ppc/cpu_init.c +++ b/target/ppc/cpu_init.c @@ -7348,6 +7348,7 @@ static Property ppc_cpu_properties[] =3D { #include "hw/core/sysemu-cpu-ops.h" =20 static const struct SysemuCPUOps ppc_sysemu_ops =3D { + .add_alias_definitions =3D ppc_add_alias_definitions, .get_phys_page_debug =3D ppc_cpu_get_phys_page_debug, .write_elf32_note =3D ppc32_cpu_write_elf32_note, .write_elf64_note =3D ppc64_cpu_write_elf64_note, diff --git a/target/ppc/ppc-qmp-cmds.c b/target/ppc/ppc-qmp-cmds.c index 528cc3e4af..267dd84718 100644 --- a/target/ppc/ppc-qmp-cmds.c +++ b/target/ppc/ppc-qmp-cmds.c @@ -29,6 +29,7 @@ #include "monitor/hmp-target.h" #include "monitor/hmp.h" #include "qapi/qapi-commands-machine-target.h" +#include "qapi/commands-target-compat.h" #include "cpu-models.h" #include "cpu-qom.h" =20 @@ -175,20 +176,6 @@ int target_get_monitor_def(CPUState *cs, const char *n= ame, uint64_t *pval) return -EINVAL; } =20 -static void ppc_cpu_defs_entry(gpointer data, gpointer user_data) -{ - ObjectClass *oc =3D data; - CpuDefinitionInfoList **first =3D user_data; - const char *typename; - CpuDefinitionInfo *info; - - typename =3D object_class_get_name(oc); - info =3D g_malloc0(sizeof(*info)); - info->name =3D cpu_model_from_type(typename); - - QAPI_LIST_PREPEND(*first, info); -} - void ppc_add_alias_definitions(CpuDefinitionInfoList **cpu_list) { for (unsigned i =3D 0; ppc_cpu_aliases[i].alias !=3D NULL; i++) { @@ -211,14 +198,5 @@ void ppc_add_alias_definitions(CpuDefinitionInfoList *= *cpu_list) =20 CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) { - CpuDefinitionInfoList *cpu_list =3D NULL; - GSList *list; - - list =3D object_class_get_list(TYPE_POWERPC_CPU, false); - g_slist_foreach(list, ppc_cpu_defs_entry, &cpu_list); - g_slist_free(list); - - ppc_add_alias_definitions(&cpu_list); - - return cpu_list; + return generic_query_cpu_definitions(errp); } --=20 2.41.0 From nobody Wed May 15 23:22:58 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1710508651; cv=none; d=zohomail.com; s=zohoarc; b=EuRf9PyPTIMwYYIAbdDCfcN0d3vJwZl8bNjLBA9feEbJsmfKnsSBLUYr/VPF/iaaBaVqlW9lc+2Z69xgmD7Koyl8rwMvguiWF/wC3MYEy7CFfrtDnwP/4eOvYUMyXjixFHAFJOSJKzNnKY5qzgcdtKHVlgI5EClEep2LwH52Y5Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710508651; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=vnvuw2s/qwtrAi1idHX4CvaMd4PeKiJ3xN49FEYysNQ=; b=DpJ+cYKR1uF3z4Ptsfr7qo8oD7gIM5j7tiy+j3P28V/tL80PMzuhohfA32WuLg8+96Nrfxl4zT4QJFUwGgBHtwv4C+lF2DlIJAqM+Xodm9/WIBrYyx3xgexplXjLZAmDojEMTVDfgRKrKLhHb4naN8r1hXMMjK37FphwIE/F3ac= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1710508650967163.28999580342702; Fri, 15 Mar 2024 06:17:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rl7Lf-0002nt-06; Fri, 15 Mar 2024 09:11:48 -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 1rl7Lb-0002ik-IR for qemu-devel@nongnu.org; Fri, 15 Mar 2024 09:11:43 -0400 Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rl7LW-0000Fz-D3 for qemu-devel@nongnu.org; Fri, 15 Mar 2024 09:11:43 -0400 Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-568b6302044so500771a12.3 for ; Fri, 15 Mar 2024 06:11:37 -0700 (PDT) Received: from m1x-phil.lan ([176.176.145.26]) by smtp.gmail.com with ESMTPSA id w23-20020a1709064a1700b00a462e5d8d4asm1676475eju.114.2024.03.15.06.11.33 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 15 Mar 2024 06:11:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710508296; x=1711113096; 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=vnvuw2s/qwtrAi1idHX4CvaMd4PeKiJ3xN49FEYysNQ=; b=UnMhEXAzG8RRZ8GrAfBS/lVof3e8c7j2ei5T+TFbAnEIBja8XE71LyWL33mKg7lMG+ XnXWZAv3PiuGWLhKxYkOW7UCuInlsF1KcRA02RzMn6cOsDTOWDN5PImatMWZEbcwAGS6 FM2KYtHY1UO5mqb6n0yc4E2WFKdhSSZkJekbmMTSMnM7M1vKusqxmcGWdJcWLfjfXOPH T7Bn4T4LCWo7uGXLhsZAD9B2A709ygXIjUVqNu0MEXnVC07Vd57EkP2/FMBbYI37MD+y SwoswZi+AmaJn0Bddf/HPQtvv+c7gD3DG9SQPlg8uEhU3VUz0rTiyR1NXdRDditPnNGy 4dHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710508296; x=1711113096; 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=vnvuw2s/qwtrAi1idHX4CvaMd4PeKiJ3xN49FEYysNQ=; b=diJpUVA1rwAW9yv4/a+t6nAaRv3ngsveUrdwuMkhu5cH5/sl4e63rNssFi+9oZ99YJ HV6trDnhO/ODUfSFR0lwkwC/CtnIcpTxmHFQhInXkEa2spe61OitdBy8CvPrcvZRtztw Hwj6QvReS0jskN27kRixvnBSXlf0yKEXyP8rsmPaIcJOGwhhQ/B/oshk+B/Ts7+APTpr iFJpS3P/RnQrjvsJIBrCujZZNHU+qr2PJsoeB55HAI8Z/lT8ruT51W+GSlfntVa9gvbF zadZrUTl6sC5B+Bpx/VOF6tUgaReK6PtoRwemnOMwQnwjX+6i28LKCcdnBpu8vcRwBJC Dq8A== X-Gm-Message-State: AOJu0YyrdsFEZeCxOdYIAaSHO5LnD/tR2RbSD+MNaSCdRiGg0HSElRhu Npv9oAY/7l9dbp4dqtHAjtadYQFH8JxY2n+H687M+1IQmMFBRYbs8NGRgMEJeA0Aq6jRpP/xjvM 6 X-Google-Smtp-Source: AGHT+IHkrsOXMB0KMEhHFjzPwy0HpwYtgpPqcJhRXSdQ9oxhn/KVwMnS7VrOrtYo7QVAmF/CxxOTZw== X-Received: by 2002:a17:906:a3d5:b0:a46:1f6d:2fef with SMTP id ca21-20020a170906a3d500b00a461f6d2fefmr3544428ejb.42.1710508296617; Fri, 15 Mar 2024 06:11:36 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-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=20P=20=2E=20Berrang=C3=A9?= , Paolo Bonzini , Eduardo Habkost , Claudio Fontana , Richard Henderson , Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Manos Pitsidianakis , Zhao Liu , qemu-arm@nongnu.org, Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , Yanan Wang , Eric Blake , Song Gao , Huacai Chen , Aurelien Jarno , Jiaxun Yang , Aleksandar Rikalo , Nicholas Piggin , Daniel Henrique Barboza , Palmer Dabbelt , Alistair Francis , Bin Meng , Weiwei Li , Liu Zhiwei Subject: [RFC PATCH-for-9.1 21/21] qapi: Make @query-cpu-definitions target-agnostic Date: Fri, 15 Mar 2024 14:09:09 +0100 Message-ID: <20240315130910.15750-22-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::534; envelope-from=philmd@linaro.org; helo=mail-ed1-x534.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1710508651895100001 All targets use the generic_query_cpu_definitions() method, which is not target-specific. Make the command target agnostic by moving it to machine.json. Rename generic_query_cpu_definitions as qmp_query_cpu_definitions. This is an introspection change for the target that were not implementing qmp_query_cpu_definitions(): now query-cpu-definitions returns an their CPUs list. Example with SH4 before: { "execute": "query-cpu-definitions" } { "error": {"class": "CommandNotFound", "desc": "The command query-cpu-de= finitions has not been found"} } and after: { "execute": "query-cpu-definitions" } { "return": [ {"name": "sh7751r", "typename": "sh7751r-superh-cpu", "static": f= alse, "deprecated": false}, {"name": "sh7750r", "typename": "sh7750r-superh-cpu", "static": f= alse, "deprecated": false}, {"name": "sh7785", "typename": "sh7785-superh-cpu", "static": fal= se, "deprecated": false} ] } However this allows heterogeneous emulation to return a correct list. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- Well, not all target got converted, I left the s390x one for later :) --- MAINTAINERS | 1 - qapi/machine-target.json | 18 ------------------ qapi/machine.json | 11 +++++++++++ include/qapi/commands-target-compat.h | 14 -------------- system/cpu-qmp-cmds.c | 4 ++-- target/arm/arm-qmp-cmds.c | 6 ------ target/i386/cpu.c | 6 ------ target/loongarch/loongarch-qmp-cmds.c | 6 ------ target/mips/sysemu/mips-qmp-cmds.c | 9 --------- target/ppc/ppc-qmp-cmds.c | 7 ------- target/riscv/riscv-qmp-cmds.c | 6 ------ 11 files changed, 13 insertions(+), 75 deletions(-) delete mode 100644 include/qapi/commands-target-compat.h diff --git a/MAINTAINERS b/MAINTAINERS index 39d7c14d98..71f446311b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1895,7 +1895,6 @@ F: qapi/machine-target.json F: include/hw/boards.h F: include/hw/core/cpu.h F: include/hw/cpu/cluster.h -F: include/qapi/commands-target-compat.h F: include/sysemu/numa.h F: tests/unit/test-smp-parse.c T: git https://gitlab.com/ehabkost/qemu.git machine-next diff --git a/qapi/machine-target.json b/qapi/machine-target.json index 7480921d33..2065972d8a 100644 --- a/qapi/machine-target.json +++ b/qapi/machine-target.json @@ -212,24 +212,6 @@ 'TARGET_LOONGARCH64', 'TARGET_RISCV' ] } } =20 -## -# @query-cpu-definitions: -# -# Return a list of supported virtual CPU definitions -# -# Returns: a list of CpuDefinitionInfo -# -# Since: 1.2 -## -{ 'command': 'query-cpu-definitions', 'returns': ['CpuDefinitionInfo'], - 'if': { 'any': [ 'TARGET_PPC', - 'TARGET_ARM', - 'TARGET_I386', - 'TARGET_S390X', - 'TARGET_MIPS', - 'TARGET_LOONGARCH64', - 'TARGET_RISCV' ] } } - ## # @CpuS390Polarization: # diff --git a/qapi/machine.json b/qapi/machine.json index 9c44b8fa82..987c64f8e7 100644 --- a/qapi/machine.json +++ b/qapi/machine.json @@ -73,6 +73,17 @@ 'deprecated' : 'bool' } } =20 +## +# @query-cpu-definitions: +# +# Return a list of supported virtual CPU definitions +# +# Returns: a list of CpuDefinitionInfo +# +# Since: 1.2 +## +{ 'command': 'query-cpu-definitions', 'returns': ['CpuDefinitionInfo'] } + ## # @CpuModelInfo: # diff --git a/include/qapi/commands-target-compat.h b/include/qapi/commands-= target-compat.h deleted file mode 100644 index 86d45d8fcc..0000000000 --- a/include/qapi/commands-target-compat.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * QAPI helpers for target specific QMP commands - * - * SPDX-FileCopyrightText: 2024 Linaro Ltd. - * SPDX-License-Identifier: GPL-2.0-or-later - */ -#ifndef QAPI_COMPAT_TARGET_H -#define QAPI_COMPAT_TARGET_H - -#include "qapi/qapi-types-machine.h" - -CpuDefinitionInfoList *generic_query_cpu_definitions(Error **errp); - -#endif diff --git a/system/cpu-qmp-cmds.c b/system/cpu-qmp-cmds.c index daeb131159..049e8b9d35 100644 --- a/system/cpu-qmp-cmds.c +++ b/system/cpu-qmp-cmds.c @@ -7,7 +7,7 @@ =20 #include "qemu/osdep.h" #include "qom/object.h" -#include "qapi/commands-target-compat.h" +#include "qapi/qapi-commands-machine.h" #include "sysemu/arch_init.h" #include "hw/core/cpu.h" #include "hw/core/sysemu-cpu-ops.h" @@ -53,7 +53,7 @@ static void arch_add_cpu_definitions(CpuDefinitionInfoLis= t **cpu_list, } } =20 -CpuDefinitionInfoList *generic_query_cpu_definitions(Error **errp) +CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) { CpuDefinitionInfoList *cpu_list =3D NULL; =20 diff --git a/target/arm/arm-qmp-cmds.c b/target/arm/arm-qmp-cmds.c index c5091e64ec..ac8d890bc0 100644 --- a/target/arm/arm-qmp-cmds.c +++ b/target/arm/arm-qmp-cmds.c @@ -28,7 +28,6 @@ #include "qapi/qobject-input-visitor.h" #include "qapi/qapi-commands-machine-target.h" #include "qapi/qapi-commands-misc-target.h" -#include "qapi/commands-target-compat.h" #include "qapi/qmp/qdict.h" #include "qom/qom-qobject.h" =20 @@ -220,8 +219,3 @@ CpuModelExpansionInfo *qmp_query_cpu_model_expansion(Cp= uModelExpansionType type, =20 return expansion_info; } - -CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) -{ - return generic_query_cpu_definitions(errp); -} diff --git a/target/i386/cpu.c b/target/i386/cpu.c index e5dbd307d8..f26adefd37 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -38,7 +38,6 @@ #ifndef CONFIG_USER_ONLY #include "sysemu/reset.h" #include "qapi/qapi-commands-machine-target.h" -#include "qapi/commands-target-compat.h" #include "exec/address-spaces.h" #include "hw/boards.h" #include "hw/i386/sgx-epc.h" @@ -5666,11 +5665,6 @@ static void x86_cpu_definition_entry(gpointer data, = gpointer user_data) QAPI_LIST_PREPEND(*cpu_list, info); } =20 -CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) -{ - return generic_query_cpu_definitions(errp); -} - #endif /* !CONFIG_USER_ONLY */ =20 uint64_t x86_cpu_get_supported_feature_word(FeatureWord w, diff --git a/target/loongarch/loongarch-qmp-cmds.c b/target/loongarch/loong= arch-qmp-cmds.c index ef5aedc1cd..aaed7bbf93 100644 --- a/target/loongarch/loongarch-qmp-cmds.c +++ b/target/loongarch/loongarch-qmp-cmds.c @@ -9,17 +9,11 @@ #include "qemu/osdep.h" #include "qapi/error.h" #include "qapi/qapi-commands-machine-target.h" -#include "qapi/commands-target-compat.h" #include "cpu.h" #include "qapi/qmp/qdict.h" #include "qapi/qobject-input-visitor.h" #include "qom/qom-qobject.h" =20 -CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) -{ - return generic_query_cpu_definitions(errp); -} - static const char *cpu_model_advertised_features[] =3D { "lsx", "lasx", NULL }; diff --git a/target/mips/sysemu/mips-qmp-cmds.c b/target/mips/sysemu/mips-q= mp-cmds.c index 329db3a028..c3c775acc6 100644 --- a/target/mips/sysemu/mips-qmp-cmds.c +++ b/target/mips/sysemu/mips-qmp-cmds.c @@ -5,12 +5,3 @@ * * SPDX-License-Identifier: LGPL-2.1-or-later */ - -#include "qemu/osdep.h" -#include "qapi/qapi-commands-machine-target.h" -#include "qapi/commands-target-compat.h" - -CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) -{ - return generic_query_cpu_definitions(errp); -} diff --git a/target/ppc/ppc-qmp-cmds.c b/target/ppc/ppc-qmp-cmds.c index 267dd84718..f85c4560f9 100644 --- a/target/ppc/ppc-qmp-cmds.c +++ b/target/ppc/ppc-qmp-cmds.c @@ -28,8 +28,6 @@ #include "qemu/ctype.h" #include "monitor/hmp-target.h" #include "monitor/hmp.h" -#include "qapi/qapi-commands-machine-target.h" -#include "qapi/commands-target-compat.h" #include "cpu-models.h" #include "cpu-qom.h" =20 @@ -195,8 +193,3 @@ void ppc_add_alias_definitions(CpuDefinitionInfoList **= cpu_list) QAPI_LIST_PREPEND(*cpu_list, info); } } - -CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) -{ - return generic_query_cpu_definitions(errp); -} diff --git a/target/riscv/riscv-qmp-cmds.c b/target/riscv/riscv-qmp-cmds.c index 45adc90d3b..170d720b24 100644 --- a/target/riscv/riscv-qmp-cmds.c +++ b/target/riscv/riscv-qmp-cmds.c @@ -26,7 +26,6 @@ =20 #include "qapi/error.h" #include "qapi/qapi-commands-machine-target.h" -#include "qapi/commands-target-compat.h" #include "qapi/qmp/qbool.h" #include "qapi/qmp/qdict.h" #include "qapi/qobject-input-visitor.h" @@ -54,11 +53,6 @@ void riscv_cpu_add_definition(gpointer data, gpointer us= er_data) QAPI_LIST_PREPEND(*cpu_list, info); } =20 -CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) -{ - return generic_query_cpu_definitions(errp); -} - static void riscv_check_if_cpu_available(RISCVCPU *cpu, Error **errp) { if (!riscv_cpu_accelerator_compatible(cpu)) { --=20 2.41.0