Skip to content

powerpc/32: Reduce head complexity and re-activate MMU earlier

Christophe Leroy linuxppc-dev lkml 2 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest14 patches 0 repliesNew
  2. v115 patches 3 repliesSuperseded

Changes in v2 from the cover letter

- Implemented early MMU activation also on 40x
- Added BOOKE in the loop
- Removed the patches that replace r11 by r1 all over the place (too much churn for very small benefit for now)

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/14powerpc/32s: Only build hash code when CONFIG_PPC_BOOK3S_604 is selectedarch/powerpc/kernel/head_book3s_32.S arch/powerpc/mm/book3s32/Makefile+15 -10 replies
2/14NOT TO BE MERGED - Squash of patches 2-7 of v6 series "powerpc: interrupt wrappers"arch/powerpc/include/asm/asm-prototypes.h arch/powerpc/include/asm/book3s/64/mmu-hash.h arch/powerpc/include/asm/bug.h +14 more+142 -2190 replies
3/14powerpc/40x: Don't use SPRN_SPRG_SCRATCH0/1 in TLB miss handlersarch/powerpc/kernel/head_40x.S+18 -210 replies
4/14powerpc/40x: Change CRITICAL_EXCEPTION_PROLOG macro to a gas macroarch/powerpc/kernel/head_40x.S+36 -350 replies
5/14powerpc/40x: Save SRR0/SRR1 and r10/r11 earlier in critical exceptionarch/powerpc/kernel/entry_32.S arch/powerpc/kernel/head_40x.S+8 -90 replies
6/14powerpc/40x: Reorder a few instructions in critical exception prologarch/powerpc/kernel/head_40x.S+4 -40 replies
7/14powerpc/40x: Prepare for enabling MMU in critical exception prologarch/powerpc/kernel/head_40x.S+39 -30 replies
8/14powerpc/40x: Prepare normal exception handler for enabling MMU earlyarch/powerpc/kernel/entry_32.S arch/powerpc/kernel/head_32.h arch/powerpc/kernel/head_40x.S+21 -130 replies
9/14powerpc/32: Preserve cr1 in exception prolog stack checkarch/powerpc/kernel/head_32.h arch/powerpc/kernel/head_book3s_32.S+1 -70 replies
10/14powerpc/32: Use LOAD_REG_IMMEDIATE() to load MSR valuesarch/powerpc/kernel/head_32.h+2 -20 replies
11/14powerpc/32: Always enable data translation in exception prologarch/powerpc/include/asm/processor.h arch/powerpc/kernel/asm-offsets.c arch/powerpc/kernel/entry_32.S +10 more+17 -2390 replies
12/14powerpc/32: Enable instruction translation at the same time as data translationarch/powerpc/kernel/entry_32.S arch/powerpc/kernel/head_32.h arch/powerpc/kernel/head_40x.S +1 more+39 -610 replies
13/14powerpc/32: Remove msr argument in EXC_XFER_TEMPLATE()arch/powerpc/kernel/head_32.h arch/powerpc/kernel/head_40x.S+4 -90 replies
14/14powerpc/32: Use fast instructions to change MSR EE/RI when availablearch/powerpc/include/asm/hw_irq.h arch/powerpc/kernel/entry_32.S arch/powerpc/kernel/head_32.h +1 more+66 -280 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 00/14] powerpc/32: Reduce head complexity and re-activate MMU earlier

This series is a first step on the way to C syscall/exception entry/exit.

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

This series is based on Nick's v6 series "powerpc: interrupt wrappers". It takes benefit of the removal of traps arguments (patches 2-7 of that series). I have squashed those patches as second patch of my series in order to please test robots. My series cleanly applies on top of entire Nick's series.

v2 has been reworked in order to apply to all PPC32, including BOOKE and 40x.

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

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

That code that accesses 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 several 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 reduce the number of test cases.

BOOKE has MMU always on, so there is no change needed for that. To allow removal of the old non VMAP stack code, only 40x need to get adapted to support earlier MMU activation. That's what patches 3-8 are for.

Once this is done, we 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

Changes in v2:
- Implemented early MMU activation also on 40x
- Added BOOKE in the loop
- Removed the patches that replace r11 by r1 all over the place (too much churn for very small benefit for now)

Christophe Leroy (14):
powerpc/32s: Only build hash code when CONFIG_PPC_BOOK3S_604 is
selected
NOT TO BE MERGED - Squash of patches 2-7 of v6 series "powerpc:
interrupt wrappers"
powerpc/40x: Don't use SPRN_SPRG_SCRATCH0/1 in TLB miss handlers powerpc/40x: Change CRITICAL_EXCEPTION_PROLOG macro to a gas macro powerpc/40x: Save SRR0/SRR1 and r10/r11 earlier in critical exception powerpc/40x: Reorder a few instructions in critical exception prolog powerpc/40x: Prepare for enabling MMU in critical exception prolog powerpc/40x: Prepare normal exception handler for enabling MMU early powerpc/32: Preserve cr1 in exception prolog stack check powerpc/32: Use LOAD_REG_IMMEDIATE() to load MSR values powerpc/32: Always enable data translation in exception prolog powerpc/32: Enable instruction translation at the same time as data
translation
powerpc/32: Remove msr argument in EXC_XFER_TEMPLATE() powerpc/32: Use fast instructions to change MSR EE/RI when available

 arch/powerpc/include/asm/asm-prototypes.h     |   4 +-
 arch/powerpc/include/asm/book3s/64/mmu-hash.h |   1 +
 arch/powerpc/include/asm/bug.h                |   7 +-
 arch/powerpc/include/asm/debug.h              |   3 +-
 arch/powerpc/include/asm/hw_irq.h             |  46 +++++
 arch/powerpc/include/asm/processor.h          |   4 +-
 arch/powerpc/kernel/asm-offsets.c             |   2 -
 arch/powerpc/kernel/entry_32.S                | 128 ++++----------
 arch/powerpc/kernel/exceptions-64e.S          |   5 +-
 arch/powerpc/kernel/exceptions-64s.S          | 164 +++++------------
 arch/powerpc/kernel/fpu.S                     |   2 -
 arch/powerpc/kernel/head_32.h                 | 167 ++++--------------
 arch/powerpc/kernel/head_40x.S                | 161 +++++++++--------
 arch/powerpc/kernel/head_8xx.S                |  26 +--
 arch/powerpc/kernel/head_book3s_32.S          |  52 ++----
 arch/powerpc/kernel/head_booke.h              |  20 +--
 arch/powerpc/kernel/idle_6xx.S                |  12 +-
 arch/powerpc/kernel/idle_e500.S               |   4 +-
 arch/powerpc/kernel/process.c                 |   7 +-
 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         |  79 ++++++---
 arch/powerpc/mm/book3s64/slb.c                |  11 +-
 arch/powerpc/mm/fault.c                       |  18 +-
 arch/powerpc/platforms/8xx/machine_check.c    |   2 +-
 27 files changed, 354 insertions(+), 593 deletions(-)
Signature · 1 line
2.25.0