All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steve Wahl <steve.wahl@hpe.com>
To: Steve Wahl <steve.wahl@hpe.com>,
	Dimitri Sivanich <dimitri.sivanich@hpe.com>,
	Russ Anderson <russ.anderson@hpe.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH RESEND v5 2/8] x86/platform/uv: Introduce helper function uv_pnode_to_socket.
Date: Fri, 19 May 2023 14:07:46 -0500	[thread overview]
Message-ID: <20230519190752.3297140-3-steve.wahl@hpe.com> (raw)
In-Reply-To: <20230519190752.3297140-1-steve.wahl@hpe.com>

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>
---
 arch/x86/include/asm/uv/uv_hub.h | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/arch/x86/include/asm/uv/uv_hub.h b/arch/x86/include/asm/uv/uv_hub.h
index d3e3197917be..0acfd1734c8b 100644
--- a/arch/x86/include/asm/uv/uv_hub.h
+++ b/arch/x86/include/asm/uv/uv_hub.h
@@ -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 */
-- 
2.26.2


  parent reply	other threads:[~2023-05-19 19:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-19 19:07 [PATCH RESEND v5 0/8] Support sub-NUMA clustering on UV Steve Wahl
2023-05-19 19:07 ` [PATCH RESEND v5 1/8] x86/platform/uv: Add platform resolving #defines for misc GAM_MMIOH_REDIRECT* Steve Wahl
2023-05-19 19:07 ` Steve Wahl [this message]
2023-05-19 19:07 ` [PATCH RESEND v5 3/8] x86/platform/uv: Fix printed information in calc_mmioh_map Steve Wahl
2023-05-19 19:07 ` [PATCH RESEND v5 4/8] x86/platform/uv: When searching for minimums, start at INT_MAX not 99999 Steve Wahl
2023-05-19 19:07 ` [PATCH RESEND v5 5/8] x86/platform/uv: helper functions for allocating and freeing conversion tables Steve Wahl
2023-05-19 19:07 ` [PATCH RESEND v5 6/8] x86/platform/uv: UV support for sub-NUMA clustering Steve Wahl
2023-05-19 19:07 ` [PATCH RESEND v5 7/8] x86/platform/uv: Remove remaining BUG_ON() and BUG() calls Steve Wahl
2023-05-19 19:07 ` [PATCH RESEND v5 8/8] x86/platform/uv: Update UV[23] platform code for SNC Steve Wahl
2023-05-31 16:25 ` [PATCH RESEND v5 0/8] Support sub-NUMA clustering on UV Steve Wahl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230519190752.3297140-3-steve.wahl@hpe.com \
    --to=steve.wahl@hpe.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=dimitri.sivanich@hpe.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=russ.anderson@hpe.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.