* [PATCH V4 0/2] powerpc/kexec: Reset endianess before kexec
@ 2015-07-22 5:50 Samuel Mendoza-Jonas
2015-07-22 5:50 ` [PATCH V4 1/2] powerpc/kexec: Reset secondary cpu " Samuel Mendoza-Jonas
2015-07-22 5:50 ` [PATCH V4 2/2] powerpc/kexec: Reset HILE before kexec_sequence Samuel Mendoza-Jonas
0 siblings, 2 replies; 5+ messages in thread
From: Samuel Mendoza-Jonas @ 2015-07-22 5:50 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Samuel Mendoza-Jonas, benh, mpe
Older ppc64 kernels, namely those missing FIXUP_ENDIAN or opal_reinit_cpus,
will fail to boot if started via kexec from a little-endian kernel.
The following two patches make sure that the current endianess is reset to
big-endian just before entering the target kernel, and are accompanied by
a separate patch to kexec-lite that resets the endianess of the boot cpu.
Changes in v4:
As pointed out by Ben since interrupts are already disabled before checking
that all secondaries are in OPAL, we can make the call to opal_reinit_cpus
in C, in pnv_kexec_cpu_down().
Changes in v3:
Move the call to opal_reinit_cpus into kexec_sequence so we can call it in
real mode with interrupts disabled. Update the kexec_sequence prototype so
that we can check if OPAL is present.
Fix the !CONFIG_PPC_BOOK3S_64 case in kexec_wait to correctly branch to 0x60
Changes in v2:
Add an #ifdef for subarch-specific code
Neaten the endian check (and extra call to mfmsr!) by modifying the msr and
branching to the target kernel in the same call to rfid.
Samuel Mendoza-Jonas (2):
powerpc/kexec: Reset secondary cpu endianess before kexec
powerpc/kexec: Reset HILE before kexec_sequence
arch/powerpc/kernel/misc_64.S | 13 +++++++++++--
arch/powerpc/platforms/powernv/setup.c | 7 +++++++
2 files changed, 18 insertions(+), 2 deletions(-)
--
2.4.6
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH V4 1/2] powerpc/kexec: Reset secondary cpu endianess before kexec
2015-07-22 5:50 [PATCH V4 0/2] powerpc/kexec: Reset endianess before kexec Samuel Mendoza-Jonas
@ 2015-07-22 5:50 ` Samuel Mendoza-Jonas
2015-08-21 7:43 ` [V4, " Michael Ellerman
2015-07-22 5:50 ` [PATCH V4 2/2] powerpc/kexec: Reset HILE before kexec_sequence Samuel Mendoza-Jonas
1 sibling, 1 reply; 5+ messages in thread
From: Samuel Mendoza-Jonas @ 2015-07-22 5:50 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Samuel Mendoza-Jonas, benh, mpe
If the target kernel does not inlcude the FIXUP_ENDIAN check, coming
from a different-endian kernel will cause the target kernel to panic.
All ppc64 kernels can handle starting in big-endian mode, so return to
big-endian before branching into the target kernel.
This mainly affects pseries as secondaries on powernv are returned to
OPAL.
Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
---
arch/powerpc/kernel/misc_64.S | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/kernel/misc_64.S b/arch/powerpc/kernel/misc_64.S
index 4e314b9..6e4168c 100644
--- a/arch/powerpc/kernel/misc_64.S
+++ b/arch/powerpc/kernel/misc_64.S
@@ -475,9 +475,18 @@ _GLOBAL(kexec_wait)
#ifdef CONFIG_KEXEC /* use no memory without kexec */
lwz r4,0(r5)
cmpwi 0,r4,0
- bnea 0x60
+ beq 99b
+#ifdef CONFIG_PPC_BOOK3S_64
+ li r10,0x60
+ mfmsr r11
+ clrrdi r11,r11,1 /* Clear MSR_LE */
+ mtsrr0 r10
+ mtsrr1 r11
+ rfid
+#else
+ ba 0x60
+#endif
#endif
- b 99b
/* this can be in text because we won't change it until we are
* running in real anyways
--
2.4.6
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH V4 2/2] powerpc/kexec: Reset HILE before kexec_sequence
2015-07-22 5:50 [PATCH V4 0/2] powerpc/kexec: Reset endianess before kexec Samuel Mendoza-Jonas
2015-07-22 5:50 ` [PATCH V4 1/2] powerpc/kexec: Reset secondary cpu " Samuel Mendoza-Jonas
@ 2015-07-22 5:50 ` Samuel Mendoza-Jonas
2015-08-21 7:43 ` [V4,2/2] " Michael Ellerman
1 sibling, 1 reply; 5+ messages in thread
From: Samuel Mendoza-Jonas @ 2015-07-22 5:50 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Samuel Mendoza-Jonas, benh, mpe
On powernv secondary cpus are returned to OPAL, and will then enter
the target kernel in big-endian. However if it is set the HILE bit
will persist, causing the first exception in the target kernel to be
delivered in litte-endian regardless of the current endianess.
If running on top of OPAL make sure the HILE bit is reset once we've
finished waiting for all of the secondaries to be returned to OPAL.
Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
---
arch/powerpc/platforms/powernv/setup.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c
index 53737e0..59076db 100644
--- a/arch/powerpc/platforms/powernv/setup.c
+++ b/arch/powerpc/platforms/powernv/setup.c
@@ -243,6 +243,13 @@ static void pnv_kexec_cpu_down(int crash_shutdown, int secondary)
} else {
/* Primary waits for the secondaries to have reached OPAL */
pnv_kexec_wait_secondaries_down();
+
+ /*
+ * We might be running as little-endian - now that interrupts
+ * are disabled, reset the HILE bit to big-endian so we don't
+ * take interrupts in the wrong endian later
+ */
+ opal_reinit_cpus(OPAL_REINIT_CPUS_HILE_BE);
}
}
#endif /* CONFIG_KEXEC */
--
2.4.6
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [V4,2/2] powerpc/kexec: Reset HILE before kexec_sequence
2015-07-22 5:50 ` [PATCH V4 2/2] powerpc/kexec: Reset HILE before kexec_sequence Samuel Mendoza-Jonas
@ 2015-08-21 7:43 ` Michael Ellerman
0 siblings, 0 replies; 5+ messages in thread
From: Michael Ellerman @ 2015-08-21 7:43 UTC (permalink / raw)
To: Samuel Mendoza-Jonas, linuxppc-dev; +Cc: Samuel Mendoza-Jonas
On Wed, 2015-22-07 at 05:50:51 UTC, Samuel Mendoza-Jonas wrote:
> On powernv secondary cpus are returned to OPAL, and will then enter
> the target kernel in big-endian. However if it is set the HILE bit
> will persist, causing the first exception in the target kernel to be
> delivered in litte-endian regardless of the current endianess.
>
> If running on top of OPAL make sure the HILE bit is reset once we've
> finished waiting for all of the secondaries to be returned to OPAL.
>
> Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/e72bb8a5a884d0222311
cheers
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [V4, 1/2] powerpc/kexec: Reset secondary cpu endianess before kexec
2015-07-22 5:50 ` [PATCH V4 1/2] powerpc/kexec: Reset secondary cpu " Samuel Mendoza-Jonas
@ 2015-08-21 7:43 ` Michael Ellerman
0 siblings, 0 replies; 5+ messages in thread
From: Michael Ellerman @ 2015-08-21 7:43 UTC (permalink / raw)
To: Samuel Mendoza-Jonas, linuxppc-dev; +Cc: Samuel Mendoza-Jonas
On Wed, 2015-22-07 at 05:50:50 UTC, Samuel Mendoza-Jonas wrote:
> If the target kernel does not inlcude the FIXUP_ENDIAN check, coming
> from a different-endian kernel will cause the target kernel to panic.
> All ppc64 kernels can handle starting in big-endian mode, so return to
> big-endian before branching into the target kernel.
>
> This mainly affects pseries as secondaries on powernv are returned to
> OPAL.
>
> Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/ffebf5f391dfa9da3e08
cheers
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-08-21 7:43 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-22 5:50 [PATCH V4 0/2] powerpc/kexec: Reset endianess before kexec Samuel Mendoza-Jonas
2015-07-22 5:50 ` [PATCH V4 1/2] powerpc/kexec: Reset secondary cpu " Samuel Mendoza-Jonas
2015-08-21 7:43 ` [V4, " Michael Ellerman
2015-07-22 5:50 ` [PATCH V4 2/2] powerpc/kexec: Reset HILE before kexec_sequence Samuel Mendoza-Jonas
2015-08-21 7:43 ` [V4,2/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).