powerpc/booke64: Use SPRG7 for VDSO
Previously SPRG3 was marked for use by both VDSO and critical
interrupts (though critical interrupts were not fully implemented).
In commit 8b64a9dfb0 ("powerpc/booke64:
Use SPRG0/3 scratch for bolted TLB miss & crit int"), Mihai Caraman
made an attempt to resolve this conflict by restoring the VDSO value
early in the critical interrupt, but this has some issues:
- It's incompatible with EXCEPTION_COMMON which restores r13 from the
by-then-overwritten scratch (this cost me some debugging time).
- It forces critical exceptions to be a special case handled
differently from even machine check and debug level exceptions.
- It didn't occur to me that it was possible to make this work at all
(by doing a final "ld r13, PACA_EXCRIT+EX_R13(r13)") until after
I made (most of) this patch. :-)
It might be worth investigating using a load rather than SPRG on return
from all exceptions (except TLB misses where the scratch never leaves
the SPRG) -- it could save a few cycles. Until then, let's stick with
SPRG for all exceptions.
Since we cannot use SPRG4-7 for scratch without corrupting the state of
a KVM guest, move VDSO to SPRG7 on book3e. Since neither SPRG4-7 nor
critical interrupts exist on book3s, SPRG3 is still used for VDSO
there.
Signed-off-by: Scott Wood <scottwood@freescale.com>
Cc: Mihai Caraman <mihai.caraman@freescale.com>
Cc: Anton Blanchard <anton@samba.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: kvm-ppc@vger.kernel.org
This commit is contained in:
@@ -55,7 +55,6 @@
|
||||
mfspr r13,SPRN_SPRG_PACA; /* get PACA */ \
|
||||
std r10,PACA_EX##type+EX_R10(r13); \
|
||||
std r11,PACA_EX##type+EX_R11(r13); \
|
||||
PROLOG_STORE_RESTORE_SCRATCH_##type; \
|
||||
mfcr r10; /* save CR */ \
|
||||
mfspr r11,SPRN_##type##_SRR1;/* what are we coming from */ \
|
||||
DO_KVM intnum,SPRN_##type##_SRR1; /* KVM hook */ \
|
||||
@@ -116,20 +115,6 @@
|
||||
#define GDBELL_EXCEPTION_PROLOG(n, intnum, addition) \
|
||||
EXCEPTION_PROLOG(n, intnum, GDBELL, addition##_GDBELL(n))
|
||||
|
||||
/*
|
||||
* Store user-visible scratch in PACA exception slots and restore proper value
|
||||
*/
|
||||
#define PROLOG_STORE_RESTORE_SCRATCH_GEN
|
||||
#define PROLOG_STORE_RESTORE_SCRATCH_GDBELL
|
||||
#define PROLOG_STORE_RESTORE_SCRATCH_DBG
|
||||
#define PROLOG_STORE_RESTORE_SCRATCH_MC
|
||||
|
||||
#define PROLOG_STORE_RESTORE_SCRATCH_CRIT \
|
||||
mfspr r10,SPRN_SPRG_CRIT_SCRATCH; /* get 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
|
||||
*/
|
||||
#define PROLOG_ADDITION_NONE_GEN(n)
|
||||
@@ -529,7 +514,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
|
||||
mtcr r10
|
||||
ld r10,PACA_EXCRIT+EX_R10(r13) /* restore registers */
|
||||
ld r11,PACA_EXCRIT+EX_R11(r13)
|
||||
ld r13,PACA_EXCRIT+EX_R13(r13)
|
||||
mfspr r13,SPRN_SPRG_CRIT_SCRATCH
|
||||
rfci
|
||||
|
||||
/* Normal debug exception */
|
||||
@@ -542,7 +527,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
|
||||
/* Now we mash up things to make it look like we are coming on a
|
||||
* normal exception
|
||||
*/
|
||||
ld r15,PACA_EXCRIT+EX_R13(r13)
|
||||
mfspr r15,SPRN_SPRG_CRIT_SCRATCH
|
||||
mtspr SPRN_SPRG_GEN_SCRATCH,r15
|
||||
mfspr r14,SPRN_DBSR
|
||||
EXCEPTION_COMMON(0xd00, PACA_EXCRIT, INTS_DISABLE)
|
||||
|
||||
Reference in New Issue
Block a user