summaryrefslogtreecommitdiff
path: root/arch/powerpc/mm/slb.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-09-22 19:48:03 (GMT)
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-22 19:48:03 (GMT)
commit14d1adfc59ba66932ef167fdff62983e7c2b0197 (patch)
tree34bad21bf4ec220be87fa5d79ff41dd98e7dad9f /arch/powerpc/mm/slb.c
parente478bec0ba0a83a48a0f6982934b6de079e7e6b3 (diff)
parent69917c26c840e7de94522bf90fb190de63bf92bd (diff)
downloadlinux-fsl-qoriq-14d1adfc59ba66932ef167fdff62983e7c2b0197.tar.xz
Merge git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
* git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc: (114 commits) [POWERPC] Fix ohare IDE irq workaround on old powermacs [POWERPC] EEH: Power4 systems sometimes need multiple resets. [POWERPC] Include <asm/mmu.h> in arch/powerpc/sysdev/fsl_soc.h for phys_addr_t. [POWERPC] Demacrofy arch/powerpc/platforms/maple/pci.c [POWERPC] Maple U3 HT - reject inappropriate config space access [POWERPC] Fix IPIC pending register assignments [POWERPC] powerpc: fix building gdb against asm/ptrace.h [POWERPC] Remove DISCONTIGMEM cruft from page.h [POWERPC] Merge iSeries i/o operations with the rest [POWERPC] 40x: Fix debug status register defines [POWERPC] Fix compile error in sbc8560 [POWERPC] EEH: support MMIO enable recovery step [POWERPC] EEH: enable MMIO/DMA on frozen slot [POWERPC] EEH: code comment cleanup [POWERPC] EEH: balance pcidev_get/put calls [POWERPC] PPC: Fix xmon stack frame address in backtrace [POWERPC] Add AT_PLATFORM value for Xilinx Virtex-4 FX [POWERPC] Start arch/powerpc/boot code reorganization [POWERPC] Define of_read_ulong helper [POWERPC] iseries: eliminate a couple of warnings ...
Diffstat (limited to 'arch/powerpc/mm/slb.c')
-rw-r--r--arch/powerpc/mm/slb.c37
1 files changed, 33 insertions, 4 deletions
diff --git a/arch/powerpc/mm/slb.c b/arch/powerpc/mm/slb.c
index de0c884..d373391 100644
--- a/arch/powerpc/mm/slb.c
+++ b/arch/powerpc/mm/slb.c
@@ -22,6 +22,8 @@
#include <asm/paca.h>
#include <asm/cputable.h>
#include <asm/cacheflush.h>
+#include <asm/smp.h>
+#include <linux/compiler.h>
#ifdef DEBUG
#define DBG(fmt...) udbg_printf(fmt)
@@ -50,9 +52,32 @@ static inline unsigned long mk_vsid_data(unsigned long ea, unsigned long flags)
return (get_kernel_vsid(ea) << SLB_VSID_SHIFT) | flags;
}
-static inline void create_slbe(unsigned long ea, unsigned long flags,
- unsigned long entry)
+static inline void slb_shadow_update(unsigned long esid, unsigned long vsid,
+ unsigned long entry)
{
+ /*
+ * Clear the ESID first so the entry is not valid while we are
+ * updating it.
+ */
+ get_slb_shadow()->save_area[entry].esid = 0;
+ barrier();
+ get_slb_shadow()->save_area[entry].vsid = vsid;
+ barrier();
+ get_slb_shadow()->save_area[entry].esid = esid;
+
+}
+
+static inline void create_shadowed_slbe(unsigned long ea, unsigned long flags,
+ unsigned long entry)
+{
+ /*
+ * Updating the shadow buffer before writing the SLB ensures
+ * we don't get a stale entry here if we get preempted by PHYP
+ * between these two statements.
+ */
+ slb_shadow_update(mk_esid_data(ea, entry), mk_vsid_data(ea, flags),
+ entry);
+
asm volatile("slbmte %0,%1" :
: "r" (mk_vsid_data(ea, flags)),
"r" (mk_esid_data(ea, entry))
@@ -77,6 +102,10 @@ void slb_flush_and_rebolt(void)
if ((ksp_esid_data & ESID_MASK) == PAGE_OFFSET)
ksp_esid_data &= ~SLB_ESID_V;
+ /* Only third entry (stack) may change here so only resave that */
+ slb_shadow_update(ksp_esid_data,
+ mk_vsid_data(ksp_esid_data, lflags), 2);
+
/* We need to do this all in asm, so we're sure we don't touch
* the stack between the slbia and rebolting it. */
asm volatile("isync\n"
@@ -209,9 +238,9 @@ void slb_initialize(void)
asm volatile("isync":::"memory");
asm volatile("slbmte %0,%0"::"r" (0) : "memory");
asm volatile("isync; slbia; isync":::"memory");
- create_slbe(PAGE_OFFSET, lflags, 0);
+ create_shadowed_slbe(PAGE_OFFSET, lflags, 0);
- create_slbe(VMALLOC_START, vflags, 1);
+ create_shadowed_slbe(VMALLOC_START, vflags, 1);
/* We don't bolt the stack for the time being - we're in boot,
* so the stack is in the bolted segment. By the time it goes