[PATCH v1 00/15] powerpc/32: Reduce head complexity and re-activate MMU earlier

From: Christophe Leroy
Date: Tue Dec 22 2020 - 08:29:19 EST


This series aims at reducing exception/syscall prologs complexity.
It also brings earlier MMU re-activation.

At the time being, we have two pathes in the prologs: one for
when we have CONFIG_VMAP stack and one when we don't.

Among 40x, 6xx and 8xx, only 40x doesn't support VMAP stack.

When VMAP stack is supported, there is special prolog code to
allow accessing stack with MMU on.

That code that access VM stack with MMU on is also able to access
linear memory, so it can also access non VM stack with MMU on.

CONFIG_VMAP_STACK as been on by default on 6xx and 8xx for some
kernel releases now, so it is known to work.

On the 8xx, null_syscall runs in 292 cycles with VMAP_STACK and in
296 cycles without VMAP stack.
On the 832x, null_syscall runs in 224 cycles with VMAP_STACK and in
213 cycles without VMAP stack.

By removing the old non VMAP stack code, and using the same prolog
regardless of the activation of VMAP stacks, we make the code a lot
simplier and open perspective to even more.

Once this is done, we can easily go one step further and re-activate
Instruction translation at the same time as data translation.

At the end, null_syscall runs in 286 cycles on the 8xx and in 216
cycles on the 832x

To do this, I splitted head_32.h in two files, one for 40x which
doesn't have VMAP stack and one for 6xx and 8xx that have VMAP stack.

Now that we have MMU back on earlier on the 6xx and 8xx, once the 40x is
gone it will be possible have more commonalities with book3e/32 which
has MMU always on.

Christophe Leroy (15):
powerpc/32: Fix vmap stack - Properly set r1 before activating MMU on
syscall too
powerpc/32s: Fix RTAS machine check with VMAP stack
powerpc/32s: Only build hash code when CONFIG_PPC_BOOK3S_604 is
selected
powerpc/32s: Do DABR match out of handle_page_fault()
powerpc: Remove address argument from bad_page_fault()
powerpc: Remove address and errorcode arguments from do_break()
powerpc: Remove address and errorcode arguments from do_page_fault()
powerpc/32: Split head_32.h into head_40x.h and head_6xx_8xx.h
powerpc/32: Preserve cr1 in exception prolog stack check
powerpc/32: Make VMAP stack code depend on HAVE_ARCH_VMAP_STACK
powerpc/32: Use r1 directly instead of r11 in syscall prolog
powerpc/32: Remove msr argument in EXC_XFER_TEMPLATE() on 6xx/8xx
powerpc/32: Enable instruction translation at the same time as data
translation
powerpc/32: Use r1 directly instead of r11 in exception prologs on
6xx/8xx
powerpc/32: Use r11 to store DSISR in prolog

arch/powerpc/include/asm/bug.h | 6 +-
arch/powerpc/include/asm/debug.h | 3 +-
arch/powerpc/include/asm/processor.h | 2 +-
arch/powerpc/kernel/asm-offsets.c | 2 +-
arch/powerpc/kernel/entry_32.S | 56 ++---
arch/powerpc/kernel/exceptions-64e.S | 5 +-
arch/powerpc/kernel/exceptions-64s.S | 10 +-
arch/powerpc/kernel/fpu.S | 2 +-
arch/powerpc/kernel/head_40x.S | 8 +-
arch/powerpc/kernel/{head_32.h => head_40x.h} | 186 +--------------
.../kernel/{head_32.h => head_6xx_8xx.h} | 222 +++++-------------
arch/powerpc/kernel/head_8xx.S | 33 +--
arch/powerpc/kernel/head_book3s_32.S | 64 ++---
arch/powerpc/kernel/head_booke.h | 4 +-
arch/powerpc/kernel/idle_6xx.S | 12 +-
arch/powerpc/kernel/process.c | 8 +-
arch/powerpc/kernel/traps.c | 2 +-
arch/powerpc/kernel/vector.S | 2 +-
arch/powerpc/mm/book3s32/Makefile | 4 +-
arch/powerpc/mm/book3s32/hash_low.S | 14 --
arch/powerpc/mm/book3s64/hash_utils.c | 2 +-
arch/powerpc/mm/book3s64/slb.c | 2 +-
arch/powerpc/mm/fault.c | 16 +-
arch/powerpc/platforms/8xx/machine_check.c | 2 +-
24 files changed, 154 insertions(+), 513 deletions(-)
copy arch/powerpc/kernel/{head_32.h => head_40x.h} (53%)
rename arch/powerpc/kernel/{head_32.h => head_6xx_8xx.h} (50%)

--
2.25.0