Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753921AbbFIQfL (ORCPT ); Tue, 9 Jun 2015 12:35:11 -0400 Received: from mail-bn1on0148.outbound.protection.outlook.com ([157.56.110.148]:28016 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932938AbbFIQet (ORCPT ); Tue, 9 Jun 2015 12:34:49 -0400 Authentication-Results: spf=none (sender IP is 165.204.84.221) smtp.mailfrom=amd.com; alien8.de; dkim=none (message not signed) header.d=none; X-WSS-ID: 0NPORDT-07-7F0-02 X-M-MSG: From: Aravind Gopalakrishnan To: , , CC: , , , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Borislav Petkov , Jacob Shin , Dave Hansen , Andy Lutomirski , "Paolo Bonzini" Subject: [PATCH 1/3] x86, amd: Store number of nodes in a static global variable Date: Tue, 9 Jun 2015 11:45:15 -0500 Message-ID: <1433868317-18417-2-git-send-email-Aravind.Gopalakrishnan@amd.com> X-Mailer: git-send-email 2.4.0 In-Reply-To: <1433868317-18417-1-git-send-email-Aravind.Gopalakrishnan@amd.com> References: <1433868317-18417-1-git-send-email-Aravind.Gopalakrishnan@amd.com> MIME-Version: 1.0 Content-Type: text/plain X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BY2FFO11OLC015;1:PF1iecLDoNQEKiccgokEPiNaLtubofiPgKcLD/5e16LsIrc6duOkxB1pUPlYOqjooLLu39poGrR2oB2ePE6qhBbiqOgxISpco6ihJ2hHijHgIeuttGWKdKOri+q8nBv80sX+dgXJiWQycxX/VpQnpBEAKgWUgGLk0XZRnH/hCfnGLHWMAUzQT3bFqhW+/wFzLWQPLVJrTvAKzvLr8PqAHhW0duBc6dYWWXVE2a8tD18nurPl7yDM7NChyVMNxYNQuRV+l8c9I4X9dUBqxblw3jrQAODbp5yGuFhzEZKlXXNziV0txykZ94m54Si8R8YPhMlLQecSnbEIyOkPGJG+FA== X-Forefront-Antispam-Report: CIP:165.204.84.221;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(428002)(199003)(189002)(101416001)(106466001)(48376002)(50986999)(2201001)(86362001)(19580395003)(87936001)(76176999)(229853001)(46102003)(19580405001)(92566002)(36756003)(2950100001)(53416004)(77096005)(5001920100001)(189998001)(62966003)(77156002)(105586002)(5001770100001)(47776003)(50466002)(50226001);DIR:OUT;SFP:1102;SCL:1;SRVR:BY1PR02MB1116;H:atltwp01.amd.com;FPR:;SPF:None;MLV:sfv;A:1;MX:1;LANG:en; X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY1PR02MB1116;UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY1PR02MB1210; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5005006)(520003)(3002001);SRVR:BY1PR02MB1116;BCL:0;PCL:0;RULEID:;SRVR:BY1PR02MB1116; X-Forefront-PRVS: 06022AA85F X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jun 2015 16:34:42.0988 (UTC) X-MS-Exchange-CrossTenant-Id: fde4dada-be84-483f-92cc-e026cbee8e96 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=fde4dada-be84-483f-92cc-e026cbee8e96;Ip=[165.204.84.221];Helo=[atltwp01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR02MB1116 X-OriginatorOrg: amd.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2653 Lines: 85 Moving this out of function local scope as we want to allow EDAC to be able to view this topology attribute. A follow-up patch introduces an accessor function for this variable that will be used by EDAC's mce_amd_inj module. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: "H. Peter Anvin" Cc: Borislav Petkov Cc: Jacob Shin Cc: Dave Hansen Cc: Andy Lutomirski Cc: Paolo Bonzini Signed-off-by: Aravind Gopalakrishnan --- arch/x86/kernel/cpu/amd.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index 5bd3a99..487083b 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c @@ -19,6 +19,13 @@ #include "cpu.h" +/* + * nodes_per_processor: Specifies number of nodes per socket + * Refer Fam15h Models 00-0fh BKDG- + * CPUID Fn8000_001E_ECX Node Identifiers[10:8] + */ +static u32 nodes_per_processor = 1; + static inline int rdmsrl_amd_safe(unsigned msr, unsigned long long *p) { u32 gprs[8] = { 0 }; @@ -291,7 +298,7 @@ static int nearby_node(int apicid) #ifdef CONFIG_SMP static void amd_get_topology(struct cpuinfo_x86 *c) { - u32 nodes, cores_per_cu = 1; + u32 cores_per_cu = 1; u8 node_id; int cpu = smp_processor_id(); @@ -300,7 +307,7 @@ static void amd_get_topology(struct cpuinfo_x86 *c) u32 eax, ebx, ecx, edx; cpuid(0x8000001e, &eax, &ebx, &ecx, &edx); - nodes = ((ecx >> 8) & 7) + 1; + nodes_per_processor = ((ecx >> 8) & 7) + 1; node_id = ecx & 7; /* get compute unit information */ @@ -311,18 +318,18 @@ static void amd_get_topology(struct cpuinfo_x86 *c) u64 value; rdmsrl(MSR_FAM10H_NODE_ID, value); - nodes = ((value >> 3) & 7) + 1; + nodes_per_processor = ((value >> 3) & 7) + 1; node_id = value & 7; } else return; /* fixup multi-node processor information */ - if (nodes > 1) { + if (nodes_per_processor > 1) { u32 cores_per_node; u32 cus_per_node; set_cpu_cap(c, X86_FEATURE_AMD_DCM); - cores_per_node = c->x86_max_cores / nodes; + cores_per_node = c->x86_max_cores / nodes_per_processor; cus_per_node = cores_per_node / cores_per_cu; /* store NodeID, use llc_shared_map to store sibling info */ -- 2.4.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/