* [PATCH 1/2] powerpc/64: Correct comment on LOAD_HANDLER()
@ 2016-07-26 5:29 Michael Ellerman
2016-07-26 5:29 ` [PATCH 2/2] powerpc/64: Do load of PACAKBASE in LOAD_HANDLER Michael Ellerman
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Michael Ellerman @ 2016-07-26 5:29 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Nick Piggin
The comment for LOAD_HANDLER() was wrong. The part about kdump has not
been true since 1f6a93e4c35e ("powerpc: Make it possible to move the
interrupt handlers away from the kernel").
Describe how it currently works, and combine the two separate comments
into one.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
arch/powerpc/include/asm/exception-64s.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/powerpc/include/asm/exception-64s.h b/arch/powerpc/include/asm/exception-64s.h
index 93ae809fe5ea..4ff3e2f16b5d 100644
--- a/arch/powerpc/include/asm/exception-64s.h
+++ b/arch/powerpc/include/asm/exception-64s.h
@@ -84,12 +84,12 @@
/*
* We're short on space and time in the exception prolog, so we can't
- * use the normal SET_REG_IMMEDIATE macro. Normally we just need the
- * low halfword of the address, but for Kdump we need the whole low
- * word.
+ * use the normal LOAD_REG_IMMEDIATE macro to load the address of label.
+ * Instead we get the base of the kernel from paca->kernelbase and or in the low
+ * part of label. This requires that the label be within 64KB of kernelbase, and
+ * that kernelbase be 64K aligned.
*/
#define LOAD_HANDLER(reg, label) \
- /* Handlers must be within 64K of kbase, which must be 64k aligned */ \
ori reg,reg,(label)-_stext; /* virt addr of handler ... */
/* Exception register prefixes */
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] powerpc/64: Do load of PACAKBASE in LOAD_HANDLER
2016-07-26 5:29 [PATCH 1/2] powerpc/64: Correct comment on LOAD_HANDLER() Michael Ellerman
@ 2016-07-26 5:29 ` Michael Ellerman
2016-07-26 6:36 ` Nicholas Piggin
2016-09-13 12:16 ` [2/2] " Michael Ellerman
2016-07-26 6:17 ` [PATCH 1/2] powerpc/64: Correct comment on LOAD_HANDLER() Nicholas Piggin
2016-09-13 12:16 ` [1/2] " Michael Ellerman
2 siblings, 2 replies; 6+ messages in thread
From: Michael Ellerman @ 2016-07-26 5:29 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Nick Piggin
The LOAD_HANDLER macro requires that you have previously loaded "reg"
with PACAKBASE. Although that gives callers flexibility to get PACAKBASE
in some interesting way, none of the callers actually do that. So fold
the load of PACAKBASE into the macro, making it simpler for callers to
use correctly.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
arch/powerpc/include/asm/exception-64s.h | 3 +--
arch/powerpc/kernel/exceptions-64s.S | 10 ----------
2 files changed, 1 insertion(+), 12 deletions(-)
diff --git a/arch/powerpc/include/asm/exception-64s.h b/arch/powerpc/include/asm/exception-64s.h
index 4ff3e2f16b5d..887867ac4bfa 100644
--- a/arch/powerpc/include/asm/exception-64s.h
+++ b/arch/powerpc/include/asm/exception-64s.h
@@ -52,7 +52,6 @@
#ifdef CONFIG_RELOCATABLE
#define __EXCEPTION_RELON_PROLOG_PSERIES_1(label, h) \
- ld r12,PACAKBASE(r13); /* get high part of &label */ \
mfspr r11,SPRN_##h##SRR0; /* save SRR0 */ \
LOAD_HANDLER(r12,label); \
mtctr r12; \
@@ -90,6 +89,7 @@
* that kernelbase be 64K aligned.
*/
#define LOAD_HANDLER(reg, label) \
+ ld reg,PACAKBASE(r13); /* get high part of &label */ \
ori reg,reg,(label)-_stext; /* virt addr of handler ... */
/* Exception register prefixes */
@@ -175,7 +175,6 @@ END_FTR_SECTION_NESTED(ftr,ftr,943)
__EXCEPTION_PROLOG_1(area, extra, vec)
#define __EXCEPTION_PROLOG_PSERIES_1(label, h) \
- ld r12,PACAKBASE(r13); /* get high part of &label */ \
ld r10,PACAKMSR(r13); /* get MSR value for kernel */ \
mfspr r11,SPRN_##h##SRR0; /* save SRR0 */ \
LOAD_HANDLER(r12,label) \
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
index 8bcc1b457115..af30f26c35d8 100644
--- a/arch/powerpc/kernel/exceptions-64s.S
+++ b/arch/powerpc/kernel/exceptions-64s.S
@@ -41,7 +41,6 @@ END_FTR_SECTION_IFSET(CPU_FTR_REAL_LE) \
#define SYSCALL_PSERIES_2_RFID \
mfspr r12,SPRN_SRR1 ; \
- ld r10,PACAKBASE(r13) ; \
LOAD_HANDLER(r10, system_call_entry) ; \
mtspr SPRN_SRR0,r10 ; \
ld r10,PACAKMSR(r13) ; \
@@ -64,7 +63,6 @@ END_FTR_SECTION_IFSET(CPU_FTR_REAL_LE) \
*/
#define SYSCALL_PSERIES_2_DIRECT \
mflr r10 ; \
- ld r12,PACAKBASE(r13) ; \
LOAD_HANDLER(r12, system_call_entry) ; \
mtctr r12 ; \
mfspr r12,SPRN_SRR1 ; \
@@ -219,7 +217,6 @@ data_access_slb_pSeries:
* the kernel ends up being put.
*/
mfctr r11
- ld r10,PACAKBASE(r13)
LOAD_HANDLER(r10, slb_miss_realmode)
mtctr r10
bctr
@@ -240,7 +237,6 @@ instruction_access_slb_pSeries:
b slb_miss_realmode
#else
mfctr r11
- ld r10,PACAKBASE(r13)
LOAD_HANDLER(r10, slb_miss_realmode)
mtctr r10
bctr
@@ -486,7 +482,6 @@ BEGIN_FTR_SECTION
mfmsr r11 /* get MSR value */
ori r11,r11,MSR_ME /* turn on ME bit */
ori r11,r11,MSR_RI /* turn on RI bit */
- ld r12,PACAKBASE(r13) /* get high part of &label */
LOAD_HANDLER(r12, machine_check_handle_early)
1: mtspr SPRN_SRR0,r12
mtspr SPRN_SRR1,r11
@@ -499,7 +494,6 @@ BEGIN_FTR_SECTION
*/
addi r1,r1,INT_FRAME_SIZE /* go back to previous stack frame */
ld r11,PACAKMSR(r13)
- ld r12,PACAKBASE(r13)
LOAD_HANDLER(r12, unrecover_mce)
li r10,MSR_ME
andc r11,r11,r10 /* Turn off MSR_ME */
@@ -802,7 +796,6 @@ data_access_slb_relon_pSeries:
* the kernel ends up being put.
*/
mfctr r11
- ld r10,PACAKBASE(r13)
LOAD_HANDLER(r10, slb_miss_realmode)
mtctr r10
bctr
@@ -822,7 +815,6 @@ instruction_access_slb_relon_pSeries:
b slb_miss_realmode
#else
mfctr r11
- ld r10,PACAKBASE(r13)
LOAD_HANDLER(r10, slb_miss_realmode)
mtctr r10
bctr
@@ -1321,7 +1313,6 @@ machine_check_handle_early:
andi. r11,r12,MSR_RI
bne 2f
1: mfspr r11,SPRN_SRR0
- ld r10,PACAKBASE(r13)
LOAD_HANDLER(r10,unrecover_mce)
mtspr SPRN_SRR0,r10
ld r10,PACAKMSR(r13)
@@ -1422,7 +1413,6 @@ ALT_MMU_FTR_SECTION_END_IFCLR(MMU_FTR_RADIX)
b . /* prevent speculative execution */
2: mfspr r11,SPRN_SRR0
- ld r10,PACAKBASE(r13)
LOAD_HANDLER(r10,unrecov_slb)
mtspr SPRN_SRR0,r10
ld r10,PACAKMSR(r13)
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] powerpc/64: Correct comment on LOAD_HANDLER()
2016-07-26 5:29 [PATCH 1/2] powerpc/64: Correct comment on LOAD_HANDLER() Michael Ellerman
2016-07-26 5:29 ` [PATCH 2/2] powerpc/64: Do load of PACAKBASE in LOAD_HANDLER Michael Ellerman
@ 2016-07-26 6:17 ` Nicholas Piggin
2016-09-13 12:16 ` [1/2] " Michael Ellerman
2 siblings, 0 replies; 6+ messages in thread
From: Nicholas Piggin @ 2016-07-26 6:17 UTC (permalink / raw)
To: Michael Ellerman; +Cc: linuxppc-dev
On Tue, 26 Jul 2016 15:29:29 +1000
Michael Ellerman <mpe@ellerman.id.au> wrote:
> The comment for LOAD_HANDLER() was wrong. The part about kdump has not
> been true since 1f6a93e4c35e ("powerpc: Make it possible to move the
> interrupt handlers away from the kernel").
>
> Describe how it currently works, and combine the two separate comments
> into one.
>
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Reviewed-by: Nick Piggin <npiggin@gmail.com>
> ---
> arch/powerpc/include/asm/exception-64s.h | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/exception-64s.h
> b/arch/powerpc/include/asm/exception-64s.h index
> 93ae809fe5ea..4ff3e2f16b5d 100644 ---
> a/arch/powerpc/include/asm/exception-64s.h +++
> b/arch/powerpc/include/asm/exception-64s.h @@ -84,12 +84,12 @@
>
> /*
> * We're short on space and time in the exception prolog, so we can't
> - * use the normal SET_REG_IMMEDIATE macro. Normally we just need the
> - * low halfword of the address, but for Kdump we need the whole low
> - * word.
> + * use the normal LOAD_REG_IMMEDIATE macro to load the address of
> label.
> + * Instead we get the base of the kernel from paca->kernelbase and
> or in the low
> + * part of label. This requires that the label be within 64KB of
> kernelbase, and
> + * that kernelbase be 64K aligned.
> */
> #define LOAD_HANDLER(reg,
> label) \
> - /* Handlers must be within 64K of kbase, which must be 64k
> aligned */ \ ori reg,reg,(label)-_stext; /* virt addr
> of handler ... */
> /* Exception register prefixes */
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] powerpc/64: Do load of PACAKBASE in LOAD_HANDLER
2016-07-26 5:29 ` [PATCH 2/2] powerpc/64: Do load of PACAKBASE in LOAD_HANDLER Michael Ellerman
@ 2016-07-26 6:36 ` Nicholas Piggin
2016-09-13 12:16 ` [2/2] " Michael Ellerman
1 sibling, 0 replies; 6+ messages in thread
From: Nicholas Piggin @ 2016-07-26 6:36 UTC (permalink / raw)
To: Michael Ellerman; +Cc: linuxppc-dev
On Tue, 26 Jul 2016 15:29:30 +1000
Michael Ellerman <mpe@ellerman.id.au> wrote:
> The LOAD_HANDLER macro requires that you have previously loaded "reg"
> with PACAKBASE. Although that gives callers flexibility to get
> PACAKBASE in some interesting way, none of the callers actually do
> that. So fold the load of PACAKBASE into the macro, making it simpler
> for callers to use correctly.
>
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
I don't see any problem with this.
Reviewed-by: Nick Piggin <npiggin@gmail.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [1/2] powerpc/64: Correct comment on LOAD_HANDLER()
2016-07-26 5:29 [PATCH 1/2] powerpc/64: Correct comment on LOAD_HANDLER() Michael Ellerman
2016-07-26 5:29 ` [PATCH 2/2] powerpc/64: Do load of PACAKBASE in LOAD_HANDLER Michael Ellerman
2016-07-26 6:17 ` [PATCH 1/2] powerpc/64: Correct comment on LOAD_HANDLER() Nicholas Piggin
@ 2016-09-13 12:16 ` Michael Ellerman
2 siblings, 0 replies; 6+ messages in thread
From: Michael Ellerman @ 2016-09-13 12:16 UTC (permalink / raw)
To: Michael Ellerman, linuxppc-dev; +Cc: Nick Piggin
On Tue, 2016-26-07 at 05:29:29 UTC, Michael Ellerman wrote:
> The comment for LOAD_HANDLER() was wrong. The part about kdump has not
> been true since 1f6a93e4c35e ("powerpc: Make it possible to move the
> interrupt handlers away from the kernel").
>
> Describe how it currently works, and combine the two separate comments
> into one.
>
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> Reviewed-by: Nick Piggin <npiggin@gmail.com>
Applied to powerpc next.
https://git.kernel.org/powerpc/c/27510235dd2bb1ab01d27b01f0
cheers
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [2/2] powerpc/64: Do load of PACAKBASE in LOAD_HANDLER
2016-07-26 5:29 ` [PATCH 2/2] powerpc/64: Do load of PACAKBASE in LOAD_HANDLER Michael Ellerman
2016-07-26 6:36 ` Nicholas Piggin
@ 2016-09-13 12:16 ` Michael Ellerman
1 sibling, 0 replies; 6+ messages in thread
From: Michael Ellerman @ 2016-09-13 12:16 UTC (permalink / raw)
To: Michael Ellerman, linuxppc-dev; +Cc: Nick Piggin
On Tue, 2016-26-07 at 05:29:30 UTC, Michael Ellerman wrote:
> The LOAD_HANDLER macro requires that you have previously loaded "reg"
> with PACAKBASE. Although that gives callers flexibility to get PACAKBASE
> in some interesting way, none of the callers actually do that. So fold
> the load of PACAKBASE into the macro, making it simpler for callers to
> use correctly.
>
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> Reviewed-by: Nick Piggin <npiggin@gmail.com>
Applied to powerpc next.
https://git.kernel.org/powerpc/c/d8d42b0511fefc78165ee9b4c2
cheers
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-09-13 12:16 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-26 5:29 [PATCH 1/2] powerpc/64: Correct comment on LOAD_HANDLER() Michael Ellerman
2016-07-26 5:29 ` [PATCH 2/2] powerpc/64: Do load of PACAKBASE in LOAD_HANDLER Michael Ellerman
2016-07-26 6:36 ` Nicholas Piggin
2016-09-13 12:16 ` [2/2] " Michael Ellerman
2016-07-26 6:17 ` [PATCH 1/2] powerpc/64: Correct comment on LOAD_HANDLER() Nicholas Piggin
2016-09-13 12:16 ` [1/2] " Michael Ellerman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).