[POWERPC] Fix CPU hotplug when using the SLB shadow buffer
authorMichael Neuling <mikey@neuling.org>
Fri, 11 Jan 2008 03:02:47 +0000 (14:02 +1100)
committerPaul Mackerras <paulus@samba.org>
Fri, 11 Jan 2008 05:33:55 +0000 (16:33 +1100)
Before we register the SLB shadow buffer, we need to invalidate the
entries in the buffer, otherwise we can end up stale entries from when
we previously offlined the CPU.

This does this invalidate as well as unregistering the buffer with
PHYP before we offline the cpu.  Tested and fixes crashes seen on
970MP (thanks to tonyb) and POWER5.

Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/mm/slb.c
arch/powerpc/platforms/pseries/hotplug-cpu.c
arch/powerpc/platforms/pseries/lpar.c
include/asm-powerpc/mmu-hash64.h

index 27922dff8b94e34614890f7764ce10c014b6fb65..a282bc212e809d76ec1a6b0b134864dca05ea876 100644 (file)
@@ -82,6 +82,14 @@ static inline void slb_shadow_clear(unsigned long entry)
        get_slb_shadow()->save_area[entry].esid = 0;
 }
 
+void slb_shadow_clear_all(void)
+{
+       int i;
+
+       for (i = 0; i < SLB_NUM_BOLTED; i++)
+               slb_shadow_clear(i);
+}
+
 static inline void create_shadowed_slbe(unsigned long ea, int ssize,
                                        unsigned long flags,
                                        unsigned long entry)
index fc48b96c81bff2ee1ec79eef9d1f13f62b6693cf..412e6b42986f2535ddfd5e101caaec85c76f7dc6 100644 (file)
@@ -29,6 +29,7 @@
 #include <asm/vdso_datapage.h>
 #include <asm/pSeries_reconfig.h>
 #include "xics.h"
+#include "plpar_wrappers.h"
 
 /* This version can't take the spinlock, because it never returns */
 static struct rtas_args rtas_stop_self_args = {
@@ -58,6 +59,7 @@ static void pseries_mach_cpu_die(void)
        local_irq_disable();
        idle_task_exit();
        xics_teardown_cpu(0);
+       unregister_slb_shadow(hard_smp_processor_id(), __pa(get_slb_shadow()));
        rtas_stop_self();
        /* Should never get here... */
        BUG();
index 9a455d46379d525181a4278714e22304f72028db..34317aa148a8368b8e0e154a461b101e5b2e2678 100644 (file)
@@ -272,6 +272,7 @@ void vpa_init(int cpu)
         */
        addr = __pa(&slb_shadow[cpu]);
        if (firmware_has_feature(FW_FEATURE_SPLPAR)) {
+               slb_shadow_clear_all();
                ret = register_slb_shadow(hwcpu, addr);
                if (ret)
                        printk(KERN_ERR
index 82328dec2b527d2ecdd05b0694ca2d8562c0558d..951e2487aa69019e80bd83b2d6ef8b12180afaf2 100644 (file)
@@ -286,6 +286,7 @@ extern void hpte_init_iSeries(void);
 extern void hpte_init_beat(void);
 extern void hpte_init_beat_v3(void);
 
+extern void slb_shadow_clear_all(void);
 extern void stabs_alloc(void);
 extern void slb_initialize(void);
 extern void slb_flush_and_rebolt(void);