1
2
3
4
5
6
7
8
9
10
11
12
13
14
15#include <asm/hw_irq.h>
16#include <asm/exception-64s.h>
17#include <asm/ptrace.h>
18#include <asm/cpuidle.h>
19
20
21
22
23
24
25
26
27
28
29
30
31
32#define SYSCALL_PSERIES_1 \
33BEGIN_FTR_SECTION \
34 cmpdi r0,0x1ebe ; \
35 beq- 1f ; \
36END_FTR_SECTION_IFSET(CPU_FTR_REAL_LE) \
37 mr r9,r13 ; \
38 GET_PACA(r13) ; \
39 mfspr r11,SPRN_SRR0 ; \
400:
41
42#define SYSCALL_PSERIES_2_RFID \
43 mfspr r12,SPRN_SRR1 ; \
44 ld r10,PACAKBASE(r13) ; \
45 LOAD_HANDLER(r10, system_call_entry) ; \
46 mtspr SPRN_SRR0,r10 ; \
47 ld r10,PACAKMSR(r13) ; \
48 mtspr SPRN_SRR1,r10 ; \
49 rfid ; \
50 b . ;
51
52#define SYSCALL_PSERIES_3 \
53 \
541: mfspr r12,SPRN_SRR1 ; \
55 xori r12,r12,MSR_LE ; \
56 mtspr SPRN_SRR1,r12 ; \
57 rfid ; \
58 b . ;
59
60
61
62
63
64
65#define SYSCALL_PSERIES_2_DIRECT \
66 mflr r10 ; \
67 ld r12,PACAKBASE(r13) ; \
68 LOAD_HANDLER(r12, system_call_entry) ; \
69 mtctr r12 ; \
70 mfspr r12,SPRN_SRR1 ; \
71 \
72 li r13,MSR_RI ; \
73 mtmsrd r13,1 ; \
74 GET_PACA(r13) ; \
75 bctr ;
76#else
77
78#define SYSCALL_PSERIES_2_DIRECT \
79 mfspr r12,SPRN_SRR1 ; \
80 li r10,MSR_RI ; \
81 mtmsrd r10,1 ; \
82 b system_call_common ;
83#endif
84
85
86
87
88
89
90
91
92
93 . = 0x100
94 .globl __start_interrupts
95__start_interrupts:
96
97 .globl system_reset_pSeries;
98system_reset_pSeries:
99 SET_SCRATCH0(r13)
100#ifdef CONFIG_PPC_P7_NAP
101BEGIN_FTR_SECTION
102
103
104
105 mfspr r13,SPRN_SRR1
106 rlwinm. r13,r13,47-31,30,31
107 beq 9f
108
109 cmpwi cr3,r13,2
110
111
112
113
114
115 GET_PACA(r13)
116 clrldi r5,r13,63
117 clrrdi r13,r13,1
118 cmpwi cr4,r5,1
119 mtspr SPRN_HSPRG0,r13
120
121 lbz r0,PACA_THREAD_IDLE_STATE(r13)
122 cmpwi cr2,r0,PNV_THREAD_NAP
123 bgt cr2,8f
124
125
126 bgt cr3,.
127
128
129 li r0,PNV_THREAD_RUNNING
130 stb r0,PACA_THREAD_IDLE_STATE(r13)
131
132#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
133 li r0,KVM_HWTHREAD_IN_KERNEL
134 stb r0,HSTATE_HWTHREAD_STATE(r13)
135
136 sync
137 lbz r0,HSTATE_HWTHREAD_REQ(r13)
138 cmpwi r0,0
139 beq 1f
140 b kvm_start_guest
1411:
142#endif
143
144
145 mfspr r3,SPRN_SRR1
146 beq cr3,2f
147 b power7_wakeup_noloss
1482: b power7_wakeup_loss
149
150
1518: GET_PACA(r13)
152 b power7_wakeup_tb_loss
153
1549:
155END_FTR_SECTION_IFSET(CPU_FTR_HVMODE | CPU_FTR_ARCH_206)
156#endif
157 EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, system_reset_common, EXC_STD,
158 NOTEST, 0x100)
159
160 . = 0x200
161machine_check_pSeries_1:
162
163
164
165
166 SET_SCRATCH0(r13)
167#ifdef CONFIG_PPC_P7_NAP
168BEGIN_FTR_SECTION
169
170
171
172
173
174 mfspr r13,SPRN_SRR1
175 rlwinm. r13,r13,47-31,30,31
176 OPT_GET_SPR(r13, SPRN_CFAR, CPU_FTR_CFAR)
177 beq 9f
178
179 mfspr r13,SPRN_SRR1
180 rlwinm. r13,r13,47-31,30,31
181
182 cmpwi cr1,r13,2
183
184 OPT_GET_SPR(r13, SPRN_CFAR, CPU_FTR_CFAR)
185 bgt cr1,.
1869:
187 OPT_SET_SPR(r13, SPRN_CFAR, CPU_FTR_CFAR)
188END_FTR_SECTION_IFSET(CPU_FTR_HVMODE | CPU_FTR_ARCH_206)
189#endif
190 EXCEPTION_PROLOG_0(PACA_EXMC)
191BEGIN_FTR_SECTION
192 b machine_check_pSeries_early
193FTR_SECTION_ELSE
194 b machine_check_pSeries_0
195ALT_FTR_SECTION_END_IFSET(CPU_FTR_HVMODE)
196
197 . = 0x300
198 .globl data_access_pSeries
199data_access_pSeries:
200 SET_SCRATCH0(r13)
201 EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, data_access_common, EXC_STD,
202 KVMTEST, 0x300)
203
204 . = 0x380
205 .globl data_access_slb_pSeries
206data_access_slb_pSeries:
207 SET_SCRATCH0(r13)
208 EXCEPTION_PROLOG_0(PACA_EXSLB)
209 EXCEPTION_PROLOG_1(PACA_EXSLB, KVMTEST, 0x380)
210 std r3,PACA_EXSLB+EX_R3(r13)
211 mfspr r3,SPRN_DAR
212#ifdef __DISABLED__
213
214 cmpdi r3,0
215 bge slb_miss_user_pseries
216#endif
217 mfspr r12,SPRN_SRR1
218#ifndef CONFIG_RELOCATABLE
219 b slb_miss_realmode
220#else
221
222
223
224
225
226 mfctr r11
227 ld r10,PACAKBASE(r13)
228 LOAD_HANDLER(r10, slb_miss_realmode)
229 mtctr r10
230 bctr
231#endif
232
233 STD_EXCEPTION_PSERIES(0x400, instruction_access)
234
235 . = 0x480
236 .globl instruction_access_slb_pSeries
237instruction_access_slb_pSeries:
238 SET_SCRATCH0(r13)
239 EXCEPTION_PROLOG_0(PACA_EXSLB)
240 EXCEPTION_PROLOG_1(PACA_EXSLB, KVMTEST, 0x480)
241 std r3,PACA_EXSLB+EX_R3(r13)
242 mfspr r3,SPRN_SRR0
243#ifdef __DISABLED__
244
245 cmpdi r3,0
246 bge slb_miss_user_pseries
247#endif
248 mfspr r12,SPRN_SRR1
249#ifndef CONFIG_RELOCATABLE
250 b slb_miss_realmode
251#else
252 mfctr r11
253 ld r10,PACAKBASE(r13)
254 LOAD_HANDLER(r10, slb_miss_realmode)
255 mtctr r10
256 bctr
257#endif
258
259
260
261
262 . = 0x500;
263 .globl hardware_interrupt_pSeries;
264 .globl hardware_interrupt_hv;
265hardware_interrupt_pSeries:
266hardware_interrupt_hv:
267 BEGIN_FTR_SECTION
268 _MASKABLE_EXCEPTION_PSERIES(0x502, hardware_interrupt,
269 EXC_HV, SOFTEN_TEST_HV)
270 KVM_HANDLER(PACA_EXGEN, EXC_HV, 0x502)
271 FTR_SECTION_ELSE
272 _MASKABLE_EXCEPTION_PSERIES(0x500, hardware_interrupt,
273 EXC_STD, SOFTEN_TEST_PR)
274 KVM_HANDLER(PACA_EXGEN, EXC_STD, 0x500)
275 ALT_FTR_SECTION_END_IFSET(CPU_FTR_HVMODE | CPU_FTR_ARCH_206)
276
277 STD_EXCEPTION_PSERIES(0x600, alignment)
278 KVM_HANDLER(PACA_EXGEN, EXC_STD, 0x600)
279
280 STD_EXCEPTION_PSERIES(0x700, program_check)
281 KVM_HANDLER(PACA_EXGEN, EXC_STD, 0x700)
282
283 STD_EXCEPTION_PSERIES(0x800, fp_unavailable)
284 KVM_HANDLER(PACA_EXGEN, EXC_STD, 0x800)
285
286 . = 0x900
287 .globl decrementer_pSeries
288decrementer_pSeries:
289 _MASKABLE_EXCEPTION_PSERIES(0x900, decrementer, EXC_STD, SOFTEN_TEST_PR)
290
291 STD_EXCEPTION_HV(0x980, 0x982, hdecrementer)
292
293 MASKABLE_EXCEPTION_PSERIES(0xa00, 0xa00, doorbell_super)
294 KVM_HANDLER(PACA_EXGEN, EXC_STD, 0xa00)
295
296 STD_EXCEPTION_PSERIES(0xb00, trap_0b)
297 KVM_HANDLER(PACA_EXGEN, EXC_STD, 0xb00)
298
299 . = 0xc00
300 .globl system_call_pSeries
301system_call_pSeries:
302
303
304
305
306
307
308
309#ifdef CONFIG_KVM_BOOK3S_64_HANDLER
310 SET_SCRATCH0(r13)
311 GET_PACA(r13)
312 std r9,PACA_EXGEN+EX_R9(r13)
313 OPT_GET_SPR(r9, SPRN_PPR, CPU_FTR_HAS_PPR);
314 HMT_MEDIUM;
315 std r10,PACA_EXGEN+EX_R10(r13)
316 OPT_SAVE_REG_TO_PACA(PACA_EXGEN+EX_PPR, r9, CPU_FTR_HAS_PPR);
317 mfcr r9
318 KVMTEST(0xc00)
319 GET_SCRATCH0(r13)
320#else
321 HMT_MEDIUM;
322#endif
323 SYSCALL_PSERIES_1
324 SYSCALL_PSERIES_2_RFID
325 SYSCALL_PSERIES_3
326 KVM_HANDLER(PACA_EXGEN, EXC_STD, 0xc00)
327
328 STD_EXCEPTION_PSERIES(0xd00, single_step)
329 KVM_HANDLER(PACA_EXGEN, EXC_STD, 0xd00)
330
331
332
333
334 . = 0xe00
335hv_data_storage_trampoline:
336 SET_SCRATCH0(r13)
337 EXCEPTION_PROLOG_0(PACA_EXGEN)
338 b h_data_storage_hv
339
340 . = 0xe20
341hv_instr_storage_trampoline:
342 SET_SCRATCH0(r13)
343 EXCEPTION_PROLOG_0(PACA_EXGEN)
344 b h_instr_storage_hv
345
346 . = 0xe40
347emulation_assist_trampoline:
348 SET_SCRATCH0(r13)
349 EXCEPTION_PROLOG_0(PACA_EXGEN)
350 b emulation_assist_hv
351
352 . = 0xe60
353hv_exception_trampoline:
354 SET_SCRATCH0(r13)
355 EXCEPTION_PROLOG_0(PACA_EXGEN)
356 b hmi_exception_early
357
358 . = 0xe80
359hv_doorbell_trampoline:
360 SET_SCRATCH0(r13)
361 EXCEPTION_PROLOG_0(PACA_EXGEN)
362 b h_doorbell_hv
363
364
365
366
367
368
369 . = 0xf00
370performance_monitor_pseries_trampoline:
371 SET_SCRATCH0(r13)
372 EXCEPTION_PROLOG_0(PACA_EXGEN)
373 b performance_monitor_pSeries
374
375 . = 0xf20
376altivec_unavailable_pseries_trampoline:
377 SET_SCRATCH0(r13)
378 EXCEPTION_PROLOG_0(PACA_EXGEN)
379 b altivec_unavailable_pSeries
380
381 . = 0xf40
382vsx_unavailable_pseries_trampoline:
383 SET_SCRATCH0(r13)
384 EXCEPTION_PROLOG_0(PACA_EXGEN)
385 b vsx_unavailable_pSeries
386
387 . = 0xf60
388facility_unavailable_trampoline:
389 SET_SCRATCH0(r13)
390 EXCEPTION_PROLOG_0(PACA_EXGEN)
391 b facility_unavailable_pSeries
392
393 . = 0xf80
394hv_facility_unavailable_trampoline:
395 SET_SCRATCH0(r13)
396 EXCEPTION_PROLOG_0(PACA_EXGEN)
397 b facility_unavailable_hv
398
399#ifdef CONFIG_CBE_RAS
400 STD_EXCEPTION_HV(0x1200, 0x1202, cbe_system_error)
401 KVM_HANDLER_SKIP(PACA_EXGEN, EXC_HV, 0x1202)
402#endif
403
404 STD_EXCEPTION_PSERIES(0x1300, instruction_breakpoint)
405 KVM_HANDLER_SKIP(PACA_EXGEN, EXC_STD, 0x1300)
406
407 . = 0x1500
408 .global denorm_exception_hv
409denorm_exception_hv:
410 mtspr SPRN_SPRG_HSCRATCH0,r13
411 EXCEPTION_PROLOG_0(PACA_EXGEN)
412 EXCEPTION_PROLOG_1(PACA_EXGEN, NOTEST, 0x1500)
413
414#ifdef CONFIG_PPC_DENORMALISATION
415 mfspr r10,SPRN_HSRR1
416 mfspr r11,SPRN_HSRR0
417 andis. r10,r10,(HSRR1_DENORM)@h
418 addi r11,r11,-4
419 bne+ denorm_assist
420#endif
421
422 KVMTEST(0x1500)
423 EXCEPTION_PROLOG_PSERIES_1(denorm_common, EXC_HV)
424 KVM_HANDLER_SKIP(PACA_EXGEN, EXC_STD, 0x1500)
425
426#ifdef CONFIG_CBE_RAS
427 STD_EXCEPTION_HV(0x1600, 0x1602, cbe_maintenance)
428 KVM_HANDLER_SKIP(PACA_EXGEN, EXC_HV, 0x1602)
429#endif
430
431 STD_EXCEPTION_PSERIES(0x1700, altivec_assist)
432 KVM_HANDLER(PACA_EXGEN, EXC_STD, 0x1700)
433
434#ifdef CONFIG_CBE_RAS
435 STD_EXCEPTION_HV(0x1800, 0x1802, cbe_thermal)
436 KVM_HANDLER_SKIP(PACA_EXGEN, EXC_HV, 0x1802)
437#else
438 . = 0x1800
439#endif
440
441
442
443
444 .align 7
445
446machine_check_pSeries_early:
447BEGIN_FTR_SECTION
448 EXCEPTION_PROLOG_1(PACA_EXMC, NOTEST, 0x200)
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471 mr r11,r1
472 lhz r10,PACA_IN_MCE(r13)
473 cmpwi r10,0
474 bne 0f
475
476 ld r1,PACAMCEMERGSP(r13)
4770: subi r1,r1,INT_FRAME_SIZE
478 addi r10,r10,1
479 sth r10,PACA_IN_MCE(r13)
480
481 cmpwi r10,4
482 bgt 2f
483 std r11,GPR1(r1)
484 std r11,0(r1)
485 mfspr r11,SPRN_SRR0
486 std r11,_NIP(r1)
487 mfspr r11,SPRN_SRR1
488 std r11,_MSR(r1)
489 mfspr r11,SPRN_DAR
490 std r11,_DAR(r1)
491 mfspr r11,SPRN_DSISR
492 std r11,_DSISR(r1)
493 std r9,_CCR(r1)
494
495 EXCEPTION_PROLOG_COMMON_2(PACA_EXMC)
496 mfmsr r11
497 ori r11,r11,MSR_ME
498 ori r11,r11,MSR_RI
499 ld r12,PACAKBASE(r13)
500 LOAD_HANDLER(r12, machine_check_handle_early)
5011: mtspr SPRN_SRR0,r12
502 mtspr SPRN_SRR1,r11
503 rfid
504 b .
5052:
506
507
508
509
510 addi r1,r1,INT_FRAME_SIZE
511 ld r11,PACAKMSR(r13)
512 ld r12,PACAKBASE(r13)
513 LOAD_HANDLER(r12, unrecover_mce)
514 li r10,MSR_ME
515 andc r11,r11,r10
516 b 1b
517 b .
518END_FTR_SECTION_IFSET(CPU_FTR_HVMODE)
519
520machine_check_pSeries:
521 .globl machine_check_fwnmi
522machine_check_fwnmi:
523 SET_SCRATCH0(r13)
524 EXCEPTION_PROLOG_0(PACA_EXMC)
525machine_check_pSeries_0:
526 EXCEPTION_PROLOG_1(PACA_EXMC, KVMTEST, 0x200)
527 EXCEPTION_PROLOG_PSERIES_1(machine_check_common, EXC_STD)
528 KVM_HANDLER_SKIP(PACA_EXMC, EXC_STD, 0x200)
529 KVM_HANDLER_SKIP(PACA_EXGEN, EXC_STD, 0x300)
530 KVM_HANDLER_SKIP(PACA_EXSLB, EXC_STD, 0x380)
531 KVM_HANDLER(PACA_EXGEN, EXC_STD, 0x400)
532 KVM_HANDLER(PACA_EXSLB, EXC_STD, 0x480)
533 KVM_HANDLER(PACA_EXGEN, EXC_STD, 0x900)
534 KVM_HANDLER(PACA_EXGEN, EXC_HV, 0x982)
535
536#ifdef CONFIG_PPC_DENORMALISATION
537denorm_assist:
538BEGIN_FTR_SECTION
539
540
541
542
543 mfmsr r10
544 ori r10,r10,(MSR_FP|MSR_FE0|MSR_FE1)
545 xori r10,r10,(MSR_FE0|MSR_FE1)
546 mtmsrd r10
547 sync
548
549#define FMR2(n) fmr (n), (n) ; fmr n+1, n+1
550#define FMR4(n) FMR2(n) ; FMR2(n+2)
551#define FMR8(n) FMR4(n) ; FMR4(n+4)
552#define FMR16(n) FMR8(n) ; FMR8(n+8)
553#define FMR32(n) FMR16(n) ; FMR16(n+16)
554 FMR32(0)
555
556FTR_SECTION_ELSE
557
558
559
560
561 mfmsr r10
562 oris r10,r10,MSR_VSX@h
563 mtmsrd r10
564 sync
565
566#define XVCPSGNDP2(n) XVCPSGNDP(n,n,n) ; XVCPSGNDP(n+1,n+1,n+1)
567#define XVCPSGNDP4(n) XVCPSGNDP2(n) ; XVCPSGNDP2(n+2)
568#define XVCPSGNDP8(n) XVCPSGNDP4(n) ; XVCPSGNDP4(n+4)
569#define XVCPSGNDP16(n) XVCPSGNDP8(n) ; XVCPSGNDP8(n+8)
570#define XVCPSGNDP32(n) XVCPSGNDP16(n) ; XVCPSGNDP16(n+16)
571 XVCPSGNDP32(0)
572
573ALT_FTR_SECTION_END_IFCLR(CPU_FTR_ARCH_206)
574
575BEGIN_FTR_SECTION
576 b denorm_done
577END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_207S)
578
579
580
581
582 XVCPSGNDP32(32)
583denorm_done:
584 mtspr SPRN_HSRR0,r11
585 mtcrf 0x80,r9
586 ld r9,PACA_EXGEN+EX_R9(r13)
587 RESTORE_PPR_PACA(PACA_EXGEN, r10)
588BEGIN_FTR_SECTION
589 ld r10,PACA_EXGEN+EX_CFAR(r13)
590 mtspr SPRN_CFAR,r10
591END_FTR_SECTION_IFSET(CPU_FTR_CFAR)
592 ld r10,PACA_EXGEN+EX_R10(r13)
593 ld r11,PACA_EXGEN+EX_R11(r13)
594 ld r12,PACA_EXGEN+EX_R12(r13)
595 ld r13,PACA_EXGEN+EX_R13(r13)
596 HRFID
597 b .
598#endif
599
600 .align 7
601
602 STD_EXCEPTION_HV_OOL(0xe02, h_data_storage)
603 KVM_HANDLER_SKIP(PACA_EXGEN, EXC_HV, 0xe02)
604 STD_EXCEPTION_HV_OOL(0xe22, h_instr_storage)
605 KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xe22)
606 STD_EXCEPTION_HV_OOL(0xe42, emulation_assist)
607 KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xe42)
608 MASKABLE_EXCEPTION_HV_OOL(0xe62, hmi_exception)
609 KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xe62)
610
611 MASKABLE_EXCEPTION_HV_OOL(0xe82, h_doorbell)
612 KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xe82)
613
614
615 STD_EXCEPTION_PSERIES_OOL(0xf00, performance_monitor)
616 KVM_HANDLER(PACA_EXGEN, EXC_STD, 0xf00)
617 STD_EXCEPTION_PSERIES_OOL(0xf20, altivec_unavailable)
618 KVM_HANDLER(PACA_EXGEN, EXC_STD, 0xf20)
619 STD_EXCEPTION_PSERIES_OOL(0xf40, vsx_unavailable)
620 KVM_HANDLER(PACA_EXGEN, EXC_STD, 0xf40)
621 STD_EXCEPTION_PSERIES_OOL(0xf60, facility_unavailable)
622 KVM_HANDLER(PACA_EXGEN, EXC_STD, 0xf60)
623 STD_EXCEPTION_HV_OOL(0xf82, facility_unavailable)
624 KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xf82)
625
626
627
628
629
630
631
632
633
634
635
636#define MASKED_INTERRUPT(_H) \
637masked_
638 std r11,PACA_EXGEN+EX_R11(r13); \
639 lbz r11,PACAIRQHAPPENED(r13); \
640 or r11,r11,r10; \
641 stb r11,PACAIRQHAPPENED(r13); \
642 cmpwi r10,PACA_IRQ_DEC; \
643 bne 1f; \
644 lis r10,0x7fff; \
645 ori r10,r10,0xffff; \
646 mtspr SPRN_DEC,r10; \
647 b 2f; \
6481: cmpwi r10,PACA_IRQ_DBELL; \
649 beq 2f; \
650 cmpwi r10,PACA_IRQ_HMI; \
651 beq 2f; \
652 mfspr r10,SPRN_
653 rldicl r10,r10,48,1; \
654 rotldi r10,r10,16; \
655 mtspr SPRN_
6562: mtcrf 0x80,r9; \
657 ld r9,PACA_EXGEN+EX_R9(r13); \
658 ld r10,PACA_EXGEN+EX_R10(r13); \
659 ld r11,PACA_EXGEN+EX_R11(r13); \
660 GET_SCRATCH0(r13); \
661
662 b .
663
664 MASKED_INTERRUPT()
665 MASKED_INTERRUPT(H)
666
667
668
669
670
671
672
673
674
675
676
677_GLOBAL(__replay_interrupt)
678
679
680
681
682 mfmsr r12
683 mflr r11
684 mfcr r9
685 ori r12,r12,MSR_EE
686 cmpwi r3,0x900
687 beq decrementer_common
688 cmpwi r3,0x500
689 beq hardware_interrupt_common
690BEGIN_FTR_SECTION
691 cmpwi r3,0xe80
692 beq h_doorbell_common
693FTR_SECTION_ELSE
694 cmpwi r3,0xa00
695 beq doorbell_super_common
696ALT_FTR_SECTION_END_IFSET(CPU_FTR_HVMODE)
697 blr
698
699#ifdef CONFIG_PPC_PSERIES
700
701
702
703 .globl system_reset_fwnmi
704 .align 7
705system_reset_fwnmi:
706 SET_SCRATCH0(r13)
707 EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, system_reset_common, EXC_STD,
708 NOTEST, 0x100)
709
710#endif
711
712#ifdef __DISABLED__
713
714
715
716
717
718slb_miss_user_pseries:
719 std r10,PACA_EXGEN+EX_R10(r13)
720 std r11,PACA_EXGEN+EX_R11(r13)
721 std r12,PACA_EXGEN+EX_R12(r13)
722 GET_SCRATCH0(r10)
723 ld r11,PACA_EXSLB+EX_R9(r13)
724 ld r12,PACA_EXSLB+EX_R3(r13)
725 std r10,PACA_EXGEN+EX_R13(r13)
726 std r11,PACA_EXGEN+EX_R9(r13)
727 std r12,PACA_EXGEN+EX_R3(r13)
728 clrrdi r12,r13,32
729 mfmsr r10
730 mfspr r11,SRR0
731 ori r12,r12,slb_miss_user_common@l
732 ori r10,r10,MSR_IR|MSR_DR|MSR_RI
733 mtspr SRR0,r12
734 mfspr r12,SRR1
735 mtspr SRR1,r10
736 rfid
737 b .
738#endif
739
740#ifdef CONFIG_KVM_BOOK3S_64_HANDLER
741kvmppc_skip_interrupt:
742
743
744
745
746 mfspr r13, SPRN_SRR0
747 addi r13, r13, 4
748 mtspr SPRN_SRR0, r13
749 GET_SCRATCH0(r13)
750 rfid
751 b .
752
753kvmppc_skip_Hinterrupt:
754
755
756
757
758 mfspr r13, SPRN_HSRR0
759 addi r13, r13, 4
760 mtspr SPRN_HSRR0, r13
761 GET_SCRATCH0(r13)
762 hrfid
763 b .
764#endif
765
766
767
768
769
770
771
772
773
774
775
776 STD_EXCEPTION_COMMON(0x100, system_reset, system_reset_exception)
777
778 STD_EXCEPTION_COMMON_ASYNC(0x500, hardware_interrupt, do_IRQ)
779 STD_EXCEPTION_COMMON_ASYNC(0x900, decrementer, timer_interrupt)
780 STD_EXCEPTION_COMMON(0x980, hdecrementer, hdec_interrupt)
781#ifdef CONFIG_PPC_DOORBELL
782 STD_EXCEPTION_COMMON_ASYNC(0xa00, doorbell_super, doorbell_exception)
783#else
784 STD_EXCEPTION_COMMON_ASYNC(0xa00, doorbell_super, unknown_exception)
785#endif
786 STD_EXCEPTION_COMMON(0xb00, trap_0b, unknown_exception)
787 STD_EXCEPTION_COMMON(0xd00, single_step, single_step_exception)
788 STD_EXCEPTION_COMMON(0xe00, trap_0e, unknown_exception)
789 STD_EXCEPTION_COMMON(0xe40, emulation_assist, emulation_assist_interrupt)
790 STD_EXCEPTION_COMMON_ASYNC(0xe60, hmi_exception, handle_hmi_exception)
791#ifdef CONFIG_PPC_DOORBELL
792 STD_EXCEPTION_COMMON_ASYNC(0xe80, h_doorbell, doorbell_exception)
793#else
794 STD_EXCEPTION_COMMON_ASYNC(0xe80, h_doorbell, unknown_exception)
795#endif
796 STD_EXCEPTION_COMMON_ASYNC(0xf00, performance_monitor, performance_monitor_exception)
797 STD_EXCEPTION_COMMON(0x1300, instruction_breakpoint, instruction_breakpoint_exception)
798 STD_EXCEPTION_COMMON(0x1502, denorm, unknown_exception)
799#ifdef CONFIG_ALTIVEC
800 STD_EXCEPTION_COMMON(0x1700, altivec_assist, altivec_assist_exception)
801#else
802 STD_EXCEPTION_COMMON(0x1700, altivec_assist, unknown_exception)
803#endif
804#ifdef CONFIG_CBE_RAS
805 STD_EXCEPTION_COMMON(0x1200, cbe_system_error, cbe_system_error_exception)
806 STD_EXCEPTION_COMMON(0x1600, cbe_maintenance, cbe_maintenance_exception)
807 STD_EXCEPTION_COMMON(0x1800, cbe_thermal, cbe_thermal_exception)
808#endif
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825 STD_RELON_EXCEPTION_PSERIES(0x4300, 0x300, data_access)
826 . = 0x4380
827 .globl data_access_slb_relon_pSeries
828data_access_slb_relon_pSeries:
829 SET_SCRATCH0(r13)
830 EXCEPTION_PROLOG_0(PACA_EXSLB)
831 EXCEPTION_PROLOG_1(PACA_EXSLB, NOTEST, 0x380)
832 std r3,PACA_EXSLB+EX_R3(r13)
833 mfspr r3,SPRN_DAR
834 mfspr r12,SPRN_SRR1
835#ifndef CONFIG_RELOCATABLE
836 b slb_miss_realmode
837#else
838
839
840
841
842
843 mfctr r11
844 ld r10,PACAKBASE(r13)
845 LOAD_HANDLER(r10, slb_miss_realmode)
846 mtctr r10
847 bctr
848#endif
849
850 STD_RELON_EXCEPTION_PSERIES(0x4400, 0x400, instruction_access)
851 . = 0x4480
852 .globl instruction_access_slb_relon_pSeries
853instruction_access_slb_relon_pSeries:
854 SET_SCRATCH0(r13)
855 EXCEPTION_PROLOG_0(PACA_EXSLB)
856 EXCEPTION_PROLOG_1(PACA_EXSLB, NOTEST, 0x480)
857 std r3,PACA_EXSLB+EX_R3(r13)
858 mfspr r3,SPRN_SRR0
859 mfspr r12,SPRN_SRR1
860#ifndef CONFIG_RELOCATABLE
861 b slb_miss_realmode
862#else
863 mfctr r11
864 ld r10,PACAKBASE(r13)
865 LOAD_HANDLER(r10, slb_miss_realmode)
866 mtctr r10
867 bctr
868#endif
869
870 . = 0x4500
871 .globl hardware_interrupt_relon_pSeries;
872 .globl hardware_interrupt_relon_hv;
873hardware_interrupt_relon_pSeries:
874hardware_interrupt_relon_hv:
875 BEGIN_FTR_SECTION
876 _MASKABLE_RELON_EXCEPTION_PSERIES(0x502, hardware_interrupt, EXC_HV, SOFTEN_TEST_HV)
877 FTR_SECTION_ELSE
878 _MASKABLE_RELON_EXCEPTION_PSERIES(0x500, hardware_interrupt, EXC_STD, SOFTEN_TEST_PR)
879 ALT_FTR_SECTION_END_IFSET(CPU_FTR_HVMODE)
880 STD_RELON_EXCEPTION_PSERIES(0x4600, 0x600, alignment)
881 STD_RELON_EXCEPTION_PSERIES(0x4700, 0x700, program_check)
882 STD_RELON_EXCEPTION_PSERIES(0x4800, 0x800, fp_unavailable)
883 MASKABLE_RELON_EXCEPTION_PSERIES(0x4900, 0x900, decrementer)
884 STD_RELON_EXCEPTION_HV(0x4980, 0x982, hdecrementer)
885 MASKABLE_RELON_EXCEPTION_PSERIES(0x4a00, 0xa00, doorbell_super)
886 STD_RELON_EXCEPTION_PSERIES(0x4b00, 0xb00, trap_0b)
887
888 . = 0x4c00
889 .globl system_call_relon_pSeries
890system_call_relon_pSeries:
891 HMT_MEDIUM
892 SYSCALL_PSERIES_1
893 SYSCALL_PSERIES_2_DIRECT
894 SYSCALL_PSERIES_3
895
896 STD_RELON_EXCEPTION_PSERIES(0x4d00, 0xd00, single_step)
897
898 . = 0x4e00
899 b .
900
901 . = 0x4e20
902 b .
903
904 . = 0x4e40
905emulation_assist_relon_trampoline:
906 SET_SCRATCH0(r13)
907 EXCEPTION_PROLOG_0(PACA_EXGEN)
908 b emulation_assist_relon_hv
909
910 . = 0x4e60
911 b .
912
913 . = 0x4e80
914h_doorbell_relon_trampoline:
915 SET_SCRATCH0(r13)
916 EXCEPTION_PROLOG_0(PACA_EXGEN)
917 b h_doorbell_relon_hv
918
919 . = 0x4f00
920performance_monitor_relon_pseries_trampoline:
921 SET_SCRATCH0(r13)
922 EXCEPTION_PROLOG_0(PACA_EXGEN)
923 b performance_monitor_relon_pSeries
924
925 . = 0x4f20
926altivec_unavailable_relon_pseries_trampoline:
927 SET_SCRATCH0(r13)
928 EXCEPTION_PROLOG_0(PACA_EXGEN)
929 b altivec_unavailable_relon_pSeries
930
931 . = 0x4f40
932vsx_unavailable_relon_pseries_trampoline:
933 SET_SCRATCH0(r13)
934 EXCEPTION_PROLOG_0(PACA_EXGEN)
935 b vsx_unavailable_relon_pSeries
936
937 . = 0x4f60
938facility_unavailable_relon_trampoline:
939 SET_SCRATCH0(r13)
940 EXCEPTION_PROLOG_0(PACA_EXGEN)
941 b facility_unavailable_relon_pSeries
942
943 . = 0x4f80
944hv_facility_unavailable_relon_trampoline:
945 SET_SCRATCH0(r13)
946 EXCEPTION_PROLOG_0(PACA_EXGEN)
947 b hv_facility_unavailable_relon_hv
948
949 STD_RELON_EXCEPTION_PSERIES(0x5300, 0x1300, instruction_breakpoint)
950#ifdef CONFIG_PPC_DENORMALISATION
951 . = 0x5500
952 b denorm_exception_hv
953#endif
954 STD_RELON_EXCEPTION_PSERIES(0x5700, 0x1700, altivec_assist)
955
956
957 .align 7
958 .globl __end_interrupts
959__end_interrupts:
960
961 .align 7
962system_call_entry:
963 b system_call_common
964
965ppc64_runlatch_on_trampoline:
966 b __ppc64_runlatch_on
967
968
969
970
971
972
973 .align 7
974 .globl data_access_common
975data_access_common:
976 mfspr r10,SPRN_DAR
977 std r10,PACA_EXGEN+EX_DAR(r13)
978 mfspr r10,SPRN_DSISR
979 stw r10,PACA_EXGEN+EX_DSISR(r13)
980 EXCEPTION_PROLOG_COMMON(0x300, PACA_EXGEN)
981 RECONCILE_IRQ_STATE(r10, r11)
982 ld r12,_MSR(r1)
983 ld r3,PACA_EXGEN+EX_DAR(r13)
984 lwz r4,PACA_EXGEN+EX_DSISR(r13)
985 li r5,0x300
986 b do_hash_page
987
988 .align 7
989 .globl h_data_storage_common
990h_data_storage_common:
991 mfspr r10,SPRN_HDAR
992 std r10,PACA_EXGEN+EX_DAR(r13)
993 mfspr r10,SPRN_HDSISR
994 stw r10,PACA_EXGEN+EX_DSISR(r13)
995 EXCEPTION_PROLOG_COMMON(0xe00, PACA_EXGEN)
996 bl save_nvgprs
997 RECONCILE_IRQ_STATE(r10, r11)
998 addi r3,r1,STACK_FRAME_OVERHEAD
999 bl unknown_exception
1000 b ret_from_except
1001
1002 .align 7
1003 .globl instruction_access_common
1004instruction_access_common:
1005 EXCEPTION_PROLOG_COMMON(0x400, PACA_EXGEN)
1006 RECONCILE_IRQ_STATE(r10, r11)
1007 ld r12,_MSR(r1)
1008 ld r3,_NIP(r1)
1009 andis. r4,r12,0x5820
1010 li r5,0x400
1011 b do_hash_page
1012
1013 STD_EXCEPTION_COMMON(0xe20, h_instr_storage, unknown_exception)
1014
1015
1016
1017
1018
1019#ifdef __DISABLED__
1020 .align 7
1021 .globl slb_miss_user_common
1022slb_miss_user_common:
1023 mflr r10
1024 std r3,PACA_EXGEN+EX_DAR(r13)
1025 stw r9,PACA_EXGEN+EX_CCR(r13)
1026 std r10,PACA_EXGEN+EX_LR(r13)
1027 std r11,PACA_EXGEN+EX_SRR0(r13)
1028 bl slb_allocate_user
1029
1030 ld r10,PACA_EXGEN+EX_LR(r13)
1031 ld r3,PACA_EXGEN+EX_R3(r13)
1032 lwz r9,PACA_EXGEN+EX_CCR(r13)
1033 ld r11,PACA_EXGEN+EX_SRR0(r13)
1034 mtlr r10
1035 beq- slb_miss_fault
1036
1037 andi. r10,r12,MSR_RI
1038 beq- unrecov_user_slb
1039 mfmsr r10
1040
1041.machine push
1042.machine "power4"
1043 mtcrf 0x80,r9
1044.machine pop
1045
1046 clrrdi r10,r10,2
1047 mtmsrd r10,1
1048
1049 mtspr SRR0,r11
1050 mtspr SRR1,r12
1051
1052 ld r9,PACA_EXGEN+EX_R9(r13)
1053 ld r10,PACA_EXGEN+EX_R10(r13)
1054 ld r11,PACA_EXGEN+EX_R11(r13)
1055 ld r12,PACA_EXGEN+EX_R12(r13)
1056 ld r13,PACA_EXGEN+EX_R13(r13)
1057 rfid
1058 b .
1059
1060slb_miss_fault:
1061 EXCEPTION_PROLOG_COMMON(0x380, PACA_EXGEN)
1062 ld r4,PACA_EXGEN+EX_DAR(r13)
1063 li r5,0
1064 std r4,_DAR(r1)
1065 std r5,_DSISR(r1)
1066 b handle_page_fault
1067
1068unrecov_user_slb:
1069 EXCEPTION_PROLOG_COMMON(0x4200, PACA_EXGEN)
1070 RECONCILE_IRQ_STATE(r10, r11)
1071 bl save_nvgprs
10721: addi r3,r1,STACK_FRAME_OVERHEAD
1073 bl unrecoverable_exception
1074 b 1b
1075
1076#endif
1077
1078
1079
1080
1081
1082
1083 .align 7
1084 .globl machine_check_common
1085machine_check_common:
1086
1087 mfspr r10,SPRN_DAR
1088 std r10,PACA_EXGEN+EX_DAR(r13)
1089 mfspr r10,SPRN_DSISR
1090 stw r10,PACA_EXGEN+EX_DSISR(r13)
1091 EXCEPTION_PROLOG_COMMON(0x200, PACA_EXMC)
1092 FINISH_NAP
1093 RECONCILE_IRQ_STATE(r10, r11)
1094 ld r3,PACA_EXGEN+EX_DAR(r13)
1095 lwz r4,PACA_EXGEN+EX_DSISR(r13)
1096 std r3,_DAR(r1)
1097 std r4,_DSISR(r1)
1098 bl save_nvgprs
1099 addi r3,r1,STACK_FRAME_OVERHEAD
1100 bl machine_check_exception
1101 b ret_from_except
1102
1103 .align 7
1104 .globl alignment_common
1105alignment_common:
1106 mfspr r10,SPRN_DAR
1107 std r10,PACA_EXGEN+EX_DAR(r13)
1108 mfspr r10,SPRN_DSISR
1109 stw r10,PACA_EXGEN+EX_DSISR(r13)
1110 EXCEPTION_PROLOG_COMMON(0x600, PACA_EXGEN)
1111 ld r3,PACA_EXGEN+EX_DAR(r13)
1112 lwz r4,PACA_EXGEN+EX_DSISR(r13)
1113 std r3,_DAR(r1)
1114 std r4,_DSISR(r1)
1115 bl save_nvgprs
1116 RECONCILE_IRQ_STATE(r10, r11)
1117 addi r3,r1,STACK_FRAME_OVERHEAD
1118 bl alignment_exception
1119 b ret_from_except
1120
1121 .align 7
1122 .globl program_check_common
1123program_check_common:
1124 EXCEPTION_PROLOG_COMMON(0x700, PACA_EXGEN)
1125 bl save_nvgprs
1126 RECONCILE_IRQ_STATE(r10, r11)
1127 addi r3,r1,STACK_FRAME_OVERHEAD
1128 bl program_check_exception
1129 b ret_from_except
1130
1131 .align 7
1132 .globl fp_unavailable_common
1133fp_unavailable_common:
1134 EXCEPTION_PROLOG_COMMON(0x800, PACA_EXGEN)
1135 bne 1f
1136 bl save_nvgprs
1137 RECONCILE_IRQ_STATE(r10, r11)
1138 addi r3,r1,STACK_FRAME_OVERHEAD
1139 bl kernel_fp_unavailable_exception
1140 BUG_OPCODE
11411:
1142#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
1143BEGIN_FTR_SECTION
1144
1145
1146
1147 rldicl. r0, r12, (64-MSR_TS_LG), (64-2)
1148 bne- 2f
1149END_FTR_SECTION_IFSET(CPU_FTR_TM)
1150#endif
1151 bl load_up_fpu
1152 b fast_exception_return
1153#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
11542:
1155 bl save_nvgprs
1156 RECONCILE_IRQ_STATE(r10, r11)
1157 addi r3,r1,STACK_FRAME_OVERHEAD
1158 bl fp_unavailable_tm
1159 b ret_from_except
1160#endif
1161 .align 7
1162 .globl altivec_unavailable_common
1163altivec_unavailable_common:
1164 EXCEPTION_PROLOG_COMMON(0xf20, PACA_EXGEN)
1165#ifdef CONFIG_ALTIVEC
1166BEGIN_FTR_SECTION
1167 beq 1f
1168#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
1169 BEGIN_FTR_SECTION_NESTED(69)
1170
1171
1172
1173 rldicl. r0, r12, (64-MSR_TS_LG), (64-2)
1174 bne- 2f
1175 END_FTR_SECTION_NESTED(CPU_FTR_TM, CPU_FTR_TM, 69)
1176#endif
1177 bl load_up_altivec
1178 b fast_exception_return
1179#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
11802:
1181 bl save_nvgprs
1182 RECONCILE_IRQ_STATE(r10, r11)
1183 addi r3,r1,STACK_FRAME_OVERHEAD
1184 bl altivec_unavailable_tm
1185 b ret_from_except
1186#endif
11871:
1188END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
1189#endif
1190 bl save_nvgprs
1191 RECONCILE_IRQ_STATE(r10, r11)
1192 addi r3,r1,STACK_FRAME_OVERHEAD
1193 bl altivec_unavailable_exception
1194 b ret_from_except
1195
1196 .align 7
1197 .globl vsx_unavailable_common
1198vsx_unavailable_common:
1199 EXCEPTION_PROLOG_COMMON(0xf40, PACA_EXGEN)
1200#ifdef CONFIG_VSX
1201BEGIN_FTR_SECTION
1202 beq 1f
1203#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
1204 BEGIN_FTR_SECTION_NESTED(69)
1205
1206
1207
1208 rldicl. r0, r12, (64-MSR_TS_LG), (64-2)
1209 bne- 2f
1210 END_FTR_SECTION_NESTED(CPU_FTR_TM, CPU_FTR_TM, 69)
1211#endif
1212 b load_up_vsx
1213#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
12142:
1215 bl save_nvgprs
1216 RECONCILE_IRQ_STATE(r10, r11)
1217 addi r3,r1,STACK_FRAME_OVERHEAD
1218 bl vsx_unavailable_tm
1219 b ret_from_except
1220#endif
12211:
1222END_FTR_SECTION_IFSET(CPU_FTR_VSX)
1223#endif
1224 bl save_nvgprs
1225 RECONCILE_IRQ_STATE(r10, r11)
1226 addi r3,r1,STACK_FRAME_OVERHEAD
1227 bl vsx_unavailable_exception
1228 b ret_from_except
1229
1230 STD_EXCEPTION_COMMON(0xf60, facility_unavailable, facility_unavailable_exception)
1231 STD_EXCEPTION_COMMON(0xf80, hv_facility_unavailable, facility_unavailable_exception)
1232
1233 .align 7
1234 .globl __end_handlers
1235__end_handlers:
1236
1237
1238 STD_RELON_EXCEPTION_HV_OOL(0xe40, emulation_assist)
1239 MASKABLE_RELON_EXCEPTION_HV_OOL(0xe80, h_doorbell)
1240
1241 STD_RELON_EXCEPTION_PSERIES_OOL(0xf00, performance_monitor)
1242 STD_RELON_EXCEPTION_PSERIES_OOL(0xf20, altivec_unavailable)
1243 STD_RELON_EXCEPTION_PSERIES_OOL(0xf40, vsx_unavailable)
1244 STD_RELON_EXCEPTION_PSERIES_OOL(0xf60, facility_unavailable)
1245 STD_RELON_EXCEPTION_HV_OOL(0xf80, hv_facility_unavailable)
1246
1247
1248
1249
1250
1251
1252 .= 0x7000
1253 .globl fwnmi_data_area
1254fwnmi_data_area:
1255
1256
1257
1258
1259 . = 0x8000
1260#endif
1261
1262 .globl hmi_exception_early
1263hmi_exception_early:
1264 EXCEPTION_PROLOG_1(PACA_EXGEN, NOTEST, 0xe60)
1265 mr r10,r1
1266 ld r1,PACAEMERGSP(r13)
1267 subi r1,r1,INT_FRAME_SIZE
1268 std r9,_CCR(r1)
1269 mfspr r11,SPRN_HSRR0
1270 std r11,_NIP(r1)
1271 mfspr r12,SPRN_HSRR1
1272 std r12,_MSR(r1)
1273 std r10,0(r1)
1274 std r0,GPR0(r1)
1275 std r10,GPR1(r1)
1276 EXCEPTION_PROLOG_COMMON_2(PACA_EXGEN)
1277 EXCEPTION_PROLOG_COMMON_3(0xe60)
1278 addi r3,r1,STACK_FRAME_OVERHEAD
1279 bl hmi_exception_realmode
1280
1281
1282 ld r9,_MSR(r1)
1283 mtspr SPRN_HSRR1,r9
1284 ld r3,_NIP(r1)
1285 mtspr SPRN_HSRR0,r3
1286 ld r9,_CTR(r1)
1287 mtctr r9
1288 ld r9,_XER(r1)
1289 mtxer r9
1290 ld r9,_LINK(r1)
1291 mtlr r9
1292 REST_GPR(0, r1)
1293 REST_8GPRS(2, r1)
1294 REST_GPR(10, r1)
1295 ld r11,_CCR(r1)
1296 mtcr r11
1297 REST_GPR(11, r1)
1298 REST_2GPRS(12, r1)
1299
1300 ld r1,GPR1(r1)
1301
1302
1303
1304
1305
1306 .globl hmi_exception_after_realmode
1307hmi_exception_after_realmode:
1308 SET_SCRATCH0(r13)
1309 EXCEPTION_PROLOG_0(PACA_EXGEN)
1310 b hmi_exception_hv
1311
1312
1313#define MACHINE_CHECK_HANDLER_WINDUP \
1314 \
1315 li r0,MSR_RI; \
1316 mfmsr r9; \
1317 andc r9,r9,r0; \
1318 mtmsrd r9,1; \
1319 \
1320 ld r9,_MSR(r1); \
1321 mtspr SPRN_SRR1,r9; \
1322 ld r3,_NIP(r1); \
1323 mtspr SPRN_SRR0,r3; \
1324 ld r9,_CTR(r1); \
1325 mtctr r9; \
1326 ld r9,_XER(r1); \
1327 mtxer r9; \
1328 ld r9,_LINK(r1); \
1329 mtlr r9; \
1330 REST_GPR(0, r1); \
1331 REST_8GPRS(2, r1); \
1332 REST_GPR(10, r1); \
1333 ld r11,_CCR(r1); \
1334 mtcr r11; \
1335 \
1336 lhz r12,PACA_IN_MCE(r13); \
1337 subi r12,r12,1; \
1338 sth r12,PACA_IN_MCE(r13); \
1339 REST_GPR(11, r1); \
1340 REST_2GPRS(12, r1); \
1341 \
1342 ld r1,GPR1(r1)
1343
1344
1345
1346
1347
1348 .align 7
1349 .globl machine_check_handle_early
1350machine_check_handle_early:
1351 std r0,GPR0(r1)
1352 EXCEPTION_PROLOG_COMMON_3(0x200)
1353 bl save_nvgprs
1354 addi r3,r1,STACK_FRAME_OVERHEAD
1355 bl machine_check_early
1356 std r3,RESULT(r1)
1357 ld r12,_MSR(r1)
1358#ifdef CONFIG_PPC_P7_NAP
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368 rlwinm. r11,r12,47-31,30,31
1369 beq 4f
1370
1371 cmpwi r11,2
1372 bne 3f
1373
1374 li r0,1
1375 stb r0,PACA_NAPSTATELOST(r13)
13763: bl machine_check_queue_event
1377 MACHINE_CHECK_HANDLER_WINDUP
1378 GET_PACA(r13)
1379 ld r1,PACAR1(r13)
1380 li r3,PNV_THREAD_NAP
1381 b power7_enter_nap_mode
13824:
1383#endif
1384
1385
1386
1387
1388 rldicl. r11,r12,4,63
1389 beq 5f
1390 andi. r11,r12,MSR_PR
1391 bne 9f
1392
13935:
1394#ifdef CONFIG_KVM_BOOK3S_64_HANDLER
1395
1396
1397
1398
1399
1400 lbz r11,HSTATE_IN_GUEST(r13)
1401 cmpwi r11,0
1402 bne 9f
1403#endif
1404
1405
1406
1407
1408
1409
1410 andi. r11,r12,MSR_RI
1411 bne 2f
14121: mfspr r11,SPRN_SRR0
1413 ld r10,PACAKBASE(r13)
1414 LOAD_HANDLER(r10,unrecover_mce)
1415 mtspr SPRN_SRR0,r10
1416 ld r10,PACAKMSR(r13)
1417
1418
1419
1420
1421
1422
1423
1424 li r3,MSR_ME
1425 andc r10,r10,r3
1426 mtspr SPRN_SRR1,r10
1427 rfid
1428 b .
14292:
1430
1431
1432
1433
1434 ld r3,RESULT(r1)
1435 cmpdi r3,0
1436
1437 beq 1b
1438
1439
1440
1441
1442
1443 bl machine_check_queue_event
1444 MACHINE_CHECK_HANDLER_WINDUP
1445 rfid
14469:
1447
1448 MACHINE_CHECK_HANDLER_WINDUP
1449 b machine_check_pSeries
1450
1451unrecover_mce:
1452
1453 addi r3,r1,STACK_FRAME_OVERHEAD
1454 bl machine_check_exception
1455
1456
1457
1458
14591: addi r3,r1,STACK_FRAME_OVERHEAD
1460 bl unrecoverable_exception
1461 b 1b
1462
1463
1464
1465
1466
1467
1468
1469
1470slb_miss_realmode:
1471 mflr r10
1472#ifdef CONFIG_RELOCATABLE
1473 mtctr r11
1474#endif
1475
1476 stw r9,PACA_EXSLB+EX_CCR(r13)
1477 std r10,PACA_EXSLB+EX_LR(r13)
1478
1479 bl slb_allocate_realmode
1480
1481
1482
1483 ld r10,PACA_EXSLB+EX_LR(r13)
1484 ld r3,PACA_EXSLB+EX_R3(r13)
1485 lwz r9,PACA_EXSLB+EX_CCR(r13)
1486
1487 mtlr r10
1488
1489 andi. r10,r12,MSR_RI
1490 beq- 2f
1491
1492.machine push
1493.machine "power4"
1494 mtcrf 0x80,r9
1495 mtcrf 0x01,r9
1496.machine pop
1497
1498 RESTORE_PPR_PACA(PACA_EXSLB, r9)
1499 ld r9,PACA_EXSLB+EX_R9(r13)
1500 ld r10,PACA_EXSLB+EX_R10(r13)
1501 ld r11,PACA_EXSLB+EX_R11(r13)
1502 ld r12,PACA_EXSLB+EX_R12(r13)
1503 ld r13,PACA_EXSLB+EX_R13(r13)
1504 rfid
1505 b .
1506
15072: mfspr r11,SPRN_SRR0
1508 ld r10,PACAKBASE(r13)
1509 LOAD_HANDLER(r10,unrecov_slb)
1510 mtspr SPRN_SRR0,r10
1511 ld r10,PACAKMSR(r13)
1512 mtspr SPRN_SRR1,r10
1513 rfid
1514 b .
1515
1516unrecov_slb:
1517 EXCEPTION_PROLOG_COMMON(0x4100, PACA_EXSLB)
1518 RECONCILE_IRQ_STATE(r10, r11)
1519 bl save_nvgprs
15201: addi r3,r1,STACK_FRAME_OVERHEAD
1521 bl unrecoverable_exception
1522 b 1b
1523
1524
1525#ifdef CONFIG_PPC_970_NAP
1526power4_fixup_nap:
1527 andc r9,r9,r10
1528 std r9,TI_LOCAL_FLAGS(r11)
1529 ld r10,_LINK(r1)
1530 std r10,_NIP(r1)
1531 blr
1532#endif
1533
1534
1535
1536
1537 .align 7
1538do_hash_page:
1539 std r3,_DAR(r1)
1540 std r4,_DSISR(r1)
1541
1542 andis. r0,r4,0xa410
1543 bne- handle_page_fault
1544 andis. r0,r4,DSISR_DABRMATCH@h
1545 bne- handle_dabr_fault
1546 CURRENT_THREAD_INFO(r11, r1)
1547 lwz r0,TI_PREEMPT(r11)
1548 andis. r0,r0,NMI_MASK@h
1549 bne 77f
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559 mr r4,r12
1560 ld r6,_DSISR(r1)
1561 bl __hash_page
1562 cmpdi r3,0
1563
1564
1565 beq fast_exc_return_irq
1566
1567
1568 blt- 13f
1569
1570
1571handle_page_fault:
157211: ld r4,_DAR(r1)
1573 ld r5,_DSISR(r1)
1574 addi r3,r1,STACK_FRAME_OVERHEAD
1575 bl do_page_fault
1576 cmpdi r3,0
1577 beq+ 12f
1578 bl save_nvgprs
1579 mr r5,r3
1580 addi r3,r1,STACK_FRAME_OVERHEAD
1581 lwz r4,_DAR(r1)
1582 bl bad_page_fault
1583 b ret_from_except
1584
1585
1586handle_dabr_fault:
1587 bl save_nvgprs
1588 ld r4,_DAR(r1)
1589 ld r5,_DSISR(r1)
1590 addi r3,r1,STACK_FRAME_OVERHEAD
1591 bl do_break
159212: b ret_from_except_lite
1593
1594
1595
1596
1597
159813: bl save_nvgprs
1599 mr r5,r3
1600 addi r3,r1,STACK_FRAME_OVERHEAD
1601 ld r4,_DAR(r1)
1602 bl low_hash_fault
1603 b ret_from_except
1604
1605
1606
1607
1608
1609
1610
1611
161277: bl save_nvgprs
1613 mr r4,r3
1614 addi r3,r1,STACK_FRAME_OVERHEAD
1615 li r5,SIGSEGV
1616 bl bad_page_fault
1617 b ret_from_except
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627bad_stack:
1628 ld r1,PACAEMERGSP(r13)
1629 subi r1,r1,64+INT_FRAME_SIZE
1630 std r9,_CCR(r1)
1631 std r10,GPR1(r1)
1632 std r11,_NIP(r1)
1633 std r12,_MSR(r1)
1634 mfspr r11,SPRN_DAR
1635 mfspr r12,SPRN_DSISR
1636 std r11,_DAR(r1)
1637 std r12,_DSISR(r1)
1638 mflr r10
1639 mfctr r11
1640 mfxer r12
1641 std r10,_LINK(r1)
1642 std r11,_CTR(r1)
1643 std r12,_XER(r1)
1644 SAVE_GPR(0,r1)
1645 SAVE_GPR(2,r1)
1646 ld r10,EX_R3(r3)
1647 std r10,GPR3(r1)
1648 SAVE_GPR(4,r1)
1649 SAVE_4GPRS(5,r1)
1650 ld r9,EX_R9(r3)
1651 ld r10,EX_R10(r3)
1652 SAVE_2GPRS(9,r1)
1653 ld r9,EX_R11(r3)
1654 ld r10,EX_R12(r3)
1655 ld r11,EX_R13(r3)
1656 std r9,GPR11(r1)
1657 std r10,GPR12(r1)
1658 std r11,GPR13(r1)
1659BEGIN_FTR_SECTION
1660 ld r10,EX_CFAR(r3)
1661 std r10,ORIG_GPR3(r1)
1662END_FTR_SECTION_IFSET(CPU_FTR_CFAR)
1663 SAVE_8GPRS(14,r1)
1664 SAVE_10GPRS(22,r1)
1665 lhz r12,PACA_TRAP_SAVE(r13)
1666 std r12,_TRAP(r1)
1667 addi r11,r1,INT_FRAME_SIZE
1668 std r11,0(r1)
1669 li r12,0
1670 std r12,0(r11)
1671 ld r2,PACATOC(r13)
1672 ld r11,exception_marker@toc(r2)
1673 std r12,RESULT(r1)
1674 std r11,STACK_FRAME_OVERHEAD-16(r1)
16751: addi r3,r1,STACK_FRAME_OVERHEAD
1676 bl kernel_bad_stack
1677 b 1b
1678