• Nicholas Piggin's avatar
    powerpc/64s/exception: Move KVM test to common code · 9600f261
    Nicholas Piggin authored
    This allows more code to be moved out of unrelocated regions. The
    system call KVMTEST is changed to be open-coded and remain in the
    tramp area to avoid having to move it to entry_64.S. The custom nature
    of the system call entry code means the hcall case can be made more
    streamlined than regular interrupt handlers.
    
    mpe: Incorporate fix from Nick:
    
    Moving KVM test to the common entry code missed the case of HMI and
    MCE, which do not do __GEN_COMMON_ENTRY (because they don't want to
    switch to virt mode).
    
    This means a MCE or HMI exception that is taken while KVM is running a
    guest context will not be switched out of that context, and KVM won't
    be notified. Found by running sigfuz in guest with patched host on
    POWER9 DD2.3, which causes some TM related HMI interrupts (which are
    expected and supposed to be handled by KVM).
    
    This fix adds a __GEN_REALMODE_COMMON_ENTRY for those handlers to add
    the KVM test. This makes them look a little more like other handlers
    that all use __GEN_COMMON_ENTRY.
    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-13-npiggin@gmail.com
    9600f261
book3s_hv_rmhandlers.S 86.7 KB