• Nicholas Piggin's avatar
    powerpc/64s/exception: Move real to virt switch into the common handler · 8729c26e
    Nicholas Piggin authored
    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: default avatarNicholas Piggin <npiggin@gmail.com>
    Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
    Link: https://lore.kernel.org/r/20200225173541.1549955-11-npiggin@gmail.com
    8729c26e
exceptions-64s.S 73.4 KB