Critical exception handler on 64-bit booke uses user-visible SPRG3 as scratch.
Restore VDSO information in SPRG3 on exception prolog.

Signed-off-by: Mihai Caraman <mihai.cara...@freescale.com>
---
 arch/powerpc/include/asm/paca.h      |    3 +++
 arch/powerpc/kernel/asm-offsets.c    |    1 +
 arch/powerpc/kernel/exceptions-64e.S |    4 +++-
 arch/powerpc/kernel/vdso.c           |    2 ++
 4 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.h
index daf813f..6b98ad4 100644
--- a/arch/powerpc/include/asm/paca.h
+++ b/arch/powerpc/include/asm/paca.h
@@ -118,6 +118,9 @@ struct paca_struct {
        void *mc_kstack;
        void *crit_kstack;
        void *dbg_kstack;
+
+       /* User-visible sprg information */
+       ulong sprg3;
 #endif /* CONFIG_PPC_BOOK3E */
 
        mm_context_t context;
diff --git a/arch/powerpc/kernel/asm-offsets.c 
b/arch/powerpc/kernel/asm-offsets.c
index 85b05c4..8ca338d 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -168,6 +168,7 @@ int main(void)
        DEFINE(PACA_MC_STACK, offsetof(struct paca_struct, mc_kstack));
        DEFINE(PACA_CRIT_STACK, offsetof(struct paca_struct, crit_kstack));
        DEFINE(PACA_DBG_STACK, offsetof(struct paca_struct, dbg_kstack));
+       DEFINE(PACA_SPRG3, offsetof(struct paca_struct, sprg3));
 #endif /* CONFIG_PPC_BOOK3E */
 
 #ifdef CONFIG_PPC_STD_MMU_64
diff --git a/arch/powerpc/kernel/exceptions-64e.S 
b/arch/powerpc/kernel/exceptions-64e.S
index 7476b0a..87a82fb 100644
--- a/arch/powerpc/kernel/exceptions-64e.S
+++ b/arch/powerpc/kernel/exceptions-64e.S
@@ -110,7 +110,9 @@
 
 #define PROLOG_STORE_RESTORE_SCRATCH_CRIT                                  \
        mfspr   r10,SPRN_SPRG_CRIT_SCRATCH;     /* get r13 */               \
-       std     r10,PACA_EXCRIT+EX_R13(r13)
+       std     r10,PACA_EXCRIT+EX_R13(r13);                                \
+       ld      r11,PACA_SPRG3(r13);                                        \
+       mtspr   SPRN_SPRG_CRIT_SCRATCH,r11;
 
 /* Variants of the "addition" argument for the prolog
  */
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c
index b67db22..a0b0d08 100644
--- a/arch/powerpc/kernel/vdso.c
+++ b/arch/powerpc/kernel/vdso.c
@@ -725,6 +725,8 @@ int __cpuinit vdso_getcpu_init(void)
        mtspr(SPRN_SPRG3, val);
 #ifdef CONFIG_KVM_BOOK3S_HANDLER
        get_paca()->kvm_hstate.sprg3 = val;
+#elif CONFIG_PPC_BOOK3E
+       get_paca()->sprg3 = val;
 #endif
 
        put_cpu();
-- 
1.7.4.1


--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to