@@ -635,51 +635,57 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_207S)
635635 * touched, no exit work created, then this can be used.
636636 */
637637 .balign IFETCH_ALIGN_BYTES
638- .globl fast_interrupt_return
639- fast_interrupt_return :
640- _ASM_NOKPROBE_SYMBOL(fast_interrupt_return )
638+ .globl fast_interrupt_return_srr
639+ fast_interrupt_return_srr :
640+ _ASM_NOKPROBE_SYMBOL(fast_interrupt_return_srr )
641641 kuap_check_amr r3, r4
642642 ld r5,_MSR(r1)
643643 andi. r0,r5,MSR_PR
644644#ifdef CONFIG_PPC_BOOK3S
645- bne .Lfast_user_interrupt_return_amr
645+ bne .Lfast_user_interrupt_return_amr_srr
646646 kuap_kernel_restore r3, r4
647647 andi. r0,r5,MSR_RI
648648 li r3,0 /* 0 return value, no EMULATE_STACK_STORE */
649- bne+ .Lfast_kernel_interrupt_return
649+ bne+ .Lfast_kernel_interrupt_return_srr
650650 addi r3,r1,STACK_FRAME_OVERHEAD
651651 bl unrecoverable_exception
652652 b . /* should not get here */
653653#else
654- bne .Lfast_user_interrupt_return
655- b .Lfast_kernel_interrupt_return
654+ bne .Lfast_user_interrupt_return_srr
655+ b .Lfast_kernel_interrupt_return_srr
656656#endif
657657
658+ .macro interrupt_return_macro srr
658659 .balign IFETCH_ALIGN_BYTES
659- .globl interrupt_return
660- interrupt_return :
661- _ASM_NOKPROBE_SYMBOL(interrupt_return )
660+ .globl interrupt_return_\srr
661+ interrupt_return_\srr\() :
662+ _ASM_NOKPROBE_SYMBOL(interrupt_return_\srr\() )
662663 ld r4,_MSR(r1)
663664 andi. r0,r4,MSR_PR
664- beq .Lkernel_interrupt_return
665+ beq .Lkernel_interrupt_return_\srr
665666 addi r3,r1,STACK_FRAME_OVERHEAD
666667 bl interrupt_exit_user_prepare
667668 cmpdi r3,0
668- bne- .Lrestore_nvgprs
669+ bne- .Lrestore_nvgprs_\srr
669670
670671#ifdef CONFIG_PPC_BOOK3S
671- .Lfast_user_interrupt_return_amr :
672+ .Lfast_user_interrupt_return_amr_\srr\() :
672673 kuap_user_restore r3, r4
673674#endif
674- .Lfast_user_interrupt_return :
675+ .Lfast_user_interrupt_return_\srr\() :
675676 ld r11,_NIP(r1)
676677 ld r12,_MSR(r1)
677678BEGIN_FTR_SECTION
678679 ld r10,_PPR(r1)
679680 mtspr SPRN_PPR,r10
680681END_FTR_SECTION_IFSET(CPU_FTR_HAS_PPR)
682+ .ifc \srr,srr
681683 mtspr SPRN_SRR0,r11
682684 mtspr SPRN_SRR1,r12
685+ .else
686+ mtspr SPRN_HSRR0,r11
687+ mtspr SPRN_HSRR1,r12
688+ .endif
683689
684690BEGIN_FTR_SECTION
685691 stdcx. r0,0 ,r1 /* to clear the reservation */
@@ -706,24 +712,33 @@ ALT_FTR_SECTION_END_IFCLR(CPU_FTR_STCX_CHECKS_ADDRESS)
706712 REST_GPR(6 , r1)
707713 REST_GPR(0 , r1)
708714 REST_GPR(1 , r1)
715+ .ifc \srr,srr
709716 RFI_TO_USER
717+ .else
718+ HRFI_TO_USER
719+ .endif
710720 b . /* prevent speculative execution */
711721
712- .Lrestore_nvgprs :
722+ .Lrestore_nvgprs_\srr\() :
713723 REST_NVGPRS(r1)
714- b .Lfast_user_interrupt_return
724+ b .Lfast_user_interrupt_return_\srr
715725
716726 .balign IFETCH_ALIGN_BYTES
717- .Lkernel_interrupt_return :
727+ .Lkernel_interrupt_return_\srr\() :
718728 addi r3,r1,STACK_FRAME_OVERHEAD
719729 bl interrupt_exit_kernel_prepare
720730
721- .Lfast_kernel_interrupt_return :
731+ .Lfast_kernel_interrupt_return_\srr\() :
722732 cmpdi cr1,r3,0
723733 ld r11,_NIP(r1)
724734 ld r12,_MSR(r1)
735+ .ifc \srr,srr
725736 mtspr SPRN_SRR0,r11
726737 mtspr SPRN_SRR1,r12
738+ .else
739+ mtspr SPRN_HSRR0,r11
740+ mtspr SPRN_HSRR1,r12
741+ .endif
727742
728743BEGIN_FTR_SECTION
729744 stdcx. r0,0 ,r1 /* to clear the reservation */
@@ -757,7 +772,11 @@ ALT_FTR_SECTION_END_IFCLR(CPU_FTR_STCX_CHECKS_ADDRESS)
757772 REST_GPR(6 , r1)
758773 REST_GPR(0 , r1)
759774 REST_GPR(1 , r1)
775+ .ifc \srr,srr
760776 RFI_TO_KERNEL
777+ .else
778+ HRFI_TO_KERNEL
779+ .endif
761780 b . /* prevent speculative execution */
762781
7637821: /*
@@ -777,8 +796,18 @@ ALT_FTR_SECTION_END_IFCLR(CPU_FTR_STCX_CHECKS_ADDRESS)
777796 std r9,0 (r1) /* perform store component of stdu */
778797 ld r9,PACA_EXGEN+0 (r13)
779798
799+ .ifc \srr,srr
780800 RFI_TO_KERNEL
801+ .else
802+ HRFI_TO_KERNEL
803+ .endif
781804 b . /* prevent speculative execution */
805+ .endm
806+
807+ interrupt_return_macro srr
808+ #ifdef CONFIG_PPC_BOOK3S
809+ interrupt_return_macro hsrr
810+ #endif
782811
783812#ifdef CONFIG_PPC_RTAS
784813/*
0 commit comments