linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Christophe Leroy <christophe.leroy@c-s.fr>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Paul Mackerras <paulus@samba.org>,
	Michael Ellerman <mpe@ellerman.id.au>
Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	linux-mm@kvack.org
Subject: [PATCH v4 15/16] powerpc/32s: avoid crossing page boundary while changing SRR0/1.
Date: Tue, 26 Nov 2019 12:36:19 +0000 (UTC)	[thread overview]
Message-ID: <5bd5ce84265711f7611b028edbca7f0fe9565499.1574771541.git.christophe.leroy@c-s.fr> (raw)
In-Reply-To: <cover.1574771539.git.christophe.leroy@c-s.fr>

Trying VMAP_STACK with KVM, vmlinux was not starting.
This was due to SRR0 and SRR1 clobbered by an ISI due to
the rfi being in a different page than the mtsrr0/1:

c0003fe0 <mmu_off>:
c0003fe0:       38 83 00 54     addi    r4,r3,84
c0003fe4:       7c 60 00 a6     mfmsr   r3
c0003fe8:       70 60 00 30     andi.   r0,r3,48
c0003fec:       4d 82 00 20     beqlr
c0003ff0:       7c 63 00 78     andc    r3,r3,r0
c0003ff4:       7c 9a 03 a6     mtsrr0  r4
c0003ff8:       7c 7b 03 a6     mtsrr1  r3
c0003ffc:       7c 00 04 ac     hwsync
c0004000:       4c 00 00 64     rfi

Align the 4 instruction block used to deactivate MMU to order 4,
so that the block never crosses a page boundary.

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
---
 arch/powerpc/kernel/head_32.S | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/powerpc/kernel/head_32.S b/arch/powerpc/kernel/head_32.S
index 7ec780858299..90ef355e958b 100644
--- a/arch/powerpc/kernel/head_32.S
+++ b/arch/powerpc/kernel/head_32.S
@@ -917,6 +917,8 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_HPTE_TABLE)
 	ori	r4,r4,2f@l
 	tophys(r4,r4)
 	li	r3,MSR_KERNEL & ~(MSR_IR|MSR_DR)
+
+	.align	4
 	mtspr	SPRN_SRR0,r4
 	mtspr	SPRN_SRR1,r3
 	SYNC
@@ -1058,6 +1060,8 @@ _ENTRY(update_bats)
 	rlwinm	r0, r6, 0, ~MSR_RI
 	rlwinm	r0, r0, 0, ~MSR_EE
 	mtmsr	r0
+
+	.align	4
 	mtspr	SPRN_SRR0, r4
 	mtspr	SPRN_SRR1, r3
 	SYNC
@@ -1097,6 +1101,8 @@ mmu_off:
 	andi.	r0,r3,MSR_DR|MSR_IR		/* MMU enabled? */
 	beqlr
 	andc	r3,r3,r0
+
+	.align	4
 	mtspr	SPRN_SRR0,r4
 	mtspr	SPRN_SRR1,r3
 	sync
-- 
2.13.3



  parent reply	other threads:[~2019-11-26 12:36 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-26 12:36 [PATCH v4 00/16] Enable CONFIG_VMAP_STACK on PPC32 Christophe Leroy
2019-11-26 12:36 ` [PATCH v4 01/16] powerpc/32: replace MTMSRD() by mtmsr Christophe Leroy
2019-11-26 12:36 ` [PATCH v4 02/16] powerpc/32: Add EXCEPTION_PROLOG_0 in head_32.h Christophe Leroy
2019-11-26 12:36 ` [PATCH v4 03/16] powerpc/32: save DEAR/DAR before calling handle_page_fault Christophe Leroy
2019-11-26 12:36 ` [PATCH v4 04/16] powerpc/32: move MSR_PR test into EXCEPTION_PROLOG_0 Christophe Leroy
2019-11-26 12:36 ` [PATCH v4 05/16] powerpc/32: add a macro to get and/or save DAR and DSISR on stack Christophe Leroy
2019-11-26 12:36 ` [PATCH v4 06/16] powerpc/32: prepare for CONFIG_VMAP_STACK Christophe Leroy
2019-11-26 12:36 ` [PATCH v4 07/16] powerpc: align stack to 2 * THREAD_SIZE with VMAP_STACK Christophe Leroy
2019-11-26 12:36 ` [PATCH v4 08/16] powerpc/32: Add early stack overflow detection with VMAP stack Christophe Leroy
2019-11-26 12:36 ` [PATCH v4 09/16] powerpc/8xx: Use alternative scratch registers in DTLB miss handler Christophe Leroy
2019-11-26 12:36 ` [PATCH v4 10/16] powerpc/8xx: drop exception entries for non-existing exceptions Christophe Leroy
2019-11-26 12:36 ` [PATCH v4 11/16] powerpc/8xx: move DataStoreTLBMiss perf handler Christophe Leroy
2019-11-26 12:36 ` [PATCH v4 12/16] powerpc/8xx: split breakpoint exception Christophe Leroy
2019-11-26 12:36 ` [PATCH v4 13/16] powerpc/8xx: Enable CONFIG_VMAP_STACK Christophe Leroy
2019-11-26 12:36 ` [PATCH v4 14/16] powerpc/32s: reorganise DSI handler Christophe Leroy
2019-11-26 12:36 ` Christophe Leroy [this message]
2019-11-26 12:36 ` [PATCH v4 16/16] powerpc/32s: Activate CONFIG_VMAP_STACK Christophe Leroy

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=5bd5ce84265711f7611b028edbca7f0fe9565499.1574771541.git.christophe.leroy@c-s.fr \
    --to=christophe.leroy@c-s.fr \
    --cc=benh@kernel.crashing.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=paulus@samba.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).