linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: Simon Horman <horms@verge.net.au>
Cc: <kexec@lists.infradead.org>, <linuxppc-dev@lists.ozlabs.org>,
	"Michael Ellerman" <mpe@ellerman.id.au>,
	Scott Wood <scottwood@freescale.com>,
	"Samuel Mendoza-Jonas" <sam.mj@au1.ibm.com>
Subject: [PATCH v2 2/3] ppc64: Avoid rfid if no need to clear MSR_LE
Date: Tue, 6 Oct 2015 17:55:49 -0500	[thread overview]
Message-ID: <1444172150-29493-2-git-send-email-scottwood@freescale.com> (raw)
In-Reply-To: <1444172150-29493-1-git-send-email-scottwood@freescale.com>

Commit a304e2d82a8c3 ("ppc64: purgatory: Reset primary cpu endian to
big-endian) changed bctr to rfid.  rfid is book3s-only and will cause a
fatal exception on book3e.

Purgatory is an isolated environment which makes importing information
about the subarch awkward, so instead rely on the fact that MSR_LE
should never be set on book3e, and the rfid is only needed if MSR_LE is
set (and thus needs to be cleared).  In theory that MSR bit is reserved
on book3e, rather than zero, but in practice I have not seen it set.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Cc: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
---
v2: new patch

 purgatory/arch/ppc64/v2wrap.S | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/purgatory/arch/ppc64/v2wrap.S b/purgatory/arch/ppc64/v2wrap.S
index 179ade9..3534080 100644
--- a/purgatory/arch/ppc64/v2wrap.S
+++ b/purgatory/arch/ppc64/v2wrap.S
@@ -116,9 +116,17 @@ master:
 	stw	7,0x5c(4)	# and patch it into the kernel
 	mr      3,16            # restore dt address
 
+	mfmsr	5
+	andi.	10,5,1		# test MSR_LE
+	bne	little_endian
+
+	li	5,0		# r5 will be 0 for kernel
+	mtctr	4		# prepare branch to
+	bctr			# start kernel
+	
+little_endian:			# book3s-only
 	mtsrr0	4		# prepare branch to
 
-	mfmsr	5
 	clrrdi	5,5,1		# clear MSR_LE
 	mtsrr1	5
 
-- 
2.1.4

  reply	other threads:[~2015-10-06 22:56 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-06 22:55 [PATCH v2 1/3] ppc64: Fix warnings Scott Wood
2015-10-06 22:55 ` Scott Wood [this message]
2015-10-16  1:48   ` [PATCH v2 2/3] ppc64: Avoid rfid if no need to clear MSR_LE Simon Horman
2015-10-30  0:16     ` Scott Wood
2015-11-01 22:55   ` Sam Mendoza-Jonas
2015-11-02  0:21     ` Sam Mendoza-Jonas
2015-11-02  2:06       ` Simon Horman
2015-10-06 22:55 ` [PATCH v2 3/3] ppc64: Add a flag to tell the kernel it's booting from kexec Scott Wood
2015-10-16  1:48   ` Simon Horman
2015-12-07 20:42   ` Scott Wood
2015-12-08  3:46     ` Michael Ellerman
2015-12-08  6:01       ` Simon Horman
2015-10-16  1:47 ` [PATCH v2 1/3] ppc64: Fix warnings Simon Horman

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=1444172150-29493-2-git-send-email-scottwood@freescale.com \
    --to=scottwood@freescale.com \
    --cc=horms@verge.net.au \
    --cc=kexec@lists.infradead.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --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).