Skip to content

Commit

Permalink
powerpc/64s/exception: Move real to virt switch into the common handler
Browse files Browse the repository at this point in the history
The real mode interrupt entry points currently use rfid to branch to
the common handler in virtual mode. This is a significant amount of
code, and forces other code (notably the KVM test) to live in the
real mode handler.

In the interest of minimising the amount of code that runs unrelocated
move the switch to virt mode into the common code, and do it with
mtmsrd, which avoids clobbering SRRs (although the post-KVMTEST
performance of real-mode interrupt handlers is not a big concern these
days).

This requires CTR to always be saved (real-mode needs to reach 0xc...)
but that's not a huge impact these days. It could be optimized away in
future.

mpe: Incorporate fix from Nick:

It's possible for interrupts to be replayed when TM is enabled and
suspended, for example rt_sigreturn, where the mtmsrd MSR_KERNEL in
the real-mode entry point to the common handler causes a TM Bad Thing
exception (due to attempting to clear suspended).

The fix for this is to have replay interrupts go to the _virt entry
point and skip the mtmsrd, which matches what happens before this
patch.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20200225173541.1549955-11-npiggin@gmail.com
  • Loading branch information
Nicholas Piggin authored and Michael Ellerman committed Apr 1, 2020
1 parent a3cd35b commit 8729c26
Show file tree
Hide file tree
Showing 2 changed files with 116 additions and 153 deletions.
4 changes: 0 additions & 4 deletions arch/powerpc/include/asm/exception-64s.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,7 @@
#include <asm/feature-fixups.h>

/* PACA save area size in u64 units (exgen, exmc, etc) */
#if defined(CONFIG_RELOCATABLE)
#define EX_SIZE 10
#else
#define EX_SIZE 9
#endif

/*
* maximum recursive depth of MCE exceptions
Expand Down
Loading

0 comments on commit 8729c26

Please sign in to comment.