Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp837502rdg; Fri, 13 Oct 2023 02:40:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGOlqYDQSJcv3aL0M3dZFEYzeO9ELOcGOn3fz8tnZIziAkpw9UH1sV5eOuO7dPjvPUOMRSE X-Received: by 2002:a05:6871:4199:b0:1e9:a70c:1321 with SMTP id lc25-20020a056871419900b001e9a70c1321mr6998501oab.42.1697190040419; Fri, 13 Oct 2023 02:40:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697190040; cv=none; d=google.com; s=arc-20160816; b=I+NsgjHE4ZxVXPXfMg+my8TdFHHIIneNW94bEAeqEU16sjvTk4zTbAXiXaUQUiEjPw G527NefNu2kFc15+gQhirpBqPfzqokvmDrhRJjr125AZHTyt3oLs+A1zTENEWWVBN6kw G+WOEK24shCD1CM3FAXt4DPpAJX5MpE0s8AWf5BxPQYYm8ljbeid/1LYMNMI6vraoslD 2LOKXrMR2/uxnC2Ezj2Z29v0dCTF5IgzPaVnBvR4cVay92G3VvioqJaqF5MV7cich3/n XJMDMlku1bY9OUwHk31KmIGava3RUpK8Bc7BuI8Ecef/fHDQjHYJ96+Izbr1lByZIO9Y r2Bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=2Tdn9YzZqvXLzEj18H/HtmAGqNqRPcJ+Ga59SnQmz6o=; fh=YWdR1d4hffByEk/GJLMoecX6FVpIUr+/C1FkTUYozXg=; b=i0cVlMHyyrQkzZdeVzxSoJDxuhQ2O716KldWjTQqndL3PDb82LhAMasdeASSAuyc5V /VIspfy5v+DVq/PgMeUWocALehp8NLmCD3QsK3CdczWoPk4XZxFz1tn9gPpJ+N5UcPBu miPo4UJvCeNGBUNABjCBHEKQavOZgc1X09XVBQXY2pFcrHlj6LQNEKoElb1lXrR+F5RY RhCBX5MM2RMrHoI14htuUeqLD6gvm9/kY/Z0ReDIXZKE0XcfnIjY0MTjn/LdGoakOfbu I40w9GUlNkiQuU8GTHhlvXcv/poEyvYPugogf/qFpNDAfTb446cqZ31rende1/Kz1bVk OkOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=BXbdsGSo; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id w8-20020a63f508000000b00564d6ad2746si4253703pgh.452.2023.10.13.02.40.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 02:40:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=BXbdsGSo; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id CB30D802DB81; Fri, 13 Oct 2023 02:40:35 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231513AbjJMJjc (ORCPT + 99 others); Fri, 13 Oct 2023 05:39:32 -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: 7bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Fri, 13 Oct 2023 02:40:35 -0700 (PDT) The following commit has been merged into the x86/core branch of tip: Commit-ID: ee545b94d39a00c93dc98b1dbcbcf731d2eadeb4 Gitweb: https://git.kernel.org/tip/ee545b94d39a00c93dc98b1dbcbcf731d2eadeb4 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_594804A808BD93A4EBF50A994F228E3A7F07@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 = get_count_order(c->x86_max_cores); - /* Socket ID is ApicId[6] for these processors. */ - c->phys_proc_id = c->apicid >> APICID_SOCKET_ID_BIT; + /* + * Socket ID is ApicId[6] for the processors with model <= 0x3 + * when running on host. + */ + if (!boot_cpu_has(X86_FEATURE_HYPERVISOR) && c->x86_model <= 0x3) + c->phys_proc_id = c->apicid >> APICID_SOCKET_ID_BIT; cacheinfo_hygon_init_llc_id(c, cpu); } else if (cpu_has(c, X86_FEATURE_NODEID_MSR)) {