Skip to content

Commit 8c646ce

Browse files
swahlhpehansendc
authored andcommitted
x86/platform/uv: Introduce helper function uv_pnode_to_socket.
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 <[email protected]> Signed-off-by: Dave Hansen <[email protected]> Link: https://lore.kernel.org/all/20230519190752.3297140-3-steve.wahl%40hpe.com
1 parent fd27bea commit 8c646ce

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -519,18 +519,24 @@ static inline int uv_socket_to_node(int socket)
519519
return _uv_socket_to_node(socket, uv_hub_info->socket_to_node);
520520
}
521521

522+
static inline int uv_pnode_to_socket(int pnode)
523+
{
524+
unsigned short *p2s = uv_hub_info->pnode_to_socket;
525+
526+
return p2s ? p2s[pnode - uv_hub_info->min_pnode] : pnode;
527+
}
528+
522529
/* pnode, offset --> socket virtual */
523530
static inline void *uv_pnode_offset_to_vaddr(int pnode, unsigned long offset)
524531
{
525532
unsigned int m_val = uv_hub_info->m_val;
526533
unsigned long base;
527-
unsigned short sockid, node, *p2s;
534+
unsigned short sockid, node;
528535

529536
if (m_val)
530537
return __va(((unsigned long)pnode << m_val) | offset);
531538

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

536542
/* limit address of previous socket is our base, except node 0 is 0 */

0 commit comments

Comments
 (0)