mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Robin Holt <holt@sgi.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Robin Holt <holt@sgi.com>, Jack Steiner <steiner@sgi.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	linux-mm@vger.kernel.org
Subject: [patch 5/8] x86: UV - Update XPC to handle updated BIOS interface.
Date: Mon, 23 Nov 2009 19:39:42 -0600	[thread overview]
Message-ID: <20091124013954.025597000@alcatraz.americas.sgi.com> (raw)
In-Reply-To: <20091124013937.354595000@alcatraz.americas.sgi.com>

[-- Attachment #1: xpc_uv_bios_changes --]
[-- Type: text/plain, Size: 7544 bytes --]


The UV BIOS has moved the location of some of their pointers to the
"partition reserved page" from memory into a uv hub MMR.  The GRU does
not support bcopy operations from MMR space so we need to special case
the MMR addresses using VLOAD operations.

Additionally, the BIOS call for registering a message queue watchlist
has removed the 'blade' value and eliminated the structure that was
being passed in.  This is also reflected in this patch.

To: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Robin Holt <holt@sgi.com>
Cc: Jack Steiner <steiner@sgi.com>
Cc: lkml <linux-kernel@vger.kernel.org>
Cc: linux-mm@vger.kernel.org

---

 arch/x86/include/asm/uv/bios.h      |   11 +----------
 arch/x86/kernel/bios_uv.c           |    8 ++------
 drivers/misc/sgi-xp/xp_uv.c         |   23 +++++++++++++++++++++++
 drivers/misc/sgi-xp/xpc_partition.c |   13 +++++++++----
 drivers/misc/sgi-xp/xpc_uv.c        |   27 +++++++++++++++------------
 5 files changed, 50 insertions(+), 32 deletions(-)


Index: pv1000000/arch/x86/include/asm/uv/bios.h
===================================================================
--- pv1000000.orig/arch/x86/include/asm/uv/bios.h	2009-11-23 18:40:44.000000000 -0600
+++ pv1000000/arch/x86/include/asm/uv/bios.h	2009-11-23 18:41:22.000000000 -0600
@@ -76,15 +76,6 @@ union partition_info_u {
 	};
 };
 
-union uv_watchlist_u {
-	u64	val;
-	struct {
-		u64	blade	: 16,
-			size	: 32,
-			filler	: 16;
-	};
-};
-
 enum uv_memprotect {
 	UV_MEMPROT_RESTRICT_ACCESS,
 	UV_MEMPROT_ALLOW_AMO,
@@ -100,7 +91,7 @@ extern s64 uv_bios_call_reentrant(enum u
 
 extern s64 uv_bios_get_sn_info(int, int *, long *, long *, long *);
 extern s64 uv_bios_freq_base(u64, u64 *);
-extern int uv_bios_mq_watchlist_alloc(int, unsigned long, unsigned int,
+extern int uv_bios_mq_watchlist_alloc(unsigned long, unsigned int,
 					unsigned long *);
 extern int uv_bios_mq_watchlist_free(int, int);
 extern s64 uv_bios_change_memprotect(u64, u64, enum uv_memprotect);
Index: pv1000000/arch/x86/kernel/bios_uv.c
===================================================================
--- pv1000000.orig/arch/x86/kernel/bios_uv.c	2009-11-23 18:40:44.000000000 -0600
+++ pv1000000/arch/x86/kernel/bios_uv.c	2009-11-23 18:41:22.000000000 -0600
@@ -101,21 +101,17 @@ s64 uv_bios_get_sn_info(int fc, int *uvt
 }
 
 int
-uv_bios_mq_watchlist_alloc(int blade, unsigned long addr, unsigned int mq_size,
+uv_bios_mq_watchlist_alloc(unsigned long addr, unsigned int mq_size,
 			   unsigned long *intr_mmr_offset)
 {
-	union uv_watchlist_u size_blade;
 	u64 watchlist;
 	s64 ret;
 
-	size_blade.size = mq_size;
-	size_blade.blade = blade;
-
 	/*
 	 * bios returns watchlist number or negative error number.
 	 */
 	ret = (int)uv_bios_call_irqsave(UV_BIOS_WATCHLIST_ALLOC, addr,
-			size_blade.val, (u64)intr_mmr_offset,
+			mq_size, (u64)intr_mmr_offset,
 			(u64)&watchlist, 0);
 	if (ret < BIOS_STATUS_SUCCESS)
 		return ret;
Index: pv1000000/drivers/misc/sgi-xp/xp_uv.c
===================================================================
--- pv1000000.orig/drivers/misc/sgi-xp/xp_uv.c	2009-11-23 18:41:17.000000000 -0600
+++ pv1000000/drivers/misc/sgi-xp/xp_uv.c	2009-11-23 18:41:22.000000000 -0600
@@ -42,11 +42,34 @@ xp_socket_pa_uv(unsigned long gpa)
 }
 
 static enum xp_retval
+xp_remote_mmr_read(unsigned long dst_gpa, const unsigned long src_gpa,
+		   size_t len)
+{
+	int ret;
+	unsigned long *dst_va = __va(uv_gpa_to_soc_phys_ram(dst_gpa));
+
+	BUG_ON(!uv_gpa_in_mmr_space(src_gpa));
+	BUG_ON(len != 8);
+
+	ret = gru_read_gpa(dst_va, src_gpa);
+	if (ret == 0)
+		return xpSuccess;
+
+	dev_err(xp, "gru_read_gpa() failed, dst_gpa=0x%016lx src_gpa=0x%016lx "
+		"len=%ld\n", dst_gpa, src_gpa, len);
+	return xpGruCopyError;
+}
+
+
+static enum xp_retval
 xp_remote_memcpy_uv(unsigned long dst_gpa, const unsigned long src_gpa,
 		    size_t len)
 {
 	int ret;
 
+	if (uv_gpa_in_mmr_space(src_gpa))
+		return xp_remote_mmr_read(dst_gpa, src_gpa, len);
+
 	ret = gru_copy_gpa(dst_gpa, src_gpa, len);
 	if (ret == 0)
 		return xpSuccess;
Index: pv1000000/drivers/misc/sgi-xp/xpc_partition.c
===================================================================
--- pv1000000.orig/drivers/misc/sgi-xp/xpc_partition.c	2009-11-23 18:40:44.000000000 -0600
+++ pv1000000/drivers/misc/sgi-xp/xpc_partition.c	2009-11-23 18:41:22.000000000 -0600
@@ -18,6 +18,7 @@
 #include <linux/device.h>
 #include <linux/hardirq.h>
 #include "xpc.h"
+#include <asm/uv/uv_hub.h>
 
 /* XPC is exiting flag */
 int xpc_exiting;
@@ -92,8 +93,12 @@ xpc_get_rsvd_page_pa(int nasid)
 			break;
 
 		/* !!! L1_CACHE_ALIGN() is only a sn2-bte_copy requirement */
-		if (L1_CACHE_ALIGN(len) > buf_len) {
-			kfree(buf_base);
+		if (is_shub())
+			len = L1_CACHE_ALIGN(len);
+
+		if (len > buf_len) {
+			if (buf_base != NULL)
+				kfree(buf_base);
 			buf_len = L1_CACHE_ALIGN(len);
 			buf = xpc_kmalloc_cacheline_aligned(buf_len, GFP_KERNEL,
 							    &buf_base);
@@ -105,7 +110,7 @@ xpc_get_rsvd_page_pa(int nasid)
 			}
 		}
 
-		ret = xp_remote_memcpy(xp_pa(buf), rp_pa, buf_len);
+		ret = xp_remote_memcpy(xp_pa(buf), rp_pa, len);
 		if (ret != xpSuccess) {
 			dev_dbg(xpc_part, "xp_remote_memcpy failed %d\n", ret);
 			break;
@@ -143,7 +148,7 @@ xpc_setup_rsvd_page(void)
 		dev_err(xpc_part, "SAL failed to locate the reserved page\n");
 		return -ESRCH;
 	}
-	rp = (struct xpc_rsvd_page *)__va(rp_pa);
+	rp = (struct xpc_rsvd_page *)__va(xp_socket_pa(rp_pa));
 
 	if (rp->SAL_version < 3) {
 		/* SAL_versions < 3 had a SAL_partid defined as a u8 */
Index: pv1000000/drivers/misc/sgi-xp/xpc_uv.c
===================================================================
--- pv1000000.orig/drivers/misc/sgi-xp/xpc_uv.c	2009-11-23 18:40:44.000000000 -0600
+++ pv1000000/drivers/misc/sgi-xp/xpc_uv.c	2009-11-23 18:41:22.000000000 -0600
@@ -156,22 +156,24 @@ xpc_gru_mq_watchlist_alloc_uv(struct xpc
 {
 	int ret;
 
-#if defined CONFIG_X86_64
-	ret = uv_bios_mq_watchlist_alloc(mq->mmr_blade, uv_gpa(mq->address),
-					 mq->order, &mq->mmr_offset);
-	if (ret < 0) {
-		dev_err(xpc_part, "uv_bios_mq_watchlist_alloc() failed, "
-			"ret=%d\n", ret);
-		return ret;
-	}
-#elif defined CONFIG_IA64_GENERIC || defined CONFIG_IA64_SGI_UV
-	ret = sn_mq_watchlist_alloc(mq->mmr_blade, (void *)uv_gpa(mq->address),
+#if defined CONFIG_IA64_GENERIC || defined CONFIG_IA64_SGI_UV
+	int mmr_pnode = uv_blade_to_pnode(mq->mmr_blade);
+
+	ret = sn_mq_watchlist_alloc(mmr_pnode, (void *)uv_gpa(mq->address),
 				    mq->order, &mq->mmr_offset);
 	if (ret < 0) {
 		dev_err(xpc_part, "sn_mq_watchlist_alloc() failed, ret=%d\n",
 			ret);
 		return -EBUSY;
 	}
+#elif defined CONFIG_X86_64
+	ret = uv_bios_mq_watchlist_alloc(uv_gpa(mq->address),
+					 mq->order, &mq->mmr_offset);
+	if (ret < 0) {
+		dev_err(xpc_part, "uv_bios_mq_watchlist_alloc() failed, "
+			"ret=%d\n", ret);
+		return ret;
+	}
 #else
 	#error not a supported configuration
 #endif
@@ -184,12 +186,13 @@ static void
 xpc_gru_mq_watchlist_free_uv(struct xpc_gru_mq_uv *mq)
 {
 	int ret;
+	int mmr_pnode = uv_blade_to_pnode(mq->mmr_blade);
 
 #if defined CONFIG_X86_64
-	ret = uv_bios_mq_watchlist_free(mq->mmr_blade, mq->watchlist_num);
+	ret = uv_bios_mq_watchlist_free(mmr_pnode, mq->watchlist_num);
 	BUG_ON(ret != BIOS_STATUS_SUCCESS);
 #elif defined CONFIG_IA64_GENERIC || defined CONFIG_IA64_SGI_UV
-	ret = sn_mq_watchlist_free(mq->mmr_blade, mq->watchlist_num);
+	ret = sn_mq_watchlist_free(mmr_pnode, mq->watchlist_num);
 	BUG_ON(ret != SALRET_OK);
 #else
 	#error not a supported configuration


  parent reply	other threads:[~2009-11-24  1:39 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-24  1:39 [patch 0/8] x86: UV - XPC fixes with related support functionality V2 Robin Holt
2009-11-24  1:39 ` [patch 1/8] x86: UV - Introduce a means to translate from gpa -> socket_paddr Robin Holt
2009-11-24  1:39 ` [patch 2/8] x86: UV - XPC needs to provide an abstraction for uv_gpa Robin Holt
2009-11-24  1:39 ` [patch 3/8] x86: UV - Introduce uv_gpa_is_mmr Robin Holt
2009-11-24  1:39 ` [patch 4/8] X86: UV - Implement a gru_read_gpa kernel function Robin Holt
2009-11-24  1:39 ` Robin Holt [this message]
2009-11-24  1:39 ` [patch 6/8] x86: UV - XPC NULL deref when mesq becomes empty Robin Holt
2009-11-24  1:39 ` [patch 7/8] X86: UV - xpc_make_first_contact hang due to not accepting ACTIVE state Robin Holt
2009-11-24  1:39 ` [patch 8/8] [patch 8/8] X86: UV - XPC receive message reuse triggers invalid BUG_ON() Robin Holt
2009-12-15 17:04 ` [patch 0/8] x86: UV - XPC fixes with related support functionality V2 Robin Holt
2009-12-15 17:06   ` Robin Holt
  -- strict thread matches above, loose matches on Subject: below --
2009-11-19 17:31 Robin Holt
2009-11-19 17:32 ` [patch 5/8] x86: UV - Update XPC to handle updated BIOS interface Robin Holt

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=20091124013954.025597000@alcatraz.americas.sgi.com \
    --to=holt@sgi.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@vger.kernel.org \
    --cc=steiner@sgi.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®