linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: linuxppc-dev@ozlabs.org
Subject: [PATCH 11/13] powerpc: Fix 64-bit BookE FP unavailable exceptions
Date: Mon,  5 Mar 2012 13:51:29 +1100	[thread overview]
Message-ID: <1330915891-19523-12-git-send-email-benh@kernel.crashing.org> (raw)
In-Reply-To: <1330915891-19523-1-git-send-email-benh@kernel.crashing.org>

We were using CR0.EQ after EXCEPTION_COMMON, hoping it still
contained whether we came from userspace or kernel space.

However, under some circumstances, EXCEPTION_COMMON will
call C code and clobber non-volatile registers, so we really
need to re-load the previous MSR from the stackframe and
re-test.

While there, invert the condition to make the fast path more
obvious and remove the BUG_OPCODE which was a debugging
leftover and call .ret_from_except as we should.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
 arch/powerpc/kernel/exceptions-64e.S |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/kernel/exceptions-64e.S b/arch/powerpc/kernel/exceptions-64e.S
index 3de9993..c4c3466 100644
--- a/arch/powerpc/kernel/exceptions-64e.S
+++ b/arch/powerpc/kernel/exceptions-64e.S
@@ -353,15 +353,16 @@ interrupt_end_book3e:
 	NORMAL_EXCEPTION_PROLOG(0x800, PROLOG_ADDITION_NONE)
 	/* we can probably do a shorter exception entry for that one... */
 	EXCEPTION_COMMON(0x800, PACA_EXGEN, INTS_KEEP)
-	bne	1f			/* if from user, just load it up */
-	INTS_DISABLE_ALL
+	ld	r12,_MSR(r1)
+	andi.	r0,r12,MSR_PR;
+	beq-	1f
+	bl	.load_up_fpu
+	b	fast_exception_return
+1:	INTS_DISABLE_ALL
 	bl	.save_nvgprs
 	addi	r3,r1,STACK_FRAME_OVERHEAD
 	bl	.kernel_fp_unavailable_exception
-	BUG_OPCODE
-1:	ld	r12,_MSR(r1)
-	bl	.load_up_fpu
-	b	fast_exception_return
+	b	.ret_from_except
 
 /* Decrementer Interrupt */
 	MASKABLE_EXCEPTION(0x900, decrementer, .timer_interrupt, ACK_DEC)
-- 
1.7.9

  parent reply	other threads:[~2012-03-05  2:53 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-05  2:51 [PATCH 00/13 v2] powerpc: Low level spring cleaning Benjamin Herrenschmidt
2012-03-05  2:51 ` [PATCH 01/13] powerpc: Remove legacy iSeries bits from assembly files Benjamin Herrenschmidt
2012-03-05  2:51 ` [PATCH 02/13] powerpc: Use the same interrupt prolog for perfmon as other interrupts Benjamin Herrenschmidt
2012-03-05  2:51 ` [PATCH 03/13] powerpc: Rework runlatch code Benjamin Herrenschmidt
2012-03-05  2:51 ` [PATCH 04/13] powerpc: Improve 64-bit syscall entry/exit Benjamin Herrenschmidt
2012-03-05  2:51 ` [PATCH 05/13] powerpc: Improve behaviour of irq tracing on 64-bit exception entry Benjamin Herrenschmidt
2012-03-05  2:51 ` [PATCH 06/13] powerpc: Disable interrupts in 64-bit kernel FP and vector faults Benjamin Herrenschmidt
2012-03-05  2:51 ` [PATCH 07/13] powerpc: Call do_page_fault() with interrupts off Benjamin Herrenschmidt
2012-03-05  2:51 ` [PATCH 08/13] powerpc: Add support for page fault retry and fatal signals Benjamin Herrenschmidt
2012-03-05  2:51 ` [PATCH 09/13] powerpc/xmon: Add display of soft & hard irq states Benjamin Herrenschmidt
2012-03-05  2:51 ` [PATCH 10/13] powerpc: Fix register clobbering when accumulating stolen time Benjamin Herrenschmidt
2012-03-05  2:51 ` Benjamin Herrenschmidt [this message]
2012-03-05  2:51 ` [PATCH 12/13] powerpc: Replace mfmsr instructions with load from PACA kernel_msr field Benjamin Herrenschmidt
2012-03-05  2:51 ` [PATCH 13/13] powerpc: Rework lazy-interrupt handling Benjamin Herrenschmidt

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=1330915891-19523-12-git-send-email-benh@kernel.crashing.org \
    --to=benh@kernel.crashing.org \
    --cc=linuxppc-dev@ozlabs.org \
    /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).