]>
Commit | Line | Data |
---|---|---|
0ebc4cda BH |
1 | /* |
2 | * This file contains the 64-bit "server" PowerPC variant | |
3 | * of the low level exception handling including exception | |
4 | * vectors, exception return, part of the slb and stab | |
5 | * handling and other fixed offset specific things. | |
6 | * | |
7 | * This file is meant to be #included from head_64.S due to | |
25985edc | 8 | * position dependent assembly. |
0ebc4cda BH |
9 | * |
10 | * Most of this originates from head_64.S and thus has the same | |
11 | * copyright history. | |
12 | * | |
13 | */ | |
14 | ||
7230c564 | 15 | #include <asm/hw_irq.h> |
8aa34ab8 | 16 | #include <asm/exception-64s.h> |
46f52210 | 17 | #include <asm/ptrace.h> |
7cba160a | 18 | #include <asm/cpuidle.h> |
da2bc464 | 19 | #include <asm/head-64.h> |
8aa34ab8 | 20 | |
0ebc4cda | 21 | /* |
57f26649 NP |
22 | * There are a few constraints to be concerned with. |
23 | * - Real mode exceptions code/data must be located at their physical location. | |
24 | * - Virtual mode exceptions must be mapped at their 0xc000... location. | |
25 | * - Fixed location code must not call directly beyond the __end_interrupts | |
26 | * area when built with CONFIG_RELOCATABLE. LOAD_HANDLER / bctr sequence | |
27 | * must be used. | |
28 | * - LOAD_HANDLER targets must be within first 64K of physical 0 / | |
29 | * virtual 0xc00... | |
30 | * - Conditional branch targets must be within +/-32K of caller. | |
31 | * | |
32 | * "Virtual exceptions" run with relocation on (MSR_IR=1, MSR_DR=1), and | |
33 | * therefore don't have to run in physically located code or rfid to | |
34 | * virtual mode kernel code. However on relocatable kernels they do have | |
35 | * to branch to KERNELBASE offset because the rest of the kernel (outside | |
36 | * the exception vectors) may be located elsewhere. | |
37 | * | |
38 | * Virtual exceptions correspond with physical, except their entry points | |
39 | * are offset by 0xc000000000000000 and also tend to get an added 0x4000 | |
40 | * offset applied. Virtual exceptions are enabled with the Alternate | |
41 | * Interrupt Location (AIL) bit set in the LPCR. However this does not | |
42 | * guarantee they will be delivered virtually. Some conditions (see the ISA) | |
43 | * cause exceptions to be delivered in real mode. | |
44 | * | |
45 | * It's impossible to receive interrupts below 0x300 via AIL. | |
46 | * | |
47 | * KVM: None of the virtual exceptions are from the guest. Anything that | |
48 | * escalated to HV=1 from HV=0 is delivered via real mode handlers. | |
49 | * | |
50 | * | |
0ebc4cda BH |
51 | * We layout physical memory as follows: |
52 | * 0x0000 - 0x00ff : Secondary processor spin code | |
57f26649 NP |
53 | * 0x0100 - 0x18ff : Real mode pSeries interrupt vectors |
54 | * 0x1900 - 0x3fff : Real mode trampolines | |
55 | * 0x4000 - 0x58ff : Relon (IR=1,DR=1) mode pSeries interrupt vectors | |
56 | * 0x5900 - 0x6fff : Relon mode trampolines | |
0ebc4cda | 57 | * 0x7000 - 0x7fff : FWNMI data area |
57f26649 NP |
58 | * 0x8000 - .... : Common interrupt handlers, remaining early |
59 | * setup code, rest of kernel. | |
e0319829 NP |
60 | * |
61 | * We could reclaim 0x4000-0x42ff for real mode trampolines if the space | |
62 | * is necessary. Until then it's more consistent to explicitly put VIRT_NONE | |
63 | * vectors there. | |
57f26649 NP |
64 | */ |
65 | OPEN_FIXED_SECTION(real_vectors, 0x0100, 0x1900) | |
66 | OPEN_FIXED_SECTION(real_trampolines, 0x1900, 0x4000) | |
67 | OPEN_FIXED_SECTION(virt_vectors, 0x4000, 0x5900) | |
68 | OPEN_FIXED_SECTION(virt_trampolines, 0x5900, 0x7000) | |
69 | #if defined(CONFIG_PPC_PSERIES) || defined(CONFIG_PPC_POWERNV) | |
70 | /* | |
71 | * Data area reserved for FWNMI option. | |
72 | * This address (0x7000) is fixed by the RPA. | |
73 | * pseries and powernv need to keep the whole page from | |
74 | * 0x7000 to 0x8000 free for use by the firmware | |
0ebc4cda | 75 | */ |
57f26649 NP |
76 | ZERO_FIXED_SECTION(fwnmi_page, 0x7000, 0x8000) |
77 | OPEN_TEXT_SECTION(0x8000) | |
78 | #else | |
79 | OPEN_TEXT_SECTION(0x7000) | |
80 | #endif | |
81 | ||
82 | USE_FIXED_SECTION(real_vectors) | |
83 | ||
0ebc4cda BH |
84 | /* |
85 | * This is the start of the interrupt handlers for pSeries | |
86 | * This code runs with relocation off. | |
87 | * Code from here to __end_interrupts gets copied down to real | |
88 | * address 0x100 when we are running a relocatable kernel. | |
89 | * Therefore any relative branches in this section must only | |
90 | * branch to labels in this section. | |
91 | */ | |
0ebc4cda BH |
92 | .globl __start_interrupts |
93 | __start_interrupts: | |
94 | ||
e0319829 | 95 | /* No virt vectors corresponding with 0x0..0x100 */ |
1a6822d1 | 96 | EXC_VIRT_NONE(0x4000, 0x100) |
e0319829 | 97 | |
fb479e44 | 98 | |
948cf67c | 99 | #ifdef CONFIG_PPC_P7_NAP |
fb479e44 NP |
100 | /* |
101 | * If running native on arch 2.06 or later, check if we are waking up | |
b51351e2 NP |
102 | * from nap/sleep/winkle, and branch to idle handler. The idle wakeup |
103 | * handler initially runs in real mode, but we branch to the 0xc000... | |
104 | * address so we can turn on relocation with mtmsr. | |
948cf67c | 105 | */ |
fb479e44 NP |
106 | #define IDLETEST(n) \ |
107 | BEGIN_FTR_SECTION ; \ | |
108 | mfspr r10,SPRN_SRR1 ; \ | |
109 | rlwinm. r10,r10,47-31,30,31 ; \ | |
110 | beq- 1f ; \ | |
111 | cmpwi cr3,r10,2 ; \ | |
b51351e2 | 112 | BRANCH_TO_C000(r10, system_reset_idle_common) ; \ |
fb479e44 NP |
113 | 1: \ |
114 | END_FTR_SECTION_IFSET(CPU_FTR_HVMODE | CPU_FTR_ARCH_206) | |
115 | #else | |
116 | #define IDLETEST NOTEST | |
117 | #endif | |
371fefd6 | 118 | |
1a6822d1 | 119 | EXC_REAL_BEGIN(system_reset, 0x100, 0x100) |
fb479e44 | 120 | SET_SCRATCH0(r13) |
c4f3b52c NP |
121 | /* |
122 | * MSR_RI is not enabled, because PACA_EXNMI and nmi stack is | |
123 | * being used, so a nested NMI exception would corrupt it. | |
124 | */ | |
125 | EXCEPTION_PROLOG_PSERIES_NORI(PACA_EXNMI, system_reset_common, EXC_STD, | |
fb479e44 NP |
126 | IDLETEST, 0x100) |
127 | ||
1a6822d1 NP |
128 | EXC_REAL_END(system_reset, 0x100, 0x100) |
129 | EXC_VIRT_NONE(0x4100, 0x100) | |
fb479e44 NP |
130 | |
131 | #ifdef CONFIG_PPC_P7_NAP | |
132 | EXC_COMMON_BEGIN(system_reset_idle_common) | |
9d292501 | 133 | mfspr r12,SPRN_SRR1 |
bf0153c1 | 134 | b pnv_powersave_wakeup |
371fefd6 PM |
135 | #endif |
136 | ||
a3d96f70 | 137 | EXC_COMMON_BEGIN(system_reset_common) |
c4f3b52c NP |
138 | /* |
139 | * Increment paca->in_nmi then enable MSR_RI. SLB or MCE will be able | |
140 | * to recover, but nested NMI will notice in_nmi and not recover | |
141 | * because of the use of the NMI stack. in_nmi reentrancy is tested in | |
142 | * system_reset_exception. | |
143 | */ | |
144 | lhz r10,PACA_IN_NMI(r13) | |
145 | addi r10,r10,1 | |
146 | sth r10,PACA_IN_NMI(r13) | |
147 | li r10,MSR_RI | |
148 | mtmsrd r10,1 | |
aca79d2b | 149 | |
b1ee8a3d NP |
150 | mr r10,r1 |
151 | ld r1,PACA_NMI_EMERG_SP(r13) | |
152 | subi r1,r1,INT_FRAME_SIZE | |
153 | EXCEPTION_COMMON_NORET_STACK(PACA_EXNMI, 0x100, | |
154 | system_reset, system_reset_exception, | |
c4f3b52c | 155 | ADD_NVGPRS;ADD_RECONCILE) |
c4f3b52c NP |
156 | |
157 | /* | |
158 | * The stack is no longer in use, decrement in_nmi. | |
159 | */ | |
160 | lhz r10,PACA_IN_NMI(r13) | |
161 | subi r10,r10,1 | |
162 | sth r10,PACA_IN_NMI(r13) | |
163 | ||
164 | b ret_from_except | |
582baf44 NP |
165 | |
166 | #ifdef CONFIG_PPC_PSERIES | |
167 | /* | |
168 | * Vectors for the FWNMI option. Share common code. | |
169 | */ | |
170 | TRAMP_REAL_BEGIN(system_reset_fwnmi) | |
171 | SET_SCRATCH0(r13) /* save r13 */ | |
c4f3b52c NP |
172 | /* See comment at system_reset exception */ |
173 | EXCEPTION_PROLOG_PSERIES_NORI(PACA_EXNMI, system_reset_common, | |
174 | EXC_STD, NOTEST, 0x100) | |
582baf44 NP |
175 | #endif /* CONFIG_PPC_PSERIES */ |
176 | ||
0ebc4cda | 177 | |
1a6822d1 | 178 | EXC_REAL_BEGIN(machine_check, 0x200, 0x100) |
b01c8b54 PM |
179 | /* This is moved out of line as it can be patched by FW, but |
180 | * some code path might still want to branch into the original | |
181 | * vector | |
182 | */ | |
1707dd16 PM |
183 | SET_SCRATCH0(r13) /* save r13 */ |
184 | EXCEPTION_PROLOG_0(PACA_EXMC) | |
1e9b4507 | 185 | BEGIN_FTR_SECTION |
2513767d | 186 | b machine_check_powernv_early |
1e9b4507 | 187 | FTR_SECTION_ELSE |
1707dd16 | 188 | b machine_check_pSeries_0 |
1e9b4507 | 189 | ALT_FTR_SECTION_END_IFSET(CPU_FTR_HVMODE) |
1a6822d1 NP |
190 | EXC_REAL_END(machine_check, 0x200, 0x100) |
191 | EXC_VIRT_NONE(0x4200, 0x100) | |
afcf0095 NP |
192 | TRAMP_REAL_BEGIN(machine_check_powernv_early) |
193 | BEGIN_FTR_SECTION | |
194 | EXCEPTION_PROLOG_1(PACA_EXMC, NOTEST, 0x200) | |
195 | /* | |
196 | * Register contents: | |
197 | * R13 = PACA | |
198 | * R9 = CR | |
199 | * Original R9 to R13 is saved on PACA_EXMC | |
200 | * | |
201 | * Switch to mc_emergency stack and handle re-entrancy (we limit | |
202 | * the nested MCE upto level 4 to avoid stack overflow). | |
203 | * Save MCE registers srr1, srr0, dar and dsisr and then set ME=1 | |
204 | * | |
205 | * We use paca->in_mce to check whether this is the first entry or | |
206 | * nested machine check. We increment paca->in_mce to track nested | |
207 | * machine checks. | |
208 | * | |
209 | * If this is the first entry then set stack pointer to | |
210 | * paca->mc_emergency_sp, otherwise r1 is already pointing to | |
211 | * stack frame on mc_emergency stack. | |
212 | * | |
213 | * NOTE: We are here with MSR_ME=0 (off), which means we risk a | |
214 | * checkstop if we get another machine check exception before we do | |
215 | * rfid with MSR_ME=1. | |
1945bc45 NP |
216 | * |
217 | * This interrupt can wake directly from idle. If that is the case, | |
218 | * the machine check is handled then the idle wakeup code is called | |
219 | * to restore state. In that case, the POWER9 DD1 idle PACA workaround | |
220 | * is not applied in the early machine check code, which will cause | |
221 | * bugs. | |
afcf0095 NP |
222 | */ |
223 | mr r11,r1 /* Save r1 */ | |
224 | lhz r10,PACA_IN_MCE(r13) | |
225 | cmpwi r10,0 /* Are we in nested machine check */ | |
226 | bne 0f /* Yes, we are. */ | |
227 | /* First machine check entry */ | |
228 | ld r1,PACAMCEMERGSP(r13) /* Use MC emergency stack */ | |
229 | 0: subi r1,r1,INT_FRAME_SIZE /* alloc stack frame */ | |
230 | addi r10,r10,1 /* increment paca->in_mce */ | |
231 | sth r10,PACA_IN_MCE(r13) | |
232 | /* Limit nested MCE to level 4 to avoid stack overflow */ | |
233 | cmpwi r10,4 | |
234 | bgt 2f /* Check if we hit limit of 4 */ | |
235 | std r11,GPR1(r1) /* Save r1 on the stack. */ | |
236 | std r11,0(r1) /* make stack chain pointer */ | |
237 | mfspr r11,SPRN_SRR0 /* Save SRR0 */ | |
238 | std r11,_NIP(r1) | |
239 | mfspr r11,SPRN_SRR1 /* Save SRR1 */ | |
240 | std r11,_MSR(r1) | |
241 | mfspr r11,SPRN_DAR /* Save DAR */ | |
242 | std r11,_DAR(r1) | |
243 | mfspr r11,SPRN_DSISR /* Save DSISR */ | |
244 | std r11,_DSISR(r1) | |
245 | std r9,_CCR(r1) /* Save CR in stackframe */ | |
246 | /* Save r9 through r13 from EXMC save area to stack frame. */ | |
247 | EXCEPTION_PROLOG_COMMON_2(PACA_EXMC) | |
248 | mfmsr r11 /* get MSR value */ | |
249 | ori r11,r11,MSR_ME /* turn on ME bit */ | |
250 | ori r11,r11,MSR_RI /* turn on RI bit */ | |
251 | LOAD_HANDLER(r12, machine_check_handle_early) | |
252 | 1: mtspr SPRN_SRR0,r12 | |
253 | mtspr SPRN_SRR1,r11 | |
254 | rfid | |
255 | b . /* prevent speculative execution */ | |
256 | 2: | |
257 | /* Stack overflow. Stay on emergency stack and panic. | |
258 | * Keep the ME bit off while panic-ing, so that if we hit | |
259 | * another machine check we checkstop. | |
260 | */ | |
261 | addi r1,r1,INT_FRAME_SIZE /* go back to previous stack frame */ | |
262 | ld r11,PACAKMSR(r13) | |
263 | LOAD_HANDLER(r12, unrecover_mce) | |
264 | li r10,MSR_ME | |
265 | andc r11,r11,r10 /* Turn off MSR_ME */ | |
266 | b 1b | |
267 | b . /* prevent speculative execution */ | |
268 | END_FTR_SECTION_IFSET(CPU_FTR_HVMODE) | |
269 | ||
270 | TRAMP_REAL_BEGIN(machine_check_pSeries) | |
271 | .globl machine_check_fwnmi | |
272 | machine_check_fwnmi: | |
273 | SET_SCRATCH0(r13) /* save r13 */ | |
274 | EXCEPTION_PROLOG_0(PACA_EXMC) | |
275 | machine_check_pSeries_0: | |
276 | EXCEPTION_PROLOG_1(PACA_EXMC, KVMTEST_PR, 0x200) | |
277 | /* | |
83a980f7 NP |
278 | * MSR_RI is not enabled, because PACA_EXMC is being used, so a |
279 | * nested machine check corrupts it. machine_check_common enables | |
280 | * MSR_RI. | |
afcf0095 | 281 | */ |
83a980f7 | 282 | EXCEPTION_PROLOG_PSERIES_1_NORI(machine_check_common, EXC_STD) |
afcf0095 NP |
283 | |
284 | TRAMP_KVM_SKIP(PACA_EXMC, 0x200) | |
285 | ||
286 | EXC_COMMON_BEGIN(machine_check_common) | |
287 | /* | |
288 | * Machine check is different because we use a different | |
289 | * save area: PACA_EXMC instead of PACA_EXGEN. | |
290 | */ | |
291 | mfspr r10,SPRN_DAR | |
292 | std r10,PACA_EXMC+EX_DAR(r13) | |
293 | mfspr r10,SPRN_DSISR | |
294 | stw r10,PACA_EXMC+EX_DSISR(r13) | |
295 | EXCEPTION_PROLOG_COMMON(0x200, PACA_EXMC) | |
296 | FINISH_NAP | |
297 | RECONCILE_IRQ_STATE(r10, r11) | |
298 | ld r3,PACA_EXMC+EX_DAR(r13) | |
299 | lwz r4,PACA_EXMC+EX_DSISR(r13) | |
300 | /* Enable MSR_RI when finished with PACA_EXMC */ | |
301 | li r10,MSR_RI | |
302 | mtmsrd r10,1 | |
303 | std r3,_DAR(r1) | |
304 | std r4,_DSISR(r1) | |
305 | bl save_nvgprs | |
306 | addi r3,r1,STACK_FRAME_OVERHEAD | |
307 | bl machine_check_exception | |
308 | b ret_from_except | |
309 | ||
310 | #define MACHINE_CHECK_HANDLER_WINDUP \ | |
311 | /* Clear MSR_RI before setting SRR0 and SRR1. */\ | |
312 | li r0,MSR_RI; \ | |
313 | mfmsr r9; /* get MSR value */ \ | |
314 | andc r9,r9,r0; \ | |
315 | mtmsrd r9,1; /* Clear MSR_RI */ \ | |
316 | /* Move original SRR0 and SRR1 into the respective regs */ \ | |
317 | ld r9,_MSR(r1); \ | |
318 | mtspr SPRN_SRR1,r9; \ | |
319 | ld r3,_NIP(r1); \ | |
320 | mtspr SPRN_SRR0,r3; \ | |
321 | ld r9,_CTR(r1); \ | |
322 | mtctr r9; \ | |
323 | ld r9,_XER(r1); \ | |
324 | mtxer r9; \ | |
325 | ld r9,_LINK(r1); \ | |
326 | mtlr r9; \ | |
327 | REST_GPR(0, r1); \ | |
328 | REST_8GPRS(2, r1); \ | |
329 | REST_GPR(10, r1); \ | |
330 | ld r11,_CCR(r1); \ | |
331 | mtcr r11; \ | |
332 | /* Decrement paca->in_mce. */ \ | |
333 | lhz r12,PACA_IN_MCE(r13); \ | |
334 | subi r12,r12,1; \ | |
335 | sth r12,PACA_IN_MCE(r13); \ | |
336 | REST_GPR(11, r1); \ | |
337 | REST_2GPRS(12, r1); \ | |
338 | /* restore original r1. */ \ | |
339 | ld r1,GPR1(r1) | |
340 | ||
1945bc45 NP |
341 | #ifdef CONFIG_PPC_P7_NAP |
342 | /* | |
343 | * This is an idle wakeup. Low level machine check has already been | |
344 | * done. Queue the event then call the idle code to do the wake up. | |
345 | */ | |
346 | EXC_COMMON_BEGIN(machine_check_idle_common) | |
347 | bl machine_check_queue_event | |
348 | ||
349 | /* | |
350 | * We have not used any non-volatile GPRs here, and as a rule | |
351 | * most exception code including machine check does not. | |
352 | * Therefore PACA_NAPSTATELOST does not need to be set. Idle | |
353 | * wakeup will restore volatile registers. | |
354 | * | |
355 | * Load the original SRR1 into r3 for pnv_powersave_wakeup_mce. | |
356 | * | |
357 | * Then decrement MCE nesting after finishing with the stack. | |
358 | */ | |
359 | ld r3,_MSR(r1) | |
360 | ||
361 | lhz r11,PACA_IN_MCE(r13) | |
362 | subi r11,r11,1 | |
363 | sth r11,PACA_IN_MCE(r13) | |
364 | ||
365 | /* Turn off the RI bit because SRR1 is used by idle wakeup code. */ | |
366 | /* Recoverability could be improved by reducing the use of SRR1. */ | |
367 | li r11,0 | |
368 | mtmsrd r11,1 | |
369 | ||
370 | b pnv_powersave_wakeup_mce | |
371 | #endif | |
afcf0095 NP |
372 | /* |
373 | * Handle machine check early in real mode. We come here with | |
374 | * ME=1, MMU (IR=0 and DR=0) off and using MC emergency stack. | |
375 | */ | |
376 | EXC_COMMON_BEGIN(machine_check_handle_early) | |
377 | std r0,GPR0(r1) /* Save r0 */ | |
378 | EXCEPTION_PROLOG_COMMON_3(0x200) | |
379 | bl save_nvgprs | |
380 | addi r3,r1,STACK_FRAME_OVERHEAD | |
381 | bl machine_check_early | |
382 | std r3,RESULT(r1) /* Save result */ | |
383 | ld r12,_MSR(r1) | |
1945bc45 | 384 | |
afcf0095 NP |
385 | #ifdef CONFIG_PPC_P7_NAP |
386 | /* | |
387 | * Check if thread was in power saving mode. We come here when any | |
388 | * of the following is true: | |
389 | * a. thread wasn't in power saving mode | |
390 | * b. thread was in power saving mode with no state loss, | |
391 | * supervisor state loss or hypervisor state loss. | |
392 | * | |
393 | * Go back to nap/sleep/winkle mode again if (b) is true. | |
394 | */ | |
1945bc45 NP |
395 | BEGIN_FTR_SECTION |
396 | rlwinm. r11,r12,47-31,30,31 | |
6102c005 | 397 | bne machine_check_idle_common |
1945bc45 | 398 | END_FTR_SECTION_IFSET(CPU_FTR_HVMODE | CPU_FTR_ARCH_206) |
afcf0095 | 399 | #endif |
1945bc45 | 400 | |
afcf0095 NP |
401 | /* |
402 | * Check if we are coming from hypervisor userspace. If yes then we | |
403 | * continue in host kernel in V mode to deliver the MC event. | |
404 | */ | |
405 | rldicl. r11,r12,4,63 /* See if MC hit while in HV mode. */ | |
406 | beq 5f | |
407 | andi. r11,r12,MSR_PR /* See if coming from user. */ | |
408 | bne 9f /* continue in V mode if we are. */ | |
409 | ||
410 | 5: | |
411 | #ifdef CONFIG_KVM_BOOK3S_64_HANDLER | |
412 | /* | |
413 | * We are coming from kernel context. Check if we are coming from | |
414 | * guest. if yes, then we can continue. We will fall through | |
415 | * do_kvm_200->kvmppc_interrupt to deliver the MC event to guest. | |
416 | */ | |
417 | lbz r11,HSTATE_IN_GUEST(r13) | |
418 | cmpwi r11,0 /* Check if coming from guest */ | |
419 | bne 9f /* continue if we are. */ | |
420 | #endif | |
421 | /* | |
422 | * At this point we are not sure about what context we come from. | |
423 | * Queue up the MCE event and return from the interrupt. | |
424 | * But before that, check if this is an un-recoverable exception. | |
425 | * If yes, then stay on emergency stack and panic. | |
426 | */ | |
427 | andi. r11,r12,MSR_RI | |
428 | bne 2f | |
429 | 1: mfspr r11,SPRN_SRR0 | |
430 | LOAD_HANDLER(r10,unrecover_mce) | |
431 | mtspr SPRN_SRR0,r10 | |
432 | ld r10,PACAKMSR(r13) | |
433 | /* | |
434 | * We are going down. But there are chances that we might get hit by | |
435 | * another MCE during panic path and we may run into unstable state | |
436 | * with no way out. Hence, turn ME bit off while going down, so that | |
437 | * when another MCE is hit during panic path, system will checkstop | |
438 | * and hypervisor will get restarted cleanly by SP. | |
439 | */ | |
440 | li r3,MSR_ME | |
441 | andc r10,r10,r3 /* Turn off MSR_ME */ | |
442 | mtspr SPRN_SRR1,r10 | |
443 | rfid | |
444 | b . | |
445 | 2: | |
446 | /* | |
447 | * Check if we have successfully handled/recovered from error, if not | |
448 | * then stay on emergency stack and panic. | |
449 | */ | |
450 | ld r3,RESULT(r1) /* Load result */ | |
451 | cmpdi r3,0 /* see if we handled MCE successfully */ | |
452 | ||
453 | beq 1b /* if !handled then panic */ | |
454 | /* | |
455 | * Return from MC interrupt. | |
456 | * Queue up the MCE event so that we can log it later, while | |
457 | * returning from kernel or opal call. | |
458 | */ | |
459 | bl machine_check_queue_event | |
460 | MACHINE_CHECK_HANDLER_WINDUP | |
461 | rfid | |
462 | 9: | |
463 | /* Deliver the machine check to host kernel in V mode. */ | |
464 | MACHINE_CHECK_HANDLER_WINDUP | |
465 | b machine_check_pSeries | |
466 | ||
467 | EXC_COMMON_BEGIN(unrecover_mce) | |
468 | /* Invoke machine_check_exception to print MCE event and panic. */ | |
469 | addi r3,r1,STACK_FRAME_OVERHEAD | |
470 | bl machine_check_exception | |
471 | /* | |
472 | * We will not reach here. Even if we did, there is no way out. Call | |
473 | * unrecoverable_exception and die. | |
474 | */ | |
475 | 1: addi r3,r1,STACK_FRAME_OVERHEAD | |
476 | bl unrecoverable_exception | |
477 | b 1b | |
478 | ||
0ebc4cda | 479 | |
1a6822d1 NP |
480 | EXC_REAL(data_access, 0x300, 0x80) |
481 | EXC_VIRT(data_access, 0x4300, 0x80, 0x300) | |
80795e6c NP |
482 | TRAMP_KVM_SKIP(PACA_EXGEN, 0x300) |
483 | ||
484 | EXC_COMMON_BEGIN(data_access_common) | |
485 | /* | |
486 | * Here r13 points to the paca, r9 contains the saved CR, | |
487 | * SRR0 and SRR1 are saved in r11 and r12, | |
488 | * r9 - r13 are saved in paca->exgen. | |
489 | */ | |
490 | mfspr r10,SPRN_DAR | |
491 | std r10,PACA_EXGEN+EX_DAR(r13) | |
492 | mfspr r10,SPRN_DSISR | |
493 | stw r10,PACA_EXGEN+EX_DSISR(r13) | |
494 | EXCEPTION_PROLOG_COMMON(0x300, PACA_EXGEN) | |
495 | RECONCILE_IRQ_STATE(r10, r11) | |
496 | ld r12,_MSR(r1) | |
497 | ld r3,PACA_EXGEN+EX_DAR(r13) | |
498 | lwz r4,PACA_EXGEN+EX_DSISR(r13) | |
499 | li r5,0x300 | |
500 | std r3,_DAR(r1) | |
501 | std r4,_DSISR(r1) | |
502 | BEGIN_MMU_FTR_SECTION | |
503 | b do_hash_page /* Try to handle as hpte fault */ | |
504 | MMU_FTR_SECTION_ELSE | |
505 | b handle_page_fault | |
506 | ALT_MMU_FTR_SECTION_END_IFCLR(MMU_FTR_TYPE_RADIX) | |
507 | ||
0ebc4cda | 508 | |
1a6822d1 | 509 | EXC_REAL_BEGIN(data_access_slb, 0x380, 0x80) |
673b189a | 510 | SET_SCRATCH0(r13) |
1707dd16 | 511 | EXCEPTION_PROLOG_0(PACA_EXSLB) |
da2bc464 | 512 | EXCEPTION_PROLOG_1(PACA_EXSLB, KVMTEST_PR, 0x380) |
0ebc4cda BH |
513 | std r3,PACA_EXSLB+EX_R3(r13) |
514 | mfspr r3,SPRN_DAR | |
b01c8b54 | 515 | mfspr r12,SPRN_SRR1 |
f0f558b1 | 516 | crset 4*cr6+eq |
0ebc4cda | 517 | #ifndef CONFIG_RELOCATABLE |
b1576fec | 518 | b slb_miss_realmode |
0ebc4cda BH |
519 | #else |
520 | /* | |
ad0289e4 | 521 | * We can't just use a direct branch to slb_miss_realmode |
0ebc4cda BH |
522 | * because the distance from here to there depends on where |
523 | * the kernel ends up being put. | |
524 | */ | |
525 | mfctr r11 | |
ad0289e4 | 526 | LOAD_HANDLER(r10, slb_miss_realmode) |
0ebc4cda BH |
527 | mtctr r10 |
528 | bctr | |
529 | #endif | |
1a6822d1 | 530 | EXC_REAL_END(data_access_slb, 0x380, 0x80) |
0ebc4cda | 531 | |
1a6822d1 | 532 | EXC_VIRT_BEGIN(data_access_slb, 0x4380, 0x80) |
2b9af6e4 NP |
533 | SET_SCRATCH0(r13) |
534 | EXCEPTION_PROLOG_0(PACA_EXSLB) | |
535 | EXCEPTION_PROLOG_1(PACA_EXSLB, NOTEST, 0x380) | |
536 | std r3,PACA_EXSLB+EX_R3(r13) | |
537 | mfspr r3,SPRN_DAR | |
538 | mfspr r12,SPRN_SRR1 | |
539 | crset 4*cr6+eq | |
540 | #ifndef CONFIG_RELOCATABLE | |
541 | b slb_miss_realmode | |
542 | #else | |
543 | /* | |
544 | * We can't just use a direct branch to slb_miss_realmode | |
545 | * because the distance from here to there depends on where | |
546 | * the kernel ends up being put. | |
547 | */ | |
548 | mfctr r11 | |
549 | LOAD_HANDLER(r10, slb_miss_realmode) | |
550 | mtctr r10 | |
551 | bctr | |
552 | #endif | |
1a6822d1 | 553 | EXC_VIRT_END(data_access_slb, 0x4380, 0x80) |
2b9af6e4 NP |
554 | TRAMP_KVM_SKIP(PACA_EXSLB, 0x380) |
555 | ||
556 | ||
1a6822d1 NP |
557 | EXC_REAL(instruction_access, 0x400, 0x80) |
558 | EXC_VIRT(instruction_access, 0x4400, 0x80, 0x400) | |
27ce77df NP |
559 | TRAMP_KVM(PACA_EXGEN, 0x400) |
560 | ||
561 | EXC_COMMON_BEGIN(instruction_access_common) | |
562 | EXCEPTION_PROLOG_COMMON(0x400, PACA_EXGEN) | |
563 | RECONCILE_IRQ_STATE(r10, r11) | |
564 | ld r12,_MSR(r1) | |
565 | ld r3,_NIP(r1) | |
566 | andis. r4,r12,0x5820 | |
567 | li r5,0x400 | |
568 | std r3,_DAR(r1) | |
569 | std r4,_DSISR(r1) | |
570 | BEGIN_MMU_FTR_SECTION | |
571 | b do_hash_page /* Try to handle as hpte fault */ | |
572 | MMU_FTR_SECTION_ELSE | |
573 | b handle_page_fault | |
574 | ALT_MMU_FTR_SECTION_END_IFCLR(MMU_FTR_TYPE_RADIX) | |
575 | ||
0ebc4cda | 576 | |
1a6822d1 | 577 | EXC_REAL_BEGIN(instruction_access_slb, 0x480, 0x80) |
673b189a | 578 | SET_SCRATCH0(r13) |
1707dd16 | 579 | EXCEPTION_PROLOG_0(PACA_EXSLB) |
da2bc464 | 580 | EXCEPTION_PROLOG_1(PACA_EXSLB, KVMTEST_PR, 0x480) |
0ebc4cda BH |
581 | std r3,PACA_EXSLB+EX_R3(r13) |
582 | mfspr r3,SPRN_SRR0 /* SRR0 is faulting address */ | |
b01c8b54 | 583 | mfspr r12,SPRN_SRR1 |
f0f558b1 | 584 | crclr 4*cr6+eq |
0ebc4cda | 585 | #ifndef CONFIG_RELOCATABLE |
b1576fec | 586 | b slb_miss_realmode |
0ebc4cda BH |
587 | #else |
588 | mfctr r11 | |
ad0289e4 | 589 | LOAD_HANDLER(r10, slb_miss_realmode) |
0ebc4cda BH |
590 | mtctr r10 |
591 | bctr | |
592 | #endif | |
1a6822d1 | 593 | EXC_REAL_END(instruction_access_slb, 0x480, 0x80) |
0ebc4cda | 594 | |
1a6822d1 | 595 | EXC_VIRT_BEGIN(instruction_access_slb, 0x4480, 0x80) |
8d04631a NP |
596 | SET_SCRATCH0(r13) |
597 | EXCEPTION_PROLOG_0(PACA_EXSLB) | |
598 | EXCEPTION_PROLOG_1(PACA_EXSLB, NOTEST, 0x480) | |
599 | std r3,PACA_EXSLB+EX_R3(r13) | |
600 | mfspr r3,SPRN_SRR0 /* SRR0 is faulting address */ | |
601 | mfspr r12,SPRN_SRR1 | |
602 | crclr 4*cr6+eq | |
603 | #ifndef CONFIG_RELOCATABLE | |
604 | b slb_miss_realmode | |
605 | #else | |
606 | mfctr r11 | |
607 | LOAD_HANDLER(r10, slb_miss_realmode) | |
608 | mtctr r10 | |
609 | bctr | |
610 | #endif | |
1a6822d1 | 611 | EXC_VIRT_END(instruction_access_slb, 0x4480, 0x80) |
8d04631a NP |
612 | TRAMP_KVM(PACA_EXSLB, 0x480) |
613 | ||
614 | ||
615 | /* This handler is used by both 0x380 and 0x480 slb miss interrupts */ | |
616 | EXC_COMMON_BEGIN(slb_miss_realmode) | |
617 | /* | |
618 | * r13 points to the PACA, r9 contains the saved CR, | |
619 | * r12 contain the saved SRR1, SRR0 is still ready for return | |
620 | * r3 has the faulting address | |
621 | * r9 - r13 are saved in paca->exslb. | |
622 | * r3 is saved in paca->slb_r3 | |
623 | * cr6.eq is set for a D-SLB miss, clear for a I-SLB miss | |
624 | * We assume we aren't going to take any exceptions during this | |
625 | * procedure. | |
626 | */ | |
627 | mflr r10 | |
628 | #ifdef CONFIG_RELOCATABLE | |
629 | mtctr r11 | |
630 | #endif | |
631 | ||
632 | stw r9,PACA_EXSLB+EX_CCR(r13) /* save CR in exc. frame */ | |
633 | std r10,PACA_EXSLB+EX_LR(r13) /* save LR */ | |
8d04631a NP |
634 | |
635 | crset 4*cr0+eq | |
636 | #ifdef CONFIG_PPC_STD_MMU_64 | |
637 | BEGIN_MMU_FTR_SECTION | |
638 | bl slb_allocate_realmode | |
639 | END_MMU_FTR_SECTION_IFCLR(MMU_FTR_TYPE_RADIX) | |
640 | #endif | |
641 | ||
642 | ld r10,PACA_EXSLB+EX_LR(r13) | |
8d04631a NP |
643 | lwz r9,PACA_EXSLB+EX_CCR(r13) /* get saved CR */ |
644 | mtlr r10 | |
645 | ||
7c28f048 | 646 | beq- 8f /* if bad address, make full stack frame */ |
8d04631a NP |
647 | |
648 | andi. r10,r12,MSR_RI /* check for unrecoverable exception */ | |
649 | beq- 2f | |
650 | ||
651 | /* All done -- return from exception. */ | |
652 | ||
653 | .machine push | |
654 | .machine "power4" | |
655 | mtcrf 0x80,r9 | |
656 | mtcrf 0x02,r9 /* I/D indication is in cr6 */ | |
657 | mtcrf 0x01,r9 /* slb_allocate uses cr0 and cr7 */ | |
658 | .machine pop | |
659 | ||
660 | RESTORE_PPR_PACA(PACA_EXSLB, r9) | |
7c28f048 | 661 | ld r3,PACA_EXSLB+EX_R3(r13) |
8d04631a NP |
662 | ld r9,PACA_EXSLB+EX_R9(r13) |
663 | ld r10,PACA_EXSLB+EX_R10(r13) | |
664 | ld r11,PACA_EXSLB+EX_R11(r13) | |
665 | ld r12,PACA_EXSLB+EX_R12(r13) | |
666 | ld r13,PACA_EXSLB+EX_R13(r13) | |
667 | rfid | |
668 | b . /* prevent speculative execution */ | |
669 | ||
7c28f048 NP |
670 | 2: std r3,PACA_EXSLB+EX_DAR(r13) |
671 | ld r3,PACA_EXSLB+EX_R3(r13) | |
672 | mfspr r11,SPRN_SRR0 | |
8d04631a NP |
673 | LOAD_HANDLER(r10,unrecov_slb) |
674 | mtspr SPRN_SRR0,r10 | |
675 | ld r10,PACAKMSR(r13) | |
676 | mtspr SPRN_SRR1,r10 | |
677 | rfid | |
678 | b . | |
679 | ||
7c28f048 NP |
680 | 8: std r3,PACA_EXSLB+EX_DAR(r13) |
681 | ld r3,PACA_EXSLB+EX_R3(r13) | |
682 | mfspr r11,SPRN_SRR0 | |
8d04631a NP |
683 | LOAD_HANDLER(r10,bad_addr_slb) |
684 | mtspr SPRN_SRR0,r10 | |
685 | ld r10,PACAKMSR(r13) | |
686 | mtspr SPRN_SRR1,r10 | |
687 | rfid | |
688 | b . | |
689 | ||
690 | EXC_COMMON_BEGIN(unrecov_slb) | |
691 | EXCEPTION_PROLOG_COMMON(0x4100, PACA_EXSLB) | |
692 | RECONCILE_IRQ_STATE(r10, r11) | |
693 | bl save_nvgprs | |
694 | 1: addi r3,r1,STACK_FRAME_OVERHEAD | |
695 | bl unrecoverable_exception | |
696 | b 1b | |
697 | ||
698 | EXC_COMMON_BEGIN(bad_addr_slb) | |
699 | EXCEPTION_PROLOG_COMMON(0x380, PACA_EXSLB) | |
700 | RECONCILE_IRQ_STATE(r10, r11) | |
701 | ld r3, PACA_EXSLB+EX_DAR(r13) | |
702 | std r3, _DAR(r1) | |
703 | beq cr6, 2f | |
704 | li r10, 0x480 /* fix trap number for I-SLB miss */ | |
705 | std r10, _TRAP(r1) | |
706 | 2: bl save_nvgprs | |
707 | addi r3, r1, STACK_FRAME_OVERHEAD | |
708 | bl slb_miss_bad_addr | |
709 | b ret_from_except | |
710 | ||
1a6822d1 | 711 | EXC_REAL_BEGIN(hardware_interrupt, 0x500, 0x100) |
b3e6b5df | 712 | .globl hardware_interrupt_hv; |
b3e6b5df | 713 | hardware_interrupt_hv: |
a5d4f3ad | 714 | BEGIN_FTR_SECTION |
da2bc464 | 715 | _MASKABLE_EXCEPTION_PSERIES(0x500, hardware_interrupt_common, |
b01c8b54 | 716 | EXC_HV, SOFTEN_TEST_HV) |
de56a948 | 717 | FTR_SECTION_ELSE |
da2bc464 | 718 | _MASKABLE_EXCEPTION_PSERIES(0x500, hardware_interrupt_common, |
31a40e2b | 719 | EXC_STD, SOFTEN_TEST_PR) |
969391c5 | 720 | ALT_FTR_SECTION_END_IFSET(CPU_FTR_HVMODE | CPU_FTR_ARCH_206) |
1a6822d1 | 721 | EXC_REAL_END(hardware_interrupt, 0x500, 0x100) |
da2bc464 | 722 | |
1a6822d1 | 723 | EXC_VIRT_BEGIN(hardware_interrupt, 0x4500, 0x100) |
c138e588 NP |
724 | .globl hardware_interrupt_relon_hv; |
725 | hardware_interrupt_relon_hv: | |
726 | BEGIN_FTR_SECTION | |
727 | _MASKABLE_RELON_EXCEPTION_PSERIES(0x500, hardware_interrupt_common, EXC_HV, SOFTEN_TEST_HV) | |
728 | FTR_SECTION_ELSE | |
729 | _MASKABLE_RELON_EXCEPTION_PSERIES(0x500, hardware_interrupt_common, EXC_STD, SOFTEN_TEST_PR) | |
730 | ALT_FTR_SECTION_END_IFSET(CPU_FTR_HVMODE) | |
1a6822d1 | 731 | EXC_VIRT_END(hardware_interrupt, 0x4500, 0x100) |
c138e588 | 732 | |
7ede5317 NP |
733 | TRAMP_KVM(PACA_EXGEN, 0x500) |
734 | TRAMP_KVM_HV(PACA_EXGEN, 0x500) | |
c138e588 NP |
735 | EXC_COMMON_ASYNC(hardware_interrupt_common, 0x500, do_IRQ) |
736 | ||
737 | ||
1a6822d1 NP |
738 | EXC_REAL(alignment, 0x600, 0x100) |
739 | EXC_VIRT(alignment, 0x4600, 0x100, 0x600) | |
da2bc464 | 740 | TRAMP_KVM(PACA_EXGEN, 0x600) |
f9aa6714 NP |
741 | EXC_COMMON_BEGIN(alignment_common) |
742 | mfspr r10,SPRN_DAR | |
743 | std r10,PACA_EXGEN+EX_DAR(r13) | |
744 | mfspr r10,SPRN_DSISR | |
745 | stw r10,PACA_EXGEN+EX_DSISR(r13) | |
746 | EXCEPTION_PROLOG_COMMON(0x600, PACA_EXGEN) | |
747 | ld r3,PACA_EXGEN+EX_DAR(r13) | |
748 | lwz r4,PACA_EXGEN+EX_DSISR(r13) | |
749 | std r3,_DAR(r1) | |
750 | std r4,_DSISR(r1) | |
751 | bl save_nvgprs | |
752 | RECONCILE_IRQ_STATE(r10, r11) | |
753 | addi r3,r1,STACK_FRAME_OVERHEAD | |
754 | bl alignment_exception | |
755 | b ret_from_except | |
756 | ||
da2bc464 | 757 | |
1a6822d1 NP |
758 | EXC_REAL(program_check, 0x700, 0x100) |
759 | EXC_VIRT(program_check, 0x4700, 0x100, 0x700) | |
da2bc464 | 760 | TRAMP_KVM(PACA_EXGEN, 0x700) |
11e87346 NP |
761 | EXC_COMMON_BEGIN(program_check_common) |
762 | EXCEPTION_PROLOG_COMMON(0x700, PACA_EXGEN) | |
763 | bl save_nvgprs | |
764 | RECONCILE_IRQ_STATE(r10, r11) | |
765 | addi r3,r1,STACK_FRAME_OVERHEAD | |
766 | bl program_check_exception | |
767 | b ret_from_except | |
768 | ||
b01c8b54 | 769 | |
1a6822d1 NP |
770 | EXC_REAL(fp_unavailable, 0x800, 0x100) |
771 | EXC_VIRT(fp_unavailable, 0x4800, 0x100, 0x800) | |
da2bc464 | 772 | TRAMP_KVM(PACA_EXGEN, 0x800) |
c78d9b97 NP |
773 | EXC_COMMON_BEGIN(fp_unavailable_common) |
774 | EXCEPTION_PROLOG_COMMON(0x800, PACA_EXGEN) | |
775 | bne 1f /* if from user, just load it up */ | |
776 | bl save_nvgprs | |
777 | RECONCILE_IRQ_STATE(r10, r11) | |
778 | addi r3,r1,STACK_FRAME_OVERHEAD | |
779 | bl kernel_fp_unavailable_exception | |
780 | BUG_OPCODE | |
781 | 1: | |
782 | #ifdef CONFIG_PPC_TRANSACTIONAL_MEM | |
783 | BEGIN_FTR_SECTION | |
784 | /* Test if 2 TM state bits are zero. If non-zero (ie. userspace was in | |
785 | * transaction), go do TM stuff | |
786 | */ | |
787 | rldicl. r0, r12, (64-MSR_TS_LG), (64-2) | |
788 | bne- 2f | |
789 | END_FTR_SECTION_IFSET(CPU_FTR_TM) | |
790 | #endif | |
791 | bl load_up_fpu | |
792 | b fast_exception_return | |
793 | #ifdef CONFIG_PPC_TRANSACTIONAL_MEM | |
794 | 2: /* User process was in a transaction */ | |
795 | bl save_nvgprs | |
796 | RECONCILE_IRQ_STATE(r10, r11) | |
797 | addi r3,r1,STACK_FRAME_OVERHEAD | |
798 | bl fp_unavailable_tm | |
799 | b ret_from_except | |
800 | #endif | |
801 | ||
a5d4f3ad | 802 | |
1a6822d1 NP |
803 | EXC_REAL_MASKABLE(decrementer, 0x900, 0x80) |
804 | EXC_VIRT_MASKABLE(decrementer, 0x4900, 0x80, 0x900) | |
39c0da57 NP |
805 | TRAMP_KVM(PACA_EXGEN, 0x900) |
806 | EXC_COMMON_ASYNC(decrementer_common, 0x900, timer_interrupt) | |
807 | ||
a485c709 | 808 | |
1a6822d1 NP |
809 | EXC_REAL_HV(hdecrementer, 0x980, 0x80) |
810 | EXC_VIRT_HV(hdecrementer, 0x4980, 0x80, 0x980) | |
facc6d74 NP |
811 | TRAMP_KVM_HV(PACA_EXGEN, 0x980) |
812 | EXC_COMMON(hdecrementer_common, 0x980, hdec_interrupt) | |
813 | ||
a5d4f3ad | 814 | |
1a6822d1 NP |
815 | EXC_REAL_MASKABLE(doorbell_super, 0xa00, 0x100) |
816 | EXC_VIRT_MASKABLE(doorbell_super, 0x4a00, 0x100, 0xa00) | |
da2bc464 | 817 | TRAMP_KVM(PACA_EXGEN, 0xa00) |
ca243163 NP |
818 | #ifdef CONFIG_PPC_DOORBELL |
819 | EXC_COMMON_ASYNC(doorbell_super_common, 0xa00, doorbell_exception) | |
820 | #else | |
821 | EXC_COMMON_ASYNC(doorbell_super_common, 0xa00, unknown_exception) | |
822 | #endif | |
823 | ||
0ebc4cda | 824 | |
1a6822d1 NP |
825 | EXC_REAL(trap_0b, 0xb00, 0x100) |
826 | EXC_VIRT(trap_0b, 0x4b00, 0x100, 0xb00) | |
da2bc464 | 827 | TRAMP_KVM(PACA_EXGEN, 0xb00) |
341215dc NP |
828 | EXC_COMMON(trap_0b_common, 0xb00, unknown_exception) |
829 | ||
acd7d8ce NP |
830 | /* |
831 | * system call / hypercall (0xc00, 0x4c00) | |
832 | * | |
833 | * The system call exception is invoked with "sc 0" and does not alter HV bit. | |
834 | * There is support for kernel code to invoke system calls but there are no | |
835 | * in-tree users. | |
836 | * | |
837 | * The hypercall is invoked with "sc 1" and sets HV=1. | |
838 | * | |
839 | * In HPT, sc 1 always goes to 0xc00 real mode. In RADIX, sc 1 can go to | |
840 | * 0x4c00 virtual mode. | |
841 | * | |
842 | * Call convention: | |
843 | * | |
844 | * syscall register convention is in Documentation/powerpc/syscall64-abi.txt | |
845 | * | |
846 | * For hypercalls, the register convention is as follows: | |
847 | * r0 volatile | |
848 | * r1-2 nonvolatile | |
849 | * r3 volatile parameter and return value for status | |
850 | * r4-r10 volatile input and output value | |
851 | * r11 volatile hypercall number and output value | |
852 | * r12 volatile | |
853 | * r13-r31 nonvolatile | |
854 | * LR nonvolatile | |
855 | * CTR volatile | |
856 | * XER volatile | |
857 | * CR0-1 CR5-7 volatile | |
858 | * CR2-4 nonvolatile | |
859 | * Other registers nonvolatile | |
860 | * | |
861 | * The intersection of volatile registers that don't contain possible | |
862 | * inputs is: r12, cr0, xer, ctr. We may use these as scratch regs | |
863 | * upon entry without saving. | |
864 | */ | |
bc355125 | 865 | #ifdef CONFIG_KVM_BOOK3S_64_HANDLER |
acd7d8ce NP |
866 | /* |
867 | * There is a little bit of juggling to get syscall and hcall | |
868 | * working well. Save r10 in ctr to be restored in case it is a | |
869 | * hcall. | |
870 | * | |
871 | * Userspace syscalls have already saved the PPR, hcalls must save | |
872 | * it before setting HMT_MEDIUM. | |
873 | */ | |
bc355125 | 874 | #define SYSCALL_KVMTEST \ |
acd7d8ce | 875 | mr r12,r13; \ |
bc355125 | 876 | GET_PACA(r13); \ |
acd7d8ce NP |
877 | mtctr r10; \ |
878 | KVMTEST_PR(0xc00); /* uses r10, branch to do_kvm_0xc00_system_call */ \ | |
bc355125 | 879 | HMT_MEDIUM; \ |
acd7d8ce | 880 | mr r9,r12; \ |
bc355125 PM |
881 | |
882 | #else | |
883 | #define SYSCALL_KVMTEST \ | |
acd7d8ce NP |
884 | HMT_MEDIUM; \ |
885 | mr r9,r13; \ | |
886 | GET_PACA(r13); | |
bc355125 PM |
887 | #endif |
888 | ||
fb479e44 NP |
889 | #define LOAD_SYSCALL_HANDLER(reg) \ |
890 | __LOAD_HANDLER(reg, system_call_common) | |
d807ad37 | 891 | |
acd7d8ce | 892 | #define SYSCALL_FASTENDIAN_TEST \ |
d807ad37 NP |
893 | BEGIN_FTR_SECTION \ |
894 | cmpdi r0,0x1ebe ; \ | |
895 | beq- 1f ; \ | |
896 | END_FTR_SECTION_IFSET(CPU_FTR_REAL_LE) \ | |
d807ad37 | 897 | |
acd7d8ce NP |
898 | /* |
899 | * After SYSCALL_KVMTEST, we reach here with PACA in r13, r13 in r9, | |
900 | * and HMT_MEDIUM. | |
901 | */ | |
902 | #define SYSCALL_REAL \ | |
903 | mfspr r11,SPRN_SRR0 ; \ | |
d807ad37 NP |
904 | mfspr r12,SPRN_SRR1 ; \ |
905 | LOAD_SYSCALL_HANDLER(r10) ; \ | |
906 | mtspr SPRN_SRR0,r10 ; \ | |
907 | ld r10,PACAKMSR(r13) ; \ | |
908 | mtspr SPRN_SRR1,r10 ; \ | |
909 | rfid ; \ | |
910 | b . ; /* prevent speculative execution */ | |
911 | ||
acd7d8ce | 912 | #define SYSCALL_FASTENDIAN \ |
d807ad37 NP |
913 | /* Fast LE/BE switch system call */ \ |
914 | 1: mfspr r12,SPRN_SRR1 ; \ | |
915 | xori r12,r12,MSR_LE ; \ | |
916 | mtspr SPRN_SRR1,r12 ; \ | |
acd7d8ce | 917 | mr r13,r9 ; \ |
d807ad37 NP |
918 | rfid ; /* return to userspace */ \ |
919 | b . ; /* prevent speculative execution */ | |
920 | ||
921 | #if defined(CONFIG_RELOCATABLE) | |
922 | /* | |
923 | * We can't branch directly so we do it via the CTR which | |
924 | * is volatile across system calls. | |
925 | */ | |
acd7d8ce NP |
926 | #define SYSCALL_VIRT \ |
927 | LOAD_SYSCALL_HANDLER(r10) ; \ | |
928 | mtctr r10 ; \ | |
929 | mfspr r11,SPRN_SRR0 ; \ | |
d807ad37 NP |
930 | mfspr r12,SPRN_SRR1 ; \ |
931 | li r10,MSR_RI ; \ | |
932 | mtmsrd r10,1 ; \ | |
933 | bctr ; | |
934 | #else | |
935 | /* We can branch directly */ | |
acd7d8ce NP |
936 | #define SYSCALL_VIRT \ |
937 | mfspr r11,SPRN_SRR0 ; \ | |
d807ad37 NP |
938 | mfspr r12,SPRN_SRR1 ; \ |
939 | li r10,MSR_RI ; \ | |
940 | mtmsrd r10,1 ; /* Set RI (EE=0) */ \ | |
941 | b system_call_common ; | |
942 | #endif | |
943 | ||
1a6822d1 | 944 | EXC_REAL_BEGIN(system_call, 0xc00, 0x100) |
acd7d8ce NP |
945 | SYSCALL_KVMTEST /* loads PACA into r13, and saves r13 to r9 */ |
946 | SYSCALL_FASTENDIAN_TEST | |
947 | SYSCALL_REAL | |
948 | SYSCALL_FASTENDIAN | |
1a6822d1 | 949 | EXC_REAL_END(system_call, 0xc00, 0x100) |
da2bc464 | 950 | |
1a6822d1 | 951 | EXC_VIRT_BEGIN(system_call, 0x4c00, 0x100) |
acd7d8ce NP |
952 | SYSCALL_KVMTEST /* loads PACA into r13, and saves r13 to r9 */ |
953 | SYSCALL_FASTENDIAN_TEST | |
954 | SYSCALL_VIRT | |
955 | SYSCALL_FASTENDIAN | |
1a6822d1 | 956 | EXC_VIRT_END(system_call, 0x4c00, 0x100) |
d807ad37 | 957 | |
acd7d8ce NP |
958 | #ifdef CONFIG_KVM_BOOK3S_64_HANDLER |
959 | /* | |
960 | * This is a hcall, so register convention is as above, with these | |
961 | * differences: | |
962 | * r13 = PACA | |
963 | * r12 = orig r13 | |
964 | * ctr = orig r10 | |
965 | */ | |
966 | TRAMP_KVM_BEGIN(do_kvm_0xc00) | |
967 | /* | |
968 | * Save the PPR (on systems that support it) before changing to | |
969 | * HMT_MEDIUM. That allows the KVM code to save that value into the | |
970 | * guest state (it is the guest's PPR value). | |
971 | */ | |
972 | OPT_GET_SPR(r0, SPRN_PPR, CPU_FTR_HAS_PPR) | |
973 | HMT_MEDIUM | |
974 | OPT_SAVE_REG_TO_PACA(PACA_EXGEN+EX_PPR, r0, CPU_FTR_HAS_PPR) | |
975 | mfctr r10 | |
976 | SET_SCRATCH0(r12) | |
977 | std r9,PACA_EXGEN+EX_R9(r13) | |
978 | mfcr r9 | |
979 | std r10,PACA_EXGEN+EX_R10(r13) | |
980 | KVM_HANDLER(PACA_EXGEN, EXC_STD, 0xc00) | |
981 | #endif | |
da2bc464 | 982 | |
d807ad37 | 983 | |
1a6822d1 NP |
984 | EXC_REAL(single_step, 0xd00, 0x100) |
985 | EXC_VIRT(single_step, 0x4d00, 0x100, 0xd00) | |
da2bc464 | 986 | TRAMP_KVM(PACA_EXGEN, 0xd00) |
bc6675c6 | 987 | EXC_COMMON(single_step_common, 0xd00, single_step_exception) |
b01c8b54 | 988 | |
1a6822d1 | 989 | EXC_REAL_OOL_HV(h_data_storage, 0xe00, 0x20) |
da0e7e62 | 990 | EXC_VIRT_OOL_HV(h_data_storage, 0x4e00, 0x20, 0xe00) |
f5c32c1d NP |
991 | TRAMP_KVM_HV_SKIP(PACA_EXGEN, 0xe00) |
992 | EXC_COMMON_BEGIN(h_data_storage_common) | |
993 | mfspr r10,SPRN_HDAR | |
994 | std r10,PACA_EXGEN+EX_DAR(r13) | |
995 | mfspr r10,SPRN_HDSISR | |
996 | stw r10,PACA_EXGEN+EX_DSISR(r13) | |
997 | EXCEPTION_PROLOG_COMMON(0xe00, PACA_EXGEN) | |
998 | bl save_nvgprs | |
999 | RECONCILE_IRQ_STATE(r10, r11) | |
1000 | addi r3,r1,STACK_FRAME_OVERHEAD | |
1001 | bl unknown_exception | |
1002 | b ret_from_except | |
f5c32c1d | 1003 | |
1707dd16 | 1004 | |
1a6822d1 | 1005 | EXC_REAL_OOL_HV(h_instr_storage, 0xe20, 0x20) |
da0e7e62 | 1006 | EXC_VIRT_OOL_HV(h_instr_storage, 0x4e20, 0x20, 0xe20) |
82517cab NP |
1007 | TRAMP_KVM_HV(PACA_EXGEN, 0xe20) |
1008 | EXC_COMMON(h_instr_storage_common, 0xe20, unknown_exception) | |
1009 | ||
1707dd16 | 1010 | |
1a6822d1 NP |
1011 | EXC_REAL_OOL_HV(emulation_assist, 0xe40, 0x20) |
1012 | EXC_VIRT_OOL_HV(emulation_assist, 0x4e40, 0x20, 0xe40) | |
031b4026 NP |
1013 | TRAMP_KVM_HV(PACA_EXGEN, 0xe40) |
1014 | EXC_COMMON(emulation_assist_common, 0xe40, emulation_assist_interrupt) | |
1015 | ||
1707dd16 | 1016 | |
e0319829 NP |
1017 | /* |
1018 | * hmi_exception trampoline is a special case. It jumps to hmi_exception_early | |
1019 | * first, and then eventaully from there to the trampoline to get into virtual | |
1020 | * mode. | |
1021 | */ | |
1a6822d1 | 1022 | __EXC_REAL_OOL_HV_DIRECT(hmi_exception, 0xe60, 0x20, hmi_exception_early) |
852e5da9 | 1023 | __TRAMP_REAL_OOL_MASKABLE_HV(hmi_exception, 0xe60) |
1a6822d1 | 1024 | EXC_VIRT_NONE(0x4e60, 0x20) |
62f9b03b NP |
1025 | TRAMP_KVM_HV(PACA_EXGEN, 0xe60) |
1026 | TRAMP_REAL_BEGIN(hmi_exception_early) | |
1027 | EXCEPTION_PROLOG_1(PACA_EXGEN, KVMTEST_HV, 0xe60) | |
a4087a4d NP |
1028 | mr r10,r1 /* Save r1 */ |
1029 | ld r1,PACAEMERGSP(r13) /* Use emergency stack for realmode */ | |
62f9b03b | 1030 | subi r1,r1,INT_FRAME_SIZE /* alloc stack frame */ |
62f9b03b | 1031 | mfspr r11,SPRN_HSRR0 /* Save HSRR0 */ |
a4087a4d NP |
1032 | mfspr r12,SPRN_HSRR1 /* Save HSRR1 */ |
1033 | EXCEPTION_PROLOG_COMMON_1() | |
62f9b03b NP |
1034 | EXCEPTION_PROLOG_COMMON_2(PACA_EXGEN) |
1035 | EXCEPTION_PROLOG_COMMON_3(0xe60) | |
1036 | addi r3,r1,STACK_FRAME_OVERHEAD | |
be5c5e84 | 1037 | BRANCH_LINK_TO_FAR(hmi_exception_realmode) /* Function call ABI */ |
62f9b03b NP |
1038 | /* Windup the stack. */ |
1039 | /* Move original HSRR0 and HSRR1 into the respective regs */ | |
1040 | ld r9,_MSR(r1) | |
1041 | mtspr SPRN_HSRR1,r9 | |
1042 | ld r3,_NIP(r1) | |
1043 | mtspr SPRN_HSRR0,r3 | |
1044 | ld r9,_CTR(r1) | |
1045 | mtctr r9 | |
1046 | ld r9,_XER(r1) | |
1047 | mtxer r9 | |
1048 | ld r9,_LINK(r1) | |
1049 | mtlr r9 | |
1050 | REST_GPR(0, r1) | |
1051 | REST_8GPRS(2, r1) | |
1052 | REST_GPR(10, r1) | |
1053 | ld r11,_CCR(r1) | |
1054 | mtcr r11 | |
1055 | REST_GPR(11, r1) | |
1056 | REST_2GPRS(12, r1) | |
1057 | /* restore original r1. */ | |
1058 | ld r1,GPR1(r1) | |
1059 | ||
1060 | /* | |
1061 | * Go to virtual mode and pull the HMI event information from | |
1062 | * firmware. | |
1063 | */ | |
1064 | .globl hmi_exception_after_realmode | |
1065 | hmi_exception_after_realmode: | |
1066 | SET_SCRATCH0(r13) | |
1067 | EXCEPTION_PROLOG_0(PACA_EXGEN) | |
1068 | b tramp_real_hmi_exception | |
1069 | ||
1070 | EXC_COMMON_ASYNC(hmi_exception_common, 0xe60, handle_hmi_exception) | |
1071 | ||
1707dd16 | 1072 | |
1a6822d1 NP |
1073 | EXC_REAL_OOL_MASKABLE_HV(h_doorbell, 0xe80, 0x20) |
1074 | EXC_VIRT_OOL_MASKABLE_HV(h_doorbell, 0x4e80, 0x20, 0xe80) | |
9bcb81bf NP |
1075 | TRAMP_KVM_HV(PACA_EXGEN, 0xe80) |
1076 | #ifdef CONFIG_PPC_DOORBELL | |
1077 | EXC_COMMON_ASYNC(h_doorbell_common, 0xe80, doorbell_exception) | |
1078 | #else | |
1079 | EXC_COMMON_ASYNC(h_doorbell_common, 0xe80, unknown_exception) | |
1080 | #endif | |
1081 | ||
0ebc4cda | 1082 | |
1a6822d1 NP |
1083 | EXC_REAL_OOL_MASKABLE_HV(h_virt_irq, 0xea0, 0x20) |
1084 | EXC_VIRT_OOL_MASKABLE_HV(h_virt_irq, 0x4ea0, 0x20, 0xea0) | |
74408776 NP |
1085 | TRAMP_KVM_HV(PACA_EXGEN, 0xea0) |
1086 | EXC_COMMON_ASYNC(h_virt_irq_common, 0xea0, do_IRQ) | |
1087 | ||
9baaef0a | 1088 | |
1a6822d1 NP |
1089 | EXC_REAL_NONE(0xec0, 0x20) |
1090 | EXC_VIRT_NONE(0x4ec0, 0x20) | |
1091 | EXC_REAL_NONE(0xee0, 0x20) | |
1092 | EXC_VIRT_NONE(0x4ee0, 0x20) | |
bda7fea2 | 1093 | |
0ebc4cda | 1094 | |
1a6822d1 NP |
1095 | EXC_REAL_OOL(performance_monitor, 0xf00, 0x20) |
1096 | EXC_VIRT_OOL(performance_monitor, 0x4f00, 0x20, 0xf00) | |
b1c7f150 NP |
1097 | TRAMP_KVM(PACA_EXGEN, 0xf00) |
1098 | EXC_COMMON_ASYNC(performance_monitor_common, 0xf00, performance_monitor_exception) | |
1099 | ||
0ebc4cda | 1100 | |
1a6822d1 NP |
1101 | EXC_REAL_OOL(altivec_unavailable, 0xf20, 0x20) |
1102 | EXC_VIRT_OOL(altivec_unavailable, 0x4f20, 0x20, 0xf20) | |
d1a0ca9c NP |
1103 | TRAMP_KVM(PACA_EXGEN, 0xf20) |
1104 | EXC_COMMON_BEGIN(altivec_unavailable_common) | |
1105 | EXCEPTION_PROLOG_COMMON(0xf20, PACA_EXGEN) | |
1106 | #ifdef CONFIG_ALTIVEC | |
1107 | BEGIN_FTR_SECTION | |
1108 | beq 1f | |
1109 | #ifdef CONFIG_PPC_TRANSACTIONAL_MEM | |
1110 | BEGIN_FTR_SECTION_NESTED(69) | |
1111 | /* Test if 2 TM state bits are zero. If non-zero (ie. userspace was in | |
1112 | * transaction), go do TM stuff | |
1113 | */ | |
1114 | rldicl. r0, r12, (64-MSR_TS_LG), (64-2) | |
1115 | bne- 2f | |
1116 | END_FTR_SECTION_NESTED(CPU_FTR_TM, CPU_FTR_TM, 69) | |
1117 | #endif | |
1118 | bl load_up_altivec | |
1119 | b fast_exception_return | |
1120 | #ifdef CONFIG_PPC_TRANSACTIONAL_MEM | |
1121 | 2: /* User process was in a transaction */ | |
1122 | bl save_nvgprs | |
1123 | RECONCILE_IRQ_STATE(r10, r11) | |
1124 | addi r3,r1,STACK_FRAME_OVERHEAD | |
1125 | bl altivec_unavailable_tm | |
1126 | b ret_from_except | |
1127 | #endif | |
1128 | 1: | |
1129 | END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC) | |
1130 | #endif | |
1131 | bl save_nvgprs | |
1132 | RECONCILE_IRQ_STATE(r10, r11) | |
1133 | addi r3,r1,STACK_FRAME_OVERHEAD | |
1134 | bl altivec_unavailable_exception | |
1135 | b ret_from_except | |
1136 | ||
0ebc4cda | 1137 | |
1a6822d1 NP |
1138 | EXC_REAL_OOL(vsx_unavailable, 0xf40, 0x20) |
1139 | EXC_VIRT_OOL(vsx_unavailable, 0x4f40, 0x20, 0xf40) | |
792cbddd NP |
1140 | TRAMP_KVM(PACA_EXGEN, 0xf40) |
1141 | EXC_COMMON_BEGIN(vsx_unavailable_common) | |
1142 | EXCEPTION_PROLOG_COMMON(0xf40, PACA_EXGEN) | |
1143 | #ifdef CONFIG_VSX | |
1144 | BEGIN_FTR_SECTION | |
1145 | beq 1f | |
1146 | #ifdef CONFIG_PPC_TRANSACTIONAL_MEM | |
1147 | BEGIN_FTR_SECTION_NESTED(69) | |
1148 | /* Test if 2 TM state bits are zero. If non-zero (ie. userspace was in | |
1149 | * transaction), go do TM stuff | |
1150 | */ | |
1151 | rldicl. r0, r12, (64-MSR_TS_LG), (64-2) | |
1152 | bne- 2f | |
1153 | END_FTR_SECTION_NESTED(CPU_FTR_TM, CPU_FTR_TM, 69) | |
1154 | #endif | |
1155 | b load_up_vsx | |
1156 | #ifdef CONFIG_PPC_TRANSACTIONAL_MEM | |
1157 | 2: /* User process was in a transaction */ | |
1158 | bl save_nvgprs | |
1159 | RECONCILE_IRQ_STATE(r10, r11) | |
1160 | addi r3,r1,STACK_FRAME_OVERHEAD | |
1161 | bl vsx_unavailable_tm | |
1162 | b ret_from_except | |
1163 | #endif | |
1164 | 1: | |
1165 | END_FTR_SECTION_IFSET(CPU_FTR_VSX) | |
1166 | #endif | |
1167 | bl save_nvgprs | |
1168 | RECONCILE_IRQ_STATE(r10, r11) | |
1169 | addi r3,r1,STACK_FRAME_OVERHEAD | |
1170 | bl vsx_unavailable_exception | |
1171 | b ret_from_except | |
1172 | ||
da2bc464 | 1173 | |
1a6822d1 NP |
1174 | EXC_REAL_OOL(facility_unavailable, 0xf60, 0x20) |
1175 | EXC_VIRT_OOL(facility_unavailable, 0x4f60, 0x20, 0xf60) | |
1134713c NP |
1176 | TRAMP_KVM(PACA_EXGEN, 0xf60) |
1177 | EXC_COMMON(facility_unavailable_common, 0xf60, facility_unavailable_exception) | |
1178 | ||
da2bc464 | 1179 | |
1a6822d1 NP |
1180 | EXC_REAL_OOL_HV(h_facility_unavailable, 0xf80, 0x20) |
1181 | EXC_VIRT_OOL_HV(h_facility_unavailable, 0x4f80, 0x20, 0xf80) | |
14b0072c NP |
1182 | TRAMP_KVM_HV(PACA_EXGEN, 0xf80) |
1183 | EXC_COMMON(h_facility_unavailable_common, 0xf80, facility_unavailable_exception) | |
1184 | ||
da2bc464 | 1185 | |
1a6822d1 NP |
1186 | EXC_REAL_NONE(0xfa0, 0x20) |
1187 | EXC_VIRT_NONE(0x4fa0, 0x20) | |
1188 | EXC_REAL_NONE(0xfc0, 0x20) | |
1189 | EXC_VIRT_NONE(0x4fc0, 0x20) | |
1190 | EXC_REAL_NONE(0xfe0, 0x20) | |
1191 | EXC_VIRT_NONE(0x4fe0, 0x20) | |
1192 | ||
1193 | EXC_REAL_NONE(0x1000, 0x100) | |
1194 | EXC_VIRT_NONE(0x5000, 0x100) | |
1195 | EXC_REAL_NONE(0x1100, 0x100) | |
1196 | EXC_VIRT_NONE(0x5100, 0x100) | |
d0c0c9a1 | 1197 | |
0ebc4cda | 1198 | #ifdef CONFIG_CBE_RAS |
1a6822d1 NP |
1199 | EXC_REAL_HV(cbe_system_error, 0x1200, 0x100) |
1200 | EXC_VIRT_NONE(0x5200, 0x100) | |
da2bc464 | 1201 | TRAMP_KVM_HV_SKIP(PACA_EXGEN, 0x1200) |
ff1b3206 | 1202 | EXC_COMMON(cbe_system_error_common, 0x1200, cbe_system_error_exception) |
da2bc464 | 1203 | #else /* CONFIG_CBE_RAS */ |
1a6822d1 NP |
1204 | EXC_REAL_NONE(0x1200, 0x100) |
1205 | EXC_VIRT_NONE(0x5200, 0x100) | |
da2bc464 | 1206 | #endif |
b01c8b54 | 1207 | |
ff1b3206 | 1208 | |
1a6822d1 NP |
1209 | EXC_REAL(instruction_breakpoint, 0x1300, 0x100) |
1210 | EXC_VIRT(instruction_breakpoint, 0x5300, 0x100, 0x1300) | |
da2bc464 | 1211 | TRAMP_KVM_SKIP(PACA_EXGEN, 0x1300) |
4e96dbbf NP |
1212 | EXC_COMMON(instruction_breakpoint_common, 0x1300, instruction_breakpoint_exception) |
1213 | ||
1a6822d1 NP |
1214 | EXC_REAL_NONE(0x1400, 0x100) |
1215 | EXC_VIRT_NONE(0x5400, 0x100) | |
da2bc464 | 1216 | |
1a6822d1 | 1217 | EXC_REAL_BEGIN(denorm_exception_hv, 0x1500, 0x100) |
b92a66a6 | 1218 | mtspr SPRN_SPRG_HSCRATCH0,r13 |
1707dd16 | 1219 | EXCEPTION_PROLOG_0(PACA_EXGEN) |
630573c1 | 1220 | EXCEPTION_PROLOG_1(PACA_EXGEN, NOTEST, 0x1500) |
b92a66a6 MN |
1221 | |
1222 | #ifdef CONFIG_PPC_DENORMALISATION | |
1223 | mfspr r10,SPRN_HSRR1 | |
1224 | mfspr r11,SPRN_HSRR0 /* save HSRR0 */ | |
afcf0095 NP |
1225 | andis. r10,r10,(HSRR1_DENORM)@h /* denorm? */ |
1226 | addi r11,r11,-4 /* HSRR0 is next instruction */ | |
1227 | bne+ denorm_assist | |
1228 | #endif | |
1e9b4507 | 1229 | |
afcf0095 NP |
1230 | KVMTEST_PR(0x1500) |
1231 | EXCEPTION_PROLOG_PSERIES_1(denorm_common, EXC_HV) | |
1a6822d1 | 1232 | EXC_REAL_END(denorm_exception_hv, 0x1500, 0x100) |
a74599a5 | 1233 | |
d7e89849 | 1234 | #ifdef CONFIG_PPC_DENORMALISATION |
1a6822d1 | 1235 | EXC_VIRT_BEGIN(denorm_exception, 0x5500, 0x100) |
d7e89849 | 1236 | b exc_real_0x1500_denorm_exception_hv |
1a6822d1 | 1237 | EXC_VIRT_END(denorm_exception, 0x5500, 0x100) |
d7e89849 | 1238 | #else |
1a6822d1 | 1239 | EXC_VIRT_NONE(0x5500, 0x100) |
afcf0095 NP |
1240 | #endif |
1241 | ||
d7e89849 | 1242 | TRAMP_KVM_SKIP(PACA_EXGEN, 0x1500) |
b01c8b54 | 1243 | |
b92a66a6 | 1244 | #ifdef CONFIG_PPC_DENORMALISATION |
da2bc464 | 1245 | TRAMP_REAL_BEGIN(denorm_assist) |
b92a66a6 MN |
1246 | BEGIN_FTR_SECTION |
1247 | /* | |
1248 | * To denormalise we need to move a copy of the register to itself. | |
1249 | * For POWER6 do that here for all FP regs. | |
1250 | */ | |
1251 | mfmsr r10 | |
1252 | ori r10,r10,(MSR_FP|MSR_FE0|MSR_FE1) | |
1253 | xori r10,r10,(MSR_FE0|MSR_FE1) | |
1254 | mtmsrd r10 | |
1255 | sync | |
d7c67fb1 MN |
1256 | |
1257 | #define FMR2(n) fmr (n), (n) ; fmr n+1, n+1 | |
1258 | #define FMR4(n) FMR2(n) ; FMR2(n+2) | |
1259 | #define FMR8(n) FMR4(n) ; FMR4(n+4) | |
1260 | #define FMR16(n) FMR8(n) ; FMR8(n+8) | |
1261 | #define FMR32(n) FMR16(n) ; FMR16(n+16) | |
1262 | FMR32(0) | |
1263 | ||
b92a66a6 MN |
1264 | FTR_SECTION_ELSE |
1265 | /* | |
1266 | * To denormalise we need to move a copy of the register to itself. | |
1267 | * For POWER7 do that here for the first 32 VSX registers only. | |
1268 | */ | |
1269 | mfmsr r10 | |
1270 | oris r10,r10,MSR_VSX@h | |
1271 | mtmsrd r10 | |
1272 | sync | |
d7c67fb1 MN |
1273 | |
1274 | #define XVCPSGNDP2(n) XVCPSGNDP(n,n,n) ; XVCPSGNDP(n+1,n+1,n+1) | |
1275 | #define XVCPSGNDP4(n) XVCPSGNDP2(n) ; XVCPSGNDP2(n+2) | |
1276 | #define XVCPSGNDP8(n) XVCPSGNDP4(n) ; XVCPSGNDP4(n+4) | |
1277 | #define XVCPSGNDP16(n) XVCPSGNDP8(n) ; XVCPSGNDP8(n+8) | |
1278 | #define XVCPSGNDP32(n) XVCPSGNDP16(n) ; XVCPSGNDP16(n+16) | |
1279 | XVCPSGNDP32(0) | |
1280 | ||
b92a66a6 | 1281 | ALT_FTR_SECTION_END_IFCLR(CPU_FTR_ARCH_206) |
fb0fce3e MN |
1282 | |
1283 | BEGIN_FTR_SECTION | |
1284 | b denorm_done | |
1285 | END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_207S) | |
1286 | /* | |
1287 | * To denormalise we need to move a copy of the register to itself. | |
1288 | * For POWER8 we need to do that for all 64 VSX registers | |
1289 | */ | |
1290 | XVCPSGNDP32(32) | |
1291 | denorm_done: | |
b92a66a6 MN |
1292 | mtspr SPRN_HSRR0,r11 |
1293 | mtcrf 0x80,r9 | |
1294 | ld r9,PACA_EXGEN+EX_R9(r13) | |
44e9309f | 1295 | RESTORE_PPR_PACA(PACA_EXGEN, r10) |
630573c1 PM |
1296 | BEGIN_FTR_SECTION |
1297 | ld r10,PACA_EXGEN+EX_CFAR(r13) | |
1298 | mtspr SPRN_CFAR,r10 | |
1299 | END_FTR_SECTION_IFSET(CPU_FTR_CFAR) | |
b92a66a6 MN |
1300 | ld r10,PACA_EXGEN+EX_R10(r13) |
1301 | ld r11,PACA_EXGEN+EX_R11(r13) | |
1302 | ld r12,PACA_EXGEN+EX_R12(r13) | |
1303 | ld r13,PACA_EXGEN+EX_R13(r13) | |
1304 | HRFID | |
1305 | b . | |
1306 | #endif | |
1307 | ||
d7e89849 NP |
1308 | EXC_COMMON_HV(denorm_common, 0x1500, unknown_exception) |
1309 | ||
1310 | ||
1311 | #ifdef CONFIG_CBE_RAS | |
1a6822d1 NP |
1312 | EXC_REAL_HV(cbe_maintenance, 0x1600, 0x100) |
1313 | EXC_VIRT_NONE(0x5600, 0x100) | |
d7e89849 | 1314 | TRAMP_KVM_HV_SKIP(PACA_EXGEN, 0x1600) |
69a79344 | 1315 | EXC_COMMON(cbe_maintenance_common, 0x1600, cbe_maintenance_exception) |
d7e89849 | 1316 | #else /* CONFIG_CBE_RAS */ |
1a6822d1 NP |
1317 | EXC_REAL_NONE(0x1600, 0x100) |
1318 | EXC_VIRT_NONE(0x5600, 0x100) | |
d7e89849 NP |
1319 | #endif |
1320 | ||
69a79344 | 1321 | |
1a6822d1 NP |
1322 | EXC_REAL(altivec_assist, 0x1700, 0x100) |
1323 | EXC_VIRT(altivec_assist, 0x5700, 0x100, 0x1700) | |
d7e89849 | 1324 | TRAMP_KVM(PACA_EXGEN, 0x1700) |
b51c079e NP |
1325 | #ifdef CONFIG_ALTIVEC |
1326 | EXC_COMMON(altivec_assist_common, 0x1700, altivec_assist_exception) | |
1327 | #else | |
1328 | EXC_COMMON(altivec_assist_common, 0x1700, unknown_exception) | |
1329 | #endif | |
1330 | ||
d7e89849 NP |
1331 | |
1332 | #ifdef CONFIG_CBE_RAS | |
1a6822d1 NP |
1333 | EXC_REAL_HV(cbe_thermal, 0x1800, 0x100) |
1334 | EXC_VIRT_NONE(0x5800, 0x100) | |
d7e89849 | 1335 | TRAMP_KVM_HV_SKIP(PACA_EXGEN, 0x1800) |
3965f8ab | 1336 | EXC_COMMON(cbe_thermal_common, 0x1800, cbe_thermal_exception) |
d7e89849 | 1337 | #else /* CONFIG_CBE_RAS */ |
1a6822d1 NP |
1338 | EXC_REAL_NONE(0x1800, 0x100) |
1339 | EXC_VIRT_NONE(0x5800, 0x100) | |
d7e89849 NP |
1340 | #endif |
1341 | ||
1342 | ||
0ebc4cda | 1343 | /* |
fe9e1d54 IM |
1344 | * An interrupt came in while soft-disabled. We set paca->irq_happened, then: |
1345 | * - If it was a decrementer interrupt, we bump the dec to max and and return. | |
1346 | * - If it was a doorbell we return immediately since doorbells are edge | |
1347 | * triggered and won't automatically refire. | |
0869b6fd MS |
1348 | * - If it was a HMI we return immediately since we handled it in realmode |
1349 | * and it won't refire. | |
fe9e1d54 IM |
1350 | * - else we hard disable and return. |
1351 | * This is called with r10 containing the value to OR to the paca field. | |
0ebc4cda | 1352 | */ |
7230c564 BH |
1353 | #define MASKED_INTERRUPT(_H) \ |
1354 | masked_##_H##interrupt: \ | |
1355 | std r11,PACA_EXGEN+EX_R11(r13); \ | |
1356 | lbz r11,PACAIRQHAPPENED(r13); \ | |
1357 | or r11,r11,r10; \ | |
1358 | stb r11,PACAIRQHAPPENED(r13); \ | |
fe9e1d54 IM |
1359 | cmpwi r10,PACA_IRQ_DEC; \ |
1360 | bne 1f; \ | |
7230c564 BH |
1361 | lis r10,0x7fff; \ |
1362 | ori r10,r10,0xffff; \ | |
1363 | mtspr SPRN_DEC,r10; \ | |
1364 | b 2f; \ | |
fe9e1d54 | 1365 | 1: cmpwi r10,PACA_IRQ_DBELL; \ |
0869b6fd MS |
1366 | beq 2f; \ |
1367 | cmpwi r10,PACA_IRQ_HMI; \ | |
fe9e1d54 IM |
1368 | beq 2f; \ |
1369 | mfspr r10,SPRN_##_H##SRR1; \ | |
7230c564 BH |
1370 | rldicl r10,r10,48,1; /* clear MSR_EE */ \ |
1371 | rotldi r10,r10,16; \ | |
1372 | mtspr SPRN_##_H##SRR1,r10; \ | |
1373 | 2: mtcrf 0x80,r9; \ | |
1374 | ld r9,PACA_EXGEN+EX_R9(r13); \ | |
1375 | ld r10,PACA_EXGEN+EX_R10(r13); \ | |
1376 | ld r11,PACA_EXGEN+EX_R11(r13); \ | |
1377 | GET_SCRATCH0(r13); \ | |
1378 | ##_H##rfid; \ | |
0ebc4cda | 1379 | b . |
57f26649 NP |
1380 | |
1381 | /* | |
1382 | * Real mode exceptions actually use this too, but alternate | |
1383 | * instruction code patches (which end up in the common .text area) | |
1384 | * cannot reach these if they are put there. | |
1385 | */ | |
1386 | USE_FIXED_SECTION(virt_trampolines) | |
7230c564 BH |
1387 | MASKED_INTERRUPT() |
1388 | MASKED_INTERRUPT(H) | |
0ebc4cda | 1389 | |
4f6c11db | 1390 | #ifdef CONFIG_KVM_BOOK3S_64_HANDLER |
da2bc464 | 1391 | TRAMP_REAL_BEGIN(kvmppc_skip_interrupt) |
4f6c11db PM |
1392 | /* |
1393 | * Here all GPRs are unchanged from when the interrupt happened | |
1394 | * except for r13, which is saved in SPRG_SCRATCH0. | |
1395 | */ | |
1396 | mfspr r13, SPRN_SRR0 | |
1397 | addi r13, r13, 4 | |
1398 | mtspr SPRN_SRR0, r13 | |
1399 | GET_SCRATCH0(r13) | |
1400 | rfid | |
1401 | b . | |
1402 | ||
da2bc464 | 1403 | TRAMP_REAL_BEGIN(kvmppc_skip_Hinterrupt) |
4f6c11db PM |
1404 | /* |
1405 | * Here all GPRs are unchanged from when the interrupt happened | |
1406 | * except for r13, which is saved in SPRG_SCRATCH0. | |
1407 | */ | |
1408 | mfspr r13, SPRN_HSRR0 | |
1409 | addi r13, r13, 4 | |
1410 | mtspr SPRN_HSRR0, r13 | |
1411 | GET_SCRATCH0(r13) | |
1412 | hrfid | |
1413 | b . | |
1414 | #endif | |
1415 | ||
0ebc4cda | 1416 | /* |
057b6d7e HB |
1417 | * Ensure that any handlers that get invoked from the exception prologs |
1418 | * above are below the first 64KB (0x10000) of the kernel image because | |
1419 | * the prologs assemble the addresses of these handlers using the | |
1420 | * LOAD_HANDLER macro, which uses an ori instruction. | |
0ebc4cda BH |
1421 | */ |
1422 | ||
1423 | /*** Common interrupt handlers ***/ | |
1424 | ||
0ebc4cda | 1425 | |
c1fb6816 MN |
1426 | /* |
1427 | * Relocation-on interrupts: A subset of the interrupts can be delivered | |
1428 | * with IR=1/DR=1, if AIL==2 and MSR.HV won't be changed by delivering | |
1429 | * it. Addresses are the same as the original interrupt addresses, but | |
1430 | * offset by 0xc000000000004000. | |
1431 | * It's impossible to receive interrupts below 0x300 via this mechanism. | |
1432 | * KVM: None of these traps are from the guest ; anything that escalated | |
1433 | * to HV=1 from HV=0 is delivered via real mode handlers. | |
1434 | */ | |
1435 | ||
1436 | /* | |
1437 | * This uses the standard macro, since the original 0x300 vector | |
1438 | * only has extra guff for STAB-based processors -- which never | |
1439 | * come here. | |
1440 | */ | |
da2bc464 | 1441 | |
57f26649 | 1442 | EXC_COMMON_BEGIN(ppc64_runlatch_on_trampoline) |
b1576fec | 1443 | b __ppc64_runlatch_on |
fe1952fc | 1444 | |
57f26649 | 1445 | USE_FIXED_SECTION(virt_trampolines) |
8ed8ab40 HB |
1446 | /* |
1447 | * The __end_interrupts marker must be past the out-of-line (OOL) | |
1448 | * handlers, so that they are copied to real address 0x100 when running | |
1449 | * a relocatable kernel. This ensures they can be reached from the short | |
1450 | * trampoline handlers (like 0x4f00, 0x4f20, etc.) which branch | |
1451 | * directly, without using LOAD_HANDLER(). | |
1452 | */ | |
1453 | .align 7 | |
1454 | .globl __end_interrupts | |
1455 | __end_interrupts: | |
57f26649 | 1456 | DEFINE_FIXED_SYMBOL(__end_interrupts) |
61383407 | 1457 | |
087aa036 | 1458 | #ifdef CONFIG_PPC_970_NAP |
7c8cb4b5 | 1459 | EXC_COMMON_BEGIN(power4_fixup_nap) |
087aa036 CG |
1460 | andc r9,r9,r10 |
1461 | std r9,TI_LOCAL_FLAGS(r11) | |
1462 | ld r10,_LINK(r1) /* make idle task do the */ | |
1463 | std r10,_NIP(r1) /* equivalent of a blr */ | |
1464 | blr | |
1465 | #endif | |
1466 | ||
57f26649 NP |
1467 | CLOSE_FIXED_SECTION(real_vectors); |
1468 | CLOSE_FIXED_SECTION(real_trampolines); | |
1469 | CLOSE_FIXED_SECTION(virt_vectors); | |
1470 | CLOSE_FIXED_SECTION(virt_trampolines); | |
1471 | ||
1472 | USE_TEXT_SECTION() | |
1473 | ||
0ebc4cda BH |
1474 | /* |
1475 | * Hash table stuff | |
1476 | */ | |
f4329f2e | 1477 | .balign IFETCH_ALIGN_BYTES |
6a3bab90 | 1478 | do_hash_page: |
caca285e | 1479 | #ifdef CONFIG_PPC_STD_MMU_64 |
9c7cc234 | 1480 | andis. r0,r4,0xa410 /* weird error? */ |
0ebc4cda | 1481 | bne- handle_page_fault /* if not, try to insert a HPTE */ |
9c7cc234 P |
1482 | andis. r0,r4,DSISR_DABRMATCH@h |
1483 | bne- handle_dabr_fault | |
9778b696 | 1484 | CURRENT_THREAD_INFO(r11, r1) |
9c1e1052 PM |
1485 | lwz r0,TI_PREEMPT(r11) /* If we're in an "NMI" */ |
1486 | andis. r0,r0,NMI_MASK@h /* (i.e. an irq when soft-disabled) */ | |
1487 | bne 77f /* then don't call hash_page now */ | |
0ebc4cda BH |
1488 | |
1489 | /* | |
1490 | * r3 contains the faulting address | |
106713a1 | 1491 | * r4 msr |
0ebc4cda | 1492 | * r5 contains the trap number |
aefa5688 | 1493 | * r6 contains dsisr |
0ebc4cda | 1494 | * |
7230c564 | 1495 | * at return r3 = 0 for success, 1 for page fault, negative for error |
0ebc4cda | 1496 | */ |
106713a1 | 1497 | mr r4,r12 |
aefa5688 | 1498 | ld r6,_DSISR(r1) |
106713a1 AK |
1499 | bl __hash_page /* build HPTE if possible */ |
1500 | cmpdi r3,0 /* see if __hash_page succeeded */ | |
0ebc4cda | 1501 | |
7230c564 | 1502 | /* Success */ |
0ebc4cda | 1503 | beq fast_exc_return_irq /* Return from exception on success */ |
0ebc4cda | 1504 | |
7230c564 BH |
1505 | /* Error */ |
1506 | blt- 13f | |
caca285e | 1507 | #endif /* CONFIG_PPC_STD_MMU_64 */ |
9c7cc234 | 1508 | |
0ebc4cda BH |
1509 | /* Here we have a page fault that hash_page can't handle. */ |
1510 | handle_page_fault: | |
0ebc4cda BH |
1511 | 11: ld r4,_DAR(r1) |
1512 | ld r5,_DSISR(r1) | |
1513 | addi r3,r1,STACK_FRAME_OVERHEAD | |
b1576fec | 1514 | bl do_page_fault |
0ebc4cda | 1515 | cmpdi r3,0 |
a546498f | 1516 | beq+ 12f |
b1576fec | 1517 | bl save_nvgprs |
0ebc4cda BH |
1518 | mr r5,r3 |
1519 | addi r3,r1,STACK_FRAME_OVERHEAD | |
1520 | lwz r4,_DAR(r1) | |
b1576fec AB |
1521 | bl bad_page_fault |
1522 | b ret_from_except | |
0ebc4cda | 1523 | |
a546498f BH |
1524 | /* We have a data breakpoint exception - handle it */ |
1525 | handle_dabr_fault: | |
b1576fec | 1526 | bl save_nvgprs |
a546498f BH |
1527 | ld r4,_DAR(r1) |
1528 | ld r5,_DSISR(r1) | |
1529 | addi r3,r1,STACK_FRAME_OVERHEAD | |
b1576fec AB |
1530 | bl do_break |
1531 | 12: b ret_from_except_lite | |
a546498f | 1532 | |
0ebc4cda | 1533 | |
caca285e | 1534 | #ifdef CONFIG_PPC_STD_MMU_64 |
0ebc4cda BH |
1535 | /* We have a page fault that hash_page could handle but HV refused |
1536 | * the PTE insertion | |
1537 | */ | |
b1576fec | 1538 | 13: bl save_nvgprs |
0ebc4cda BH |
1539 | mr r5,r3 |
1540 | addi r3,r1,STACK_FRAME_OVERHEAD | |
1541 | ld r4,_DAR(r1) | |
b1576fec AB |
1542 | bl low_hash_fault |
1543 | b ret_from_except | |
caca285e | 1544 | #endif |
0ebc4cda | 1545 | |
9c1e1052 PM |
1546 | /* |
1547 | * We come here as a result of a DSI at a point where we don't want | |
1548 | * to call hash_page, such as when we are accessing memory (possibly | |
1549 | * user memory) inside a PMU interrupt that occurred while interrupts | |
1550 | * were soft-disabled. We want to invoke the exception handler for | |
1551 | * the access, or panic if there isn't a handler. | |
1552 | */ | |
b1576fec | 1553 | 77: bl save_nvgprs |
9c1e1052 PM |
1554 | mr r4,r3 |
1555 | addi r3,r1,STACK_FRAME_OVERHEAD | |
1556 | li r5,SIGSEGV | |
b1576fec AB |
1557 | bl bad_page_fault |
1558 | b ret_from_except | |
4e2bf01b ME |
1559 | |
1560 | /* | |
1561 | * Here we have detected that the kernel stack pointer is bad. | |
1562 | * R9 contains the saved CR, r13 points to the paca, | |
1563 | * r10 contains the (bad) kernel stack pointer, | |
1564 | * r11 and r12 contain the saved SRR0 and SRR1. | |
1565 | * We switch to using an emergency stack, save the registers there, | |
1566 | * and call kernel_bad_stack(), which panics. | |
1567 | */ | |
1568 | bad_stack: | |
1569 | ld r1,PACAEMERGSP(r13) | |
1570 | subi r1,r1,64+INT_FRAME_SIZE | |
1571 | std r9,_CCR(r1) | |
1572 | std r10,GPR1(r1) | |
1573 | std r11,_NIP(r1) | |
1574 | std r12,_MSR(r1) | |
1575 | mfspr r11,SPRN_DAR | |
1576 | mfspr r12,SPRN_DSISR | |
1577 | std r11,_DAR(r1) | |
1578 | std r12,_DSISR(r1) | |
1579 | mflr r10 | |
1580 | mfctr r11 | |
1581 | mfxer r12 | |
1582 | std r10,_LINK(r1) | |
1583 | std r11,_CTR(r1) | |
1584 | std r12,_XER(r1) | |
1585 | SAVE_GPR(0,r1) | |
1586 | SAVE_GPR(2,r1) | |
1587 | ld r10,EX_R3(r3) | |
1588 | std r10,GPR3(r1) | |
1589 | SAVE_GPR(4,r1) | |
1590 | SAVE_4GPRS(5,r1) | |
1591 | ld r9,EX_R9(r3) | |
1592 | ld r10,EX_R10(r3) | |
1593 | SAVE_2GPRS(9,r1) | |
1594 | ld r9,EX_R11(r3) | |
1595 | ld r10,EX_R12(r3) | |
1596 | ld r11,EX_R13(r3) | |
1597 | std r9,GPR11(r1) | |
1598 | std r10,GPR12(r1) | |
1599 | std r11,GPR13(r1) | |
1600 | BEGIN_FTR_SECTION | |
1601 | ld r10,EX_CFAR(r3) | |
1602 | std r10,ORIG_GPR3(r1) | |
1603 | END_FTR_SECTION_IFSET(CPU_FTR_CFAR) | |
1604 | SAVE_8GPRS(14,r1) | |
1605 | SAVE_10GPRS(22,r1) | |
1606 | lhz r12,PACA_TRAP_SAVE(r13) | |
1607 | std r12,_TRAP(r1) | |
1608 | addi r11,r1,INT_FRAME_SIZE | |
1609 | std r11,0(r1) | |
1610 | li r12,0 | |
1611 | std r12,0(r11) | |
1612 | ld r2,PACATOC(r13) | |
1613 | ld r11,exception_marker@toc(r2) | |
1614 | std r12,RESULT(r1) | |
1615 | std r11,STACK_FRAME_OVERHEAD-16(r1) | |
1616 | 1: addi r3,r1,STACK_FRAME_OVERHEAD | |
1617 | bl kernel_bad_stack | |
1618 | b 1b | |
0f0c6ca1 | 1619 | |
a9af97aa NP |
1620 | /* |
1621 | * When doorbell is triggered from system reset wakeup, the message is | |
1622 | * not cleared, so it would fire again when EE is enabled. | |
1623 | * | |
1624 | * When coming from local_irq_enable, there may be the same problem if | |
1625 | * we were hard disabled. | |
1626 | * | |
1627 | * Execute msgclr to clear pending exceptions before handling it. | |
1628 | */ | |
1629 | h_doorbell_common_msgclr: | |
1630 | LOAD_REG_IMMEDIATE(r3, PPC_DBELL_MSGTYPE << (63-36)) | |
1631 | PPC_MSGCLR(3) | |
1632 | b h_doorbell_common | |
1633 | ||
1634 | doorbell_super_common_msgclr: | |
1635 | LOAD_REG_IMMEDIATE(r3, PPC_DBELL_MSGTYPE << (63-36)) | |
1636 | PPC_MSGCLRP(3) | |
1637 | b doorbell_super_common | |
1638 | ||
0f0c6ca1 NP |
1639 | /* |
1640 | * Called from arch_local_irq_enable when an interrupt needs | |
1641 | * to be resent. r3 contains 0x500, 0x900, 0xa00 or 0xe80 to indicate | |
1642 | * which kind of interrupt. MSR:EE is already off. We generate a | |
1643 | * stackframe like if a real interrupt had happened. | |
1644 | * | |
1645 | * Note: While MSR:EE is off, we need to make sure that _MSR | |
1646 | * in the generated frame has EE set to 1 or the exception | |
1647 | * handler will not properly re-enable them. | |
b48bbb82 NP |
1648 | * |
1649 | * Note that we don't specify LR as the NIP (return address) for | |
1650 | * the interrupt because that would unbalance the return branch | |
1651 | * predictor. | |
0f0c6ca1 NP |
1652 | */ |
1653 | _GLOBAL(__replay_interrupt) | |
1654 | /* We are going to jump to the exception common code which | |
1655 | * will retrieve various register values from the PACA which | |
1656 | * we don't give a damn about, so we don't bother storing them. | |
1657 | */ | |
1658 | mfmsr r12 | |
b48bbb82 | 1659 | LOAD_REG_ADDR(r11, .L__replay_interrupt_return) |
0f0c6ca1 NP |
1660 | mfcr r9 |
1661 | ori r12,r12,MSR_EE | |
1662 | cmpwi r3,0x900 | |
1663 | beq decrementer_common | |
1664 | cmpwi r3,0x500 | |
1665 | beq hardware_interrupt_common | |
1666 | BEGIN_FTR_SECTION | |
1667 | cmpwi r3,0xe80 | |
a9af97aa | 1668 | beq h_doorbell_common_msgclr |
0f0c6ca1 NP |
1669 | cmpwi r3,0xea0 |
1670 | beq h_virt_irq_common | |
1671 | cmpwi r3,0xe60 | |
1672 | beq hmi_exception_common | |
1673 | FTR_SECTION_ELSE | |
1674 | cmpwi r3,0xa00 | |
a9af97aa | 1675 | beq doorbell_super_common_msgclr |
0f0c6ca1 | 1676 | ALT_FTR_SECTION_END_IFSET(CPU_FTR_HVMODE) |
b48bbb82 | 1677 | .L__replay_interrupt_return: |
0f0c6ca1 | 1678 | blr |
b48bbb82 | 1679 |