From nobody Sun Nov 9 15:11:53 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550753578221848.3250024482494; Thu, 21 Feb 2019 04:52:58 -0800 (PST) Received: from localhost ([127.0.0.1]:59634 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gwnqR-0000Ri-8i for importer@patchew.org; Thu, 21 Feb 2019 07:52:55 -0500 Received: from eggs.gnu.org ([209.51.188.92]:55146) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gwnl8-0004iW-TA for qemu-devel@nongnu.org; Thu, 21 Feb 2019 07:47:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gwnl5-00063U-1T for qemu-devel@nongnu.org; Thu, 21 Feb 2019 07:47:26 -0500 Received: from mx2.rt-rk.com ([89.216.37.149]:37874 helo=mail.rt-rk.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gwnl3-00061E-6A for qemu-devel@nongnu.org; Thu, 21 Feb 2019 07:47:22 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.rt-rk.com (Postfix) with ESMTP id 8D3B31A2205; Thu, 21 Feb 2019 13:46:12 +0100 (CET) Received: from rtrkw774-lin.domain.local (rtrkw774-lin.domain.local [10.10.13.43]) by mail.rt-rk.com (Postfix) with ESMTPSA id 54AED1A22C6; Thu, 21 Feb 2019 13:46:12 +0100 (CET) X-Virus-Scanned: amavisd-new at rt-rk.com From: Aleksandar Markovic To: qemu-devel@nongnu.org Date: Thu, 21 Feb 2019 13:45:57 +0100 Message-Id: <1550753160-15142-6-git-send-email-aleksandar.markovic@rt-rk.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1550753160-15142-1-git-send-email-aleksandar.markovic@rt-rk.com> References: <1550753160-15142-1-git-send-email-aleksandar.markovic@rt-rk.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 89.216.37.149 Subject: [Qemu-devel] [PULL 5/8] target/mips: implement QMP query-cpu-definitions command X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, amarkovic@wavecomp.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Pavel Dovgalyuk This patch enables QMP-based querying of the available CPU types for MIPS and MIPS64 platforms. Signed-off-by: Pavel Dovgalyuk Signed-off-by: Aleksandar Markovic Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Markus Armbruster --- qapi/target.json | 4 ++-- target/mips/helper.c | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/qapi/target.json b/qapi/target.json index da7b4be..1d4d54b 100644 --- a/qapi/target.json +++ b/qapi/target.json @@ -499,7 +499,7 @@ 'static': 'bool', '*unavailable-features': [ 'str' ], 'typename': 'str' }, - 'if': 'defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386= ) || defined(TARGET_S390X)' } + 'if': 'defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386= ) || defined(TARGET_S390X) || defined(TARGET_MIPS)' } =20 ## # @query-cpu-definitions: @@ -511,4 +511,4 @@ # Since: 1.2.0 ## { 'command': 'query-cpu-definitions', 'returns': ['CpuDefinitionInfo'], - 'if': 'defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386= ) || defined(TARGET_S390X)' } + 'if': 'defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386= ) || defined(TARGET_S390X) || defined(TARGET_MIPS)' } diff --git a/target/mips/helper.c b/target/mips/helper.c index 944f094..c44cdca 100644 --- a/target/mips/helper.c +++ b/target/mips/helper.c @@ -24,6 +24,7 @@ #include "exec/cpu_ldst.h" #include "exec/log.h" #include "hw/mips/cpudevs.h" +#include "qapi/qapi-commands-target.h" =20 enum { TLBRET_XI =3D -6, @@ -1470,3 +1471,35 @@ void QEMU_NORETURN do_raise_exception_err(CPUMIPSSta= te *env, =20 cpu_loop_exit_restore(cs, pc); } + +static void mips_cpu_add_definition(gpointer data, gpointer user_data) +{ + ObjectClass *oc =3D data; + CpuDefinitionInfoList **cpu_list =3D user_data; + CpuDefinitionInfoList *entry; + CpuDefinitionInfo *info; + const char *typename; + + typename =3D object_class_get_name(oc); + info =3D g_malloc0(sizeof(*info)); + info->name =3D g_strndup(typename, + strlen(typename) - strlen("-" TYPE_MIPS_CPU)); + info->q_typename =3D g_strdup(typename); + + entry =3D g_malloc0(sizeof(*entry)); + entry->value =3D info; + entry->next =3D *cpu_list; + *cpu_list =3D entry; +} + +CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) +{ + CpuDefinitionInfoList *cpu_list =3D NULL; + GSList *list; + + list =3D object_class_get_list(TYPE_MIPS_CPU, false); + g_slist_foreach(list, mips_cpu_add_definition, &cpu_list); + g_slist_free(list); + + return cpu_list; +} --=20 2.7.4