• Paul Mackerras's avatar
    KVM: PPC: Book3S: Rework TM save/restore code and make it C-callable · 7854f754
    Paul Mackerras authored
    This adds a parameter to __kvmppc_save_tm and __kvmppc_restore_tm
    which allows the caller to indicate whether it wants the nonvolatile
    register state to be preserved across the call, as required by the C
    calling conventions.  This parameter being non-zero also causes the
    MSR bits that enable TM, FP, VMX and VSX to be preserved.  The
    condition register and DSCR are now always preserved.
    
    With this, kvmppc_save_tm_hv and kvmppc_restore_tm_hv can be called
    from C code provided the 3rd parameter is non-zero.  So that these
    functions can be called from modules, they now include code to set
    the TOC pointer (r2) on entry, as they can call other built-in C
    functions which will assume the TOC to have been set.
    
    Also, the fake suspend code in kvmppc_save_tm_hv is modified here to
    assume that treclaim in fake-suspend state does not modify any registers,
    which is the case on POWER9.  This enables the code to be simplified
    quite a bit.
    
    _kvmppc_save_tm_pr and _kvmppc_restore_tm_pr become much simpler with
    this change, since they now only need to save and restore TAR and pass
    1 for the 3rd argument to __kvmppc_{save,restore}_tm.
    Reviewed-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
    Signed-off-by: default avatarPaul Mackerras <paulus@ozlabs.org>
    Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
    7854f754
asm-prototypes.h 5.55 KB