aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/exceptions-64e.S
diff options
context:
space:
mode:
authorMihai Caraman <mihai.caraman@freescale.com>2012-08-05 23:27:07 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2012-09-05 01:35:52 -0400
commit8b64a9dfb091f1eca8b7e58da82f1e7d1d5fe0ad (patch)
tree9d0bfd7ecd07c02fef68e7b198a0560340bf0846 /arch/powerpc/kernel/exceptions-64e.S
parent79b5c8dbaa4528a6fd03a4d9d8a6d56a46293a3a (diff)
powerpc/booke64: Use SPRG0/3 scratch for bolted TLB miss & crit int
Embedded.Hypervisor category defines GSPRG0..3 physical registers for guests. Avoid SPRG4-7 usage as scratch in host exception handlers, otherwise guest SPRG4-7 registers will be clobbered. For bolted TLB miss exception handlers, which is the version currently supported by KVM, use SPRN_SPRG_GEN_SCRATCH aka SPRG0 instead of SPRN_SPRG_TLB_SCRATCH aka SPRG6. Keep using TLB PACA slots to fit in one 64-byte cache line. For critical exception handlers use SPRG3 instead of SPRG7. Provide a routine to store and restore user-visible SPRGs. This will be subsequently used to restore VDSO information in SPRG3. Add EX_R13 to paca slots to free up SPRG3 and change the critical exception epilog to use it. Signed-off-by: Mihai Caraman <mihai.caraman@freescale.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kernel/exceptions-64e.S')
-rw-r--r--arch/powerpc/kernel/exceptions-64e.S17
1 files changed, 15 insertions, 2 deletions
diff --git a/arch/powerpc/kernel/exceptions-64e.S b/arch/powerpc/kernel/exceptions-64e.S
index 83c20e84a4fb..7476b0ae09fb 100644
--- a/arch/powerpc/kernel/exceptions-64e.S
+++ b/arch/powerpc/kernel/exceptions-64e.S
@@ -42,6 +42,7 @@
42 mfspr r13,SPRN_SPRG_PACA; /* get PACA */ \ 42 mfspr r13,SPRN_SPRG_PACA; /* get PACA */ \
43 std r10,PACA_EX##type+EX_R10(r13); \ 43 std r10,PACA_EX##type+EX_R10(r13); \
44 std r11,PACA_EX##type+EX_R11(r13); \ 44 std r11,PACA_EX##type+EX_R11(r13); \
45 PROLOG_STORE_RESTORE_SCRATCH_##type; \
45 mfcr r10; /* save CR */ \ 46 mfcr r10; /* save CR */ \
46 mfspr r11,SPRN_##type##_SRR1;/* what are we coming from */ \ 47 mfspr r11,SPRN_##type##_SRR1;/* what are we coming from */ \
47 DO_KVM intnum,SPRN_##type##_SRR1; /* KVM hook */ \ 48 DO_KVM intnum,SPRN_##type##_SRR1; /* KVM hook */ \
@@ -99,6 +100,18 @@
99#define GDBELL_EXCEPTION_PROLOG(n, intnum, addition) \ 100#define GDBELL_EXCEPTION_PROLOG(n, intnum, addition) \
100 EXCEPTION_PROLOG(n, intnum, GDBELL, addition##_GDBELL(n)) 101 EXCEPTION_PROLOG(n, intnum, GDBELL, addition##_GDBELL(n))
101 102
103/*
104 * Store user-visible scratch in PACA exception slots and restore proper value
105 */
106#define PROLOG_STORE_RESTORE_SCRATCH_GEN
107#define PROLOG_STORE_RESTORE_SCRATCH_GDBELL
108#define PROLOG_STORE_RESTORE_SCRATCH_DBG
109#define PROLOG_STORE_RESTORE_SCRATCH_MC
110
111#define PROLOG_STORE_RESTORE_SCRATCH_CRIT \
112 mfspr r10,SPRN_SPRG_CRIT_SCRATCH; /* get r13 */ \
113 std r10,PACA_EXCRIT+EX_R13(r13)
114
102/* Variants of the "addition" argument for the prolog 115/* Variants of the "addition" argument for the prolog
103 */ 116 */
104#define PROLOG_ADDITION_NONE_GEN(n) 117#define PROLOG_ADDITION_NONE_GEN(n)
@@ -454,7 +467,7 @@ interrupt_end_book3e:
454 mtcr r10 467 mtcr r10
455 ld r10,PACA_EXCRIT+EX_R10(r13) /* restore registers */ 468 ld r10,PACA_EXCRIT+EX_R10(r13) /* restore registers */
456 ld r11,PACA_EXCRIT+EX_R11(r13) 469 ld r11,PACA_EXCRIT+EX_R11(r13)
457 mfspr r13,SPRN_SPRG_CRIT_SCRATCH 470 ld r13,PACA_EXCRIT+EX_R13(r13)
458 rfci 471 rfci
459 472
460 /* Normal debug exception */ 473 /* Normal debug exception */
@@ -467,7 +480,7 @@ interrupt_end_book3e:
467 /* Now we mash up things to make it look like we are coming on a 480 /* Now we mash up things to make it look like we are coming on a
468 * normal exception 481 * normal exception
469 */ 482 */
470 mfspr r15,SPRN_SPRG_CRIT_SCRATCH 483 ld r15,PACA_EXCRIT+EX_R13(r13)
471 mtspr SPRN_SPRG_GEN_SCRATCH,r15 484 mtspr SPRN_SPRG_GEN_SCRATCH,r15
472 mfspr r14,SPRN_DBSR 485 mfspr r14,SPRN_DBSR
473 EXCEPTION_COMMON(0xd00, PACA_EXCRIT, INTS_DISABLE) 486 EXCEPTION_COMMON(0xd00, PACA_EXCRIT, INTS_DISABLE)