exceptions-64s.S (9daf112bd41ee9ca24a9a87adc70f70400a2ba5b) exceptions-64s.S (0869b6fd209bda402576a9a559120ddd4f61198e)
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
8 * position dependent assembly.

--- 321 unchanged lines hidden (view full) ---

330 SET_SCRATCH0(r13)
331 EXCEPTION_PROLOG_0(PACA_EXGEN)
332 b emulation_assist_hv
333
334 . = 0xe60
335hv_exception_trampoline:
336 SET_SCRATCH0(r13)
337 EXCEPTION_PROLOG_0(PACA_EXGEN)
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
8 * position dependent assembly.

--- 321 unchanged lines hidden (view full) ---

330 SET_SCRATCH0(r13)
331 EXCEPTION_PROLOG_0(PACA_EXGEN)
332 b emulation_assist_hv
333
334 . = 0xe60
335hv_exception_trampoline:
336 SET_SCRATCH0(r13)
337 EXCEPTION_PROLOG_0(PACA_EXGEN)
338 b hmi_exception_hv
338 b hmi_exception_early
339
340 . = 0xe80
341hv_doorbell_trampoline:
342 SET_SCRATCH0(r13)
343 EXCEPTION_PROLOG_0(PACA_EXGEN)
344 b h_doorbell_hv
345
346 /* We need to deal with the Altivec unavailable exception

--- 237 unchanged lines hidden (view full) ---

584 .align 7
585 /* moved from 0xe00 */
586 STD_EXCEPTION_HV_OOL(0xe02, h_data_storage)
587 KVM_HANDLER_SKIP(PACA_EXGEN, EXC_HV, 0xe02)
588 STD_EXCEPTION_HV_OOL(0xe22, h_instr_storage)
589 KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xe22)
590 STD_EXCEPTION_HV_OOL(0xe42, emulation_assist)
591 KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xe42)
339
340 . = 0xe80
341hv_doorbell_trampoline:
342 SET_SCRATCH0(r13)
343 EXCEPTION_PROLOG_0(PACA_EXGEN)
344 b h_doorbell_hv
345
346 /* We need to deal with the Altivec unavailable exception

--- 237 unchanged lines hidden (view full) ---

584 .align 7
585 /* moved from 0xe00 */
586 STD_EXCEPTION_HV_OOL(0xe02, h_data_storage)
587 KVM_HANDLER_SKIP(PACA_EXGEN, EXC_HV, 0xe02)
588 STD_EXCEPTION_HV_OOL(0xe22, h_instr_storage)
589 KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xe22)
590 STD_EXCEPTION_HV_OOL(0xe42, emulation_assist)
591 KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xe42)
592 STD_EXCEPTION_HV_OOL(0xe62, hmi_exception) /* need to flush cache ? */
592 MASKABLE_EXCEPTION_HV_OOL(0xe62, hmi_exception)
593 KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xe62)
593 KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xe62)
594
595 .globl hmi_exception_early
596hmi_exception_early:
597 EXCEPTION_PROLOG_1(PACA_EXGEN, NOTEST, 0xe60)
598 mr r10,r1 /* Save r1 */
599 ld r1,PACAEMERGSP(r13) /* Use emergency stack */
600 subi r1,r1,INT_FRAME_SIZE /* alloc stack frame */
601 std r9,_CCR(r1) /* save CR in stackframe */
602 mfspr r11,SPRN_HSRR0 /* Save HSRR0 */
603 std r11,_NIP(r1) /* save HSRR0 in stackframe */
604 mfspr r12,SPRN_HSRR1 /* Save SRR1 */
605 std r12,_MSR(r1) /* save SRR1 in stackframe */
606 std r10,0(r1) /* make stack chain pointer */
607 std r0,GPR0(r1) /* save r0 in stackframe */
608 std r10,GPR1(r1) /* save r1 in stackframe */
609 EXCEPTION_PROLOG_COMMON_2(PACA_EXGEN)
610 EXCEPTION_PROLOG_COMMON_3(0xe60)
611 addi r3,r1,STACK_FRAME_OVERHEAD
612 bl hmi_exception_realmode
613 /* Windup the stack. */
614 /* Clear MSR_RI before setting SRR0 and SRR1. */
615 li r0,MSR_RI
616 mfmsr r9 /* get MSR value */
617 andc r9,r9,r0
618 mtmsrd r9,1 /* Clear MSR_RI */
619 /* Move original HSRR0 and HSRR1 into the respective regs */
620 ld r9,_MSR(r1)
621 mtspr SPRN_HSRR1,r9
622 ld r3,_NIP(r1)
623 mtspr SPRN_HSRR0,r3
624 ld r9,_CTR(r1)
625 mtctr r9
626 ld r9,_XER(r1)
627 mtxer r9
628 ld r9,_LINK(r1)
629 mtlr r9
630 REST_GPR(0, r1)
631 REST_8GPRS(2, r1)
632 REST_GPR(10, r1)
633 ld r11,_CCR(r1)
634 mtcr r11
635 REST_GPR(11, r1)
636 REST_2GPRS(12, r1)
637 /* restore original r1. */
638 ld r1,GPR1(r1)
639
640 /*
641 * Go to virtual mode and pull the HMI event information from
642 * firmware.
643 */
644 .globl hmi_exception_after_realmode
645hmi_exception_after_realmode:
646 SET_SCRATCH0(r13)
647 EXCEPTION_PROLOG_0(PACA_EXGEN)
648 b hmi_exception_hv
649
594 MASKABLE_EXCEPTION_HV_OOL(0xe82, h_doorbell)
595 KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xe82)
596
597 /* moved from 0xf00 */
598 STD_EXCEPTION_PSERIES_OOL(0xf00, performance_monitor)
599 KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0xf00)
600 STD_EXCEPTION_PSERIES_OOL(0xf20, altivec_unavailable)
601 KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0xf20)

--- 4 unchanged lines hidden (view full) ---

606 STD_EXCEPTION_HV_OOL(0xf82, facility_unavailable)
607 KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xf82)
608
609/*
610 * An interrupt came in while soft-disabled. We set paca->irq_happened, then:
611 * - If it was a decrementer interrupt, we bump the dec to max and and return.
612 * - If it was a doorbell we return immediately since doorbells are edge
613 * triggered and won't automatically refire.
650 MASKABLE_EXCEPTION_HV_OOL(0xe82, h_doorbell)
651 KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xe82)
652
653 /* moved from 0xf00 */
654 STD_EXCEPTION_PSERIES_OOL(0xf00, performance_monitor)
655 KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0xf00)
656 STD_EXCEPTION_PSERIES_OOL(0xf20, altivec_unavailable)
657 KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0xf20)

--- 4 unchanged lines hidden (view full) ---

662 STD_EXCEPTION_HV_OOL(0xf82, facility_unavailable)
663 KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xf82)
664
665/*
666 * An interrupt came in while soft-disabled. We set paca->irq_happened, then:
667 * - If it was a decrementer interrupt, we bump the dec to max and and return.
668 * - If it was a doorbell we return immediately since doorbells are edge
669 * triggered and won't automatically refire.
670 * - If it was a HMI we return immediately since we handled it in realmode
671 * and it won't refire.
614 * - else we hard disable and return.
615 * This is called with r10 containing the value to OR to the paca field.
616 */
617#define MASKED_INTERRUPT(_H) \
618masked_##_H##interrupt: \
619 std r11,PACA_EXGEN+EX_R11(r13); \
620 lbz r11,PACAIRQHAPPENED(r13); \
621 or r11,r11,r10; \
622 stb r11,PACAIRQHAPPENED(r13); \
623 cmpwi r10,PACA_IRQ_DEC; \
624 bne 1f; \
625 lis r10,0x7fff; \
626 ori r10,r10,0xffff; \
627 mtspr SPRN_DEC,r10; \
628 b 2f; \
6291: cmpwi r10,PACA_IRQ_DBELL; \
630 beq 2f; \
672 * - else we hard disable and return.
673 * This is called with r10 containing the value to OR to the paca field.
674 */
675#define MASKED_INTERRUPT(_H) \
676masked_##_H##interrupt: \
677 std r11,PACA_EXGEN+EX_R11(r13); \
678 lbz r11,PACAIRQHAPPENED(r13); \
679 or r11,r11,r10; \
680 stb r11,PACAIRQHAPPENED(r13); \
681 cmpwi r10,PACA_IRQ_DEC; \
682 bne 1f; \
683 lis r10,0x7fff; \
684 ori r10,r10,0xffff; \
685 mtspr SPRN_DEC,r10; \
686 b 2f; \
6871: cmpwi r10,PACA_IRQ_DBELL; \
688 beq 2f; \
689 cmpwi r10,PACA_IRQ_HMI; \
690 beq 2f; \
631 mfspr r10,SPRN_##_H##SRR1; \
632 rldicl r10,r10,48,1; /* clear MSR_EE */ \
633 rotldi r10,r10,16; \
634 mtspr SPRN_##_H##SRR1,r10; \
6352: mtcrf 0x80,r9; \
636 ld r9,PACA_EXGEN+EX_R9(r13); \
637 ld r10,PACA_EXGEN+EX_R10(r13); \
638 ld r11,PACA_EXGEN+EX_R11(r13); \

--- 123 unchanged lines hidden (view full) ---

762 STD_EXCEPTION_COMMON_ASYNC(0xa00, doorbell_super, doorbell_exception)
763#else
764 STD_EXCEPTION_COMMON_ASYNC(0xa00, doorbell_super, unknown_exception)
765#endif
766 STD_EXCEPTION_COMMON(0xb00, trap_0b, unknown_exception)
767 STD_EXCEPTION_COMMON(0xd00, single_step, single_step_exception)
768 STD_EXCEPTION_COMMON(0xe00, trap_0e, unknown_exception)
769 STD_EXCEPTION_COMMON(0xe40, emulation_assist, emulation_assist_interrupt)
691 mfspr r10,SPRN_##_H##SRR1; \
692 rldicl r10,r10,48,1; /* clear MSR_EE */ \
693 rotldi r10,r10,16; \
694 mtspr SPRN_##_H##SRR1,r10; \
6952: mtcrf 0x80,r9; \
696 ld r9,PACA_EXGEN+EX_R9(r13); \
697 ld r10,PACA_EXGEN+EX_R10(r13); \
698 ld r11,PACA_EXGEN+EX_R11(r13); \

--- 123 unchanged lines hidden (view full) ---

822 STD_EXCEPTION_COMMON_ASYNC(0xa00, doorbell_super, doorbell_exception)
823#else
824 STD_EXCEPTION_COMMON_ASYNC(0xa00, doorbell_super, unknown_exception)
825#endif
826 STD_EXCEPTION_COMMON(0xb00, trap_0b, unknown_exception)
827 STD_EXCEPTION_COMMON(0xd00, single_step, single_step_exception)
828 STD_EXCEPTION_COMMON(0xe00, trap_0e, unknown_exception)
829 STD_EXCEPTION_COMMON(0xe40, emulation_assist, emulation_assist_interrupt)
770 STD_EXCEPTION_COMMON(0xe60, hmi_exception, unknown_exception)
830 STD_EXCEPTION_COMMON_ASYNC(0xe60, hmi_exception, handle_hmi_exception)
771#ifdef CONFIG_PPC_DOORBELL
772 STD_EXCEPTION_COMMON_ASYNC(0xe80, h_doorbell, doorbell_exception)
773#else
774 STD_EXCEPTION_COMMON_ASYNC(0xe80, h_doorbell, unknown_exception)
775#endif
776 STD_EXCEPTION_COMMON_ASYNC(0xf00, performance_monitor, performance_monitor_exception)
777 STD_EXCEPTION_COMMON(0x1300, instruction_breakpoint, instruction_breakpoint_exception)
778 STD_EXCEPTION_COMMON(0x1502, denorm, unknown_exception)

--- 860 unchanged lines hidden ---
831#ifdef CONFIG_PPC_DOORBELL
832 STD_EXCEPTION_COMMON_ASYNC(0xe80, h_doorbell, doorbell_exception)
833#else
834 STD_EXCEPTION_COMMON_ASYNC(0xe80, h_doorbell, unknown_exception)
835#endif
836 STD_EXCEPTION_COMMON_ASYNC(0xf00, performance_monitor, performance_monitor_exception)
837 STD_EXCEPTION_COMMON(0x1300, instruction_breakpoint, instruction_breakpoint_exception)
838 STD_EXCEPTION_COMMON(0x1502, denorm, unknown_exception)

--- 860 unchanged lines hidden ---