From nobody Mon May 6 21:44:00 2024 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.zoho.com; dkim=fail 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 1492631731067171.50755751632596; Wed, 19 Apr 2017 12:55:31 -0700 (PDT) Received: from localhost ([::1]:50173 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d0vhH-0003T7-Bi for importer@patchew.org; Wed, 19 Apr 2017 15:55:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55127) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d0vgB-0002og-4J for qemu-devel@nongnu.org; Wed, 19 Apr 2017 15:54:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d0vg8-0005o1-2s for qemu-devel@nongnu.org; Wed, 19 Apr 2017 15:54:19 -0400 Received: from mail-yb0-x243.google.com ([2607:f8b0:4002:c09::243]:36184) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d0vg7-0005ni-VC for qemu-devel@nongnu.org; Wed, 19 Apr 2017 15:54:16 -0400 Received: by mail-yb0-x243.google.com with SMTP id b2so2121076yba.3 for ; Wed, 19 Apr 2017 12:54:15 -0700 (PDT) Received: from localhost.localdomain (c-73-207-178-95.hsd1.ga.comcast.net. [73.207.178.95]) by smtp.gmail.com with ESMTPSA id e190sm1471494ywd.33.2017.04.19.12.54.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Apr 2017 12:54:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=TqvnwGgBEoyxaKcelUFZgItnJuu+0ZVzY9g6y5dSkRU=; b=XtQumj48yWJdWjbZ8+BMUlB9TkOsYCxuBYClNwH5bWm1n+C1YFdTMB7YHHTU3ASxHA Rk+FQxtq6lFs/GWnGNsByxguLMywpSvHAkNz9eXjDNpH3YaqVlj9K792ov0/nFRgez/F HwJQX6zkvuNh93peyGn71ArsWkLeHbp/DY7j6phJieQhVJq0H4BmtAkBHi+lsVwt+5c6 dEFkYpYoLV66F7qgmmiIzuNaMft94rurIaudaaepN0yASV8LFdd0AYnovtb8Ziv85tnY iQDy5sP55sm97LtIR2SGXAbBdCH7HskMfK7ZLrLI+5QNe95gbGCIuycIOlKJz9kh9QJU +ZZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=TqvnwGgBEoyxaKcelUFZgItnJuu+0ZVzY9g6y5dSkRU=; b=rdV2yp9ta6k+PYwD8AhikXesZ6vXP3kQR8RyiXg7WFJXwOby+MMp8OYpisc3lyYDYb uLV0btffb8zSo6efer10nom86xZJPCx77eXQakSntW/DiCIKh8PAKqnFCkNH3AWmfhZj rs2gIJfYMi+nXDyAfNLNPeIOboX29uPtHp22Xy9UwOMBDBcah6yCFqXZrO3wLD8Ns1ZP 4tPR3mEWCyhvz1rHoCNhVwz1cwMQNmIzxVHUV4ncyi33wRjRHCftrKme6Lti+mcF9YER VnqfADxXr7Gye0reA0td7KCjgBEZSNASTFJciaegXNH9iyM79NuZCTqHvUXUiLiD1FPJ DIjw== X-Gm-Message-State: AN3rC/5m6AQ4xxDsiAJBC++tCYd86YG9CGKYJg6EoivisNf74BTQsgKu A7bPo29IxxvcfyRgtuY= X-Received: by 10.37.163.101 with SMTP id d92mr3731369ybi.186.1492631655012; Wed, 19 Apr 2017 12:54:15 -0700 (PDT) From: Pranith Kumar To: Paolo Bonzini , Richard Henderson , Eduardo Habkost , qemu-devel@nongnu.org (open list:All patches CC here) Date: Wed, 19 Apr 2017 15:54:12 -0400 Message-Id: <20170419195413.30141-1-bobby.prani@gmail.com> X-Mailer: git-send-email 2.11.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4002:c09::243 Subject: [Qemu-devel] [RFC PATCH] tcg/i386: Do not display HT warning for TCG 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" When we enable hyperthreading (using threads smp argument), we warn the user if the cpu is an AMD cpu. This does not make sense on TCG and is also obsolete now that AMD Ryzen support hyperthreading. Fix this by adding CPUID_HT bit to the TCG features and explicitly checking this bit in the cpuid. Signed-off-by: Pranith Kumar --- target/i386/cpu.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 13c0985f11..f34bb5ead7 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -202,12 +202,12 @@ static void x86_cpu_vendor_words2str(char *dst, uint3= 2_t vendor1, #define TCG_FEATURES (CPUID_FP87 | CPUID_PSE | CPUID_TSC | CPUID_MSR | \ CPUID_PAE | CPUID_MCE | CPUID_CX8 | CPUID_APIC | CPUID_SEP | \ CPUID_MTRR | CPUID_PGE | CPUID_MCA | CPUID_CMOV | CPUID_PAT | \ - CPUID_PSE36 | CPUID_CLFLUSH | CPUID_ACPI | CPUID_MMX | \ + CPUID_PSE36 | CPUID_CLFLUSH | CPUID_ACPI | CPUID_MMX | CPUID_HT = | \ CPUID_FXSR | CPUID_SSE | CPUID_SSE2 | CPUID_SS | CPUID_DE) /* partly implemented: CPUID_MTRR, CPUID_MCA, CPUID_CLFLUSH (needed for Win64) */ /* missing: - CPUID_VME, CPUID_DTS, CPUID_SS, CPUID_HT, CPUID_TM, CPUID_PBE */ + CPUID_VME, CPUID_DTS, CPUID_SS, CPUID_TM, CPUID_PBE */ #define TCG_EXT_FEATURES (CPUID_EXT_SSE3 | CPUID_EXT_PCLMULQDQ | \ CPUID_EXT_MONITOR | CPUID_EXT_SSSE3 | CPUID_EXT_CX16 | \ CPUID_EXT_SSE41 | CPUID_EXT_SSE42 | CPUID_EXT_POPCNT | \ @@ -3643,7 +3643,7 @@ static void x86_cpu_realizefn(DeviceState *dev, Error= **errp) =20 qemu_init_vcpu(cs); =20 - /* Only Intel CPUs support hyperthreading. Even though QEMU fixes this + /* Only some CPUs support hyperthreading. Even though QEMU fixes this * issue by adjusting CPUID_0000_0001_EBX and CPUID_8000_0008_ECX * based on inputs (sockets,cores,threads), it is still better to gives * users a warning. @@ -3651,8 +3651,8 @@ static void x86_cpu_realizefn(DeviceState *dev, Error= **errp) * NOTE: the following code has to follow qemu_init_vcpu(). Otherwise * cs->nr_threads hasn't be populated yet and the checking is incorrec= t. */ - if (!IS_INTEL_CPU(env) && cs->nr_threads > 1 && !ht_warned) { - error_report("AMD CPU doesn't support hyperthreading. Please confi= gure" + if ((env->features[FEAT_1_EDX] & CPUID_HT) && (cs->nr_threads > 1) && = !ht_warned) { + error_report("This CPU doesn't support hyperthreading. Please conf= igure" " -smp options properly."); ht_warned =3D true; } --=20 2.11.0