From nobody Mon Nov 25 07:33:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=bytedance.com ARC-Seal: i=1; a=rsa-sha256; t=1716779727; cv=none; d=zohomail.com; s=zohoarc; b=R+2Iwoc6vvwFt99qMHwDNOIeeg/5OMe17kZP0rkb68O6hq8cAdH8TKjKDHZ+M8xFbLzwo4GCvXuDS/dumzfYnMD2I5NluehDMOvmMwNT3gEsd0EMX3MmiCvqc5m5x3jOCUeMh1ip6BNLFRjMLrL2QnE8InMkqQk1EZE0gXzIqpw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716779727; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=kdfKBWYgXkwQbXE4PNGLBClW49IP35uOBMWtBZKXUP0=; b=iiQTxotXtnJ3kxuAKLn5t0NTH3NZ6DM3lb5cZlzDfO0V+fKo/uHFVhgyJXfNM0savIcfrkdqNLpqGdMgS0aKxHKhRj34C71x1ZBy3tGfrCccMxVjxBuvZb9aw/BwmjR+NPaO0CUvd5Ba8ohZEanguZrZa7Syy7kKe0GxHL4VWW8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1716779727053703.28306690462; Sun, 26 May 2024 20:15:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sBQp9-000672-ND; Sun, 26 May 2024 23:14:59 -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 1sBQp7-00066W-QK for qemu-devel@nongnu.org; Sun, 26 May 2024 23:14:57 -0400 Received: from mail-oo1-xc2a.google.com ([2607:f8b0:4864:20::c2a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sBQov-0004G1-Q0 for qemu-devel@nongnu.org; Sun, 26 May 2024 23:14:57 -0400 Received: by mail-oo1-xc2a.google.com with SMTP id 006d021491bc7-5b9817a135aso805925eaf.0 for ; Sun, 26 May 2024 20:14:39 -0700 (PDT) Received: from MacBook-Pro-2.local.bytedance.net ([203.208.167.151]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-6f8fbd3dd5dsm4035662b3a.42.2024.05.26.20.14.35 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 26 May 2024 20:14:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1716779678; x=1717384478; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=kdfKBWYgXkwQbXE4PNGLBClW49IP35uOBMWtBZKXUP0=; b=ZqrKpOpVKWys1hHn1E4rLJXQV2DO2aJx96BWKpm/YcgpgxxGfYLOYo6lT1gYmsqsWo VhJPueh96E0R+M3Gnqgnmup9QL1goWVMQ8Ryw1CN1Sor4gH5fRmMBRQhxn4sR3aWGqiw 0MthLncNDwG4sUAvvYsrTSzgovYllvhHu2NqUg9mpPt0GPoyigrLyFbpObus4tb0BWKJ efaQvEdgzjwJ9q/WRg1RxcMiAKXS/2AmOSkPKCVG8qbL9GU9mgoA9KbDEr72xVoWydYE ftFMeTccvcipgp9FVCne8AdsQRtQxJSgNhMZ49kjnzRW2IqHu6WFD/JxTvPTPkPUTEMJ qPjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716779678; x=1717384478; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=kdfKBWYgXkwQbXE4PNGLBClW49IP35uOBMWtBZKXUP0=; b=toN42gNWH3I6bbzXbzNf1WiNl1XuOx6GFzUWiG91Tbo7zHmnu9mt1dGf/PRX5ZLFVT +/iC0cRfweVcEThHohRfdSC2h/f2T7A9RUoievTjMQk9+KcCJ51J/rliRyapXJdVaQO4 MBoGzlSyGflUCGtV2OJ/xDvOKBQ2zTiX/vFq2pC7pLwbZQL53r38DjvXLTVpsS4TpeD+ NeePgr1NRR3sEaHi3o4rqkp3c2OAa1lQi6jKrBdDTnDHOvIsQoLZoH4wPBRzoNAevF1h +nf74jSAHHMG3hSkuWj/HV14wHDKeKuvP4eikYDmMs7VQV4EtunoxQe7yLuEUXfDu3Fy sbNw== X-Gm-Message-State: AOJu0YwF3D57CoTG86SIDKvkCjQeTrKInw9I3qqYw9767UNayJkeHalE SkH5rvVjccC2/Fsf/wCmhhbHj1IJAQ1jQKAVHg3xuRaDauFf94YfJQBb/4Dp1ZoR9wycE5cKHjp M X-Google-Smtp-Source: AGHT+IGRhHTXc+LsEodxhXEnl0n2mVHStpAYEdHBYnH4/b9WIzHSstOhRzB7Mi/OcV05D8hI5YaNrQ== X-Received: by 2002:a05:6870:7195:b0:24f:d4b4:698f with SMTP id 586e51a60fabf-24fd4b49812mr6594428fac.1.1716779678674; Sun, 26 May 2024 20:14:38 -0700 (PDT) From: Chuang Xu To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com, xieyongji@bytedance.com, Chuang Xu , Guixiong Wei , Yipeng Yin Subject: [PATCH] x86: cpu: fixup number of addressable IDs for processor cores in the physical package Date: Mon, 27 May 2024 11:13:33 +0800 Message-Id: <20240527031333.85932-1-xuchuangxclwt@bytedance.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=2607:f8b0:4864:20::c2a; envelope-from=xuchuangxclwt@bytedance.com; helo=mail-oo1-xc2a.google.com X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 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, FROM_LOCAL_NOVOWEL=0.5, HK_RANDOM_ENVFROM=0.001, HK_RANDOM_FROM=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @bytedance.com) X-ZM-MESSAGEID: 1716779728090100001 Content-Type: text/plain; charset="utf-8" When QEMU is started with: -cpu host,host-cache-info=3Don,l3-cache=3Doff \ -smp 2,sockets=3D1,dies=3D1,cores=3D1,threads=3D2 Guest can't acquire maximum number of addressable IDs for processor cores in the physical package from CPUID[04H]. This bug was introduced in commit d7caf13b5fcf742e5680c1d3448ba070fc811644. Fix it by changing the judgement condition to a >=3D 1. Signed-off-by: Chuang Xu Signed-off-by: Guixiong Wei Signed-off-by: Yipeng Yin --- target/i386/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index cd16cb893d..0369c01153 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -6097,7 +6097,7 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, = uint32_t count, if (*eax & 31) { int host_vcpus_per_cache =3D 1 + ((*eax & 0x3FFC000) >> 14= ); int vcpus_per_socket =3D cs->nr_cores * cs->nr_threads; - if (cs->nr_cores > 1) { + if (cs->nr_cores >=3D 1) { *eax &=3D ~0xFC000000; *eax |=3D (pow2ceil(cs->nr_cores) - 1) << 26; } --=20 2.20.1