Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753507AbcD1BHI (ORCPT ); Wed, 27 Apr 2016 21:07:08 -0400 Received: from relay2.sgi.com ([192.48.180.65]:46846 "EHLO relay.sgi.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752147AbcD1BGH (ORCPT ); Wed, 27 Apr 2016 21:06:07 -0400 Message-Id: <20160428005459.572744364@asylum.americas.sgi.com> References: <20160428005457.471061412@asylum.americas.sgi.com> User-Agent: quilt/0.46-1 Date: Wed, 27 Apr 2016 19:55:09 -0500 From: Mike Travis To: Ingo Molnar , "H. Peter Anvin" , Thomas Gleixner , Andrew Morton , Len Brown Cc: x86@kernel.org, linux-kernel@vger.kernel.org, uv4-kernel@sgi.com Subject: [PATCH 12/21] X86_64, UV: Move blade local processor ID to the per cpu info struct Content-Disposition: inline; filename=uv4_add_per_cpu_blade_procid Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3961 Lines: 105 Move references to blade local processor ID to the new per cpu info structs. Create an access function that makes this move, and potential other moves opaque to callers of this function. Define a flag that indicates to callers in external GPL modules that this function replaces any local definition. This allows calling source code to be built for both pre-UV4 kernels as well as post-UV4 kernels. Signed-off-by: Mike Travis Reviewed-by: Dimitri Sivanich Tested-by: John Estabrook Tested-by: Gary Kroening --- arch/x86/include/asm/uv/uv_hub.h | 10 ++++++++-- arch/x86/kernel/apic/x2apic_uv_x.c | 2 +- arch/x86/platform/uv/tlb_uv.c | 3 ++- arch/x86/platform/uv/uv_time.c | 6 +++--- 4 files changed, 14 insertions(+), 7 deletions(-) --- linux.orig/arch/x86/include/asm/uv/uv_hub.h +++ linux/arch/x86/include/asm/uv/uv_hub.h @@ -159,7 +159,6 @@ struct uv_hub_info_s { unsigned short pnode_mask; unsigned short coherency_domain_number; unsigned short numa_blade_id; - unsigned char blade_processor_id; unsigned char m_val; unsigned char n_val; }; @@ -565,9 +564,16 @@ extern short uv_possible_blades; /* Blade-local cpu number of current cpu. Numbered 0 .. <# cpus on the blade> */ static inline int uv_blade_processor_id(void) { - return uv_hub_info->blade_processor_id; + return uv_cpu_info->blade_cpu_id; } +/* Blade-local cpu number of cpu N. Numbered 0 .. <# cpus on the blade> */ +static inline int uv_cpu_blade_processor_id(int cpu) +{ + return uv_cpu_info_per(cpu)->blade_cpu_id; +} +#define _uv_cpu_blade_processor_id 1 /* indicate function available */ + /* Blade number of current cpu. Numnbered 0 .. <#blades -1> */ static inline int uv_numa_blade_id(void) { --- linux.orig/arch/x86/kernel/apic/x2apic_uv_x.c +++ linux/arch/x86/kernel/apic/x2apic_uv_x.c @@ -1007,12 +1007,12 @@ void __init uv_system_init(void) uv_cpu_hub_info(cpu)->numa_blade_id = blade; uv_cpu_hub_info(cpu)->pnode = pnode; - uv_cpu_hub_info(cpu)->blade_processor_id = lcpu; uv_node_to_blade[nodeid] = blade; uv_cpu_to_blade[cpu] = blade; /* Initialize per cpu info list */ uv_cpu_info_per(cpu)->p_uv_hub_info = uv_cpu_hub_info(cpu); + uv_cpu_info_per(cpu)->blade_cpu_id = lcpu; uv_cpu_info_per(cpu)->scir.offset = uv_scir_offset(apicid); } --- linux.orig/arch/x86/platform/uv/tlb_uv.c +++ linux/arch/x86/platform/uv/tlb_uv.c @@ -2025,7 +2025,8 @@ static int scan_sock(struct socket_desc return 1; } bcp->uvhub_master = *hmasterp; - bcp->uvhub_cpu = uv_cpu_hub_info(cpu)->blade_processor_id; + bcp->uvhub_cpu = uv_cpu_blade_processor_id(cpu); + if (bcp->uvhub_cpu >= MAX_CPUS_PER_UVHUB) { printk(KERN_EMERG "%d cpus per uvhub invalid\n", bcp->uvhub_cpu); --- linux.orig/arch/x86/platform/uv/uv_time.c +++ linux/arch/x86/platform/uv/uv_time.c @@ -164,7 +164,7 @@ static __init int uv_rtc_allocate_timers for_each_present_cpu(cpu) { int nid = cpu_to_node(cpu); int bid = uv_cpu_to_blade_id(cpu); - int bcpu = uv_cpu_hub_info(cpu)->blade_processor_id; + int bcpu = uv_cpu_blade_processor_id(cpu); struct uv_rtc_timer_head *head = blade_info[bid]; if (!head) { @@ -225,7 +225,7 @@ static int uv_rtc_set_timer(int cpu, u64 int pnode = uv_cpu_to_pnode(cpu); int bid = uv_cpu_to_blade_id(cpu); struct uv_rtc_timer_head *head = blade_info[bid]; - int bcpu = uv_cpu_hub_info(cpu)->blade_processor_id; + int bcpu = uv_cpu_blade_processor_id(cpu); u64 *t = &head->cpu[bcpu].expires; unsigned long flags; int next_cpu; @@ -261,7 +261,7 @@ static int uv_rtc_unset_timer(int cpu, i int pnode = uv_cpu_to_pnode(cpu); int bid = uv_cpu_to_blade_id(cpu); struct uv_rtc_timer_head *head = blade_info[bid]; - int bcpu = uv_cpu_hub_info(cpu)->blade_processor_id; + int bcpu = uv_cpu_blade_processor_id(cpu); u64 *t = &head->cpu[bcpu].expires; unsigned long flags; int rc = 0; --