Commit 36db3144 authored by Linus Torvalds's avatar Linus Torvalds

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*
parents a3d763f0 73b3108d
...@@ -177,6 +177,7 @@ struct uv_hub_info_s { ...@@ -177,6 +177,7 @@ struct uv_hub_info_s {
unsigned short nr_possible_cpus; unsigned short nr_possible_cpus;
unsigned short nr_online_cpus; unsigned short nr_online_cpus;
short memory_nid; short memory_nid;
unsigned short *node_to_socket;
}; };
/* CPU specific info with a pointer to the hub common info struct */ /* 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) ...@@ -519,25 +520,30 @@ static inline int uv_socket_to_node(int socket)
return _uv_socket_to_node(socket, uv_hub_info->socket_to_node); return _uv_socket_to_node(socket, uv_hub_info->socket_to_node);
} }
static inline int uv_pnode_to_socket(int pnode)
{
unsigned short *p2s = uv_hub_info->pnode_to_socket;
return p2s ? p2s[pnode - uv_hub_info->min_pnode] : pnode;
}
/* pnode, offset --> socket virtual */ /* pnode, offset --> socket virtual */
static inline void *uv_pnode_offset_to_vaddr(int pnode, unsigned long offset) static inline void *uv_pnode_offset_to_vaddr(int pnode, unsigned long offset)
{ {
unsigned int m_val = uv_hub_info->m_val; unsigned int m_val = uv_hub_info->m_val;
unsigned long base; unsigned long base;
unsigned short sockid, node, *p2s; unsigned short sockid;
if (m_val) if (m_val)
return __va(((unsigned long)pnode << m_val) | offset); return __va(((unsigned long)pnode << m_val) | offset);
p2s = uv_hub_info->pnode_to_socket; sockid = uv_pnode_to_socket(pnode);
sockid = p2s ? p2s[pnode - uv_hub_info->min_pnode] : pnode;
node = uv_socket_to_node(sockid);
/* limit address of previous socket is our base, except node 0 is 0 */ /* limit address of previous socket is our base, except node 0 is 0 */
if (!node) if (sockid == 0)
return __va((unsigned long)offset); return __va((unsigned long)offset);
base = (unsigned long)(uv_hub_info->gr_table[node - 1].limit); base = (unsigned long)(uv_hub_info->gr_table[sockid - 1].limit);
return __va(base << UV_GAM_RANGE_SHFT | offset); return __va(base << UV_GAM_RANGE_SHFT | offset);
} }
...@@ -644,7 +650,7 @@ static inline int uv_cpu_blade_processor_id(int cpu) ...@@ -644,7 +650,7 @@ static inline int uv_cpu_blade_processor_id(int cpu)
/* Blade number to Node number (UV2..UV4 is 1:1) */ /* Blade number to Node number (UV2..UV4 is 1:1) */
static inline int uv_blade_to_node(int blade) static inline int uv_blade_to_node(int blade)
{ {
return blade; return uv_socket_to_node(blade);
} }
/* Blade number of current cpu. Numnbered 0 .. <#blades -1> */ /* Blade number of current cpu. Numnbered 0 .. <#blades -1> */
...@@ -656,23 +662,27 @@ static inline int uv_numa_blade_id(void) ...@@ -656,23 +662,27 @@ static inline int uv_numa_blade_id(void)
/* /*
* Convert linux node number to the UV blade number. * Convert linux node number to the UV blade number.
* .. Currently for UV2 thru UV4 the node and the blade are identical. * .. Currently for UV2 thru UV4 the node and the blade are identical.
* .. If this changes then you MUST check references to this function! * .. UV5 needs conversion when sub-numa clustering is enabled.
*/ */
static inline int uv_node_to_blade_id(int nid) static inline int uv_node_to_blade_id(int nid)
{ {
return nid; unsigned short *n2s = uv_hub_info->node_to_socket;
return n2s ? n2s[nid] : nid;
} }
/* Convert a CPU number to the UV blade number */ /* Convert a CPU number to the UV blade number */
static inline int uv_cpu_to_blade_id(int cpu) static inline int uv_cpu_to_blade_id(int cpu)
{ {
return uv_node_to_blade_id(cpu_to_node(cpu)); return uv_cpu_hub_info(cpu)->numa_blade_id;
} }
/* Convert a blade id to the PNODE of the blade */ /* Convert a blade id to the PNODE of the blade */
static inline int uv_blade_to_pnode(int bid) static inline int uv_blade_to_pnode(int bid)
{ {
return uv_hub_info_list(uv_blade_to_node(bid))->pnode; unsigned short *s2p = uv_hub_info->socket_to_pnode;
return s2p ? s2p[bid] : bid;
} }
/* Nid of memory node on blade. -1 if no blade-local memory */ /* Nid of memory node on blade. -1 if no blade-local memory */
......
...@@ -4199,6 +4199,13 @@ union uvh_rh_gam_mmioh_overlay_config1_u { ...@@ -4199,6 +4199,13 @@ union uvh_rh_gam_mmioh_overlay_config1_u {
#define UV3H_RH_GAM_MMIOH_REDIRECT_CONFIG0_NASID_SHFT 0 #define UV3H_RH_GAM_MMIOH_REDIRECT_CONFIG0_NASID_SHFT 0
#define UV3H_RH_GAM_MMIOH_REDIRECT_CONFIG0_NASID_MASK 0x0000000000007fffUL #define UV3H_RH_GAM_MMIOH_REDIRECT_CONFIG0_NASID_MASK 0x0000000000007fffUL
/* UVH common defines */
#define UVH_RH_GAM_MMIOH_REDIRECT_CONFIG0_NASID_MASK ( \
is_uv(UV4A) ? UV4AH_RH_GAM_MMIOH_REDIRECT_CONFIG0_NASID_MASK : \
is_uv(UV4) ? UV4H_RH_GAM_MMIOH_REDIRECT_CONFIG0_NASID_MASK : \
is_uv(UV3) ? UV3H_RH_GAM_MMIOH_REDIRECT_CONFIG0_NASID_MASK : \
0)
union uvh_rh_gam_mmioh_redirect_config0_u { union uvh_rh_gam_mmioh_redirect_config0_u {
unsigned long v; unsigned long v;
...@@ -4247,8 +4254,8 @@ union uvh_rh_gam_mmioh_redirect_config0_u { ...@@ -4247,8 +4254,8 @@ union uvh_rh_gam_mmioh_redirect_config0_u {
0) 0)
/* UV4A unique defines */ /* UV4A unique defines */
#define UV4AH_RH_GAM_MMIOH_REDIRECT_CONFIG0_NASID_SHFT 0 #define UV4AH_RH_GAM_MMIOH_REDIRECT_CONFIG1_NASID_SHFT 0
#define UV4AH_RH_GAM_MMIOH_REDIRECT_CONFIG0_NASID_MASK 0x0000000000000fffUL #define UV4AH_RH_GAM_MMIOH_REDIRECT_CONFIG1_NASID_MASK 0x0000000000000fffUL
/* UV4 unique defines */ /* UV4 unique defines */
#define UV4H_RH_GAM_MMIOH_REDIRECT_CONFIG1_NASID_SHFT 0 #define UV4H_RH_GAM_MMIOH_REDIRECT_CONFIG1_NASID_SHFT 0
...@@ -4258,6 +4265,13 @@ union uvh_rh_gam_mmioh_redirect_config0_u { ...@@ -4258,6 +4265,13 @@ union uvh_rh_gam_mmioh_redirect_config0_u {
#define UV3H_RH_GAM_MMIOH_REDIRECT_CONFIG1_NASID_SHFT 0 #define UV3H_RH_GAM_MMIOH_REDIRECT_CONFIG1_NASID_SHFT 0
#define UV3H_RH_GAM_MMIOH_REDIRECT_CONFIG1_NASID_MASK 0x0000000000007fffUL #define UV3H_RH_GAM_MMIOH_REDIRECT_CONFIG1_NASID_MASK 0x0000000000007fffUL
/* UVH common defines */
#define UVH_RH_GAM_MMIOH_REDIRECT_CONFIG1_NASID_MASK ( \
is_uv(UV4A) ? UV4AH_RH_GAM_MMIOH_REDIRECT_CONFIG1_NASID_MASK : \
is_uv(UV4) ? UV4H_RH_GAM_MMIOH_REDIRECT_CONFIG1_NASID_MASK : \
is_uv(UV3) ? UV3H_RH_GAM_MMIOH_REDIRECT_CONFIG1_NASID_MASK : \
0)
union uvh_rh_gam_mmioh_redirect_config1_u { union uvh_rh_gam_mmioh_redirect_config1_u {
unsigned long v; unsigned long v;
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment