x86/platform/uv: Introduce helper function uv_pnode_to_socket.
authorSteve Wahl <steve.wahl@hpe.com>
Fri, 19 May 2023 19:07:46 +0000 (14:07 -0500)
committerDave Hansen <dave.hansen@linux.intel.com>
Wed, 31 May 2023 16:34:59 +0000 (09:34 -0700)
Add and use uv_pnode_to_socket() function, which parallels other
helper functions in here, and will enable avoiding duplicate code
in an upcoming patch.

Signed-off-by: Steve Wahl <steve.wahl@hpe.com>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Link: https://lore.kernel.org/all/20230519190752.3297140-3-steve.wahl%40hpe.com
arch/x86/include/asm/uv/uv_hub.h

index d3e3197917be89f9bb7d9d488bf5a9772ccb9090..0acfd1734c8bdb4449294378e27b503ed443d2fd 100644 (file)
@@ -519,18 +519,24 @@ static inline int uv_socket_to_node(int socket)
        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 */
 static inline void *uv_pnode_offset_to_vaddr(int pnode, unsigned long offset)
 {
        unsigned int m_val = uv_hub_info->m_val;
        unsigned long base;
-       unsigned short sockid, node, *p2s;
+       unsigned short sockid, node;
 
        if (m_val)
                return __va(((unsigned long)pnode << m_val) | offset);
 
-       p2s = uv_hub_info->pnode_to_socket;
-       sockid = p2s ? p2s[pnode - uv_hub_info->min_pnode] : pnode;
+       sockid = uv_pnode_to_socket(pnode);
        node = uv_socket_to_node(sockid);
 
        /* limit address of previous socket is our base, except node 0 is 0 */