Skip to content

Commit 36db314

Browse files
committed
Merge tag 'x86_platform_for_6.5' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 platform updates from Dave Hansen: "Allow CPUs in SGX/HPE Ultraviolet to start using Sub-NUMA clustering (SNC) mode. SNC has been around outside the UV world for a while but evidently never worked on UV systems. SNC is rather notorious for breaking bad assumptions of a 1:1 relationship between physical sockets and NUMA nodes. The UV code was rather prolific with these assumptions and took quite a bit of refactoring to remove them" * tag 'x86_platform_for_6.5' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/platform/uv: Update UV[23] platform code for SNC x86/platform/uv: Remove remaining BUG_ON() and BUG() calls x86/platform/uv: UV support for sub-NUMA clustering x86/platform/uv: Helper functions for allocating and freeing conversion tables x86/platform/uv: When searching for minimums, start at INT_MAX not 99999 x86/platform/uv: Fix printed information in calc_mmioh_map x86/platform/uv: Introduce helper function uv_pnode_to_socket. x86/platform/uv: Add platform resolving #defines for misc GAM_MMIOH_REDIRECT*
2 parents a3d763f + 73b3108 commit 36db314

File tree

3 files changed

+232
-136
lines changed

3 files changed

+232
-136
lines changed

arch/x86/include/asm/uv/uv_hub.h

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ struct uv_hub_info_s {
177177
unsigned short nr_possible_cpus;
178178
unsigned short nr_online_cpus;
179179
short memory_nid;
180+
unsigned short *node_to_socket;
180181
};
181182

182183
/* CPU specific info with a pointer to the hub common info struct */
@@ -519,25 +520,30 @@ static inline int uv_socket_to_node(int socket)
519520
return _uv_socket_to_node(socket, uv_hub_info->socket_to_node);
520521
}
521522

523+
static inline int uv_pnode_to_socket(int pnode)
524+
{
525+
unsigned short *p2s = uv_hub_info->pnode_to_socket;
526+
527+
return p2s ? p2s[pnode - uv_hub_info->min_pnode] : pnode;
528+
}
529+
522530
/* pnode, offset --> socket virtual */
523531
static inline void *uv_pnode_offset_to_vaddr(int pnode, unsigned long offset)
524532
{
525533
unsigned int m_val = uv_hub_info->m_val;
526534
unsigned long base;
527-
unsigned short sockid, node, *p2s;
535+
unsigned short sockid;
528536

529537
if (m_val)
530538
return __va(((unsigned long)pnode << m_val) | offset);
531539

532-
p2s = uv_hub_info->pnode_to_socket;
533-
sockid = p2s ? p2s[pnode - uv_hub_info->min_pnode] : pnode;
534-
node = uv_socket_to_node(sockid);
540+
sockid = uv_pnode_to_socket(pnode);
535541

536542
/* limit address of previous socket is our base, except node 0 is 0 */
537-
if (!node)
543+
if (sockid == 0)
538544
return __va((unsigned long)offset);
539545

540-
base = (unsigned long)(uv_hub_info->gr_table[node - 1].limit);
546+
base = (unsigned long)(uv_hub_info->gr_table[sockid - 1].limit);
541547
return __va(base << UV_GAM_RANGE_SHFT | offset);
542548
}
543549

@@ -644,7 +650,7 @@ static inline int uv_cpu_blade_processor_id(int cpu)
644650
/* Blade number to Node number (UV2..UV4 is 1:1) */
645651
static inline int uv_blade_to_node(int blade)
646652
{
647-
return blade;
653+
return uv_socket_to_node(blade);
648654
}
649655

650656
/* Blade number of current cpu. Numnbered 0 .. <#blades -1> */
@@ -656,23 +662,27 @@ static inline int uv_numa_blade_id(void)
656662
/*
657663
* Convert linux node number to the UV blade number.
658664
* .. Currently for UV2 thru UV4 the node and the blade are identical.
659-
* .. If this changes then you MUST check references to this function!
665+
* .. UV5 needs conversion when sub-numa clustering is enabled.
660666
*/
661667
static inline int uv_node_to_blade_id(int nid)
662668
{
663-
return nid;
669+
unsigned short *n2s = uv_hub_info->node_to_socket;
670+
671+
return n2s ? n2s[nid] : nid;
664672
}
665673

666674
/* Convert a CPU number to the UV blade number */
667675
static inline int uv_cpu_to_blade_id(int cpu)
668676
{
669-
return uv_node_to_blade_id(cpu_to_node(cpu));
677+
return uv_cpu_hub_info(cpu)->numa_blade_id;
670678
}
671679

672680
/* Convert a blade id to the PNODE of the blade */
673681
static inline int uv_blade_to_pnode(int bid)
674682
{
675-
return uv_hub_info_list(uv_blade_to_node(bid))->pnode;
683+
unsigned short *s2p = uv_hub_info->socket_to_pnode;
684+
685+
return s2p ? s2p[bid] : bid;
676686
}
677687

678688
/* Nid of memory node on blade. -1 if no blade-local memory */

arch/x86/include/asm/uv/uv_mmrs.h

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4199,6 +4199,13 @@ union uvh_rh_gam_mmioh_overlay_config1_u {
41994199
#define UV3H_RH_GAM_MMIOH_REDIRECT_CONFIG0_NASID_SHFT 0
42004200
#define UV3H_RH_GAM_MMIOH_REDIRECT_CONFIG0_NASID_MASK 0x0000000000007fffUL
42014201

4202+
/* UVH common defines */
4203+
#define UVH_RH_GAM_MMIOH_REDIRECT_CONFIG0_NASID_MASK ( \
4204+
is_uv(UV4A) ? UV4AH_RH_GAM_MMIOH_REDIRECT_CONFIG0_NASID_MASK : \
4205+
is_uv(UV4) ? UV4H_RH_GAM_MMIOH_REDIRECT_CONFIG0_NASID_MASK : \
4206+
is_uv(UV3) ? UV3H_RH_GAM_MMIOH_REDIRECT_CONFIG0_NASID_MASK : \
4207+
0)
4208+
42024209

42034210
union uvh_rh_gam_mmioh_redirect_config0_u {
42044211
unsigned long v;
@@ -4247,8 +4254,8 @@ union uvh_rh_gam_mmioh_redirect_config0_u {
42474254
0)
42484255

42494256
/* UV4A unique defines */
4250-
#define UV4AH_RH_GAM_MMIOH_REDIRECT_CONFIG0_NASID_SHFT 0
4251-
#define UV4AH_RH_GAM_MMIOH_REDIRECT_CONFIG0_NASID_MASK 0x0000000000000fffUL
4257+
#define UV4AH_RH_GAM_MMIOH_REDIRECT_CONFIG1_NASID_SHFT 0
4258+
#define UV4AH_RH_GAM_MMIOH_REDIRECT_CONFIG1_NASID_MASK 0x0000000000000fffUL
42524259

42534260
/* UV4 unique defines */
42544261
#define UV4H_RH_GAM_MMIOH_REDIRECT_CONFIG1_NASID_SHFT 0
@@ -4258,6 +4265,13 @@ union uvh_rh_gam_mmioh_redirect_config0_u {
42584265
#define UV3H_RH_GAM_MMIOH_REDIRECT_CONFIG1_NASID_SHFT 0
42594266
#define UV3H_RH_GAM_MMIOH_REDIRECT_CONFIG1_NASID_MASK 0x0000000000007fffUL
42604267

4268+
/* UVH common defines */
4269+
#define UVH_RH_GAM_MMIOH_REDIRECT_CONFIG1_NASID_MASK ( \
4270+
is_uv(UV4A) ? UV4AH_RH_GAM_MMIOH_REDIRECT_CONFIG1_NASID_MASK : \
4271+
is_uv(UV4) ? UV4H_RH_GAM_MMIOH_REDIRECT_CONFIG1_NASID_MASK : \
4272+
is_uv(UV3) ? UV3H_RH_GAM_MMIOH_REDIRECT_CONFIG1_NASID_MASK : \
4273+
0)
4274+
42614275

42624276
union uvh_rh_gam_mmioh_redirect_config1_u {
42634277
unsigned long v;

0 commit comments

Comments
 (0)