From nobody Tue Nov 4 15:29:01 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1530551012830987.8545864859885; Mon, 2 Jul 2018 10:03:32 -0700 (PDT) Received: from localhost ([::1]:34339 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fa2EZ-0002Ng-Nn for importer@patchew.org; Mon, 02 Jul 2018 13:03:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57608) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fa27j-0005ZT-Qp for qemu-devel@nongnu.org; Mon, 02 Jul 2018 12:56:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fa27f-0002Av-Qd for qemu-devel@nongnu.org; Mon, 02 Jul 2018 12:56:23 -0400 Received: from 5.mo69.mail-out.ovh.net ([46.105.43.105]:39969) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fa27f-00029S-J2 for qemu-devel@nongnu.org; Mon, 02 Jul 2018 12:56:19 -0400 Received: from player696.ha.ovh.net (unknown [10.109.108.102]) by mo69.mail-out.ovh.net (Postfix) with ESMTP id C5D541AB1B for ; Mon, 2 Jul 2018 18:56:17 +0200 (CEST) Received: from bahia.lan (lns-bzn-46-82-253-208-248.adsl.proxad.net [82.253.208.248]) (Authenticated sender: groug@kaod.org) by player696.ha.ovh.net (Postfix) with ESMTPA id 36B633C00A9; Mon, 2 Jul 2018 18:56:12 +0200 (CEST) From: Greg Kurz To: qemu-devel@nongnu.org Date: Mon, 02 Jul 2018 18:56:06 +0200 Message-ID: <153055056654.212317.4697363278304826913.stgit@bahia.lan> User-Agent: StGit/0.17.1-46-g6855-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Ovh-Tracer-Id: 6426636671180446158 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedtiedrvdejgddutdehucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddm X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 46.105.43.105 Subject: [Qemu-devel] [PATCH] i386: fix '-cpu ?' output for host cpu type 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: Paolo Bonzini , Eduardo Habkost , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Since commit d6dcc5583e7, '-cpu ?' shows the description of the X86_CPU_TYPE_NAME("max") for the host CPU model: Enables all features supported by the accelerator in the current host instead of the expected: KVM processor with all supported host features or HVF processor with all supported host features This is caused by the early use of kvm_enabled() and hvf_enabled() in a class_init function. Since the accelerator isn't configured yet, both helpers return false unconditionally. A QEMU binary will only be compiled with one of these accelerators, not both. The appropriate description can thus be decided at build time. Signed-off-by: Greg Kurz Reviewed-by: Daniel P. Berrang=C3=A9 --- target/i386/cpu.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 1e6a7d0a7504..e5da60b28973 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -2838,13 +2838,13 @@ static void host_x86_cpu_class_init(ObjectClass *oc= , void *data) xcc->host_cpuid_required =3D true; xcc->ordering =3D 8; =20 - if (kvm_enabled()) { - xcc->model_description =3D - "KVM processor with all supported host features "; - } else if (hvf_enabled()) { - xcc->model_description =3D - "HVF processor with all supported host features "; - } +#if defined(CONFIG_KVM) + xcc->model_description =3D + "KVM processor with all supported host features "; +#elif defined(CONFIG_HVF) + xcc->model_description =3D + "HVF processor with all supported host features "; +#endif } =20 static const TypeInfo host_x86_cpu_type_info =3D {