From patchwork Mon Jul 24 17:44:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 125150 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp1980794vqg; Mon, 24 Jul 2023 11:35:26 -0700 (PDT) X-Google-Smtp-Source: APBJJlEGnDV84SbWTWJA6c3uZ6oKl/xBGiXi57iFC3Btjnqa3cFFffKLC9/E7+fi/1I1/b03oG+a X-Received: by 2002:a17:906:31d4:b0:993:e2ba:55a2 with SMTP id f20-20020a17090631d400b00993e2ba55a2mr9492937ejf.19.1690223726679; Mon, 24 Jul 2023 11:35:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690223726; cv=none; d=google.com; s=arc-20160816; b=BEXPiy2XSzfQAA1phvfwEzhmwM95kofipmRD2e1Wuoa7nBMkVa2PvP52jB1qYrZKFg ueEqvyRrzx6pZzsuJruhYq6EZYTATiv5JL9OgQN8Cz6T9uRo9AYz5iv1PvnJQJsNNHb5 T3uTcNMsp5vuSIaXGNkj2nOGted7JZYY6WbCl5maICDSHedBlLFcYkAW7PoedzqC8Zef kyyRqqXSfbgatjtJu11DqWNun+RmvO+X5Nao9okdEd8iNx0yw49xyKwRkIjtRXaLwpm8 i1waOrznY8OV6FNz3/DyrdbdXxrqjRIYmYCUj74JAUU/kRgqsoCbd/bEesxRowsNNnq3 VoEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:mime-version:references:subject:cc:to:from :dkim-signature:dkim-signature:message-id; bh=u2nALLK7m8WtmbLIhAtObAjpwOgRje3zo0FH2XahcbM=; fh=cDlgSYzM/IiVZ/EC06yL1+GD3+pSK8bXSWGje/Xzf2k=; b=d48ezSLrQNaze0vgFo9Af3Soj5Z2ZhSzAXDtDrDzhUdeMQhOZGOjoXZ6C7N65UROXe 7FXTk/cWkw70BQOJQXup34jhRnZ5g9SHPPsz6bEs9W77ikWc6YqrV9XHKQAmwB4J6SoS na7/nn+BXJcPv8ELQPTqgPxVUWuxIJdugojW+j00bhvMnsCXjS6l48c7CJbyRvWA/x49 CI822JQ8IhjER9ORs0SS1ifFFgDadLbO/8eOdZy2c0KIZqf+H28cgoJSP2MNUPT9q/02 iol0uOX+oTwqsvZHc44bo1QCcqY4zKIJsUTm+mSTOAccAcOwVEejdnSfc1uL3iBN2ayq geVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=In6sm8Cd; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pj13-20020a170906d78d00b00993860a6d38si7115603ejb.314.2023.07.24.11.35.02; Mon, 24 Jul 2023 11:35:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=In6sm8Cd; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231960AbjGXRrt (ORCPT + 99 others); Mon, 24 Jul 2023 13:47:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230095AbjGXRq2 (ORCPT ); Mon, 24 Jul 2023 13:46:28 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE128270B; Mon, 24 Jul 2023 10:44:39 -0700 (PDT) Message-ID: <20230724172845.149433362@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1690220670; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=u2nALLK7m8WtmbLIhAtObAjpwOgRje3zo0FH2XahcbM=; b=In6sm8CdyFRFh0QmujmmeLPeD6D7AF4e7Ga+CG/HwjqAtRQbsG7Mc2fOBEr230c7HkUsNL EBbJ1LwC3epaoRGPBaSNabiC+zllxbZ0A2pRMk9IxueDcRiG2GRzOJpwk0POEo8IF13/ol 1HH4LGKYoNZ3jbFoCTbE9hemK6CBPIBcpahLyKZRYWJSYXl2bCnogvZWrphMYOV8Kfrrdg w5BJq8y80EU2zeDZ96udK4I1eCxHM4AS3Lay52ErtJA1UFutscKxtNshCbYwwvGxOWh6tJ XV9B14ySDuug6j0opzfunrXAqdu/m1c+9PjIsxbIn8ColmaAYD/5baNxNF+7GA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1690220670; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=u2nALLK7m8WtmbLIhAtObAjpwOgRje3zo0FH2XahcbM=; b=FpOfgG5zN2iI0+T4ZbRwZborOR0tdWultLaO/4fwwSblOCnyaM2wCRQfE9GbT6/dlOHzPH aaBxvwQ31bsohoBA== From: Thomas Gleixner To: LKML Cc: x86@kernel.org, Tom Lendacky , Andrew Cooper , Arjan van de Ven , "James E.J. Bottomley" , Dick Kennedy , James Smart , "Martin K. Petersen" , linux-scsi@vger.kernel.org, linux-hwmon@vger.kernel.org, Jean Delvare , Huang Rui , Guenter Roeck , Steve Wahl , Mike Travis , Dimitri Sivanich , Russ Anderson Subject: [patch 25/29] x86/cpu: Make topology_amd_node_id() use the actual node info References: <20230724155329.474037902@linutronix.de> MIME-Version: 1.0 Date: Mon, 24 Jul 2023 19:44:30 +0200 (CEST) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772328034545639485 X-GMAIL-MSGID: 1772328034545639485 Now that everything is converted switch it over and remove the intermediate operation. Signed-off-by: Thomas Gleixner --- arch/x86/include/asm/topology.h | 4 ++-- arch/x86/kernel/cpu/topology_common.c | 7 ++----- 2 files changed, 4 insertions(+), 7 deletions(-) --- a/arch/x86/include/asm/topology.h +++ b/arch/x86/include/asm/topology.h @@ -136,7 +136,7 @@ extern const struct cpumask *cpu_cluster #define topology_core_id(cpu) (cpu_data(cpu).topo.core_id) #define topology_ppin(cpu) (cpu_data(cpu).ppin) -#define topology_amd_node_id(cpu) (cpu_data(cpu).topo.die_id) +#define topology_amd_node_id(cpu) (cpu_data(cpu).topo.amd_node_id) extern unsigned int __max_die_per_package; @@ -171,7 +171,7 @@ extern unsigned int __amd_nodes_per_pkg; static inline unsigned int topology_amd_nodes_per_pkg(void) { - return __max_die_per_package; + return __amd_nodes_per_pkg; } extern struct cpumask __cpu_primary_thread_mask; --- a/arch/x86/kernel/cpu/topology_common.c +++ b/arch/x86/kernel/cpu/topology_common.c @@ -143,9 +143,7 @@ static void topo_set_ids(struct topo_sca /* Relative core ID */ c->topo.core_id = topo_relative_domain_id(apicid, TOPO_CORE_DOMAIN); - /* Temporary workaround */ - if (tscan->amd_nodes_per_pkg) - c->topo.amd_node_id = c->topo.die_id = tscan->amd_node_id; + c->topo.amd_node_id = tscan->amd_node_id; if (c->x86_vendor == X86_VENDOR_AMD) cpu_topology_fixup_amd(tscan); @@ -231,6 +229,5 @@ void __init cpu_init_topology(struct cpu * AMD systems have Nodes per package which cannot be mapped to * APIC ID (yet). */ - if (c->x86_vendor == X86_VENDOR_AMD || c->x86_vendor == X86_VENDOR_HYGON) - __amd_nodes_per_pkg = __max_die_per_package = tscan.amd_nodes_per_pkg; + __amd_nodes_per_pkg = tscan.amd_nodes_per_pkg; }