From 6e27b91cf46834391c59062d3f26d277cc299f4b Mon Sep 17 00:00:00 2001 From: Mike Travis Date: Fri, 29 Apr 2016 16:54:20 -0500 Subject: x86/platform/UV: Build GAM reference tables An aspect of the UV4 system architecture changes involve changing the way sockets, nodes, and pnodes are translated between one another. Decode the information from the BIOS provided EFI system table to build the needed conversion tables. Tested-by: Dimitri Sivanich Tested-by: John Estabrook Tested-by: Gary Kroening Tested-by: Nathan Zimmer Signed-off-by: Mike Travis Reviewed-by: Dimitri Sivanich Cc: Andrew Banman Cc: Andrew Morton Cc: Andy Lutomirski Cc: Borislav Petkov Cc: Brian Gerst Cc: Denys Vlasenko Cc: H. Peter Anvin Cc: Len Brown Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Russ Anderson Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/20160429215405.673495324@asylum.americas.sgi.com Signed-off-by: Ingo Molnar --- arch/x86/include/asm/uv/uv_hub.h | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'arch/x86/include/asm/uv/uv_hub.h') diff --git a/arch/x86/include/asm/uv/uv_hub.h b/arch/x86/include/asm/uv/uv_hub.h index 1978e4b8dcff..6900161e1684 100644 --- a/arch/x86/include/asm/uv/uv_hub.h +++ b/arch/x86/include/asm/uv/uv_hub.h @@ -149,6 +149,9 @@ struct uv_hub_info_s { unsigned long global_mmr_base; unsigned long global_mmr_shift; unsigned long gpa_mask; + unsigned short *socket_to_node; + unsigned short *socket_to_pnode; + unsigned short *pnode_to_socket; unsigned short min_socket; unsigned short min_pnode; unsigned char hub_revision; @@ -481,10 +484,21 @@ static inline void *uv_pnode_offset_to_vaddr(int pnode, unsigned long offset) return __va(((unsigned long)pnode << uv_hub_info->m_val) | offset); } -/* Extract a PNODE from an APICID (full apicid, not processor subset) */ +/* Convert socket to node */ +static inline int uv_socket_to_node(int socket) +{ + unsigned short *s2nid = uv_hub_info->socket_to_node; + + return s2nid ? s2nid[socket - uv_hub_info->min_socket] : socket; +} + +/* Extract/Convert a PNODE from an APICID (full apicid, not processor subset) */ static inline int uv_apicid_to_pnode(int apicid) { - return (apicid >> uv_hub_info->apic_pnode_shift); + int pnode = apicid >> uv_hub_info->apic_pnode_shift; + unsigned short *s2pn = uv_hub_info->socket_to_pnode; + + return s2pn ? s2pn[pnode - uv_hub_info->min_socket] : pnode; } /* Convert an apicid to the socket number on the blade */ -- cgit v1.2.3