From patchwork Fri Mar 15 13:08:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 780482 Delivered-To: patch@linaro.org Received: by 2002:a5d:46c1:0:b0:33e:7753:30bd with SMTP id g1csp188790wrs; Fri, 15 Mar 2024 06:10:07 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUKjfXiXchVD+d1MBZM6X/b54KuDZIsjlSRgHLf7w15hmkDDcEZKv0lWQkeZv5hpKEAuYOWA9zSIILMon8xNlHJ X-Google-Smtp-Source: AGHT+IFhqgJlFzq9lGXGOvAJfqm7JDLxTjWGLWqNJZXVYYFGPJEos07H4pp2HaCDo6kRErFH/W8t X-Received: by 2002:a05:6871:3a22:b0:220:f92f:5bf7 with SMTP id pu34-20020a0568713a2200b00220f92f5bf7mr5135332oac.50.1710508207413; Fri, 15 Mar 2024 06:10:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710508207; cv=none; d=google.com; s=arc-20160816; b=Vhz4rL/UDqhjJz7NA545sEjrbnT7mnJtFOL4z7HMZ19RFXGNjhuhns60RGpPB+b8nz iU3ZHnoWlEQPDLq4v74TXMZ0AOecgsFdzYms6k4mML4ttjS80zMfhkyWqQkvRNrgnKCH Z/meNrLgLQW5ooANCs1Wszo+gZ2Bef3pNdKLncghfLLjZM99LXrub2BmHydmdEksc4s5 6JXD6bjrKg3pzvBkbjL1rMDcDJoZCW9qavrYMfpRIDBWt8unkaOri3U+PmpGm45wpkZV E/BuE4HxePe+EL/d1X+OMb7W8GWK9uMGRJZBNywj6HqQ6kjHvv1ItdVLNc00BuOOcxgv 37Xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NCfHsLOktJnJk/FrjkYW88SQD28CKLAyjY7rSKM5rcw=; fh=Ol3tAPX/VLbajEqrc9A2NaG0RWh2tFO21EWtQ1skWSs=; b=YmDZq5FHxl/tevFRF1+Xk4pB4fkgJ0h/dU3ur6VB2E3jTVycuKn/JgTXU9OUYdl62x qnZgmKxnxjjQel2rs0ByRx0DATGKnYGSy5kpa5cHfYm1rjwazZOdh2VLLOUp3WkR9Nkg 2beNDJ1ybFf24nJKhZXOOKl/sXdLauRKElJaNn63QFw8t4zJhabYr0xDAuecEkcnhJR7 82jfjcoumsk4FJ0uAtHI4vHBW3KzGB7Bd+iEfxzvNl8ZZYRWLmOUqsCJxE8u3zxnvdpq 6DfUxOBvUSL53Uj0ER5uSsbje18Wz+s/c15KP5x+mC4orfdxFYVLrGYUygb2O9/uqQi2 fi0w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ODJzEgTe; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b14-20020a05620a088e00b00789dcdb32c8si1088570qka.675.2024.03.15.06.10.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 Mar 2024 06:10:07 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ODJzEgTe; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Markus Armbruster Cc: qemu-riscv@nongnu.org, Anton Johansson , qemu-s390x@nongnu.org, qemu-ppc@nongnu.org, =?utf-8?q?Daniel_P_=2E_Berrang?= =?utf-8?q?=C3=A9?= , Paolo Bonzini , Eduardo Habkost , Claudio Fontana , Richard Henderson , Peter Maydell , =?utf-8?q?Alex_Benn=C3=A9e?= , Manos Pitsidianakis , Zhao Liu , qemu-arm@nongnu.org, Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org When multiple QOM types are registered in the same file, it is simpler to use the the DEFINE_TYPES() macro. In particular because type array declared with such macro are easier to review. In few commits we are going to add more types, so replace the type_register_static() to ease further reviews. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson 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); } -static const TypeInfo max_x86_cpu_type_info = { - .name = X86_CPU_TYPE_NAME("max"), - .parent = TYPE_X86_CPU, - .instance_init = max_x86_cpu_initfn, - .class_init = max_x86_cpu_class_init, -}; - static char *feature_word_description(FeatureWordInfo *f, uint32_t bit) { assert(f->type == CPUID_FEATURE_WORD || f->type == MSR_FEATURE_WORD); @@ -8041,19 +8034,6 @@ static void x86_cpu_common_class_init(ObjectClass *oc, void *data) } } -static const TypeInfo x86_cpu_type_info = { - .name = TYPE_X86_CPU, - .parent = TYPE_CPU, - .instance_size = sizeof(X86CPU), - .instance_align = __alignof(X86CPU), - .instance_init = x86_cpu_initfn, - .instance_post_init = x86_cpu_post_initfn, - - .abstract = true, - .class_size = sizeof(X86CPUClass), - .class_init = 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 = 8; } -static const TypeInfo x86_base_cpu_type_info = { - .name = X86_CPU_TYPE_NAME("base"), - .parent = TYPE_X86_CPU, - .class_init = x86_cpu_base_class_init, +static const TypeInfo x86_cpu_types[] = { + { + .name = TYPE_X86_CPU, + .parent = TYPE_CPU, + .abstract = true, + .instance_size = sizeof(X86CPU), + .instance_align = __alignof(X86CPU), + .instance_init = x86_cpu_initfn, + .instance_post_init = x86_cpu_post_initfn, + .class_size = sizeof(X86CPUClass), + .class_init = x86_cpu_common_class_init, + }, { + .name = X86_CPU_TYPE_NAME("base"), + .parent = TYPE_X86_CPU, + .class_init = x86_cpu_base_class_init, + }, { + .name = X86_CPU_TYPE_NAME("max"), + .parent = TYPE_X86_CPU, + .instance_init = max_x86_cpu_initfn, + .class_init = max_x86_cpu_class_init, + } }; +DEFINE_TYPES(x86_cpu_types) + static void x86_cpu_register_types(void) { int i; - type_register_static(&x86_cpu_type_info); for (i = 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); } type_init(x86_cpu_register_types) From patchwork Fri Mar 15 13:08:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 780490 Delivered-To: patch@linaro.org Received: by 2002:a5d:46c1:0:b0:33e:7753:30bd with SMTP id g1csp191205wrs; Fri, 15 Mar 2024 06:14:06 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCURPPnRztajJ++mpE+N1HB6KQJGrLhgFSmBcrpPzl+6oU+OZ3hV0j59Nwb4Ho3e+5fNmvWcr6cHL67fnA6ZtXC/ X-Google-Smtp-Source: AGHT+IEB2CwQ3N05E2IQDih/mLs9E/2RpF6VMmyfvygHCrVGMgkSGztCabEaKA0XO6/t5RQYqgZB X-Received: by 2002:a05:6102:3bfa:b0:475:9e57:c8f5 with SMTP id be26-20020a0561023bfa00b004759e57c8f5mr3243305vsb.28.1710508446360; Fri, 15 Mar 2024 06:14:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710508446; cv=none; d=google.com; s=arc-20160816; b=X4bNvQKf7puDcJjbCGMHDqxlKTzG7fLSVmOqjX28kxCk2VDy1iRS3BjJwdRtWIfi6A 2zLEpUC/LVy4OQdryAghAfl/CCIacJWpESzoMBxvvULE5ZLFljaKQwI7SV+LHVWzfkep uupfTjNdlVq1e+Try8s0FT75adxLSTHYHjkMCLKrZ+pivIbycgU0fifa+GOku/I8HWFK tyGTXluj2Ne+aoEQZCUXuUq5y9ZIQPytrh4kcmZUWt2WVf0YMAZw/Qq+BMu5nbz5E+02 vYzk+aZ4Y8dGeMkr4l7T+nL7zekMc998zFGr4Vn0HjPSrGEZb4YMpJj4NgCSugrlcPfj 5/8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=38DwNqP/w4iyE7cU/eTej+AEZTmllcOjbkkM5XAd0Sw=; fh=F2+QQIPEJyMWNCWEy/iUXtRDC/KBr0A2IhPrLkpPhW4=; b=KWPPcyEP655tkAEJrP49IUY48GcNJxbfzf5jhMaykzOQM2OMFHoC+ruZIuMxZ/g3wB JX+FOHD9zOiT0XHxh7mWvhkTsifawu/MEPvAJIfp/bZFTFWXeYWwVpOsv+yOXbivKU+u TlUATi2aYhOxpjX5V6QrN9Lq+aMCQ7b3NmxNNoqmS0UHqlxW7i40yjadB2eY39yaGdk/ 7pPCK7KrIV9CtToAATp68OHy+XubTlwBudZUGDUAN6ah8tQN2vMQ7NFVHt3dbRIMRzkH sA8+TJX73GDdECdEwmZP0bUm9cpRtK5LKZYV5ZS7Ds1c7Njn1ccVMlhGcWYQokHi0R9I DWbA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XB5H0U5l; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c17-20020a0561023a5100b00472c3fa96cdsi504621vsu.678.2024.03.15.06.14.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 Mar 2024 06:14:06 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XB5H0U5l; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Markus Armbruster Cc: qemu-riscv@nongnu.org, Anton Johansson , qemu-s390x@nongnu.org, qemu-ppc@nongnu.org, =?utf-8?q?Daniel_P_=2E_Berrang?= =?utf-8?q?=C3=A9?= , Paolo Bonzini , Eduardo Habkost , Claudio Fontana , Richard Henderson , Peter Maydell , =?utf-8?q?Alex_Benn=C3=A9e?= , Manos Pitsidianakis , Zhao Liu , qemu-arm@nongnu.org, Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org When multiple QOM types are registered in the same file, it is simpler to use the the DEFINE_TYPES() macro. In particular because type array declared with such macro are easier to review. In few commits we are going to add more types, so replace the type_register_static() to ease further reviews. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20231013140116.255-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 */ } -static const TypeInfo mips_cpu_type_info = { - .name = TYPE_MIPS_CPU, - .parent = TYPE_CPU, - .instance_size = sizeof(MIPSCPU), - .instance_align = __alignof(MIPSCPU), - .instance_init = mips_cpu_initfn, - .abstract = true, - .class_size = sizeof(MIPSCPUClass), - .class_init = mips_cpu_class_init, +static const TypeInfo mips_cpu_types[] = { + { + .name = TYPE_MIPS_CPU, + .parent = TYPE_CPU, + .instance_size = sizeof(MIPSCPU), + .instance_align = __alignof(MIPSCPU), + .instance_init = mips_cpu_initfn, + .abstract = true, + .class_size = sizeof(MIPSCPUClass), + .class_init = mips_cpu_class_init, + } }; +DEFINE_TYPES(mips_cpu_types) + static void mips_cpu_cpudef_class_init(ObjectClass *oc, void *data) { MIPSCPUClass *mcc = MIPS_CPU_CLASS(oc); @@ -629,7 +633,6 @@ static void mips_cpu_register_types(void) { int i; - type_register_static(&mips_cpu_type_info); for (i = 0; i < mips_defs_number; i++) { mips_register_cpudef_type(&mips_defs[i]); } From patchwork Fri Mar 15 13:08:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 780503 Delivered-To: patch@linaro.org Received: by 2002:a5d:46c1:0:b0:33e:7753:30bd with SMTP id g1csp194365wrs; Fri, 15 Mar 2024 06:19:44 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXpKzVDV5AVBU063VRwFfnORkfF82HjI0V0pq7qdQEoCWTCqvwYt1tWEI7q3bVeS4z1ye96FBThGB+mUr2kr+Gx X-Google-Smtp-Source: AGHT+IEWaylX3z1WNHR3Z0MOYbk3M++d3ALZ+nfQ3ZTVm8oV1pU4rmZUbPjNllcouRKger8vAV70 X-Received: by 2002:a9d:7749:0:b0:6e5:319:3a19 with SMTP id t9-20020a9d7749000000b006e503193a19mr5205844otl.24.1710508783988; Fri, 15 Mar 2024 06:19:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710508783; cv=none; d=google.com; s=arc-20160816; b=s5gZQ1VN9XtggRp4aPvtFisX+sw9OWGFWta9Etch5EH7IopL2zHDtvtMlUoX+kbWFX rFa9bjUYvpvYe0KQvZLGFkXoYwKS59Swryjp3kkIlSiD1NxfIyEa3yqn83cslZyfupVS Hxor1A6P6gYeZmrOQWN9T9KNikvdgYJ7i1nkx/UcFmJwnEVHhLrl15dIn2jw+kmb5KZf 1gFoueHhWC/zNSbYAqLNkuN6wuGNabdUlKkjrHq35eRUXptmZk7jem9tGN8/Ijr0nHyu 0xxAcPiPdOXPijcyIUYZKfTpK7BMIRVUy52KQDtLXVWcen9bMxaME+YpBQHEC4LORNe/ WnkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QXR+KoDyjF3DzCtPRlneMC/cDzpoxSokp1VWknBDtAc=; fh=p5Jsywvh0HlF/zmTgHQajT3V6107Umb8gJEfVX/nN3w=; b=Cnzpxm84qd54u/zD34GUnNDIKTHTT+bujf5weJ2a8aLX+DlEXYjlZnjsMrrOEwloGs alnN4mySmrjo0JCDljnAjEKXQYcyIf3U9lgwWzXN4MNjaxRcbSJ4SzX6CWJM0eH3sJdR +a4oLlIkYLTeWxuiPOqfAVpb2cZgtpeDQfXWIQcQO7PvG2fjH/Ji+OtYq4s440b5n5ga MAN7j1V3/iqlPA3u/N1xjYOXur2oQKotdd24Pl8KOJUoGMG7cfpV84mbgITwJ7Jcg4rA Hn52o4M3dpAOugfdYRmEdWJzAVu9oQ/71szpESRMRYKEga45PUqPTb5yXMipXQDCWi2Y 0vnw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OIKG7UBb; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id p14-20020a05620a056e00b007886f252dedsi3530100qkp.391.2024.03.15.06.19.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 Mar 2024 06:19:43 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OIKG7UBb; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rl7Jr-0006Cy-Et; Fri, 15 Mar 2024 09:09:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rl7Jb-0005eP-Sn for qemu-devel@nongnu.org; Fri, 15 Mar 2024 09:09:40 -0400 Received: from mail-ed1-x532.google.com ([2a00:1450:4864:20::532]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rl7JY-0007dV-1R for qemu-devel@nongnu.org; Fri, 15 Mar 2024 09:09:39 -0400 Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-5658082d2c4so2805491a12.1 for ; Fri, 15 Mar 2024 06:09:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710508174; x=1711112974; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=QXR+KoDyjF3DzCtPRlneMC/cDzpoxSokp1VWknBDtAc=; b=OIKG7UBbSegyL5K4xTc8cRKmFmd3w+Kh8zZMEqL33VJK1NazutogQCSSnilz8hXtoN 8Pw6pY2voj9Sz13mo4rIdXScYcCjgwc8aubTIG3mmaK8pczHsMYV/J7ER79ByRcwb0qv 6Md90/UyQKaN92DJttmyvCqADnE1AAygbh+hD7OOGAgULOgHDhD7sHHnpAEVmZGo7bm3 +v3aJtumfpjULMF+NvbLRBHUnowuUSTPpnY1Iifb15rKSuNjPgdRt2r+AR24VEj6fXE6 02lSwobYUP7cTFMiG6hKRWknhkYwBIKf9m7NyjUW8cbX9s2+Z32h37hna6n3d59hRi52 THdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710508174; x=1711112974; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QXR+KoDyjF3DzCtPRlneMC/cDzpoxSokp1VWknBDtAc=; b=s5p8qui8W+SkKdgNZZHBv4jyr1087ncPh7G8IWnrFMhMZGFAtaUnTk7wujNLdOmIHh 1JIEZqXJRqQYRyPKYe9k8FODiDmbnO6xyNAQl+AgglEP36yNuLtt8W86XpceicRlu3re 2gEvi4P5u5c6Yj8WGv6F2LamTXn8l7VKaHCw6wHGBmzsc3RaBgMP5ZNTahS/VzVBPpuk rMv+t4C1Kv7upOHd32BrSQh75kwuWf+2a+ZQhK8LIQVNWr1q8nIvGyRi1z/sCWsSsNI8 OrYF+XP/9+ngy0jym3UThHBhhHRkJoX0KilVKzCNy3ezkeKBzL3OXqijkfCfLWI+Nx2g /6Kg== X-Gm-Message-State: AOJu0YzcFbNNs/7FhHCk1iYk7d5MtSrH9PX2SzZ8yMEMytDkvAGRlzAj wIkc7vIibTDte5AgGG3FYzYJ346sLS/A/d8IHuAOJU+im5sSbn4fMaO+r1VWmDgAAdM5jAje9Pf i X-Received: by 2002:a17:906:c30f:b0:a46:2a85:b37b with SMTP id s15-20020a170906c30f00b00a462a85b37bmr2902264ejz.51.1710508173970; Fri, 15 Mar 2024 06:09:33 -0700 (PDT) Received: from m1x-phil.lan ([176.176.145.26]) by smtp.gmail.com with ESMTPSA id v23-20020a1709067d9700b00a461a7ba686sm1707470ejo.75.2024.03.15.06.09.31 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 15 Mar 2024 06:09:33 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Markus Armbruster Cc: qemu-riscv@nongnu.org, Anton Johansson , qemu-s390x@nongnu.org, qemu-ppc@nongnu.org, =?utf-8?q?Daniel_P_=2E_Berrang?= =?utf-8?q?=C3=A9?= , Paolo Bonzini , Eduardo Habkost , Claudio Fontana , Richard Henderson , Peter Maydell , =?utf-8?q?Alex_Benn=C3=A9e?= , Manos Pitsidianakis , Zhao Liu , qemu-arm@nongnu.org, Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Nicholas Piggin , Daniel Henrique Barboza Subject: [PATCH-for-9.1 03/21] target/ppc: Declare CPU QOM types using DEFINE_TYPES() macro Date: Fri, 15 Mar 2024 14:08:51 +0100 Message-ID: <20240315130910.15750-4-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240315130910.15750-1-philmd@linaro.org> References: <20240315130910.15750-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::532; envelope-from=philmd@linaro.org; helo=mail-ed1-x532.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org When multiple QOM types are registered in the same file, it is simpler to use the the DEFINE_TYPES() macro. In particular because type array declared with such macro are easier to review. In few commits we are going to add more types, so replace the type_register_static() to ease further reviews. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20231013140116.255-16-philmd@linaro.org> Reviewed-by: Zhao Liu --- target/ppc/cpu_init.c | 52 +++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 29 deletions(-) diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c index 7e65f08147..d5e227a6fb 100644 --- a/target/ppc/cpu_init.c +++ b/target/ppc/cpu_init.c @@ -7432,39 +7432,34 @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data) #endif /* CONFIG_TCG */ } -static const TypeInfo ppc_cpu_type_info = { - .name = TYPE_POWERPC_CPU, - .parent = TYPE_CPU, - .instance_size = sizeof(PowerPCCPU), - .instance_align = __alignof__(PowerPCCPU), - .instance_init = ppc_cpu_instance_init, - .instance_finalize = ppc_cpu_instance_finalize, - .abstract = true, - .class_size = sizeof(PowerPCCPUClass), - .class_init = ppc_cpu_class_init, +static const TypeInfo ppc_cpu_types[] = { + { + .name = TYPE_POWERPC_CPU, + .parent = TYPE_CPU, + .abstract = true, + .instance_size = sizeof(PowerPCCPU), + .instance_align = __alignof__(PowerPCCPU), + .instance_init = ppc_cpu_instance_init, + .instance_finalize = ppc_cpu_instance_finalize, + .class_size = sizeof(PowerPCCPUClass), + .class_init = ppc_cpu_class_init, #ifndef CONFIG_USER_ONLY - .interfaces = (InterfaceInfo[]) { - { TYPE_INTERRUPT_STATS_PROVIDER }, - { } + .interfaces = (InterfaceInfo[]) { + { TYPE_INTERRUPT_STATS_PROVIDER }, + { } + }, +#endif + }, +#ifndef CONFIG_USER_ONLY + { + .name = TYPE_PPC_VIRTUAL_HYPERVISOR, + .parent = TYPE_INTERFACE, + .class_size = sizeof(PPCVirtualHypervisorClass), }, #endif }; -#ifndef CONFIG_USER_ONLY -static const TypeInfo ppc_vhyp_type_info = { - .name = TYPE_PPC_VIRTUAL_HYPERVISOR, - .parent = TYPE_INTERFACE, - .class_size = sizeof(PPCVirtualHypervisorClass), -}; -#endif - -static void ppc_cpu_register_types(void) -{ - type_register_static(&ppc_cpu_type_info); -#ifndef CONFIG_USER_ONLY - type_register_static(&ppc_vhyp_type_info); -#endif -} +DEFINE_TYPES(ppc_cpu_types) void ppc_cpu_dump_state(CPUState *cs, FILE *f, int flags) { @@ -7658,4 +7653,3 @@ void ppc_cpu_dump_state(CPUState *cs, FILE *f, int flags) #undef RGPL #undef RFPL } -type_init(ppc_cpu_register_types) From patchwork Fri Mar 15 13:08:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 780483 Delivered-To: patch@linaro.org Received: by 2002:a5d:46c1:0:b0:33e:7753:30bd with SMTP id g1csp189114wrs; Fri, 15 Mar 2024 06:10:39 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWYns84hSPS0ZKIAklO1PKCNNhWXWTLjg8+eDFx1h35N7tqLTXJhUHy9a0VnLDBBDly74KvSlrtRgpTflZgcP4t X-Google-Smtp-Source: AGHT+IEeuToXJdaG9wCCD3AplSLTJn4p8oufTcFo1lY6HSkk+JHtrfaMKKPh/c4gF8Jqirw436cv X-Received: by 2002:a05:620a:1018:b0:787:ea8a:d048 with SMTP id z24-20020a05620a101800b00787ea8ad048mr3947705qkj.46.1710508239209; Fri, 15 Mar 2024 06:10:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710508239; cv=none; d=google.com; s=arc-20160816; b=ry2VQhwJc4uQz/NTV9LelLZ+9t3Tf6JEBdxvdqHJStO1MI0BaSofcYDgNTBYOxX1tC ipUQINccjxIjGs0rG/BMzfJtdVGeUDXJPE9+b4SSB8GZod0IYpzy1oxbJBhrVoHEpiOu COC8e4eTY0mmmcsOb4xN/cMbPGUz/UiRhYoVUMGwM8V09l1I29RSZv4YpM92KA53owNq pXJtcmiLDJn6B+CpAXSgTCSJ7x8obug2C9QcjP3Ai905Ldl0wymevzflZwHy0MQ/NQDa EXGDqd5ZuI+67lAAtzqO0crcB4cbGjR8opceVVKDQcgwrUX1sUa8dkzLP3beWFbXFVMK iHuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xkGMjK1G9yFAmyZjfysW+oy0VEwc0DxCtLcyXCgX4n0=; fh=7/7DbajHzTjQrBgzONxijGgQFmSrUBH4ZShWy4lMy6Q=; b=obe/QNq/WSLkl5AmsUWkNyTrR7e1GOC63Djta6evVgpwiIwVPNPZdO3dQICXab1NfJ kWUcoGK9abN+RnSFtUWOBQudOiuIoNVmr7T4AH05JmvHnmqyYu7C3mS/DkSnvKsjG3hy /y4slpvRq/lYUbytUT/4jIIaLhdrYxBD3Qu4X2+VCcM5r5OccX2y6K8XaIUFQSALR/g1 5Vw7r+2S7LcvmhbHqEH22W258Th+TCuwCXaw/5qZgTPO8JA4fPzjuMQ/095y2zg3ERxO kiZ/ODem/NVICDmVDKd+EL5nVVmVxk2HGswjyHDuKyNMm8wjOUNNZLAyEhaSRD9BO6zQ UNcQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yUX8Bfrd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id m3-20020a05620a290300b00788742dc07bsi4035821qkp.495.2024.03.15.06.10.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 Mar 2024 06:10:39 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yUX8Bfrd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Markus Armbruster Cc: qemu-riscv@nongnu.org, Anton Johansson , qemu-s390x@nongnu.org, qemu-ppc@nongnu.org, =?utf-8?q?Daniel_P_=2E_Berrang?= =?utf-8?q?=C3=A9?= , Paolo Bonzini , Eduardo Habkost , Claudio Fontana , Richard Henderson , Peter Maydell , =?utf-8?q?Alex_Benn=C3=A9e?= , Manos Pitsidianakis , Zhao Liu , qemu-arm@nongnu.org, Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org When multiple QOM types are registered in the same file, it is simpler to use the the DEFINE_TYPES() macro. In particular because type array declared with such macro are easier to review. In few commits we are going to add more types, so replace the type_register_static() to ease further reviews. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson 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, void *data) cc->tcg_ops = &sparc_tcg_ops; } -static const TypeInfo sparc_cpu_type_info = { - .name = TYPE_SPARC_CPU, - .parent = TYPE_CPU, - .instance_size = sizeof(SPARCCPU), - .instance_align = __alignof(SPARCCPU), - .instance_init = sparc_cpu_initfn, - .abstract = true, - .class_size = sizeof(SPARCCPUClass), - .class_init = sparc_cpu_class_init, +static const TypeInfo sparc_cpu_types[] = { + { + .name = TYPE_SPARC_CPU, + .parent = TYPE_CPU, + .instance_size = sizeof(SPARCCPU), + .instance_align = __alignof(SPARCCPU), + .instance_init = sparc_cpu_initfn, + .abstract = true, + .class_size = sizeof(SPARCCPUClass), + .class_init = sparc_cpu_class_init, + } }; +DEFINE_TYPES(sparc_cpu_types) + static void sparc_cpu_cpudef_class_init(ObjectClass *oc, void *data) { SPARCCPUClass *scc = SPARC_CPU_CLASS(oc); @@ -984,7 +988,6 @@ static void sparc_cpu_register_types(void) { int i; - type_register_static(&sparc_cpu_type_info); for (i = 0; i < ARRAY_SIZE(sparc_defs); i++) { sparc_register_cpudef_type(&sparc_defs[i]); } From patchwork Fri Mar 15 13:08:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 780486 Delivered-To: patch@linaro.org Received: by 2002:a5d:46c1:0:b0:33e:7753:30bd with SMTP id g1csp190079wrs; Fri, 15 Mar 2024 06:12:20 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV6bDOSLVqVVUaSWIpsaYJ8b3r2cha2lto44Or+Drr46a68XPc8qcO7eu9Z3Wp2398N0sm4QHP+957K/WV6I1RU X-Google-Smtp-Source: AGHT+IEkgsmcWXHjZlV/+fTMRcnGTCZiKV5jnJRjhDWbAkoiY95+tGqOB/YA6SXmOokzyJYA64WJ X-Received: by 2002:a05:6214:1c0a:b0:690:b03e:15b3 with SMTP id u10-20020a0562141c0a00b00690b03e15b3mr8246315qvc.17.1710508339973; Fri, 15 Mar 2024 06:12:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710508339; cv=none; d=google.com; s=arc-20160816; b=l/oBKVATPVqa9hShnktQCoxGkPa75MXhnyMyGfTLIbp9j70NFdKrjqIf8Pgl/cCEAO E47j0/ZhUSIDG2FnAlrFz+q7rCEP1DbTx4vngx3ZZDlxzG6DrY4HwCDkd5bcNypFzsWz 8rN9g6Cc7EgJZ3Ri9vDhjtzylonA400nsuEEjSYnd0KOi1i43kx4DZdx4VtJqgKXVhxg WyAeQN02r8eFozTDA6RAzvoWj43N/bEQk4/XyqGxKLbQB/gsgRz9mHTaFYU8pfLmzl8Y QcWKQjhLb45lFPjvHVW5fnWBIyOlH2xX+cl9HzvLYsCaELZApqVzM4ZEIa/L1H9wvve4 GVoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7ztA/s++99kJlJQVkkhi5KVYRPW5VID21TBVzyIGr2Y=; fh=sP1j86B4Cq3cnuHiJPjjVux7pLdYXCqeFC+/cz7MhyM=; b=sLAhkLaL9e/jVUP3S/ZIytoVypXT6xAGtiH7plJYbBJs0Kzjr2daDjKcYbPJqyoME8 gEM5WeD4RxB7VngH6GcT2hjBibF677t6fnDKm3/emuj2XboF0Ee7CAPLx25zrDI8YchB sHZ09qzQPjPVHddDxwyDBKFUiSN0QW/am+Hq46eBZP7fSi5nQoIzRAjvUNwEnPqh5Ndm ZZSqdlXQFkX3vMtYBbi/fYC+3u7UW8pk4kuMJktVXNgSzg4i1ntYZQU06m76UGRkuN5F nSITW1QUckYMfjTDX8+4WiegWeCxAkvrVfzXzn3hoZtJnkIP6mpBdB63NuA9ymwBVdBK q0wA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jiGT8GrZ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id kk23-20020a056214509700b0068c8a605eb5si2746535qvb.96.2024.03.15.06.12.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 Mar 2024 06:12:19 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jiGT8GrZ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Markus Armbruster Cc: qemu-riscv@nongnu.org, Anton Johansson , qemu-s390x@nongnu.org, qemu-ppc@nongnu.org, =?utf-8?q?Daniel_P_=2E_Berrang?= =?utf-8?q?=C3=A9?= , Paolo Bonzini , Eduardo Habkost , Claudio Fontana , Richard Henderson , Peter Maydell , =?utf-8?q?Alex_Benn=C3=A9e?= , Manos Pitsidianakis , Zhao Liu , qemu-arm@nongnu.org, Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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_ArchCPU' 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_TYPE' 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_##TypeName ^ :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é Acked-by: Richard Henderson --- TODO: check rth comment: What about adding an OBJECT_DECLARE_CPU_SUBTYPE that omits half the stuff instead? 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) typedef enum MMUAccessType { MMU_DATA_LOAD = 0, From patchwork Fri Mar 15 13:08:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 780494 Delivered-To: patch@linaro.org Received: by 2002:a5d:46c1:0:b0:33e:7753:30bd with SMTP id g1csp192508wrs; Fri, 15 Mar 2024 06:16:16 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVXlQ6GT7Tvsc3mr57eEbQ56gAJycGkfqpc5QvY9f+XQRINJemcScMx/SkYbs7gkUucWVsxRBgHH7pgZtpbLYvV X-Google-Smtp-Source: AGHT+IFXUsvXXCZlp2I7mbaX/xgKngzQB849uIoFPbXtENqq0AkPd2LJwGo8Ll8UVJ/bbEZJI08b X-Received: by 2002:a05:622a:12:b0:42e:f60c:66f with SMTP id x18-20020a05622a001200b0042ef60c066fmr3866302qtw.52.1710508575982; Fri, 15 Mar 2024 06:16:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710508575; cv=none; d=google.com; s=arc-20160816; b=yk4WO6jax/ZygYMTCTfOoi0m2uZSwhPPFvwJvMDBbYsGFMMSaBZHf+cQ12Sb0kXB7E e1+qtDgBreGqEWvkqNZXXN5Mg6ahDNrWS9GdLAKE/bKB89QVBQIh8UKrgPMuEtNAJ9a3 ydYCbizJaMnbkwx5U20k2IFQr8Kk7+dFGjg+l4dREuqN3GybpZGzsB26qpdIFk4NHArT UVtGFkdniREH4yBP3afAoclA7saZuRDTwaUrW1wW7e35e+vyIlo/OzmVKRLbiW7px1Aj A7uIHEnT//KeC0iTTSrN4rAwm9WkO+Fcj0yjp5PmZFnMf9PK3CuxUJyQ/oGqBamAhyhE 3sow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ySG/dFK2HZQD+JLMFszQWRBPaJ0ef+Mlaqjr0ZCyRnE=; fh=ysVyv4NDd/Nyu4/YF9/9iJnDzvlMLfId2Gvov5d4COg=; b=w6BDyzEhrprf4Zn6R/BLNWjdnn/583JSpTExVH9yrdaWVOCdKKxPUSm87wXJZ6ig// 0dAPLc6Qt8PS+XNQ8JwCDOwf2aw9AnAhGkswtIzyMpsqEsH20ZiHKUGGIVLdkwf2T9ry BgmJXfLi55MGEtmkd65czyCcIN6IxD5yu6ydk6PWUkNbirQ5oE03jOGcolcakpeorc6Z ZIIUvqeNf/kvQGC+LOU0d6LuoUAv76/nSaUbIo+zA69We3XElfSinnjxxAlLoA8yKN5f jcmAFQ+rftwwuAm+eRYXiySwRaSPuQOjYQ9+fsyj6B1OgEoV4zRxOJ+OkXnvjN1LMTDv ng1g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tuqz9HFZ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h10-20020a05622a170a00b0042f28e60aebsi3798789qtk.106.2024.03.15.06.16.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 Mar 2024 06:16:15 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tuqz9HFZ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Markus Armbruster Cc: qemu-riscv@nongnu.org, Anton Johansson , qemu-s390x@nongnu.org, qemu-ppc@nongnu.org, =?utf-8?q?Daniel_P_=2E_Berrang?= =?utf-8?q?=C3=A9?= , Paolo Bonzini , Eduardo Habkost , Claudio Fontana , Richard Henderson , Peter Maydell , =?utf-8?q?Alex_Benn=C3=A9e?= , Manos Pitsidianakis , Zhao Liu , qemu-arm@nongnu.org, Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , 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 Received-SPF: pass client-ip=2a00:1450:4864:20::532; envelope-from=philmd@linaro.org; helo=mail-ed1-x532.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org "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é 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 @@ #include "hw/core/cpu.h" -#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" OBJECT_DECLARE_CPU_TYPE(X86CPU, X86CPUClass, X86_CPU) +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) 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[] = { .class_size = sizeof(X86CPUClass), .class_init = x86_cpu_common_class_init, }, { - .name = X86_CPU_TYPE_NAME("base"), + .name = TYPE_I386_CPU, .parent = TYPE_X86_CPU, + .abstract = true, + }, { + .name = TYPE_X86_64_CPU, + .parent = TYPE_X86_CPU, + .abstract = true, + }, { + .name = X86_CPU_TYPE_NAME("base"), +#ifdef TARGET_X86_64 + .parent = TYPE_X86_64_CPU, +#else + .parent = TYPE_I386_CPU, +#endif .class_init = x86_cpu_base_class_init, }, { .name = X86_CPU_TYPE_NAME("max"), - .parent = TYPE_X86_CPU, +#ifdef TARGET_X86_64 + .parent = TYPE_X86_64_CPU, +#else + .parent = TYPE_I386_CPU, +#endif .instance_init = max_x86_cpu_initfn, .class_init = 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 = g_strdup(mname); data->cpu_model = "Haswell"; /* 1.3+ theoretically */ data->device_model = g_strdup_printf("%s-%s-cpu", data->cpu_model, - qtest_get_arch()); + qtest_get_base_arch()); data->sockets = 1; data->cores = 3; data->threads = 2; From patchwork Fri Mar 15 13:08:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 780501 Delivered-To: patch@linaro.org Received: by 2002:a5d:46c1:0:b0:33e:7753:30bd with SMTP id g1csp194094wrs; Fri, 15 Mar 2024 06:19:11 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUNFrTPYP+l75HJDlS8Kkp3byfJpS/Xwy0HidlgioR2jCJv0c4sFPPx8ASQNcmaNeHkzfbij18AIe0N0XHgnugH X-Google-Smtp-Source: AGHT+IGqKIp5ZzC2VQgDSHmCXA6B9P2KkE1nQ7JCfBvL2wbrmtX0Xi3+9xvzP9ybGKRi4CWrI6KR X-Received: by 2002:a05:6830:102:b0:6e6:695d:f286 with SMTP id i2-20020a056830010200b006e6695df286mr5044800otp.23.1710508751561; Fri, 15 Mar 2024 06:19:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710508751; cv=none; d=google.com; s=arc-20160816; b=AVDowLJv9Q5xFvykW14ywmqsp7fWPTLtkAcJ7NokQQW0QwbR2ysf1Lu1cft2oCiavj +Cwz7HJxEctsLJUIdw6UBr6cBOBJjtD9va/lqnzwN0C/8CGgaFKYzApLjW62JkW8XixF K7zjGXu8yMy4TsXkY6lvw2Ez6uC8pTmjlz7hZL3hQqxHTlpHb4pYDnN1Z7vXTcks98lW sKpqaV3JqJ00zmzcgJpRISR6qeEGFGWQTV8nUYzrlngJSSsxh3FbGdLCFivjUeKjRmF6 08GglBM1cn9Gc3seYojWVOK/g+94+yk9oZ624AjfkySEQA348qXE8BKhKFJo99hH1sfw fmJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fQB6SJNy6yiy7zdv0lmI6ciVyOB2Uy024AmMoGafIwE=; fh=85r/OVnsV7RrkGrWQB+/y8IVWO+q5o/yUConn+TqcOk=; b=mcsPtk3XA9Rm7QlJ8qKwLASUrUUexJEooJxf0epd9m54/AliBhDYl2wzwi8wOjzdE+ ET92K9XG6X/6kPR+ady6R74UBggqDH5fbPEfK0B6oleEEDhxAAb/WN3SPl21G7jeIWMD lZRRbIMbqFg+MGn6MYFYW1LS1TNpqVX6wBRSLMA342T34/qcqucFJ7v3vFm8LTf6fEyZ TwdSmZh15VPk5JQBFfVOSlFOQ+9QEIokme/h/9EYA/+8ew7BKjYkQa0N5qBUwmvQSXrw /qktlweby2FTrbUm0l7cNKci4Da1KqK9DhAhqhPkZSSCmmqN6ztA35gKuuDSmMqzjOrk 21pg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=D5Yow0ZK; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s21-20020a05620a29d500b00789e81d095fsi590364qkp.199.2024.03.15.06.19.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 Mar 2024 06:19:11 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=D5Yow0ZK; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Markus Armbruster Cc: qemu-riscv@nongnu.org, Anton Johansson , qemu-s390x@nongnu.org, qemu-ppc@nongnu.org, =?utf-8?q?Daniel_P_=2E_Berrang?= =?utf-8?q?=C3=A9?= , Paolo Bonzini , Eduardo Habkost , Claudio Fontana , Richard Henderson , Peter Maydell , =?utf-8?q?Alex_Benn=C3=A9e?= , Manos Pitsidianakis , Zhao Liu , qemu-arm@nongnu.org, Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org "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é --- 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 @@ #include "hw/core/cpu.h" -#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" OBJECT_DECLARE_CPU_TYPE(MIPSCPU, MIPSCPUClass, MIPS_CPU) +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 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[] = { .abstract = true, .class_size = sizeof(MIPSCPUClass), .class_init = mips_cpu_class_init, + }, { + .name = TYPE_MIPS32_CPU, + .parent = TYPE_MIPS_CPU, + .abstract = true, + }, { + .name = TYPE_MIPS64_CPU, + .parent = TYPE_MIPS_CPU, + .abstract = true, } }; @@ -620,7 +628,8 @@ static void mips_register_cpudef_type(const struct mips_def_t *def) char *typename = mips_cpu_type_name(def->name); TypeInfo ti = { .name = typename, - .parent = TYPE_MIPS_CPU, + .parent = def->insn_flags & CPU_MIPS64 + ? TYPE_MIPS64_CPU : TYPE_MIPS32_CPU, .class_init = mips_cpu_cpudef_class_init, .class_data = (void *)def, }; diff --git a/target/mips/sysemu/mips-qmp-cmds.c b/target/mips/sysemu/mips-qmp-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 @@ #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 = data; - CpuDefinitionInfoList **cpu_list = user_data; - CpuDefinitionInfo *info; - const char *typename; - - typename = object_class_get_name(oc); - info = g_malloc0(sizeof(*info)); - info->name = cpu_model_from_type(typename); - info->q_typename = g_strdup(typename); - - QAPI_LIST_PREPEND(*cpu_list, info); -} +#include "qapi/commands-target-compat.h" CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) { - CpuDefinitionInfoList *cpu_list = NULL; - GSList *list; - - list = 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); } From patchwork Fri Mar 15 13:08:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 780499 Delivered-To: patch@linaro.org Received: by 2002:a5d:46c1:0:b0:33e:7753:30bd with SMTP id g1csp193799wrs; Fri, 15 Mar 2024 06:18:39 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVa341CjEg/yc1WkSLhFOvyeQd69JykAVl6ouvut1D37fKbusCbIyZenebugIu8nwqr2R2N5KMdo6QweuVoIvnq X-Google-Smtp-Source: AGHT+IG3sdzg0C73LqvbGiI7Oo54sEObpCBYsrDH7JjJd34fZoBj1qlFNQHQb3Ykz1wUgAeAYelE X-Received: by 2002:a05:6870:7185:b0:220:13b5:3e9e with SMTP id d5-20020a056870718500b0022013b53e9emr4094117oah.4.1710508719380; Fri, 15 Mar 2024 06:18:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710508719; cv=none; d=google.com; s=arc-20160816; b=fJo3a7plTktZtX7EvtLyoFf9jv04PcDshiGbE3bF+HZb3qdW0JoJB/XthotmwHh85g jNNpPXrRetn+DPhLTnPkDNHiPkRSdnV8CA9hfvHK+4kX2k3DzVY2pUhSP2qXwaw5XwVq QbxlFsoobEnwvm2Apwa7jzxB1cOPJ9w8nosdjTCv/hUN9XY5U31s4ZKoAnfBn3jvdqnQ EdLMdOZ2K0N4OAKwNC2C54fjZq3GwO4YbR6XGjHr8yLtpS7JzP1B/88T7E00ckzBqUFe HZCy0DbxiX9ukUyOYtcNjIQVGapgtrWdVWbuA5XRR5VT1V/NxdWmfxJV5cwtmcTkIoYm 5dFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qDIsKXjb1Jl9yBqR7T/u0FWdWtcs/rDVYwZEhcpoxew=; fh=7/7DbajHzTjQrBgzONxijGgQFmSrUBH4ZShWy4lMy6Q=; b=pG34C+lASe+PNKz3jtLt/4Zxp336egG2asdJIz5udrVBaLh2krPD0AP6KYVMPmsHcf 3yIQGKsCQTFrc9yiRv6w392I0dxFeKQBeAW3HMVQRSFd2bXhWEspmk1LHMJKpt0DCDQI IRK7vUbm/W1j8GDlR/5SsxAkhZLA3ykf1igJjVkFiHuZrp8VMh3LJkd0VJZYRgsTc0y3 RgtXSiOQf7uQLDhrP+Lz3bUgbSbp4tfnh+iSJ84ZFPQs3Q+cCnlJPZ312dBB6Ah/lMNJ AfPm/DQtUGK/QqiiJjUWe8uDDe7bb42Q6Ud/dsD08sBBdD7pW+gVUAgz4A/fssJ1rwQa +ZAA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nloCUCPn; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h9-20020a05620a400900b0078826373df2si3894444qko.611.2024.03.15.06.18.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 Mar 2024 06:18:39 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nloCUCPn; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Markus Armbruster Cc: qemu-riscv@nongnu.org, Anton Johansson , qemu-s390x@nongnu.org, qemu-ppc@nongnu.org, =?utf-8?q?Daniel_P_=2E_Berrang?= =?utf-8?q?=C3=A9?= , Paolo Bonzini , Eduardo Habkost , Claudio Fontana , Richard Henderson , Peter Maydell , =?utf-8?q?Alex_Benn=C3=A9e?= , Manos Pitsidianakis , Zhao Liu , qemu-arm@nongnu.org, Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org "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é 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 @@ #include "hw/core/cpu.h" -#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" OBJECT_DECLARE_CPU_TYPE(SPARCCPU, SPARCCPUClass, SPARC_CPU) +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 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[] = { .abstract = true, .class_size = sizeof(SPARCCPUClass), .class_init = sparc_cpu_class_init, + }, { + .name = TYPE_SPARC32_CPU, + .parent = TYPE_SPARC_CPU, + }, { + .name = TYPE_SPARC64_CPU, + .parent = TYPE_SPARC_CPU, } }; @@ -975,7 +981,11 @@ static void sparc_register_cpudef_type(const struct sparc_def_t *def) char *typename = sparc_cpu_type_name(def->name); TypeInfo ti = { .name = typename, - .parent = TYPE_SPARC_CPU, +#ifdef TARGET_SPARC64 + .parent = TYPE_SPARC64_CPU, +#else + .parent = TYPE_SPARC32_CPU, +#endif .class_init = sparc_cpu_cpudef_class_init, .class_data = (void *)def, }; From patchwork Fri Mar 15 13:08:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 780491 Delivered-To: patch@linaro.org Received: by 2002:a5d:46c1:0:b0:33e:7753:30bd with SMTP id g1csp191428wrs; Fri, 15 Mar 2024 06:14:27 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW2v4XRQQgUtjaZkWfa0v8aEhlC8aAVHDZbEYjp3FUcSL4BbgZsLFJEcWV5dzyVNXVU01sc88EF43MsBu4F/kV1 X-Google-Smtp-Source: AGHT+IHuIN0FT4htu1u1VINqT0vUHaWEzNI+MzOA73R4ous56U/bj2mkZ1SDUTbvjkigTVe/kq1P X-Received: by 2002:a9d:7f99:0:b0:6e6:78d7:609b with SMTP id t25-20020a9d7f99000000b006e678d7609bmr2354167otp.8.1710508467311; Fri, 15 Mar 2024 06:14:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710508467; cv=none; d=google.com; s=arc-20160816; b=bhSDI3BvPH4ak1YKgKmix3sMUPr2oKMKW1/royfx8k85V7qpnYMWdkMUuyJvuRa+qL hc5xSoAhuF5lTaaJ+2XyqZ5te3SVIkJlnCjPhkiMb4hZfAy1vfbUitQbcWQXEGFgza2D b9gp6xgjp6cI4fWWSQQAF6NzU6TbjSe7AOz29s8VhpmbpEA2v8yv/Z50+uTTqeFBkiZP YMZe3/3XOUkaTnNEfbiKNK3IT0Lqpy8Zys7bh6KBXJ8AjCXtvu2rtl50kegpty3UbHKY Lpp0fFSgU4zFc6zn0gZezcz//Vm2S5FOJFZcCIS2sUoaP4ojP9w85W97zuO0oC16xh/P kh4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=501a0naqlbNKu8avIdgSMPglnIX/rNjXROgIt46X+30=; fh=2VzDBqlFiyVCvkFZTYzUjvN0fQatfqzVnPW1+dphnSY=; b=BORpFm7be7qUMlHQLvU93wBALgh8YmOWv3THKtz+r9sGK1TQTReHC3u85GvzGkuk4V g3146OCaLMsj3LGvXPVTWJHIcOgkhu7PbnLg9GcUL2f1PhvZiT6oKNrMFEYjueHqGh2X +U6hWl6aIhn8oZRsj+E/VRSsYbjyZdpi/P+kkcCzOn8XTTHG/nyDk7Im/op93TIpeq4a QK3sPy3HOcs8TuZxVDc5rzwPopIl83MYjeHgKQyLjlhpdSmOELFGMjT4gSAl7XWWgHp3 3Nr9uh82pJrDUVi3hsmVKgsOORSwSsiOtNixdff85T3zbdhma0jAiWnTgAnpppxL4Ovw 2i4Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YQ7VCtbR; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id i26-20020a056122129a00b004c8c7cab618si449346vkp.195.2024.03.15.06.14.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 Mar 2024 06:14:27 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YQ7VCtbR; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Markus Armbruster Cc: qemu-riscv@nongnu.org, Anton Johansson , qemu-s390x@nongnu.org, qemu-ppc@nongnu.org, =?utf-8?q?Daniel_P_=2E_Berrang?= =?utf-8?q?=C3=A9?= , Paolo Bonzini , Eduardo Habkost , Claudio Fontana , Richard Henderson , Peter Maydell , =?utf-8?q?Alex_Benn=C3=A9e?= , Manos Pitsidianakis , Zhao Liu , qemu-arm@nongnu.org, Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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é --- 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=python -# -# This work is licensed under the terms of the GNU GPL, version 2 or later. -# See the COPYING file in the top-level directory. - -## -# = 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. -{ 'include': 'machine-common.json' } +{ 'include': 'machine.json' } ## # @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 @@ ## { 'include': 'common.json' } -{ 'include': 'machine-common.json' } ## # @SysEmuTarget: @@ -50,6 +49,18 @@ 'prefix': 'S390_CPU_STATE', 'data': [ 'uninitialized', 'stopped', 'check-stop', 'operating', 'load' ] } +## +# @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" #define ELF_MACHINE_UNAME "S390X" 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 = [ 'error', 'introspect', 'job', - 'machine-common', 'machine', 'machine-target', 'migration', From patchwork Fri Mar 15 13:08:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 780492 Delivered-To: patch@linaro.org Received: by 2002:a5d:46c1:0:b0:33e:7753:30bd with SMTP id g1csp191512wrs; Fri, 15 Mar 2024 06:14:39 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUAOX7jqr82+wtSU9eRJbRvthUXYL4w1DebcnZtcptec78ld07YTvnkKEZHZhQpj4DWz3YwHECtrXh7cHQKGHRm X-Google-Smtp-Source: AGHT+IHKdOUHiRHHpsKU3EsuYca+VfBtyyWp2UWX2Q2+6++Psb8/S/E/+Ecto7jOusvrp50QWGna X-Received: by 2002:a1f:7d8b:0:b0:4d4:2176:6b6a with SMTP id y133-20020a1f7d8b000000b004d421766b6amr4873459vkc.8.1710508478823; Fri, 15 Mar 2024 06:14:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710508478; cv=none; d=google.com; s=arc-20160816; b=rb+IwJCqGLEYcfXkbE/19J1Zsl7q21shtbQNOKFBqaijibyp3fK0/YG4DsTyQOf6L4 DlRim7XrwGo30cVPQLSq9Ar+KXn8vzrKpL47TaAepGMHnjtlNZ/58uw3xrDfeRlsm4HL FL8uQVCK594za6AJY2ear3pSHKT7YptqkC9PjeUOAPdnis/wYWEm4JiizjhvExxdn22L t/Ym+UhASCbpaSpCZ4hUvHIYAFo6sTXUYs19BIiWDOyDekRANikiFhmu+bxVsT/DuEc+ 4ibZuPqtHCg+rCFuoHvk6O+8n884LFC1tiXM1A+lFnruDvmfym5gGcYFO82iyAfdZ5Ox 4zsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=juKrFHTenueZGgaczYCixm7yTPX2XVgDuiXA1GdKgho=; fh=PA7Itx6BY35wAM0XPD2z9TDGi1pstgqjn3JUvFuazwM=; b=FILAeQABAjSz8ok3WPCbU7bigBKuRnZ7bv6j29s7PZroV52J4/3CbN888yNBTDLOxF LKW6A9WlXWNwzJGdZx6TAMeVBEYEwjs2DscKvmEJ2OxXlp+IKV8s7SYcMi4wi8uD4E59 zAvolbpCPg+TFXdchSLHoTuRSi58AGb/eRWWqOBb6qgKZZd8DCBtVfXBBYDShpTAsYfG nMRActIRWjP/Jw311rd1iHU+vvdV+pWP1sOl1i5woaZ2CcPEY+LYI5fHdzohV9+DwU/1 DJU5fohkEONI7i2t+IuGcF/iZx1Ld67wgIwSjQPVCL2ua36ykmhQFFzOH4di+xIPphlG ONLQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nvfjlwjp; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id n14-20020ac5c88e000000b004d40884cb62si476567vkl.162.2024.03.15.06.14.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 Mar 2024 06:14:38 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nvfjlwjp; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Markus Armbruster Cc: qemu-riscv@nongnu.org, Anton Johansson , qemu-s390x@nongnu.org, qemu-ppc@nongnu.org, =?utf-8?q?Daniel_P_=2E_Berrang?= =?utf-8?q?=C3=A9?= , Paolo Bonzini , Eduardo Habkost , Claudio Fontana , Richard Henderson , Peter Maydell , =?utf-8?q?Alex_Benn=C3=A9e?= , Manos Pitsidianakis , Zhao Liu , qemu-arm@nongnu.org, Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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é --- 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 @@ { 'include': 'machine.json' } -## -# @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 @@ { 'include': 'common.json' } +## +# @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: # From patchwork Fri Mar 15 13:08:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 780500 Delivered-To: patch@linaro.org Received: by 2002:a5d:46c1:0:b0:33e:7753:30bd with SMTP id g1csp193798wrs; Fri, 15 Mar 2024 06:18:39 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWK6PflHPNDuVFuhjU2umKiQSi10AGV35clQ4pyh/WRdIaECihGHK2BncPZfZia4dbeJBSBhv9XG/xMWqq4dujI X-Google-Smtp-Source: AGHT+IE85qZP2BAzV/yP9Qo5+OsmkdaK15Pv6Y2rSyZW4qmLkIiCEZjmdZDvoqlCh/TGGIDJ5+y/ X-Received: by 2002:a9d:734e:0:b0:6e5:23aa:9afc with SMTP id l14-20020a9d734e000000b006e523aa9afcmr5175826otk.14.1710508719295; Fri, 15 Mar 2024 06:18:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710508719; cv=none; d=google.com; s=arc-20160816; b=qkOvaVQ+9aS4t+OHihJ2x2vCx+1Ix3ad99HDNKKNsDleAV/wEVjZ4P8nmnSs04lQ8I nUItWWKQiANLxfpmRoM4t7nfTCDUUr4cE/narZF78QetnyWk9bXzQ6McCgTZNhkASfMw dSnLMYH3gO5on6NiUhcscskT2E6BvsYhuMwKNz5IWuRws4WYN6+CekiiTSSiLrCLM89w 2CJztA39TyrF6aXAyCDRe16RZyzTPnDX/aVQxVI23AN89NdzjBxyprnhT/9Fg2QusylD To3jdgN/U8Usqxdpek2vWoyVmurF6VIjr3f9uHF14GnDcfpCMnyTV/mAwHK4J6l/WKRw x54A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3PuQ6WSEYLWnTCNPDldZo+Ppk/XGMtRnTbQuxwxDUsU=; fh=PA7Itx6BY35wAM0XPD2z9TDGi1pstgqjn3JUvFuazwM=; b=nFWywB528KEDMrWbqOOEssn6QU1H0Q7J6QkBrWqUMyKE5hATfvYHmR3cTew27QJ9fH kROebEpd2QA3vAe6CZ80Sb+V9qHqqBLm7x4zwtglg/tPqLRyPYDs7qGCnwVoFeoq0q2/ zoN5krQaHJgejf4QTjt5rnTvgPVQZKGclMI2PLvSN+cVWR12nZmmGT4pA69mkkC+x3DB w6NElYenhzBiw9huPjIKDfFXkXWvJHt60rN+mMZe7MWbSBdFg6175rIOW3qdEVeLT31h 6jtgs/ENhqfU0JS+0zzPEZtflJc7C96J9/9kQSHbru0JhqR19Yce50/pdAUZyIghLY+3 etwg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N8uBIKKO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id r21-20020a05622a035500b0042f0f76945bsi1819307qtw.326.2024.03.15.06.18.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 Mar 2024 06:18:39 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N8uBIKKO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Markus Armbruster Cc: qemu-riscv@nongnu.org, Anton Johansson , qemu-s390x@nongnu.org, qemu-ppc@nongnu.org, =?utf-8?q?Daniel_P_=2E_Berrang?= =?utf-8?q?=C3=A9?= , Paolo Bonzini , Eduardo Habkost , Claudio Fontana , Richard Henderson , Peter Maydell , =?utf-8?q?Alex_Benn=C3=A9e?= , Manos Pitsidianakis , Zhao Liu , qemu-arm@nongnu.org, Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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é --- 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' ] } } -## -# @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 @@ { 'include': 'common.json' } +## +# @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: # From patchwork Fri Mar 15 13:09:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 780493 Delivered-To: patch@linaro.org Received: by 2002:a5d:46c1:0:b0:33e:7753:30bd with SMTP id g1csp191862wrs; Fri, 15 Mar 2024 06:15:13 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW4oq5ML3RVo1iND48zATU8r6coQNCpB3gJI+Izjes/bYKCbEbSo3/5AfmLiTI5f3gR99B+ZwZamJ6PsDvJB40E X-Google-Smtp-Source: AGHT+IFcbt4w18Ri9pSvEM1DIFefaK5ayRXh7hFkNUHm/pXzEmajhiFAXkDYnx7f7QyalMOW8mj0 X-Received: by 2002:a05:6830:84:b0:6e4:f953:3fac with SMTP id a4-20020a056830008400b006e4f9533facmr3760613oto.33.1710508513396; Fri, 15 Mar 2024 06:15:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710508513; cv=none; d=google.com; s=arc-20160816; b=Y307iF3vZDhOaxt0Q5P/bLOUZApH5qsh34XDNrt4M3q0MpZNsJKF5bTf8rel1ebmGF rvggaNXOmeJPFie5LHCOxAD77Jv3YIKijR9PEMMNHJAwJbagDc2co182cpC+DB50Wz0Z PJtNjmwMl0ffZhvo8suqj9Q+hts5NelzO3e3njrpbv5Iz+LXAykLF3sj37GhbbqiIpfT Pug8QYB6LN9VJ9M6joJi+EdQBv2sA8OEF2KjuhGUEFjdMClT6ji5iRMjhvV4MnBzwo2t nfzbzJK3bI5oJZpir1fs8LkOn5T7PAFgF3QwLbO6ryfC4RuIWYWRhWXDwSUJ0iW5qIIF 4ILg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Ziq2wowWWC1u1AFoZqkoU9Vq9nlm9ySbjwCpiWVML/s=; fh=Ol3tAPX/VLbajEqrc9A2NaG0RWh2tFO21EWtQ1skWSs=; b=DMUg9SWLXUfF8PKayhY4cZ8ZTZT3twDV7lfVbfRK8QKySOqM7TdGmZNM7zIHMxScjw Bshn2pfbtqtIj/ybkhRKY7T2P2XmxHeSy0Mm3cd2Zh+maxNmLRiiZl3RlpJDn4LaiBS7 21Ge//GPeLeg7aPwn8PBRc2B0d+A3zVOMhoEhIR0z7ppVqY5QBDCI/DE5ThUP1/nVm7j ZtkGeiQtIl2kJ6LvyI1HRVKfGr+bfwMkX6Ea6dqXQ7WJvzMDroCwhSb0fJjPbfzuC7ci J184dUTbTvu8JhD9xxR28QHNi4N5IXyqsShCZhYkrHlQKR/2MpKzaibXciZtj8dNvyFw rtzg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=op75yWP2; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id i24-20020a056122059800b004d33a7e99a4si475218vko.189.2024.03.15.06.15.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 Mar 2024 06:15:13 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=op75yWP2; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Markus Armbruster Cc: qemu-riscv@nongnu.org, Anton Johansson , qemu-s390x@nongnu.org, qemu-ppc@nongnu.org, =?utf-8?q?Daniel_P_=2E_Berrang?= =?utf-8?q?=C3=A9?= , Paolo Bonzini , Eduardo Habkost , Claudio Fontana , Richard Henderson , Peter Maydell , =?utf-8?q?Alex_Benn=C3=A9e?= , Manos Pitsidianakis , Zhao Liu , qemu-arm@nongnu.org, Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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é --- 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 +typedef enum QemuArchBit { + QEMU_ARCH_BIT_ALPHA = 0, + QEMU_ARCH_BIT_ARM = 1, + QEMU_ARCH_BIT_CRIS = 2, + QEMU_ARCH_BIT_I386 = 3, + QEMU_ARCH_BIT_M68K = 4, + QEMU_ARCH_BIT_MICROBLAZE = 6, + QEMU_ARCH_BIT_MIPS = 7, + QEMU_ARCH_BIT_PPC = 8, + QEMU_ARCH_BIT_S390X = 9, + QEMU_ARCH_BIT_SH4 = 10, + QEMU_ARCH_BIT_SPARC = 11, + QEMU_ARCH_BIT_XTENSA = 12, + QEMU_ARCH_BIT_OPENRISC = 13, + QEMU_ARCH_BIT_TRICORE = 16, + QEMU_ARCH_BIT_NIOS2 = 17, + QEMU_ARCH_BIT_HPPA = 18, + QEMU_ARCH_BIT_RISCV = 19, + QEMU_ARCH_BIT_RX = 20, + QEMU_ARCH_BIT_AVR = 21, + QEMU_ARCH_BIT_HEXAGON = 22, + QEMU_ARCH_BIT_LOONGARCH = 23, -enum { + QEMU_ARCH_BIT_LAST = QEMU_ARCH_BIT_LOONGARCH +} QemuArchBit; + +enum QemuArchMask { QEMU_ARCH_ALL = -1, - QEMU_ARCH_ALPHA = (1 << 0), - QEMU_ARCH_ARM = (1 << 1), - QEMU_ARCH_CRIS = (1 << 2), - QEMU_ARCH_I386 = (1 << 3), - QEMU_ARCH_M68K = (1 << 4), - QEMU_ARCH_MICROBLAZE = (1 << 6), - QEMU_ARCH_MIPS = (1 << 7), - QEMU_ARCH_PPC = (1 << 8), - QEMU_ARCH_S390X = (1 << 9), - QEMU_ARCH_SH4 = (1 << 10), - QEMU_ARCH_SPARC = (1 << 11), - QEMU_ARCH_XTENSA = (1 << 12), - QEMU_ARCH_OPENRISC = (1 << 13), - QEMU_ARCH_TRICORE = (1 << 16), - QEMU_ARCH_NIOS2 = (1 << 17), - QEMU_ARCH_HPPA = (1 << 18), - QEMU_ARCH_RISCV = (1 << 19), - QEMU_ARCH_RX = (1 << 20), - QEMU_ARCH_AVR = (1 << 21), - QEMU_ARCH_HEXAGON = (1 << 22), - QEMU_ARCH_LOONGARCH = (1 << 23), + QEMU_ARCH_ALPHA = (1 << QEMU_ARCH_BIT_ALPHA), + QEMU_ARCH_ARM = (1 << QEMU_ARCH_BIT_ARM), + QEMU_ARCH_CRIS = (1 << QEMU_ARCH_BIT_CRIS), + QEMU_ARCH_I386 = (1 << QEMU_ARCH_BIT_I386), + QEMU_ARCH_M68K = (1 << QEMU_ARCH_BIT_M68K), + QEMU_ARCH_MICROBLAZE = (1 << QEMU_ARCH_BIT_MICROBLAZE), + QEMU_ARCH_MIPS = (1 << QEMU_ARCH_BIT_MIPS), + QEMU_ARCH_PPC = (1 << QEMU_ARCH_BIT_PPC), + QEMU_ARCH_S390X = (1 << QEMU_ARCH_BIT_S390X), + QEMU_ARCH_SH4 = (1 << QEMU_ARCH_BIT_SH4), + QEMU_ARCH_SPARC = (1 << QEMU_ARCH_BIT_SPARC), + QEMU_ARCH_XTENSA = (1 << QEMU_ARCH_BIT_XTENSA), + QEMU_ARCH_OPENRISC = (1 << QEMU_ARCH_BIT_OPENRISC), + QEMU_ARCH_TRICORE = (1 << QEMU_ARCH_BIT_TRICORE), + QEMU_ARCH_NIOS2 = (1 << QEMU_ARCH_BIT_NIOS2), + QEMU_ARCH_HPPA = (1 << QEMU_ARCH_BIT_HPPA), + QEMU_ARCH_RISCV = (1 << QEMU_ARCH_BIT_RISCV), + QEMU_ARCH_RX = (1 << QEMU_ARCH_BIT_RX), + QEMU_ARCH_AVR = (1 << QEMU_ARCH_BIT_AVR), + QEMU_ARCH_HEXAGON = (1 << QEMU_ARCH_BIT_HEXAGON), + QEMU_ARCH_LOONGARCH = (1 << QEMU_ARCH_BIT_LOONGARCH), }; extern const uint32_t arch_type; From patchwork Fri Mar 15 13:09:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 780487 Delivered-To: patch@linaro.org Received: by 2002:a5d:46c1:0:b0:33e:7753:30bd with SMTP id g1csp190263wrs; Fri, 15 Mar 2024 06:12:34 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWhfrpgue/rjDEvuHGxaT2znvZh4By0IzG4Z9qd0G6JLGf6/MgTztlaEzZJULfqluRxJ+xXgvwUPco76epx+HoS X-Google-Smtp-Source: AGHT+IFpFikX6SVsV3Jx166dRkrx/91XVDCguS3b2iRizMdEys4nuYzZd8n3OM+P96XzbuIGEIxi X-Received: by 2002:a05:6808:2f18:b0:3c1:e619:31c9 with SMTP id gu24-20020a0568082f1800b003c1e61931c9mr4595404oib.27.1710508354544; Fri, 15 Mar 2024 06:12:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710508354; cv=none; d=google.com; s=arc-20160816; b=IiiK5I+FdjflUtUprAYVTIlWfi65WEhusEyG6g9F+8ATXfVRlz+nwh1sXqZMBh5imY MMqOeUq3mn2dpBCxL+RT79ttVqDZwBfbuEZqWjFeJbLVI01s0on+pWHvxF9+DR1aLMge Oc9/vE8Doxu47O6XVQuMU0SVf+Yug+NWBmi2u8SapAphfk7h/AqoYtgyDJGGkqUDq5BA rmw4MmFYSL1u6Ea9IkJmmLJVTAYb6kcdx/tCkwIrpYXGrb/hIbMbObrSGgM0MfbLD1+G 8U3WvccA3+t3Rr2hkt+LRWkWnQ5YhaxtY1/viYfTj1v1aZT1NvNGG/8GOp7WWA+DbEgq ahUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=J25HPqsyrmOQ1iioSn9g7nmBc+Xq8CsuJB3WGvQV87Y=; fh=Ol3tAPX/VLbajEqrc9A2NaG0RWh2tFO21EWtQ1skWSs=; b=ATs25qQr6WgG61+F+8QaQumuR/2spkJGm5Oi1pVc51gxaRlBYRafMhKi6+8JgY5Bhk /SxHX7ZK4cy7QeIFSsF2PFij/ic0k0s4cot8uRtIiGNkT+itFepxwl7/xGd/Au7z0Dww u+hLnqsVMDfnNaBQK7GkGZjqTqSRf05WrVr0BsBk6OFiVbiwHopNtL3qjlnz1eG4nkth 4wn5VGVC5wq8mt5SAz954+WSxsap1ovRfSFnvCRERWmzw8ulaLvL6dwsJBufLfB4+0a6 FU3ADaMbUdpTdXQWjVBGXtleWUWtpr6d2JiJPdYUnRYdkKQ+TiGBWNk/YPdMy2/MHifs DcLA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Vi27EO75; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y25-20020ab05b99000000b007e000ab8a14si83906uae.63.2024.03.15.06.12.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 Mar 2024 06:12:34 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Vi27EO75; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Markus Armbruster Cc: qemu-riscv@nongnu.org, Anton Johansson , qemu-s390x@nongnu.org, qemu-ppc@nongnu.org, =?utf-8?q?Daniel_P_=2E_Berrang?= =?utf-8?q?=C3=A9?= , Paolo Bonzini , Eduardo Habkost , Claudio Fontana , Richard Henderson , Peter Maydell , =?utf-8?q?Alex_Benn=C3=A9e?= , Manos Pitsidianakis , Zhao Liu , qemu-arm@nongnu.org, Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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é --- --- 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 = QEMU_ARCH_BIT_LOONGARCH } QemuArchBit; +const char *cpu_typename_by_arch_bit(QemuArchBit arch_bit); + enum QemuArchMask { QEMU_ARCH_ALL = -1, QEMU_ARCH_ALPHA = (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] = { + [QEMU_ARCH_BIT_ALPHA] = TYPE_ALPHA_CPU, + [QEMU_ARCH_BIT_ARM] = TYPE_ARM_CPU, + [QEMU_ARCH_BIT_CRIS] = TYPE_CRIS_CPU, + [QEMU_ARCH_BIT_I386] = TYPE_I386_CPU, + [QEMU_ARCH_BIT_M68K] = TYPE_M68K_CPU, + [QEMU_ARCH_BIT_MICROBLAZE] = TYPE_MICROBLAZE_CPU, + [QEMU_ARCH_BIT_MIPS] = TYPE_MIPS_CPU, + /* TODO: TYPE_PPC_CPU */ + [QEMU_ARCH_BIT_S390X] = TYPE_S390_CPU, + [QEMU_ARCH_BIT_SH4] = TYPE_SUPERH_CPU, + [QEMU_ARCH_BIT_SPARC] = TYPE_SPARC_CPU, + [QEMU_ARCH_BIT_XTENSA] = TYPE_XTENSA_CPU, + [QEMU_ARCH_BIT_OPENRISC] = TYPE_OPENRISC_CPU, + [QEMU_ARCH_BIT_TRICORE] = TYPE_TRICORE_CPU, + [QEMU_ARCH_BIT_NIOS2] = TYPE_NIOS2_CPU, + [QEMU_ARCH_BIT_HPPA] = TYPE_HPPA_CPU, + [QEMU_ARCH_BIT_RISCV] = TYPE_RISCV_CPU, + [QEMU_ARCH_BIT_RX] = TYPE_RX_CPU, + [QEMU_ARCH_BIT_AVR] = TYPE_AVR_CPU, + [QEMU_ARCH_BIT_HEXAGON] = TYPE_HEXAGON_CPU, + [QEMU_ARCH_BIT_LOONGARCH] = 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', From patchwork Fri Mar 15 13:09:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 780489 Delivered-To: patch@linaro.org Received: by 2002:a5d:46c1:0:b0:33e:7753:30bd with SMTP id g1csp191113wrs; Fri, 15 Mar 2024 06:13:56 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXmAD/3kAAnTwCd9IaRik1D/BEG/93NOtQNSGe+d9ZVOdWsWxMUQE0KEzOw29/osKVyc4L8gCtOysjRIV3VLOqS X-Google-Smtp-Source: AGHT+IGERW5jyEtpfJ4/ZtNAjNZTJ50HlmPgMk1JkPPCcZz5I2LGm5evkZfedmG4ExHumlIL7sxS X-Received: by 2002:a05:6102:2249:b0:476:589f:d03f with SMTP id e9-20020a056102224900b00476589fd03fmr3376888vsb.5.1710508436475; Fri, 15 Mar 2024 06:13:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710508436; cv=none; d=google.com; s=arc-20160816; b=n0ZNchlMPBKXktL4dcJs3eWIArAlvYV0TDZh+im/Ip6Jzepn2lg5KV/oh+qesNKuZs DQ1bEIkcafCiGQnDetgmq55OfF0/0ZLm6plTk5Ss+YDtxzbAVbz/l+1uS0PLjIwB/nSd +oqPTxUK9a/W48wcEu7WNTa3/sWFZJpq1bmhixDk7mozyFrIi81X6Rj0BEUufUW/unjx /rCs01tHSDvlNU18gqAYBwfCaogaJG+qVQ/7HjQMWPzS0DLFiPUUwHGWO4tvFW1Y1LuK jkQ6qX76AAkN86ntOW6wll1jQRgdwxur4X3TmGLD8Ho5gGzO1x9mYChK+MeoJltUVQEz 4NRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=H3LBH1Jf2Bo2/j/14kl9+1lHNfd8WjvuONiFN4gQJjI=; fh=UXb1p39HCk0xe2vOHgG+QSrKQAU4GT8humqwJ2g9cg4=; b=HFGS30zuCHYIFFmMP2+uM3py3W1fzEISPtwrlFvKyZPtxFF0OYwZf0wWbe2rdQph3S HpJQnMJ6+mDVjOBB41xJP0Jm6c+ua48qVj5GBCqUG/wc588Mcqqlc38f7JD3ZfSRj7AV WkXxxOlzn7RikH6b/PDJckpdM2ngTrS9Nl7M2A/gJ7r/JyE2JS4VmHq1F5Uu4rtWXon2 SCQg1PiHpMwso0JnLUwGwPKowhqbmfjEvPQQ041/zrYpXlyn04sis8y+ebJ4xcb1Nc0E 6dExXYvGiSV5CXd8ap8Daa8JiFheB9q7mcECNkuShEEXt/5kqI6p0hoCHTcRTaVjdBKa 6nQA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="v7clIY/q"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id p8-20020a67e948000000b0047048ee14fcsi522031vso.628.2024.03.15.06.13.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 Mar 2024 06:13:56 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="v7clIY/q"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Markus Armbruster Cc: qemu-riscv@nongnu.org, Anton Johansson , qemu-s390x@nongnu.org, qemu-ppc@nongnu.org, =?utf-8?q?Daniel_P_=2E_Berrang?= =?utf-8?q?=C3=A9?= , Paolo Bonzini , Eduardo Habkost , Claudio Fontana , Richard Henderson , Peter Maydell , =?utf-8?q?Alex_Benn=C3=A9e?= , Manos Pitsidianakis , Zhao Liu , qemu-arm@nongnu.org, Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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é --- 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 #include "hw/core/cpu.h" +#include "qapi/qapi-types-machine.h" /* * struct SysemuCPUOps: System operations specific to a CPU class @@ -81,6 +82,19 @@ typedef struct SysemuCPUOps { */ bool (*virtio_is_big_endian)(CPUState *cpu); + /** + * @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 instead. 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 = data; + CpuDefinitionInfoList **cpu_list = user_data; + CpuDefinitionInfo *info; + const char *typename; + + typename = object_class_get_name(oc); + info = g_malloc0(sizeof(*info)); + info->name = cpu_model_from_type(typename); + info->q_typename = 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 = object_class_by_name(cpu_typename); + if (!oc) { + return; + } + ops = CPU_CLASS(oc)->sysemu_ops; + + list = object_class_get_list(cpu_typename, false); + if (ops->cpu_list_compare) { + list = g_slist_sort(list, ops->cpu_list_compare); + } + g_slist_foreach(list, ops->add_definition ? : cpu_common_add_definition, + 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 = NULL; + + for (unsigned i = 0; i <= QEMU_ARCH_BIT_LAST; i++) { + const char *cpu_typename; + + cpu_typename = 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', From patchwork Fri Mar 15 13:09:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 780498 Delivered-To: patch@linaro.org Received: by 2002:a5d:46c1:0:b0:33e:7753:30bd with SMTP id g1csp193715wrs; Fri, 15 Mar 2024 06:18:33 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVfS/9QT5fb08Hsrnol4XEx9Ia15UiDYwVGpWF5Jn9UJPVazoyk3xj9tDS/yPjA383YxJvTs8iYwDJXI2rD7p2c X-Google-Smtp-Source: AGHT+IG/R/gJTAeizLe6Bd6RFct3DjVPSRQlZgFsl8rCJJL1FCGK2W2fVlhBWIOuvvnai6oCbPdc X-Received: by 2002:ac8:5d89:0:b0:42e:7dae:5e41 with SMTP id d9-20020ac85d89000000b0042e7dae5e41mr8186959qtx.33.1710508713465; Fri, 15 Mar 2024 06:18:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710508713; cv=none; d=google.com; s=arc-20160816; b=JAJMLdsb0Dk5HMOmU9hyi3VETGle5Dthe6Bs1YFCUikHRPsV4b3tiF32ZyXl+qdBqA nQtCRWCA6PyX3B6Ao1GxP4B6aRHg14uToR6cDepKaFJLPXPFdcfCBMKVFGgDwbMsS92M JnLQd8Kxiy3OjryDDkomYENnoNMlD+guaFm0qaAxiS31uT5CAaimo7bMPjvZ/f4b848l PathQZQnFMQsEwjsRR/htRBFNKSytOT8hHy1XpC1tqoHpYsFOPruSCNltD5svHdJilup 5wfLGqeni+jwO5U+8+MVjips4syvks+2NdV435Ny6NR1h39n9XIC/ZQI0JhkVPKB1ozs 2SKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XKSoPbdfR84sDrdE++VJn8/NPQXAflULbgNG03R7vOs=; fh=Ol3tAPX/VLbajEqrc9A2NaG0RWh2tFO21EWtQ1skWSs=; b=xI2eM8eByJMFlxmMqJetMQL3MkhrG2jTy0nxiXzu4xGDs5CBJx21LAmGdA/K/pu3/o 4Rik+5Ya3DuLl2Hd5Gilu0auVhwpBgPx01To/Ut4+1rGSJ/6soTqtzsul/+dn13lhFjM esM8mD4Q5tw6Gvf/Movzsd6NHnwawrCRsw5eCDrZ0g0BEzPRQLKdGrJE17fakjvlBgrM 0+QHrBcKbvLiCcA+PzcelfaBfcnxFFENcc5ueIJUhBs8iw5AMIFiF/enpKjV8fNO3cOH PGQTwWbbxuLAzXI6a6r2TCTVTCEl4RpfvCaR0KbE1AAkMGmfpJk8YQnHwNPi7aejm8eB zZvw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GJdmN5Qd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id g3-20020ac85d43000000b0042f08391296si3645729qtx.396.2024.03.15.06.18.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 Mar 2024 06:18:33 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GJdmN5Qd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Markus Armbruster Cc: qemu-riscv@nongnu.org, Anton Johansson , qemu-s390x@nongnu.org, qemu-ppc@nongnu.org, =?utf-8?q?Daniel_P_=2E_Berrang?= =?utf-8?q?=C3=A9?= , Paolo Bonzini , Eduardo Habkost , Claudio Fontana , Richard Henderson , Peter Maydell , =?utf-8?q?Alex_Benn=C3=A9e?= , Manos Pitsidianakis , Zhao Liu , qemu-arm@nongnu.org, Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé --- 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" @@ -220,29 +221,7 @@ CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType type, return expansion_info; } -static void arm_cpu_add_definition(gpointer data, gpointer user_data) -{ - ObjectClass *oc = data; - CpuDefinitionInfoList **cpu_list = user_data; - CpuDefinitionInfo *info; - const char *typename; - - typename = object_class_get_name(oc); - info = g_malloc0(sizeof(*info)); - info->name = cpu_model_from_type(typename); - info->q_typename = g_strdup(typename); - - QAPI_LIST_PREPEND(*cpu_list, info); -} - CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) { - CpuDefinitionInfoList *cpu_list = NULL; - GSList *list; - - list = 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); } From patchwork Fri Mar 15 13:09:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 780485 Delivered-To: patch@linaro.org Received: by 2002:a5d:46c1:0:b0:33e:7753:30bd with SMTP id g1csp189948wrs; Fri, 15 Mar 2024 06:12:05 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW7S4vRgGZDBWTKyQ8156X5Dl8wU2o7uuLUjsMwUlVAjrZGk34vwhiVIGgva5UCX3UhHkZ76wKsBVdKddP5KObE X-Google-Smtp-Source: AGHT+IH2DhiDD4ohcBTvu9swgD1Bu7MGm9UblFskCIOmeJtpsrlgyMzNehilzgh3UVOAtQdPImSn X-Received: by 2002:a05:6359:7c25:b0:17b:db48:9349 with SMTP id xm37-20020a0563597c2500b0017bdb489349mr4133269rwb.2.1710508325580; Fri, 15 Mar 2024 06:12:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710508325; cv=none; d=google.com; s=arc-20160816; b=y1vKuCHDO4BbFK/D2ifMyQdquTsMS4Z1eYnGT3Y1NJBY5s+qnT2S11IaSTtZ04OhqO dLIMzE/v38Xb/ibMf8UncrItStE6hJTX7cc9miY7PnmHL3xjAY118fM5cOmTQA/FXn1a 7rmmdyGye28t98DcM7SKD+X5w/9uW/T2up2xrSPMzTl/w/75a7huzIKutZWUwnSN6jZH Fbw0sZRNd5rsUSoD+l7+1Wu45PI33hynvn3aFBDELUqDMTx8CsMQyr2XZyuXfUmVY0Id TyIHbLSxZPQuh+ZbTzzqo/ezyZsd7jHntCYRfzZOW1bvWCjOG0BvYgSVcXxLWDCLYfCS 5t5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9q6xaVyoPJIMQfl186LF5IP9vgj5sXw3ui9Yz0YXC2Q=; fh=AYqC0GUGkzDOiAvoW6G58I91aDyqaLDgQz3SgR0+i1U=; b=nv7zRNE4pRG1u7UVL8CasEp8/fEoYI1OsjCx9ha4/LmpQGLPx6uyErt7Zl5f/HED/k Z71TUUopYPuDZ7kiJ7LgHAdyLkMyCchac5kYMeKE2QRwVXyzc7xMGZgZKuZMD3vn0AXH Anb2f2pHmKllNB6Le36C2zJXDiz5ess8OZE9CasffrRkYxhNSXIc/Oop0nSCM6Yu2ZZ5 0pA853rewmFkFwYYOK8iosQUOZiyaKGVKFsv8MIQpFRgWkR2ssRd8aBm/Wmlk/EnG3dO /jX1qDe+Uz0GqYG1aQrEc2aAmVqX++l9K6jTREJzbFzyK9EvJNGoc4uBLrnxVLROpO+m L8jQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TMVOa6AS; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id p12-20020a05622a048c00b00430975caac8si3676765qtx.117.2024.03.15.06.12.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 Mar 2024 06:12:05 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TMVOa6AS; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Markus Armbruster Cc: qemu-riscv@nongnu.org, Anton Johansson , qemu-s390x@nongnu.org, qemu-ppc@nongnu.org, =?utf-8?q?Daniel_P_=2E_Berrang?= =?utf-8?q?=C3=A9?= , Paolo Bonzini , Eduardo Habkost , Claudio Fontana , Richard Henderson , Peter Maydell , =?utf-8?q?Alex_Benn=C3=A9e?= , Manos Pitsidianakis , Zhao Liu , qemu-arm@nongnu.org, Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé --- 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/loongarch-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" -static void loongarch_cpu_add_definition(gpointer data, gpointer user_data) -{ - ObjectClass *oc = data; - CpuDefinitionInfoList **cpu_list = user_data; - CpuDefinitionInfo *info = g_new0(CpuDefinitionInfo, 1); - const char *typename = object_class_get_name(oc); - - info->name = cpu_model_from_type(typename); - info->q_typename = g_strdup(typename); - - QAPI_LIST_PREPEND(*cpu_list, info); -} - CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) { - CpuDefinitionInfoList *cpu_list = NULL; - GSList *list; - - list = 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); } static const char *cpu_model_advertised_features[] = { From patchwork Fri Mar 15 13:09:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 780502 Delivered-To: patch@linaro.org Received: by 2002:a5d:46c1:0:b0:33e:7753:30bd with SMTP id g1csp194112wrs; Fri, 15 Mar 2024 06:19:14 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUA8hj/bofzyvHY7EbiE/AEJh2HncAlwnOun52Awh+sCecZvQwBF0euCCUsGHU0Ip2M3NEluAAd0ChdTehyBnLv X-Google-Smtp-Source: AGHT+IGtBCyYv4xPDzjLf5rdrIOTLmHBTMa1nl2p4W77n5SIfOsvIzQxKvAt84VXArQc3yDtph7c X-Received: by 2002:a05:620a:2986:b0:789:e9a8:f353 with SMTP id r6-20020a05620a298600b00789e9a8f353mr391138qkp.58.1710508754190; Fri, 15 Mar 2024 06:19:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710508754; cv=none; d=google.com; s=arc-20160816; b=xr8F4eC+jo4kIzzR5OYDcKg3rgW1f5N2gQSeeCiiR+pLZuPSvbhjsDE57F9GewdWyP MFn7HEuspvt0d3f4pEifzmqOB/XFvOY61HUY9wdx9BHtv1mEAWYi9Xne+NvVg5wdB8O2 EXQhK/B8LqcRsr5BAG5OlrVFbxlD37rVx2nl9tQhLKOG2JNhcQJ4LJcmGyhlA2HvjM1C JVWWzh8JbTaTM9bd/9zv2B9MnCxO82C2zXFD7uNSEr8s1RJ1sj0muVJgroPa9xPT0yHm WO93uahWROoNV/tmgBBOcNmkCSh/G2btlexS4TRr+ZZ092nx/44Fc2060qEFTPf9yQAF wZNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=oFQX8aoXPy4f67f4Z4hL1RP4Zt/8Mcsow7bhGPOckjM=; fh=5U6/qr4gVFgKVmHC4z44d81YK17C2kD9N8wEY3PkrFA=; b=mOyYqVLFlXeclAmFIASBNJ5XN1t0u8Siu65HPic4ncT8l+R53rJfWzVQQby+0dq/8A MDfauPQuN8nAy5v1RhB+jDAS3M5d5VZRJHYupk5pQ74/CuAEd06Zw0nknSFIezNiaWTQ Z16pZcv2o3oDK7iIpnEXRHXO7n2f1sWzYUvaCLIKwoIGFq9NrW2CUudhFfE9X9DDuM7N H/2WIm+7BUeiilJ5HBYCBCMeArTBSgGsVjt5O+c+XmeMNhnxIDNVU6CB/AzZ6iOojtGR 2TDVfk84uG6Ro86FcpPzEL7g5vfyIaWtdJBfyR2c0FEAqtYwb7c2r86UcOFP8kSliuh2 9isw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kQwSSy5r; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id p28-20020a05620a113c00b00789e7ecda1asi577912qkk.25.2024.03.15.06.19.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 Mar 2024 06:19:14 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kQwSSy5r; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Markus Armbruster Cc: qemu-riscv@nongnu.org, Anton Johansson , qemu-s390x@nongnu.org, qemu-ppc@nongnu.org, =?utf-8?q?Daniel_P_=2E_Berrang?= =?utf-8?q?=C3=A9?= , Paolo Bonzini , Eduardo Habkost , Claudio Fontana , Richard Henderson , Peter Maydell , =?utf-8?q?Alex_Benn=C3=A9e?= , Manos Pitsidianakis , Zhao Liu , qemu-arm@nongnu.org, Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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é --- 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); +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" static const struct SysemuCPUOps riscv_sysemu_ops = { + .add_definition = riscv_cpu_add_definition, .get_phys_page_debug = riscv_cpu_get_phys_page_debug, .write_elf64_note = riscv_cpu_write_elf64_note, .write_elf32_note = 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 @@ #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" -static void riscv_cpu_add_definition(gpointer data, gpointer user_data) +void riscv_cpu_add_definition(gpointer data, gpointer user_data) { ObjectClass *oc = data; CpuDefinitionInfoList **cpu_list = user_data; @@ -55,13 +56,7 @@ static void riscv_cpu_add_definition(gpointer data, gpointer user_data) CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) { - CpuDefinitionInfoList *cpu_list = NULL; - GSList *list = 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); } static void riscv_check_if_cpu_available(RISCVCPU *cpu, Error **errp) From patchwork Fri Mar 15 13:09:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 780484 Delivered-To: patch@linaro.org Received: by 2002:a5d:46c1:0:b0:33e:7753:30bd with SMTP id g1csp189827wrs; Fri, 15 Mar 2024 06:11:49 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUrXFBgHywyOZ+FRBrFtPr0CeRZOMM0Aal8ElHctVd8WQ1pqaaQSJt2/kITQrf7AjBPnQpe8CIw6mm1QxP65O/I X-Google-Smtp-Source: AGHT+IElZafDjhxEI1oJ6C7L5sJMi9CiwyKiC5YJ9pNfewaTooOeBbHRRWbR/f8CQZG1VuXQzSpJ X-Received: by 2002:a05:6808:221c:b0:3c2:5184:6972 with SMTP id bd28-20020a056808221c00b003c251846972mr4123174oib.1.1710508309239; Fri, 15 Mar 2024 06:11:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710508309; cv=none; d=google.com; s=arc-20160816; b=S13miQFt8+qxdltNApr/memXIGxl/KsJOt6HtsJZA1+FtavOl+f7N2ziz2UPBj4DiD 9iPE5WnurFZ+7iEKXWLd4CAvV3+EKDGlm1oPyV7lUclJpQEOX7O5ro62uL8oH33m1xVJ gduu+Wk4TVCcEu8biKK690zYrE6DdiCFdZ7YIuHh7S6UzbbalAyHncQaEkVNeXmVvLUh gkKA68mDztqPjMbwUll6FV83wchINeSnAL6utZXQ/17wtm8rlk8nghibj7NH/LxgbEfq DGNgxHv6bOBNWNIjWsz/vFO6UzmCFEdy/nS9TtydMZHtYoKHo5A63TOA8ycBBKbVQU3N u2Zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+0JRGXmaH9yCo1gEGbOzPrdlVZvoU4tW4IJan5xxXVU=; fh=Ol3tAPX/VLbajEqrc9A2NaG0RWh2tFO21EWtQ1skWSs=; b=eZ8AARI2y4aFAklE2yq8pVAr532+jw+7dKdsSShRs1fXFmZDFlETiiMa9DvhfDE07g Q0iXuJ1LA2w+LOMTYiO9WSVb2/zTUlzf+iv3M80JuFptd2VKNrg022gUWqkSV9mbz6vb f5FREto8yaSQ3iC7sMKUap3uMQxNA9O1SDNE3B+Bw03FxGOH2a/cU6/dr+LdDxaI81ix CP1awTui+ARUhprBtskR9xifaRgznCHJH/tmA5VKndKIr8vn/JwPMcpzn7qPlb8H+RTE KWubGXqWCkEJ+ndD5LobUNE6/Ray6K9OAlXu82YqdUIFDSJsBd9S9FpfEXdeecQayo6e RKrA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dpSYf7Eo; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c3-20020ad45ae3000000b0068fd0486f10si2715139qvh.51.2024.03.15.06.11.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 Mar 2024 06:11:49 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dpSYf7Eo; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Markus Armbruster Cc: qemu-riscv@nongnu.org, Anton Johansson , qemu-s390x@nongnu.org, qemu-ppc@nongnu.org, =?utf-8?q?Daniel_P_=2E_Berrang?= =?utf-8?q?=C3=A9?= , Paolo Bonzini , Eduardo Habkost , Claudio Fontana , Richard Henderson , Peter Maydell , =?utf-8?q?Alex_Benn=C3=A9e?= , Manos Pitsidianakis , Zhao Liu , qemu-arm@nongnu.org, Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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é --- 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) CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) { - CpuDefinitionInfoList *cpu_list = NULL; - GSList *list = 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); } #endif /* !CONFIG_USER_ONLY */ @@ -7937,6 +7934,8 @@ static Property x86_cpu_properties[] = { #include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps i386_sysemu_ops = { + .add_definition = x86_cpu_definition_entry, + .cpu_list_compare = x86_cpu_list_compare, .get_memory_mapping = x86_cpu_get_memory_mapping, .get_paging_enabled = x86_cpu_get_paging_enabled, .get_phys_page_attrs_debug = x86_cpu_get_phys_page_attrs_debug, From patchwork Fri Mar 15 13:09:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 780488 Delivered-To: patch@linaro.org Received: by 2002:a5d:46c1:0:b0:33e:7753:30bd with SMTP id g1csp190991wrs; Fri, 15 Mar 2024 06:13:43 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXya6Va9mVhklW1t/GTpqPJmQosUMp1zoUiKJwpw61Tx48h2CP4bFvKWxOeV61YXotZazjO/WrzLo2/M+hOjH/y X-Google-Smtp-Source: AGHT+IHfzZzpOLnrNsfYXpUB2CrtcXBGC5RHdg60DuYHng0LacgZmSLwOlRd9k1hScnLMReIQfKC X-Received: by 2002:ac5:c76b:0:b0:4d3:2d27:9f4 with SMTP id c11-20020ac5c76b000000b004d32d2709f4mr4902955vkn.0.1710508423527; Fri, 15 Mar 2024 06:13:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710508423; cv=none; d=google.com; s=arc-20160816; b=f39Q7B1fL3U5gOkUy5YF2wrHw6OMYmMetI8paowvlxykB+Wwy2GY1HrxBD32ExmD9o +8ifKe3CDiR6GbA6h1ASH2vEvfQIecFIcDihF+sA/E5eW8FmPt7OY/AVicIn0IKbputI ZzuKYAp/7ciwgbfv0lirxrmTh+ooPb/orbgYILbx53muO1Y7yZALsvVZN8R5Ln784i9k TEKFshngwdc4lI3B9P9BthciWtz7BQWHdPSZHKLVGcopnkIr4wLEId5WEAy+CBPOVcAl l4Vke8UETytZhFDJ7if3C2yF/chb09l9PbaJ9319ylsZB69fFYgUZ/kmyP+K7ErRZ0Zw gQNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JlSnNkdCGhkGJY+zh070ayuUxIbMNrgyLxLLZYypnXY=; fh=p5Jsywvh0HlF/zmTgHQajT3V6107Umb8gJEfVX/nN3w=; b=uK/diSwdyUbBgyy6yoYf0bYmfqZhclls1Mq0XjfJMmNd8h2kjyW1VmLkVmEN2w6NGh CizFIsqjU48tUtsQtuWsSSaFTpPENce3GD6aQQsQR6KzKl/A5lGbdu1YWlEj4e909ezS 47ozqzmgSdttRSes1Tg+blxBQMP1iEdGfJaK+VnKjOYosPMUd+rwOsQi4bQKxTivsPaN tGi56o4Uwia2L0e17RhEKv1E8ObE+MPjBkzEhksxndN/m+sJLlRb+nUa2QnVsg+1PpDv 4WFxL0nji4hcvVCOnk20r75rueit/O0dQuYb0rlim0rkloc7KKaJGhyVkzp10qaE1kdw lFPw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yx8CFeUc; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c1-20020a056122030100b004c021303babsi470954vko.302.2024.03.15.06.13.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 Mar 2024 06:13:43 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yx8CFeUc; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Markus Armbruster Cc: qemu-riscv@nongnu.org, Anton Johansson , qemu-s390x@nongnu.org, qemu-ppc@nongnu.org, =?utf-8?q?Daniel_P_=2E_Berrang?= =?utf-8?q?=C3=A9?= , Paolo Bonzini , Eduardo Habkost , Claudio Fontana , Richard Henderson , Peter Maydell , =?utf-8?q?Alex_Benn=C3=A9e?= , Manos Pitsidianakis , Zhao Liu , qemu-arm@nongnu.org, Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Nicholas Piggin , Daniel Henrique Barboza Subject: [PATCH-for-9.1 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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é 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 +#include "qapi/qapi-types-machine.h" + /** * PowerPCCPUAlias: * @alias: The alias name. @@ -480,4 +482,6 @@ enum { POWERPC_SVR_8641D = 0x80900121, }; +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); } -CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) +void ppc_add_alias_definitions(CpuDefinitionInfoList **cpu_list) { - CpuDefinitionInfoList *cpu_list = NULL; - GSList *list; - int i; - - list = object_class_get_list(TYPE_POWERPC_CPU, false); - g_slist_foreach(list, ppc_cpu_defs_entry, &cpu_list); - g_slist_free(list); - - for (i = 0; ppc_cpu_aliases[i].alias != NULL; i++) { + for (unsigned i = 0; ppc_cpu_aliases[i].alias != NULL; i++) { PowerPCCPUAlias *alias = &ppc_cpu_aliases[i]; ObjectClass *oc; CpuDefinitionInfo *info; @@ -213,8 +205,20 @@ CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) info->name = g_strdup(alias->alias); info->q_typename = g_strdup(object_class_get_name(oc)); - QAPI_LIST_PREPEND(cpu_list, info); + QAPI_LIST_PREPEND(*cpu_list, info); } +} + +CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) +{ + CpuDefinitionInfoList *cpu_list = NULL; + GSList *list; + + list = 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; } From patchwork Fri Mar 15 13:09:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 780497 Delivered-To: patch@linaro.org Received: by 2002:a5d:46c1:0:b0:33e:7753:30bd with SMTP id g1csp193280wrs; Fri, 15 Mar 2024 06:17:39 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX16mJPrueVOpXGr+H7IyeT4GMi8S0gQuuSo9SxIuAnbDEfoJFdU5vT2p9CyRs5ALN25i/OLI5DYXfogl7fJZRi X-Google-Smtp-Source: AGHT+IFMsPrQg4Y+gG2Ebxc26gWYhd0zvbFaX046zHHbRQmiSoQ/UOGUuxY9nVNGslCzpnyg7c+x X-Received: by 2002:a05:620a:919:b0:789:e8e8:f674 with SMTP id v25-20020a05620a091900b00789e8e8f674mr592351qkv.30.1710508659313; Fri, 15 Mar 2024 06:17:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710508659; cv=none; d=google.com; s=arc-20160816; b=cAXdSsrBZilJ/lg7W2Wd37V5bxbJzoRGa63qFEl71KBeIDTB1Jug1up9dVIP/c81gr E/60Fu47QQhtK0YM0WwJtVfgfbUsAPvEt6TVbXKbBvuiOqYJT0ysoia2Wp4JhA+QLf6h asIXHnKY8sGz6De1Rc/h5oHibsH6cf+O91ywwlgMmbeeZb6PHBeFbArsrtNMidGcpVaK Q41gtFPeHLK7ZyOCLCjFVyLmqu6Vn55aek8tRyLncqg6MttPf2upAvKq2j6kvuWZfMAy WW60hSVSpWAfZ3jkjEmpsfYVKQ+xNI62YpHRJQT69qkXTEcPjyF3IkplCF0Zi7C3F0Fi mTvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7krNd92WPqJ39NLap53W9GJe07xrMw6PHe3R7xrqxWM=; fh=p5Jsywvh0HlF/zmTgHQajT3V6107Umb8gJEfVX/nN3w=; b=jH4YlHlxwjVsgPIzTqU4w98+EdCLwzgt8SwldOCG+AZhWmGPQwnxG1/naFWrVZ7Fwv 5hAm9+s2fFa93ArWaIBr6JwBzAKg0+6N+gPCy5N9BWvZNPHOXV81ijI329PBZ8WB4LXJ L1GnVZrp0/0S4RmFht1cCxg0JQTpohVRMJv/PkyblRu//BCUVYvsU6+o0JGgBbBcXP08 9pG9vka01QqTTkUgqRQ/u7mjsJGtLb5pwl2qzVfyAseSJdUj7KIRca6RPDRrRPbORS6p 0PSKMe/wk2NADBlsu7/PFG9qSQokt3FpxY4nCBCxr0ZhFH37NiaEGnM1AzOJX7CRz2oG REwg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BWnjLFnX; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id e2-20020a05620a12c200b00789e232b39csi1897949qkl.494.2024.03.15.06.17.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 Mar 2024 06:17:39 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BWnjLFnX; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Markus Armbruster Cc: qemu-riscv@nongnu.org, Anton Johansson , qemu-s390x@nongnu.org, qemu-ppc@nongnu.org, =?utf-8?q?Daniel_P_=2E_Berrang?= =?utf-8?q?=C3=A9?= , Paolo Bonzini , Eduardo Habkost , Claudio Fontana , Richard Henderson , Peter Maydell , =?utf-8?q?Alex_Benn=C3=A9e?= , Manos Pitsidianakis , Zhao Liu , qemu-arm@nongnu.org, Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Nicholas Piggin , Daniel Henrique Barboza Subject: [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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Register ppc_add_alias_definitions() as handler so we can use the QMP generic_query_cpu_definitions() method. Signed-off-by: Philippe Mathieu-Daudé --- 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[] = { #include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps ppc_sysemu_ops = { + .add_alias_definitions = ppc_add_alias_definitions, .get_phys_page_debug = ppc_cpu_get_phys_page_debug, .write_elf32_note = ppc32_cpu_write_elf32_note, .write_elf64_note = 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" @@ -175,20 +176,6 @@ int target_get_monitor_def(CPUState *cs, const char *name, uint64_t *pval) return -EINVAL; } -static void ppc_cpu_defs_entry(gpointer data, gpointer user_data) -{ - ObjectClass *oc = data; - CpuDefinitionInfoList **first = user_data; - const char *typename; - CpuDefinitionInfo *info; - - typename = object_class_get_name(oc); - info = g_malloc0(sizeof(*info)); - info->name = cpu_model_from_type(typename); - - QAPI_LIST_PREPEND(*first, info); -} - void ppc_add_alias_definitions(CpuDefinitionInfoList **cpu_list) { for (unsigned i = 0; ppc_cpu_aliases[i].alias != NULL; i++) { @@ -211,14 +198,5 @@ void ppc_add_alias_definitions(CpuDefinitionInfoList **cpu_list) CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) { - CpuDefinitionInfoList *cpu_list = NULL; - GSList *list; - - list = 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); } From patchwork Fri Mar 15 13:09:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 780496 Delivered-To: patch@linaro.org Received: by 2002:a5d:46c1:0:b0:33e:7753:30bd with SMTP id g1csp193210wrs; Fri, 15 Mar 2024 06:17:30 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW7uDGLvVpxpT+H/TLbKMYlNlX0I8aqGnaOGvQpoCLyHMqwpBTy8CHEQsMIaSi05vrS184X6FqUiaFbK5Rl+jPI X-Google-Smtp-Source: AGHT+IEWRx29saFylYrlwVkTnkoCIvsyc2DVtKgXC4um8a7Yxg5QBkuAZl/ErTbal1tGrZ+cuZzF X-Received: by 2002:ac8:590c:0:b0:42e:f6dc:bc7d with SMTP id 12-20020ac8590c000000b0042ef6dcbc7dmr4536242qty.65.1710508650546; Fri, 15 Mar 2024 06:17:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710508650; cv=none; d=google.com; s=arc-20160816; b=zBwbvla8ShqJ9fPd2YK8mA4GTBC6WbQ0eD12jTiDwIdAJ9IPCfg/TZSQXGCdn83qnb /BAVu/psFursgpoUu5VtvIPgYHGaCr3XdV/i2RUdIFBTU0UXPcnbsiG1kGsk2N468FMU w+nxmQwrz1cRPe5j8gc/i2RRORV3vnvSpsOPoP9gwjtRGaU7QjgnIZYl3O8NHmb3n8PL vwizo5xgrRuIyrAHKWUm38Y5xAXAeQQqKBsQ86YEAG2p4wbYB0RJ4jhfmJzDshh3jhGl SdmlBlNAWoIEmHLAPnPHwSK3lTrwZUHrK1/5KbisDmmb6A0z2/HkJdrKhoentNm6IrZN buVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vnvuw2s/qwtrAi1idHX4CvaMd4PeKiJ3xN49FEYysNQ=; fh=Yf5gNRT8HYTf5B88DrRoP6o4KyZnhBYJJ+Hf19sxZfs=; b=wpMmVCd6aqohKr5BoG8g/mPEeyIkdn2zuajPoUS6zhlOM8z0xUk5pbPEvcYxp0nQld b7xzzDIZ3crnzB1fEyQRbGuDPKTogOKdiADP5aAdKhgLPtWk4GgDuuHdwhdYN1zO2NXu C9VmfiMq0yYjuEoACEitOWS8tMkFiqkBIuEJ5RfBwXbG8yhQU53sB6aacEi7u1xx7rgU n0wGio9GSSAM8Ij0UcITHOAq7ZK00ktjRtu/Jjr7k/H4QooUAGdzD5HN+Oo2TldKl/ER sGsipmzhhFf+hcRIBBq5jYiK37VM6cAMOuitq4QRuQUpxMoXLC9v2ldspcnnnKkYBBue I+vg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UnMhEXAz; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id n8-20020a05622a11c800b0042ed8f4ae31si3863862qtk.515.2024.03.15.06.17.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 Mar 2024 06:17:30 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UnMhEXAz; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Markus Armbruster Cc: qemu-riscv@nongnu.org, Anton Johansson , qemu-s390x@nongnu.org, qemu-ppc@nongnu.org, =?utf-8?q?Daniel_P_=2E_Berrang?= =?utf-8?q?=C3=A9?= , Paolo Bonzini , Eduardo Habkost , Claudio Fontana , Richard Henderson , Peter Maydell , =?utf-8?q?Alex_Benn=C3=A9e?= , Manos Pitsidianakis , Zhao Liu , qemu-arm@nongnu.org, Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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-definitions has not been found"} } and after: { "execute": "query-cpu-definitions" } { "return": [ {"name": "sh7751r", "typename": "sh7751r-superh-cpu", "static": false, "deprecated": false}, {"name": "sh7750r", "typename": "sh7750r-superh-cpu", "static": false, "deprecated": false}, {"name": "sh7785", "typename": "sh7785-superh-cpu", "static": false, "deprecated": false} ] } However this allows heterogeneous emulation to return a correct list. Signed-off-by: Philippe Mathieu-Daudé --- 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' ] } } -## -# @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' } } +## +# @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 @@ #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(CpuDefinitionInfoList **cpu_list, } } -CpuDefinitionInfoList *generic_query_cpu_definitions(Error **errp) +CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) { CpuDefinitionInfoList *cpu_list = NULL; 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" @@ -220,8 +219,3 @@ CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType type, 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); } -CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) -{ - return generic_query_cpu_definitions(errp); -} - #endif /* !CONFIG_USER_ONLY */ uint64_t x86_cpu_get_supported_feature_word(FeatureWord w, diff --git a/target/loongarch/loongarch-qmp-cmds.c b/target/loongarch/loongarch-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" -CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) -{ - return generic_query_cpu_definitions(errp); -} - static const char *cpu_model_advertised_features[] = { "lsx", "lasx", NULL }; diff --git a/target/mips/sysemu/mips-qmp-cmds.c b/target/mips/sysemu/mips-qmp-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" @@ -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 @@ #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 user_data) QAPI_LIST_PREPEND(*cpu_list, info); } -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)) {