linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] non maskable interrupt reentrancy fixes for OPAL
@ 2017-05-01 12:01 Nicholas Piggin
  2017-05-01 12:01 ` [PATCH 1/2] powerpc/64s: Fix FIXUP_ENDIAN non-maskable interrupt reentrancy Nicholas Piggin
  2017-05-01 12:01 ` [PATCH 2/2] powerpc/64s: Fix OPAL_CALL " Nicholas Piggin
  0 siblings, 2 replies; 4+ messages in thread
From: Nicholas Piggin @ 2017-05-01 12:01 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Nicholas Piggin, Benjamin Herrenschmidt, Michael Ellerman

Hi,

These fixes are more minimal, and split up properly since last post.
Also accounted for Ben's comment of using HSRRs rather than disabling
RI for OPAL_CALL.

This will still increase cost of opal calls a bit due to new mtmsr in
FIXUP_ENDIAN return.

I have a few more patches that reduce overhead quite a bit, but they
won't be suitable for 4.12, so I'll send those out after merge window.

Thanks,
Nick

Nicholas Piggin (2):
  powerpc/64s: Fix FIXUP_ENDIAN non-maskable interrupt reentrancy
  powerpc/64s: Fix OPAL_CALL non-maskable interrupt reentrancy

 arch/powerpc/boot/ppc_asm.h                    | 12 +++++++-----
 arch/powerpc/include/asm/ppc_asm.h             | 11 +++++++----
 arch/powerpc/platforms/powernv/opal-wrappers.S |  6 +++---
 3 files changed, 17 insertions(+), 12 deletions(-)

-- 
2.11.0

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] powerpc/64s: Fix FIXUP_ENDIAN non-maskable interrupt reentrancy
  2017-05-01 12:01 [PATCH 0/2] non maskable interrupt reentrancy fixes for OPAL Nicholas Piggin
@ 2017-05-01 12:01 ` Nicholas Piggin
  2017-05-30  9:11   ` [1/2] " Michael Ellerman
  2017-05-01 12:01 ` [PATCH 2/2] powerpc/64s: Fix OPAL_CALL " Nicholas Piggin
  1 sibling, 1 reply; 4+ messages in thread
From: Nicholas Piggin @ 2017-05-01 12:01 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Nicholas Piggin, Benjamin Herrenschmidt, Michael Ellerman

FIXUP_ENDIAN uses SRR[01] with MSR_RI=1, which gets corrupted if there
is an interleaving system reset or machine check interrupt.

Set MSR_RI=0 before setting SRRs. The rfid will restore MSR.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 arch/powerpc/boot/ppc_asm.h        | 12 +++++++-----
 arch/powerpc/include/asm/ppc_asm.h | 11 +++++++----
 2 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/arch/powerpc/boot/ppc_asm.h b/arch/powerpc/boot/ppc_asm.h
index b03373d8b386..68e388ee94fe 100644
--- a/arch/powerpc/boot/ppc_asm.h
+++ b/arch/powerpc/boot/ppc_asm.h
@@ -67,13 +67,15 @@
 #define MSR_LE		0x0000000000000001
 
 #define FIXUP_ENDIAN						   \
-	tdi   0, 0, 0x48; /* Reverse endian of b . + 8		*/ \
-	b     $+36;	  /* Skip trampoline if endian is good	*/ \
-	.long 0x05009f42; /* bcl 20,31,$+4			*/ \
-	.long 0xa602487d; /* mflr r10				*/ \
-	.long 0x1c004a39; /* addi r10,r10,28			*/ \
+	tdi   0,0,0x48;	  /* Reverse endian of b . + 8		*/ \
+	b     $+44;	  /* Skip trampoline if endian is good	*/ \
 	.long 0xa600607d; /* mfmsr r11				*/ \
 	.long 0x01006b69; /* xori r11,r11,1			*/ \
+	.long 0x00004039; /* li r10,0				*/ \
+	.long 0x6401417d; /* mtmsrd r10,1			*/ \
+	.long 0x05009f42; /* bcl 20,31,$+4			*/ \
+	.long 0xa602487d; /* mflr r10				*/ \
+	.long 0x14004a39; /* addi r10,r10,20			*/ \
 	.long 0xa6035a7d; /* mtsrr0 r10				*/ \
 	.long 0xa6037b7d; /* mtsrr1 r11				*/ \
 	.long 0x2400004c  /* rfid				*/
diff --git a/arch/powerpc/include/asm/ppc_asm.h b/arch/powerpc/include/asm/ppc_asm.h
index 359c44341761..6baeeb9acd0d 100644
--- a/arch/powerpc/include/asm/ppc_asm.h
+++ b/arch/powerpc/include/asm/ppc_asm.h
@@ -770,15 +770,18 @@ END_FTR_SECTION_IFCLR(CPU_FTR_601)
 #else
 #define FIXUP_ENDIAN						   \
 	tdi   0,0,0x48;	  /* Reverse endian of b . + 8		*/ \
-	b     $+36;	  /* Skip trampoline if endian is good	*/ \
-	.long 0x05009f42; /* bcl 20,31,$+4			*/ \
-	.long 0xa602487d; /* mflr r10				*/ \
-	.long 0x1c004a39; /* addi r10,r10,28			*/ \
+	b     $+44;	  /* Skip trampoline if endian is good	*/ \
 	.long 0xa600607d; /* mfmsr r11				*/ \
 	.long 0x01006b69; /* xori r11,r11,1			*/ \
+	.long 0x00004039; /* li r10,0				*/ \
+	.long 0x6401417d; /* mtmsrd r10,1			*/ \
+	.long 0x05009f42; /* bcl 20,31,$+4			*/ \
+	.long 0xa602487d; /* mflr r10				*/ \
+	.long 0x14004a39; /* addi r10,r10,20			*/ \
 	.long 0xa6035a7d; /* mtsrr0 r10				*/ \
 	.long 0xa6037b7d; /* mtsrr1 r11				*/ \
 	.long 0x2400004c  /* rfid				*/
+
 #endif /* !CONFIG_PPC_BOOK3E */
 
 #endif /*  __ASSEMBLY__ */
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] powerpc/64s: Fix OPAL_CALL non-maskable interrupt reentrancy
  2017-05-01 12:01 [PATCH 0/2] non maskable interrupt reentrancy fixes for OPAL Nicholas Piggin
  2017-05-01 12:01 ` [PATCH 1/2] powerpc/64s: Fix FIXUP_ENDIAN non-maskable interrupt reentrancy Nicholas Piggin
@ 2017-05-01 12:01 ` Nicholas Piggin
  1 sibling, 0 replies; 4+ messages in thread
From: Nicholas Piggin @ 2017-05-01 12:01 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Nicholas Piggin, Benjamin Herrenschmidt, Michael Ellerman

OPAL_CALL uses SRR[01] with MSR_RI=1, which gets corrupted if there
is an interleaving system reset or machine check interrupt.

Use HSRR[01] instead, which does not require MSR_RI=0.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 arch/powerpc/platforms/powernv/opal-wrappers.S | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/platforms/powernv/opal-wrappers.S b/arch/powerpc/platforms/powernv/opal-wrappers.S
index f620572f891f..4ca6c26a56d5 100644
--- a/arch/powerpc/platforms/powernv/opal-wrappers.S
+++ b/arch/powerpc/platforms/powernv/opal-wrappers.S
@@ -99,10 +99,10 @@ opal_return:
 	lwz	r4,8(r1);
 	ld	r5,PPC_LR_STKOFF(r1);
 	ld	r6,PACASAVEDMSR(r13);
-	mtspr	SPRN_SRR0,r5;
-	mtspr	SPRN_SRR1,r6;
 	mtcr	r4;
-	rfid
+	mtspr	SPRN_HSRR0,r5;
+	mtspr	SPRN_HSRR1,r6;
+	hrfid
 
 opal_real_call:
 	mfcr	r11
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [1/2] powerpc/64s: Fix FIXUP_ENDIAN non-maskable interrupt reentrancy
  2017-05-01 12:01 ` [PATCH 1/2] powerpc/64s: Fix FIXUP_ENDIAN non-maskable interrupt reentrancy Nicholas Piggin
@ 2017-05-30  9:11   ` Michael Ellerman
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2017-05-30  9:11 UTC (permalink / raw)
  To: Nicholas Piggin, linuxppc-dev; +Cc: Nicholas Piggin

On Mon, 2017-05-01 at 12:01:09 UTC, Nicholas Piggin wrote:
> FIXUP_ENDIAN uses SRR[01] with MSR_RI=1, which gets corrupted if there
> is an interleaving system reset or machine check interrupt.
> 
> Set MSR_RI=0 before setting SRRs. The rfid will restore MSR.
> 
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>

Series applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/f1fe5252018075e18d7f0c0e23ee17

cheers

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-05-30  9:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-01 12:01 [PATCH 0/2] non maskable interrupt reentrancy fixes for OPAL Nicholas Piggin
2017-05-01 12:01 ` [PATCH 1/2] powerpc/64s: Fix FIXUP_ENDIAN non-maskable interrupt reentrancy Nicholas Piggin
2017-05-30  9:11   ` [1/2] " Michael Ellerman
2017-05-01 12:01 ` [PATCH 2/2] powerpc/64s: Fix OPAL_CALL " Nicholas Piggin

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).