summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorKanoj Sarcar <kanoj@engr.sgi.com>2000-06-13 01:13:50 +0000
committerKanoj Sarcar <kanoj@engr.sgi.com>2000-06-13 01:13:50 +0000
commit42b952be1de697c355819bf2679291eeb49a0755 (patch)
treede175df48330b1e18b091fcb0c96cd5265d02847 /arch
parent4925c5662482c19b880fe231e216090a074dd190 (diff)
When doing kernel text replication, make sure we do not scribble on
top of the replicated kernel text thinking it is unused memory. This lets us get to multiuser on a replicated kernel text system.
Diffstat (limited to 'arch')
-rw-r--r--arch/mips64/sgi-ip27/ip27-klnuma.c27
-rw-r--r--arch/mips64/sgi-ip27/ip27-memory.c21
2 files changed, 27 insertions, 21 deletions
diff --git a/arch/mips64/sgi-ip27/ip27-klnuma.c b/arch/mips64/sgi-ip27/ip27-klnuma.c
index 8e2a6e566..1b36208eb 100644
--- a/arch/mips64/sgi-ip27/ip27-klnuma.c
+++ b/arch/mips64/sgi-ip27/ip27-klnuma.c
@@ -7,6 +7,7 @@
#include <linux/mmzone.h>
#include <linux/kernel.h>
+#include <asm/page.h>
#include <asm/sn/types.h>
#include <asm/sn/arch.h>
#include <asm/sn/gda.h>
@@ -19,6 +20,7 @@
#define CPUMASK_SETB(p, bit) (p) |= 1 << (bit)
#define CPUMASK_TSTB(p, bit) ((p) & (1ULL << (bit)))
+extern char _end;
static cpumask_t ktext_repmask;
/*
@@ -117,3 +119,28 @@ void __init replicate_kernel_text(int maxnodes)
set_ktext_source(client_nasid, server_nasid);
}
}
+
+/*
+ * Return pfn of first free page of memory on a node. PROM may allocate
+ * data structures on the first couple of pages of the first slot of each
+ * node. If this is the case, getfirstfree(node) > getslotstart(node, 0).
+ */
+pfn_t node_getfirstfree(cnodeid_t cnode)
+{
+ unsigned long loadbase = CKSEG0;
+ nasid_t nasid = COMPACT_TO_NASID_NODEID(cnode);
+ unsigned long offset;
+
+#ifdef CONFIG_MAPPED_KERNEL
+ loadbase = CKSSEG + 16777216;
+#endif
+ offset = PAGE_ALIGN((unsigned long)(&_end)) - loadbase;
+ if (cnode == 0)
+ return (offset >> PAGE_SHIFT);
+ else if (CPUMASK_TSTB(ktext_repmask, cnode))
+ return (TO_NODE(nasid, offset) >> PAGE_SHIFT);
+ else
+ return (KDM_TO_PHYS(PAGE_ALIGN(SYMMON_STK_ADDR(nasid, 0))) >>
+ PAGE_SHIFT);
+}
+
diff --git a/arch/mips64/sgi-ip27/ip27-memory.c b/arch/mips64/sgi-ip27/ip27-memory.c
index 67ca9ab09..ff218d1d2 100644
--- a/arch/mips64/sgi-ip27/ip27-memory.c
+++ b/arch/mips64/sgi-ip27/ip27-memory.c
@@ -27,8 +27,6 @@
#include <asm/sn/arch.h>
#include <asm/mmzone.h>
-extern char _end;
-
#define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)
#define SLOT_IGNORED 0xffff
@@ -48,25 +46,6 @@ int numa_debug(void)
}
/*
- * Return pfn of first free page of memory on a node. PROM may allocate
- * data structures on the first couple of pages of the first slot of each
- * node. If this is the case, getfirstfree(node) > getslotstart(node, 0).
- */
-pfn_t node_getfirstfree(cnodeid_t cnode)
-{
- unsigned long loadbase = CKSEG0;
- nasid_t nasid = COMPACT_TO_NASID_NODEID(cnode);
-
-#ifdef CONFIG_MAPPED_KERNEL
- loadbase = CKSSEG + 16777216;
-#endif
- if (cnode == 0)
- return (KDM_TO_PHYS(PAGE_ALIGN((unsigned long)(&_end)) -
- (loadbase - K0BASE)) >> PAGE_SHIFT);
- return (KDM_TO_PHYS(PAGE_ALIGN(SYMMON_STK_ADDR(nasid, 0))) >> PAGE_SHIFT);
-}
-
-/*
* Return the number of pages of memory provided by the given slot
* on the specified node.
*/