aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/include/asm/exception-64s.h
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2011-04-05 00:20:31 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2011-04-19 21:03:22 -0400
commita5d4f3ad3a28cf046836b9bfae61d532b8f77036 (patch)
tree6940ace9422e91459d819b385dacf9b2ab44bd50 /arch/powerpc/include/asm/exception-64s.h
parent2dd60d79e0202628a47af9812a84d502cc63628c (diff)
powerpc: Base support for exceptions using HSRR0/1
Pass the register type to the prolog, also provides alternate "HV" version of hardware interrupt (0x500) and adjust LPES accordingly We tag those interrupts by setting bit 0x2 in the trap number 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.h65
1 files changed, 33 insertions, 32 deletions
diff --git a/arch/powerpc/include/asm/exception-64s.h b/arch/powerpc/include/asm/exception-64s.h
index 337b6fa2f8cd..1d98e05be511 100644
--- a/arch/powerpc/include/asm/exception-64s.h
+++ b/arch/powerpc/include/asm/exception-64s.h
@@ -56,30 +56,37 @@
56#define LOAD_HANDLER(reg, label) \ 56#define LOAD_HANDLER(reg, label) \
57 addi reg,reg,(label)-_stext; /* virt addr of handler ... */ 57 addi reg,reg,(label)-_stext; /* virt addr of handler ... */
58 58
59#define EXCEPTION_PROLOG_1(area) \ 59/* Exception register prefixes */
60#define EXC_HV H
61#define EXC_STD
62
63#define __EXCEPTION_PROLOG_1(area, h) \
60 GET_PACA(r13); \ 64 GET_PACA(r13); \
61 std r9,area+EX_R9(r13); /* save r9 - r12 */ \ 65 std r9,area+EX_R9(r13); /* save r9 - r12 */ \
62 std r10,area+EX_R10(r13); \ 66 std r10,area+EX_R10(r13); \
63 std r11,area+EX_R11(r13); \ 67 std r11,area+EX_R11(r13); \
64 std r12,area+EX_R12(r13); \ 68 std r12,area+EX_R12(r13); \
65 mfspr r9,SPRN_SPRG_SCRATCH0; \ 69 mfspr r9,SPRN_SPRG_##h##SCRATCH0; \
66 std r9,area+EX_R13(r13); \ 70 std r9,area+EX_R13(r13); \
67 mfcr r9 71 mfcr r9
72#define EXCEPTION_PROLOG_1(area, h) __EXCEPTION_PROLOG_1(area, h)
68 73
69#define EXCEPTION_PROLOG_PSERIES_1(label) \ 74#define __EXCEPTION_PROLOG_PSERIES_1(label, h) \
70 ld r12,PACAKBASE(r13); /* get high part of &label */ \ 75 ld r12,PACAKBASE(r13); /* get high part of &label */ \
71 ld r10,PACAKMSR(r13); /* get MSR value for kernel */ \ 76 ld r10,PACAKMSR(r13); /* get MSR value for kernel */ \
72 mfspr r11,SPRN_SRR0; /* save SRR0 */ \ 77 mfspr r11,SPRN_##h##SRR0; /* save SRR0 */ \
73 LOAD_HANDLER(r12,label) \ 78 LOAD_HANDLER(r12,label) \
74 mtspr SPRN_SRR0,r12; \ 79 mtspr SPRN_##h##SRR0,r12; \
75 mfspr r12,SPRN_SRR1; /* and SRR1 */ \ 80 mfspr r12,SPRN_##h##SRR1; /* and SRR1 */ \
76 mtspr SPRN_SRR1,r10; \ 81 mtspr SPRN_##h##SRR1,r10; \
77 rfid; \ 82 h##rfid; \
78 b . /* prevent speculative execution */ 83 b . /* prevent speculative execution */
84#define EXCEPTION_PROLOG_PSERIES_1(label, h) \
85 __EXCEPTION_PROLOG_PSERIES_1(label, h)
79 86
80#define EXCEPTION_PROLOG_PSERIES(area, label) \ 87#define EXCEPTION_PROLOG_PSERIES(area, label, h) \
81 EXCEPTION_PROLOG_1(area); \ 88 EXCEPTION_PROLOG_1(area, h); \
82 EXCEPTION_PROLOG_PSERIES_1(label); 89 EXCEPTION_PROLOG_PSERIES_1(label, h);
83 90
84/* 91/*
85 * The common exception prolog is used for all except a few exceptions 92 * The common exception prolog is used for all except a few exceptions
@@ -150,50 +157,44 @@ label##_pSeries: \
150 HMT_MEDIUM; \ 157 HMT_MEDIUM; \
151 DO_KVM n; \ 158 DO_KVM n; \
152 mtspr SPRN_SPRG_SCRATCH0,r13; /* save r13 */ \ 159 mtspr SPRN_SPRG_SCRATCH0,r13; /* save r13 */ \
153 EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, label##_common) 160 EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, label##_common, EXC_STD)
154 161
155#define HSTD_EXCEPTION_PSERIES(n, label) \ 162#define HSTD_EXCEPTION_PSERIES(n, label) \
156 . = n; \ 163 . = n; \
157 .globl label##_pSeries; \ 164 .globl label##_pSeries; \
158label##_pSeries: \ 165label##_pSeries: \
159 HMT_MEDIUM; \ 166 HMT_MEDIUM; \
160 mtspr SPRN_SPRG_SCRATCH0,r20; /* save r20 */ \ 167 DO_KVM n; \
161 mfspr r20,SPRN_HSRR0; /* copy HSRR0 to SRR0 */ \ 168 mtspr SPRN_SPRG_HSCRATCH0,r13;/* save r13 */ \
162 mtspr SPRN_SRR0,r20; \ 169 EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, label##_common, EXC_HV)
163 mfspr r20,SPRN_HSRR1; /* copy HSRR0 to SRR0 */ \
164 mtspr SPRN_SRR1,r20; \
165 mfspr r20,SPRN_SPRG_SCRATCH0; /* restore r20 */ \
166 mtspr SPRN_SPRG_SCRATCH0,r13; /* save r13 */ \
167 EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, label##_common)
168 170
169 171
170#define MASKABLE_EXCEPTION_PSERIES(n, label) \ 172#define __MASKABLE_EXCEPTION_PSERIES(n, label, h) \
171 . = n; \
172 .globl label##_pSeries; \
173label##_pSeries: \
174 HMT_MEDIUM; \ 173 HMT_MEDIUM; \
175 DO_KVM n; \ 174 DO_KVM n; \
176 mtspr SPRN_SPRG_SCRATCH0,r13; /* save r13 */ \ 175 mtspr SPRN_SPRG_##h##SCRATCH0,r13; /* save r13 */ \
177 GET_PACA(r13); \ 176 GET_PACA(r13); \
178 std r9,PACA_EXGEN+EX_R9(r13); /* save r9, r10 */ \ 177 std r9,PACA_EXGEN+EX_R9(r13); /* save r9, r10 */ \
179 std r10,PACA_EXGEN+EX_R10(r13); \ 178 std r10,PACA_EXGEN+EX_R10(r13); \
180 lbz r10,PACASOFTIRQEN(r13); \ 179 lbz r10,PACASOFTIRQEN(r13); \
181 mfcr r9; \ 180 mfcr r9; \
182 cmpwi r10,0; \ 181 cmpwi r10,0; \
183 beq masked_interrupt; \ 182 beq masked_##h##interrupt; \
184 mfspr r10,SPRN_SPRG_SCRATCH0; \ 183 mfspr r10,SPRN_SPRG_##h##SCRATCH0; \
185 std r10,PACA_EXGEN+EX_R13(r13); \ 184 std r10,PACA_EXGEN+EX_R13(r13); \
186 std r11,PACA_EXGEN+EX_R11(r13); \ 185 std r11,PACA_EXGEN+EX_R11(r13); \
187 std r12,PACA_EXGEN+EX_R12(r13); \ 186 std r12,PACA_EXGEN+EX_R12(r13); \
188 ld r12,PACAKBASE(r13); /* get high part of &label */ \ 187 ld r12,PACAKBASE(r13); /* get high part of &label */ \
189 ld r10,PACAKMSR(r13); /* get MSR value for kernel */ \ 188 ld r10,PACAKMSR(r13); /* get MSR value for kernel */ \
190 mfspr r11,SPRN_SRR0; /* save SRR0 */ \ 189 mfspr r11,SPRN_##h##SRR0; /* save SRR0 */ \
191 LOAD_HANDLER(r12,label##_common) \ 190 LOAD_HANDLER(r12,label##_common) \
192 mtspr SPRN_SRR0,r12; \ 191 mtspr SPRN_##h##SRR0,r12; \
193 mfspr r12,SPRN_SRR1; /* and SRR1 */ \ 192 mfspr r12,SPRN_##h##SRR1; /* and SRR1 */ \
194 mtspr SPRN_SRR1,r10; \ 193 mtspr SPRN_##h##SRR1,r10; \
195 rfid; \ 194 h##rfid; \
196 b . /* prevent speculative execution */ 195 b . /* prevent speculative execution */
196#define MASKABLE_EXCEPTION_PSERIES(n, label, h) \
197 __MASKABLE_EXCEPTION_PSERIES(n, label, h)
197 198
198#ifdef CONFIG_PPC_ISERIES 199#ifdef CONFIG_PPC_ISERIES
199#define DISABLE_INTS \ 200#define DISABLE_INTS \