summaryrefslogtreecommitdiffstats
path: root/arch/powerpc/include/asm/exception-64s.h
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2011-04-05 13:59:58 +1000
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2011-04-20 11:03:23 +1000
commit673b189a2e3353061fa8c49515d1014dab6ad9b9 (patch)
tree71d5842f2dcfcd24370ef25f35c97f0f81ebae87 /arch/powerpc/include/asm/exception-64s.h
parentb3e6b5dfcf0974069a8ddcce7dd071120d20d79c (diff)
powerpc: Always use SPRN_SPRG_HSCRATCH0 when running in HV mode
This uses feature sections to arrange that we always use HSPRG1 as the scratch register in the interrupt entry code rather than SPRG2 when we're running in hypervisor mode on POWER7. This will ensure that we don't trash the guest's SPRG2 when we are running KVM guests. To simplify the code, we define GET_SCRATCH0() and SET_SCRATCH0() macros like the GET_PACA/SET_PACA macros. Signed-off-by: Paul Mackerras <paulus@samba.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/include/asm/exception-64s.h')
-rw-r--r--arch/powerpc/include/asm/exception-64s.h15
1 files changed, 7 insertions, 8 deletions
diff --git a/arch/powerpc/include/asm/exception-64s.h b/arch/powerpc/include/asm/exception-64s.h
index fb5b0af30fc..d6b4849df9b 100644
--- a/arch/powerpc/include/asm/exception-64s.h
+++ b/arch/powerpc/include/asm/exception-64s.h
@@ -60,16 +60,15 @@
#define EXC_HV H
#define EXC_STD
-#define __EXCEPTION_PROLOG_1(area, h) \
+#define EXCEPTION_PROLOG_1(area) \
GET_PACA(r13); \
std r9,area+EX_R9(r13); /* save r9 - r12 */ \
std r10,area+EX_R10(r13); \
std r11,area+EX_R11(r13); \
std r12,area+EX_R12(r13); \
- mfspr r9,SPRN_SPRG_##h##SCRATCH0; \
+ GET_SCRATCH0(r9); \
std r9,area+EX_R13(r13); \
mfcr r9
-#define EXCEPTION_PROLOG_1(area, h) __EXCEPTION_PROLOG_1(area, h)
#define __EXCEPTION_PROLOG_PSERIES_1(label, h) \
ld r12,PACAKBASE(r13); /* get high part of &label */ \
@@ -85,7 +84,7 @@
__EXCEPTION_PROLOG_PSERIES_1(label, h)
#define EXCEPTION_PROLOG_PSERIES(area, label, h) \
- EXCEPTION_PROLOG_1(area, h); \
+ EXCEPTION_PROLOG_1(area); \
EXCEPTION_PROLOG_PSERIES_1(label, h);
/*
@@ -156,7 +155,7 @@
label##_pSeries: \
HMT_MEDIUM; \
DO_KVM vec; \
- mtspr SPRN_SPRG_SCRATCH0,r13; /* save r13 */ \
+ SET_SCRATCH0(r13); /* save r13 */ \
EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, label##_common, EXC_STD)
#define STD_EXCEPTION_HV(loc, vec, label) \
@@ -165,13 +164,13 @@ label##_pSeries: \
label##_hv: \
HMT_MEDIUM; \
DO_KVM vec; \
- mtspr SPRN_SPRG_HSCRATCH0,r13;/* save r13 */ \
+ SET_SCRATCH0(r13); /* save r13 */ \
EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, label##_common, EXC_HV)
#define __MASKABLE_EXCEPTION_PSERIES(vec, label, h) \
HMT_MEDIUM; \
DO_KVM vec; \
- mtspr SPRN_SPRG_##h##SCRATCH0,r13; /* save r13 */ \
+ SET_SCRATCH0(r13); /* save r13 */ \
GET_PACA(r13); \
std r9,PACA_EXGEN+EX_R9(r13); /* save r9, r10 */ \
std r10,PACA_EXGEN+EX_R10(r13); \
@@ -179,7 +178,7 @@ label##_hv: \
mfcr r9; \
cmpwi r10,0; \
beq masked_##h##interrupt; \
- mfspr r10,SPRN_SPRG_##h##SCRATCH0; \
+ GET_SCRATCH0(r10); \
std r10,PACA_EXGEN+EX_R13(r13); \
std r11,PACA_EXGEN+EX_R11(r13); \
std r12,PACA_EXGEN+EX_R12(r13); \