From: Scott Wood <scottwood@freescale.com>
To: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
Cc: <linuxppc-dev@ozlabs.org>
Subject: Re: [PATCH 1/2] powerpc/kexec: Reset secondary cpu endianess before kexec
Date: Tue, 7 Jul 2015 21:35:38 -0500 [thread overview]
Message-ID: <1436322938.2658.60.camel@freescale.com> (raw)
In-Reply-To: <1436318605-13031-1-git-send-email-sam.mj@au1.ibm.com>
On Wed, 2015-07-08 at 11:23 +1000, 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>
> ---
> arch/powerpc/kernel/misc_64.S | 15 +++++++++++++--
> 1 file changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/kernel/misc_64.S b/arch/powerpc/kernel/misc_64.S
> index 4e314b9..c73e587 100644
> --- a/arch/powerpc/kernel/misc_64.S
> +++ b/arch/powerpc/kernel/misc_64.S
> @@ -475,9 +475,20 @@ _GLOBAL(kexec_wait)
> #ifdef CONFIG_KEXEC /* use no memory without kexec */
> lwz r4,0(r5)
> cmpwi 0,r4,0
> - bnea 0x60
> + beq 99b
> + mfmsr r9 /* Check endianess */
> + clrldi. r10,r9,63
> + beqa 0x60 /* Already big-endian */
> + bcl 20,31,$+4
> + mflr r10
> + addi r10,r10,28
> + mfmsr r11
> + xori r11,r11,1
> + mtsrr0 r10
> + mtsrr1 r11
> + rfid
> + .long 0x62000048 /* ba 0x60 */
> #endif
> - b 99b
Could you put a book3s ifdef around this? The low bit of MSR is reserved on
book3e (and rfid doesn't exist). Granted the bit should be zero, at least on
FSL book3e, but it's better to be explicit about code that is subarch-
specific.
And yes, I have book3e kexec patches coming.
Also, it would be better to use label subtraction rather than hardcoding
"28", and the bcl instruction would be more readable as "bl <label>".
-Scott
next prev parent reply other threads:[~2015-07-08 2:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-08 1:23 [PATCH 1/2] powerpc/kexec: Reset secondary cpu endianess before kexec Samuel Mendoza-Jonas
2015-07-08 1:23 ` [PATCH 2/2] powerpc/kexec: Reset HILE before kexec_sequence Samuel Mendoza-Jonas
2015-07-08 6:14 ` Stewart Smith
2015-07-08 2:35 ` Scott Wood [this message]
2015-07-08 4:04 ` [PATCH 1/2] powerpc/kexec: Reset secondary cpu endianess before kexec Paul Mackerras
2015-07-08 4:22 ` Scott Wood
2015-07-09 15:42 ` Segher Boessenkool
2015-07-09 20:27 ` Scott Wood
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1436322938.2658.60.camel@freescale.com \
--to=scottwood@freescale.com \
--cc=linuxppc-dev@ozlabs.org \
--cc=sam.mj@au1.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).