@@ -58,6 +58,8 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_300)
5858#define STACK_SLOT_DAWR (SFS-56 )
5959#define STACK_SLOT_DAWRX (SFS-64 )
6060#define STACK_SLOT_HFSCR (SFS-72 )
61+ #define STACK_SLOT_AMR (SFS-80 )
62+ #define STACK_SLOT_UAMOR (SFS-88 )
6163/* the following is used by the P9 short path */
6264#define STACK_SLOT_NVGPRS (SFS-152 ) /* 18 gprs */
6365
@@ -726,23 +728,28 @@ BEGIN_FTR_SECTION
726728 mfspr r5, SPRN_TIDR
727729 mfspr r6, SPRN_PSSCR
728730 mfspr r7, SPRN_PID
729- mfspr r8, SPRN_IAMR
730731 std r5, STACK_SLOT_TID(r1)
731732 std r6, STACK_SLOT_PSSCR(r1)
732733 std r7, STACK_SLOT_PID(r1)
733- std r8, STACK_SLOT_IAMR(r1)
734734 mfspr r5, SPRN_HFSCR
735735 std r5, STACK_SLOT_HFSCR(r1)
736736END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300)
737737BEGIN_FTR_SECTION
738738 mfspr r5, SPRN_CIABR
739739 mfspr r6, SPRN_DAWR
740740 mfspr r7, SPRN_DAWRX
741+ mfspr r8, SPRN_IAMR
741742 std r5, STACK_SLOT_CIABR(r1)
742743 std r6, STACK_SLOT_DAWR(r1)
743744 std r7, STACK_SLOT_DAWRX(r1)
745+ std r8, STACK_SLOT_IAMR(r1)
744746END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S)
745747
748+ mfspr r5, SPRN_AMR
749+ std r5, STACK_SLOT_AMR(r1)
750+ mfspr r6, SPRN_UAMOR
751+ std r6, STACK_SLOT_UAMOR(r1)
752+
746753BEGIN_FTR_SECTION
747754 /* Set partition DABR */
748755 /* Do this before re-enabling PMU to avoid P7 DABR corruption bug */
@@ -1631,22 +1638,25 @@ ALT_FTR_SECTION_END_IFCLR(CPU_FTR_ARCH_300)
16311638 mtspr SPRN_PSPB, r0
16321639 mtspr SPRN_WORT, r0
16331640BEGIN_FTR_SECTION
1634- mtspr SPRN_IAMR, r0
16351641 mtspr SPRN_TCSCR, r0
16361642 /* Set MMCRS to 1<<31 to freeze and disable the SPMC counters */
16371643 li r0, 1
16381644 sldi r0, r0, 31
16391645 mtspr SPRN_MMCRS, r0
16401646END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_300)
1641- 8:
16421647
1643- /* Save and reset AMR and UAMOR before turning on the MMU */
1648+ /* Save and restore AMR, IAMR and UAMOR before turning on the MMU */
1649+ ld r8, STACK_SLOT_IAMR(r1)
1650+ mtspr SPRN_IAMR, r8
1651+
1652+ 8: /* Power7 jumps back in here */
16441653 mfspr r5,SPRN_AMR
16451654 mfspr r6,SPRN_UAMOR
16461655 std r5,VCPU_AMR(r9)
16471656 std r6,VCPU_UAMOR(r9)
1648- li r6,0
1649- mtspr SPRN_AMR,r6
1657+ ld r5,STACK_SLOT_AMR(r1)
1658+ ld r6,STACK_SLOT_UAMOR(r1)
1659+ mtspr SPRN_AMR, r5
16501660 mtspr SPRN_UAMOR, r6
16511661
16521662 /* Switch DSCR back to host value */
@@ -1746,11 +1756,9 @@ BEGIN_FTR_SECTION
17461756 ld r5, STACK_SLOT_TID(r1)
17471757 ld r6, STACK_SLOT_PSSCR(r1)
17481758 ld r7, STACK_SLOT_PID(r1)
1749- ld r8, STACK_SLOT_IAMR(r1)
17501759 mtspr SPRN_TIDR, r5
17511760 mtspr SPRN_PSSCR, r6
17521761 mtspr SPRN_PID, r7
1753- mtspr SPRN_IAMR, r8
17541762END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300)
17551763
17561764#ifdef CONFIG_PPC_RADIX_MMU
0 commit comments