Message ID | 20170521131550.25813-4-npiggin@gmail.com (mailing list archive) |
---|---|
State | Accepted |
Commit | fe5482c04312791bb19202e47f8a7751d476251e |
Headers | show |
Nicholas Piggin <npiggin@gmail.com> writes: > The EXCEPTION_PROLOG_1 used by SLB miss already saves CTR when the > kernel is built with CONFIG_RELOCATABLE. So it does not have to be > saved and reloaded when branching to slb_miss_realmode. It can be > restored from the PACA as usual. > > Signed-off-by: Nicholas Piggin <npiggin@gmail.com> > --- > arch/powerpc/kernel/exceptions-64s.S | 13 +++++-------- > 1 file changed, 5 insertions(+), 8 deletions(-) > > diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S > index a4a71bce35d6..486e205cc762 100644 > --- a/arch/powerpc/kernel/exceptions-64s.S > +++ b/arch/powerpc/kernel/exceptions-64s.S > @@ -519,7 +519,7 @@ EXC_REAL_BEGIN(data_access_slb, 0x380, 0x80) > * because the distance from here to there depends on where > * the kernel ends up being put. > */ > - mfctr r11 > + /* CTR is saved if RELOCATABLE */ > LOAD_HANDLER(r10, slb_miss_realmode) > mtctr r10 > bctr AFAICS these can all use BRANCH_TO_COMMON(). So I'll drop all the comment additions from this and do a follow-up to switch to BRANCH_TO_COMMON(). cheers
On Mon, 19 Jun 2017 21:45:06 +1000 Michael Ellerman <mpe@ellerman.id.au> wrote: > Nicholas Piggin <npiggin@gmail.com> writes: > > > The EXCEPTION_PROLOG_1 used by SLB miss already saves CTR when the > > kernel is built with CONFIG_RELOCATABLE. So it does not have to be > > saved and reloaded when branching to slb_miss_realmode. It can be > > restored from the PACA as usual. > > > > Signed-off-by: Nicholas Piggin <npiggin@gmail.com> > > --- > > arch/powerpc/kernel/exceptions-64s.S | 13 +++++-------- > > 1 file changed, 5 insertions(+), 8 deletions(-) > > > > diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S > > index a4a71bce35d6..486e205cc762 100644 > > --- a/arch/powerpc/kernel/exceptions-64s.S > > +++ b/arch/powerpc/kernel/exceptions-64s.S > > @@ -519,7 +519,7 @@ EXC_REAL_BEGIN(data_access_slb, 0x380, 0x80) > > * because the distance from here to there depends on where > > * the kernel ends up being put. > > */ > > - mfctr r11 > > + /* CTR is saved if RELOCATABLE */ > > LOAD_HANDLER(r10, slb_miss_realmode) > > mtctr r10 > > bctr > > AFAICS these can all use BRANCH_TO_COMMON(). > > So I'll drop all the comment additions from this and do a follow-up to > switch to BRANCH_TO_COMMON(). That will tidy up those ifdefs nicely. Good catch. Thanks, Nick
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index a4a71bce35d6..486e205cc762 100644 --- a/arch/powerpc/kernel/exceptions-64s.S +++ b/arch/powerpc/kernel/exceptions-64s.S @@ -519,7 +519,7 @@ EXC_REAL_BEGIN(data_access_slb, 0x380, 0x80) * because the distance from here to there depends on where * the kernel ends up being put. */ - mfctr r11 + /* CTR is saved if RELOCATABLE */ LOAD_HANDLER(r10, slb_miss_realmode) mtctr r10 bctr @@ -542,7 +542,7 @@ EXC_VIRT_BEGIN(data_access_slb, 0x4380, 0x80) * because the distance from here to there depends on where * the kernel ends up being put. */ - mfctr r11 + /* CTR is saved if RELOCATABLE */ LOAD_HANDLER(r10, slb_miss_realmode) mtctr r10 bctr @@ -582,7 +582,7 @@ EXC_REAL_BEGIN(instruction_access_slb, 0x480, 0x80) #ifndef CONFIG_RELOCATABLE b slb_miss_realmode #else - mfctr r11 + /* CTR is saved if RELOCATABLE */ LOAD_HANDLER(r10, slb_miss_realmode) mtctr r10 bctr @@ -600,7 +600,7 @@ EXC_VIRT_BEGIN(instruction_access_slb, 0x4480, 0x80) #ifndef CONFIG_RELOCATABLE b slb_miss_realmode #else - mfctr r11 + /* CTR is saved if RELOCATABLE */ LOAD_HANDLER(r10, slb_miss_realmode) mtctr r10 bctr @@ -622,10 +622,6 @@ EXC_COMMON_BEGIN(slb_miss_realmode) * procedure. */ mflr r10 -#ifdef CONFIG_RELOCATABLE - mtctr r11 -#endif - stw r9,PACA_EXSLB+EX_CCR(r13) /* save CR in exc. frame */ std r10,PACA_EXSLB+EX_LR(r13) /* save LR */ @@ -654,6 +650,7 @@ END_MMU_FTR_SECTION_IFCLR(MMU_FTR_TYPE_RADIX) mtcrf 0x01,r9 /* slb_allocate uses cr0 and cr7 */ .machine pop + RESTORE_CTR(r9, PACA_EXSLB) RESTORE_PPR_PACA(PACA_EXSLB, r9) ld r3,PACA_EXSLB+EX_R3(r13) ld r9,PACA_EXSLB+EX_R9(r13)
The EXCEPTION_PROLOG_1 used by SLB miss already saves CTR when the kernel is built with CONFIG_RELOCATABLE. So it does not have to be saved and reloaded when branching to slb_miss_realmode. It can be restored from the PACA as usual. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> --- arch/powerpc/kernel/exceptions-64s.S | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)