From nobody Wed Oct 29 20:35:00 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.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 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1524606534897998.2254379713952; Tue, 24 Apr 2018 14:48:54 -0700 (PDT) Received: from localhost ([::1]:60949 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fB5np-00043Z-DS for importer@patchew.org; Tue, 24 Apr 2018 17:48:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32873) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fB5lK-0002lJ-5P for qemu-devel@nongnu.org; Tue, 24 Apr 2018 17:46:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fB5lG-000725-Ub for qemu-devel@nongnu.org; Tue, 24 Apr 2018 17:46:10 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:43528 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fB5lG-00071i-Q1; Tue, 24 Apr 2018 17:46:06 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0973A814DF4C; Tue, 24 Apr 2018 21:46:04 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-175.rdu2.redhat.com [10.10.120.175]) by smtp.corp.redhat.com (Postfix) with ESMTP id C56EC2156A4E; Tue, 24 Apr 2018 21:46:02 +0000 (UTC) From: Laszlo Ersek To: qemu-devel@nongnu.org Date: Tue, 24 Apr 2018 23:45:45 +0200 Message-Id: <20180424214550.32549-2-lersek@redhat.com> In-Reply-To: <20180424214550.32549-1-lersek@redhat.com> References: <20180424214550.32549-1-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Tue, 24 Apr 2018 21:46:05 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Tue, 24 Apr 2018 21:46:05 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'lersek@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 1/6] qapi: fill in CpuInfoFast.arch in query-cpus-fast 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 Crosthwaite , qemu-stable@nongnu.org, Markus Armbruster , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Commit ca230ff33f89 added added the @arch field to @CpuInfoFast, but it failed to set the new field in qmp_query_cpus_fast(), when TARGET_S390X was not defined. The updated @query-cpus-fast example in "qapi-schema.json" showed "arch":"x86" only because qmp_query_cpus_fast() calls g_malloc0() to allocate CpuInfoFast, and the CPU_INFO_ARCH_X86 enum constant is generated with value 0. All @arch values other than @s390 implied the @CpuInfoOther sub-struct for @CpuInfoFast -- at the time of writing the patch --, thus no fields other than @arch needed to be set when TARGET_S390X was not defined. Set @arch now, by copying the corresponding assignments from qmp_query_cpus(). Cc: Eric Blake Cc: Markus Armbruster Cc: Paolo Bonzini Cc: Peter Crosthwaite Cc: Richard Henderson Cc: qemu-stable@nongnu.org Fixes: ca230ff33f89bf7102cbfbc2328716da6750aaed Signed-off-by: Laszlo Ersek Reviewed-by: Cornelia Huck Reviewed-by: Eric Blake --- Notes: PATCHv1: =20 - new patch cpus.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/cpus.c b/cpus.c index 38eba8bff334..1a9a2edee1f2 100644 --- a/cpus.c +++ b/cpus.c @@ -2210,27 +2210,39 @@ CpuInfoFastList *qmp_query_cpus_fast(Error **errp) info->value->qom_path =3D object_get_canonical_path(OBJECT(cpu)); info->value->thread_id =3D cpu->thread_id; =20 info->value->has_props =3D !!mc->cpu_index_to_instance_props; if (info->value->has_props) { CpuInstanceProperties *props; props =3D g_malloc0(sizeof(*props)); *props =3D mc->cpu_index_to_instance_props(ms, cpu->cpu_index); info->value->props =3D props; } =20 -#if defined(TARGET_S390X) +#if defined(TARGET_I386) + info->value->arch =3D CPU_INFO_ARCH_X86; +#elif defined(TARGET_PPC) + info->value->arch =3D CPU_INFO_ARCH_PPC; +#elif defined(TARGET_SPARC) + info->value->arch =3D CPU_INFO_ARCH_SPARC; +#elif defined(TARGET_MIPS) + info->value->arch =3D CPU_INFO_ARCH_MIPS; +#elif defined(TARGET_TRICORE) + info->value->arch =3D CPU_INFO_ARCH_TRICORE; +#elif defined(TARGET_S390X) s390_cpu =3D S390_CPU(cpu); env =3D &s390_cpu->env; info->value->arch =3D CPU_INFO_ARCH_S390; info->value->u.s390.cpu_state =3D env->cpu_state; +#else + info->value->arch =3D CPU_INFO_ARCH_OTHER; #endif if (!cur_item) { head =3D cur_item =3D info; } else { cur_item->next =3D info; cur_item =3D info; } } =20 return head; } --=20 2.14.1.3.gb7cf6e02401b