From nobody Tue Dec 16 19:57:19 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F281CCDB47E for ; Fri, 13 Oct 2023 09:39:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231517AbjJMJje (ORCPT ); Fri, 13 Oct 2023 05:39:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231285AbjJMJiR (ORCPT ); Fri, 13 Oct 2023 05:38:17 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 313F3DA; Fri, 13 Oct 2023 02:38:16 -0700 (PDT) Date: Fri, 13 Oct 2023 09:38:14 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1697189894; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2Tdn9YzZqvXLzEj18H/HtmAGqNqRPcJ+Ga59SnQmz6o=; b=BXbdsGSowodu3hAWxSP8kCy0/apsBjQKrYaIxUEge1PHG58p+zEHDMR8qrabG/jS1r3uNn /XY2+l3hOFVR+ghivBFFAAiHiULTJX4Dl/r8MNE13pUzWuj+oZ9zpxwU/LJueJqTzdzb8r 1bMr6ApVcLVd2ZPTmuce/+5FOF4/VI4XudSaJX3dyYOO229YGdzBJ48HRGoQa9SZwQgbmH esN2ffsJj1mPARiVYN/Ra0bzWJTcveM6JzFAEdkNVitl4hYJrnfuNE/HGE2uSV0hQc40im Bce96eb5x9JphOaUlOpZb2+dTYroigO79zYWStQX8JXAee0qmyY/SaSv5bfXQA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1697189894; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2Tdn9YzZqvXLzEj18H/HtmAGqNqRPcJ+Ga59SnQmz6o=; b=PwP3o0WEqKmuLbJWVEmMYTMg39RMPKFOhpuMya5GATkLVwdGAk782BRfMoeWBsTo6yQM1Z ktkJ6ufKsk2HH/Cg== From: "tip-bot2 for Pu Wen" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/core] x86/cpu/hygon: Fix the CPU topology evaluation for real Cc: Pu Wen , Thomas Gleixner , "Peter Zijlstra (Intel)" , , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: References: MIME-Version: 1.0 Message-ID: <169718989416.3135.5181697052679641742.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the x86/core branch of tip: Commit-ID: ee545b94d39a00c93dc98b1dbcbcf731d2eadeb4 Gitweb: https://git.kernel.org/tip/ee545b94d39a00c93dc98b1dbcbcf731d= 2eadeb4 Author: Pu Wen AuthorDate: Mon, 14 Aug 2023 10:18:26 +02:00 Committer: Thomas Gleixner CommitterDate: Tue, 10 Oct 2023 14:38:16 +02:00 x86/cpu/hygon: Fix the CPU topology evaluation for real Hygon processors with a model ID > 3 have CPUID leaf 0xB correctly populated and don't need the fixed package ID shift workaround. The fixup is also incorrect when running in a guest. Fixes: e0ceeae708ce ("x86/CPU/hygon: Fix phys_proc_id calculation logic for= multi-die processors") Signed-off-by: Pu Wen Signed-off-by: Thomas Gleixner Acked-by: Peter Zijlstra (Intel) Cc: Link: https://lore.kernel.org/r/tencent_594804A808BD93A4EBF50A994F228E3A7F0= 7@qq.com Link: https://lore.kernel.org/r/20230814085112.089607918@linutronix.de --- arch/x86/kernel/cpu/hygon.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/cpu/hygon.c b/arch/x86/kernel/cpu/hygon.c index defdc59..a7b3ef4 100644 --- a/arch/x86/kernel/cpu/hygon.c +++ b/arch/x86/kernel/cpu/hygon.c @@ -87,8 +87,12 @@ static void hygon_get_topology(struct cpuinfo_x86 *c) if (!err) c->x86_coreid_bits =3D get_count_order(c->x86_max_cores); =20 - /* Socket ID is ApicId[6] for these processors. */ - c->phys_proc_id =3D c->apicid >> APICID_SOCKET_ID_BIT; + /* + * Socket ID is ApicId[6] for the processors with model <=3D 0x3 + * when running on host. + */ + if (!boot_cpu_has(X86_FEATURE_HYPERVISOR) && c->x86_model <=3D 0x3) + c->phys_proc_id =3D c->apicid >> APICID_SOCKET_ID_BIT; =20 cacheinfo_hygon_init_llc_id(c, cpu); } else if (cpu_has(c, X86_FEATURE_NODEID_MSR)) {