Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752627AbbFBU1e (ORCPT ); Tue, 2 Jun 2015 16:27:34 -0400 Received: from mail-by2on0132.outbound.protection.outlook.com ([207.46.100.132]:28064 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751424AbbFBU0X (ORCPT ); Tue, 2 Jun 2015 16:26:23 -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: 0NPC3FV-07-71E-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" , Denys Vlasenko , "Hector Marco-Gisbert" Subject: [PATCH V2 8/9] x86, amd: Provide accessor for number of nodes Date: Tue, 2 Jun 2015 15:36:01 -0500 Message-ID: <1433277362-10911-9-git-send-email-Aravind.Gopalakrishnan@amd.com> X-Mailer: git-send-email 2.4.0 In-Reply-To: <1433277362-10911-1-git-send-email-Aravind.Gopalakrishnan@amd.com> References: <1433277362-10911-1-git-send-email-Aravind.Gopalakrishnan@amd.com> MIME-Version: 1.0 Content-Type: text/plain X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BN1BFFO11FD010;1:z478C8oXHUUuRV3P5qGc0mvA2YtOPP4ZTah1LTZRlHndoOMTADnbtsPULj4/hqftQM3ReHmyzqRvP+ZLFDBptgquNdsH5PJajWnviboPZEgnRFOECD5a2nV8KsmPu57Ayspj1GEPwqHt3MlmFPEgDEkkdkKLdFbaeVFLPxEhFxZ39BwOUfmstcKfq+s/jbIk7aAlmiy9Lp6PAJfWxpJQk0fbOxxrVhL54W+vkYqkRMRt44SHN3pgME2u/C8ORCzG1dacXK/rOQ7O7sNEyMlm4+XViAjsnoo0hizd0TM0ae0= X-Forefront-Antispam-Report: CIP:165.204.84.221;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(979002)(6009001)(428002)(189002)(199003)(229853001)(106466001)(92566002)(48376002)(64706001)(86362001)(19580405001)(87936001)(50226001)(47776003)(19580395003)(105586002)(50466002)(77096005)(77156002)(62966003)(68736005)(5001920100001)(2950100001)(5001830100001)(5001860100001)(101416001)(76176999)(50986999)(36756003)(4001540100001)(5001770100001)(2201001)(53416004)(97736004)(46102003)(189998001)(969003)(989001)(999001)(1009001)(1019001);DIR:OUT;SFP:1102;SCL:1;SRVR:BLUPR02MB065;H:atltwp01.amd.com;FPR:;SPF:None;PTR:InfoDomainNonexistent;MX:1;A:1;LANG:en; X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR02MB065; 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:BLUPR02MB065;BCL:0;PCL:0;RULEID:;SRVR:BLUPR02MB065; X-Forefront-PRVS: 05954A7C45 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jun 2015 20:26:20.9759 (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: BLUPR02MB065 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1912 Lines: 59 Add an accessor function amd_get_nodes_cnt() which returns the number of nodes per socket. In a subsequent patch, we will use this info in EDAC 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 Cc: Denys Vlasenko Cc: Hector Marco-Gisbert Signed-off-by: Aravind Gopalakrishnan --- arch/x86/include/asm/processor.h | 1 + arch/x86/kernel/cpu/amd.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h index 8e04f51..34faf24 100644 --- a/arch/x86/include/asm/processor.h +++ b/arch/x86/include/asm/processor.h @@ -820,6 +820,7 @@ static inline int mpx_disable_management(struct task_struct *tsk) #endif /* CONFIG_X86_INTEL_MPX */ extern u16 amd_get_nb_id(int cpu); +extern u32 amd_get_nodes_cnt(void); static inline uint32_t hypervisor_cpuid_base(const char *sig, uint32_t leaves) { diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index c595669..e91b9bd 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c @@ -384,6 +384,12 @@ u16 amd_get_nb_id(int cpu) } EXPORT_SYMBOL_GPL(amd_get_nb_id); +u32 amd_get_nodes_cnt(void) +{ + return nodes_per_processor; +} +EXPORT_SYMBOL_GPL(amd_get_nodes_cnt); + static void srat_detect_node(struct cpuinfo_x86 *c) { #ifdef CONFIG_NUMA -- 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/