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,