aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/include/asm/uv
diff options
context:
space:
mode:
authorMike Travis <travis@sgi.com>2016-04-29 17:54:16 -0400
committerIngo Molnar <mingo@kernel.org>2016-05-04 02:48:49 -0400
commit906f3b20da8c6ec3eeef81753b4af9b6780e2edc (patch)
tree8813d3811a85d1328f15d63d387d5d200c2d06c3 /arch/x86/include/asm/uv
parent3edcf2ff7ae50d1096030fab9a1bafb421e07d4c (diff)
x86/platform/UV: Fold blade info into per node hub info structs
Migrate references from the blade info structs to the per node hub info structs. This phases out the allocation of the list of per blade info structs on node 0, in favor of a per node hub info struct allocated on the node's local memory. There are also some minor cosemetic changes in the comments and whitespace to clean things up a bit. Tested-by: Dimitri Sivanich <sivanich@sgi.com> Tested-by: John Estabrook <estabrook@sgi.com> Tested-by: Gary Kroening <gfk@sgi.com> Tested-by: Nathan Zimmer <nzimmer@sgi.com> Signed-off-by: Mike Travis <travis@sgi.com> Reviewed-by: Andrew Banman <abanman@sgi.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Borislav Petkov <bp@alien8.de> Cc: Brian Gerst <brgerst@gmail.com> Cc: Denys Vlasenko <dvlasenk@redhat.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Len Brown <len.brown@intel.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Russ Anderson <rja@sgi.com> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/20160429215404.987204515@asylum.americas.sgi.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/include/asm/uv')
-rw-r--r--arch/x86/include/asm/uv/uv_hub.h71
1 files changed, 32 insertions, 39 deletions
diff --git a/arch/x86/include/asm/uv/uv_hub.h b/arch/x86/include/asm/uv/uv_hub.h
index 35987d9d2759..e04cb41bc09a 100644
--- a/arch/x86/include/asm/uv/uv_hub.h
+++ b/arch/x86/include/asm/uv/uv_hub.h
@@ -16,6 +16,7 @@
16#include <linux/percpu.h> 16#include <linux/percpu.h>
17#include <linux/timer.h> 17#include <linux/timer.h>
18#include <linux/io.h> 18#include <linux/io.h>
19#include <linux/topology.h>
19#include <asm/types.h> 20#include <asm/types.h>
20#include <asm/percpu.h> 21#include <asm/percpu.h>
21#include <asm/uv/uv_mmrs.h> 22#include <asm/uv/uv_mmrs.h>
@@ -161,6 +162,9 @@ struct uv_hub_info_s {
161 unsigned short numa_blade_id; 162 unsigned short numa_blade_id;
162 unsigned char m_val; 163 unsigned char m_val;
163 unsigned char n_val; 164 unsigned char n_val;
165 unsigned short nr_possible_cpus;
166 unsigned short nr_online_cpus;
167 short memory_nid;
164}; 168};
165 169
166/* CPU specific info with a pointer to the hub common info struct */ 170/* CPU specific info with a pointer to the hub common info struct */
@@ -446,7 +450,7 @@ static inline unsigned long uv_gpa_to_soc_phys_ram(unsigned long gpa)
446} 450}
447 451
448 452
449/* gpa -> pnode */ 453/* gpa -> gnode */
450static inline unsigned long uv_gpa_to_gnode(unsigned long gpa) 454static inline unsigned long uv_gpa_to_gnode(unsigned long gpa)
451{ 455{
452 return gpa >> uv_hub_info->n_lshift; 456 return gpa >> uv_hub_info->n_lshift;
@@ -455,12 +459,10 @@ static inline unsigned long uv_gpa_to_gnode(unsigned long gpa)
455/* gpa -> pnode */ 459/* gpa -> pnode */
456static inline int uv_gpa_to_pnode(unsigned long gpa) 460static inline int uv_gpa_to_pnode(unsigned long gpa)
457{ 461{
458 unsigned long n_mask = (1UL << uv_hub_info->n_val) - 1; 462 return uv_gpa_to_gnode(gpa) & uv_hub_info->pnode_mask;
459
460 return uv_gpa_to_gnode(gpa) & n_mask;
461} 463}
462 464
463/* gpa -> node offset*/ 465/* gpa -> node offset */
464static inline unsigned long uv_gpa_to_offset(unsigned long gpa) 466static inline unsigned long uv_gpa_to_offset(unsigned long gpa)
465{ 467{
466 return (gpa << uv_hub_info->m_shift) >> uv_hub_info->m_shift; 468 return (gpa << uv_hub_info->m_shift) >> uv_hub_info->m_shift;
@@ -472,18 +474,13 @@ static inline void *uv_pnode_offset_to_vaddr(int pnode, unsigned long offset)
472 return __va(((unsigned long)pnode << uv_hub_info->m_val) | offset); 474 return __va(((unsigned long)pnode << uv_hub_info->m_val) | offset);
473} 475}
474 476
475 477/* Extract a PNODE from an APICID (full apicid, not processor subset) */
476/*
477 * Extract a PNODE from an APICID (full apicid, not processor subset)
478 */
479static inline int uv_apicid_to_pnode(int apicid) 478static inline int uv_apicid_to_pnode(int apicid)
480{ 479{
481 return (apicid >> uv_hub_info->apic_pnode_shift); 480 return (apicid >> uv_hub_info->apic_pnode_shift);
482} 481}
483 482
484/* 483/* Convert an apicid to the socket number on the blade */
485 * Convert an apicid to the socket number on the blade
486 */
487static inline int uv_apicid_to_socket(int apicid) 484static inline int uv_apicid_to_socket(int apicid)
488{ 485{
489 if (is_uv1_hub()) 486 if (is_uv1_hub())
@@ -581,21 +578,6 @@ static inline void uv_write_local_mmr8(unsigned long offset, unsigned char val)
581 writeb(val, uv_local_mmr_address(offset)); 578 writeb(val, uv_local_mmr_address(offset));
582} 579}
583 580
584/*
585 * Structures and definitions for converting between cpu, node, pnode, and blade
586 * numbers.
587 */
588struct uv_blade_info {
589 unsigned short nr_possible_cpus;
590 unsigned short nr_online_cpus;
591 unsigned short pnode;
592 short memory_nid;
593};
594extern struct uv_blade_info *uv_blade_info;
595extern short *uv_node_to_blade;
596extern short *uv_cpu_to_blade;
597extern short uv_possible_blades;
598
599/* Blade-local cpu number of current cpu. Numbered 0 .. <# cpus on the blade> */ 581/* Blade-local cpu number of current cpu. Numbered 0 .. <# cpus on the blade> */
600static inline int uv_blade_processor_id(void) 582static inline int uv_blade_processor_id(void)
601{ 583{
@@ -609,61 +591,72 @@ static inline int uv_cpu_blade_processor_id(int cpu)
609} 591}
610#define _uv_cpu_blade_processor_id 1 /* indicate function available */ 592#define _uv_cpu_blade_processor_id 1 /* indicate function available */
611 593
594/* Blade number to Node number (UV1..UV4 is 1:1) */
595static inline int uv_blade_to_node(int blade)
596{
597 return blade;
598}
599
612/* Blade number of current cpu. Numnbered 0 .. <#blades -1> */ 600/* Blade number of current cpu. Numnbered 0 .. <#blades -1> */
613static inline int uv_numa_blade_id(void) 601static inline int uv_numa_blade_id(void)
614{ 602{
615 return uv_hub_info->numa_blade_id; 603 return uv_hub_info->numa_blade_id;
616} 604}
617 605
618/* Convert a cpu number to the the UV blade number */ 606/*
619static inline int uv_cpu_to_blade_id(int cpu) 607 * Convert linux node number to the UV blade number.
608 * .. Currently for UV1 thru UV4 the node and the blade are identical.
609 * .. If this changes then you MUST check references to this function!
610 */
611static inline int uv_node_to_blade_id(int nid)
620{ 612{
621 return uv_cpu_to_blade[cpu]; 613 return nid;
622} 614}
623 615
624/* Convert linux node number to the UV blade number */ 616/* Convert a cpu number to the the UV blade number */
625static inline int uv_node_to_blade_id(int nid) 617static inline int uv_cpu_to_blade_id(int cpu)
626{ 618{
627 return uv_node_to_blade[nid]; 619 return uv_node_to_blade_id(cpu_to_node(cpu));
628} 620}
629 621
630/* Convert a blade id to the PNODE of the blade */ 622/* Convert a blade id to the PNODE of the blade */
631static inline int uv_blade_to_pnode(int bid) 623static inline int uv_blade_to_pnode(int bid)
632{ 624{
633 return uv_blade_info[bid].pnode; 625 return uv_hub_info_list(uv_blade_to_node(bid))->pnode;
634} 626}
635 627
636/* Nid of memory node on blade. -1 if no blade-local memory */ 628/* Nid of memory node on blade. -1 if no blade-local memory */
637static inline int uv_blade_to_memory_nid(int bid) 629static inline int uv_blade_to_memory_nid(int bid)
638{ 630{
639 return uv_blade_info[bid].memory_nid; 631 return uv_hub_info_list(uv_blade_to_node(bid))->memory_nid;
640} 632}
641 633
642/* Determine the number of possible cpus on a blade */ 634/* Determine the number of possible cpus on a blade */
643static inline int uv_blade_nr_possible_cpus(int bid) 635static inline int uv_blade_nr_possible_cpus(int bid)
644{ 636{
645 return uv_blade_info[bid].nr_possible_cpus; 637 return uv_hub_info_list(uv_blade_to_node(bid))->nr_possible_cpus;
646} 638}
647 639
648/* Determine the number of online cpus on a blade */ 640/* Determine the number of online cpus on a blade */
649static inline int uv_blade_nr_online_cpus(int bid) 641static inline int uv_blade_nr_online_cpus(int bid)
650{ 642{
651 return uv_blade_info[bid].nr_online_cpus; 643 return uv_hub_info_list(uv_blade_to_node(bid))->nr_online_cpus;
652} 644}
653 645
654/* Convert a cpu id to the PNODE of the blade containing the cpu */ 646/* Convert a cpu id to the PNODE of the blade containing the cpu */
655static inline int uv_cpu_to_pnode(int cpu) 647static inline int uv_cpu_to_pnode(int cpu)
656{ 648{
657 return uv_blade_info[uv_cpu_to_blade_id(cpu)].pnode; 649 return uv_cpu_hub_info(cpu)->pnode;
658} 650}
659 651
660/* Convert a linux node number to the PNODE of the blade */ 652/* Convert a linux node number to the PNODE of the blade */
661static inline int uv_node_to_pnode(int nid) 653static inline int uv_node_to_pnode(int nid)
662{ 654{
663 return uv_blade_info[uv_node_to_blade_id(nid)].pnode; 655 return uv_hub_info_list(nid)->pnode;
664} 656}
665 657
666/* Maximum possible number of blades */ 658/* Maximum possible number of blades */
659extern short uv_possible_blades;
667static inline int uv_num_possible_blades(void) 660static inline int uv_num_possible_blades(void)
668{ 661{
669 return uv_possible_blades; 662 return uv_possible_blades;