• Paul Mackerras's avatar
    KVM: PPC: Book3S HV: Do SLB load/unload with guest LPCR value loaded · 6964e6a4
    Paul Mackerras authored
    This moves the code that loads and unloads the guest SLB values so that
    it is done while the guest LPCR value is loaded in the LPCR register.
    The reason for doing this is that on POWER9, the behaviour of the
    slbmte instruction depends on the LPCR[UPRT] bit.  If UPRT is 1, as
    it is for a radix host (or guest), the SLB index is truncated to
    2 bits.  This means that for a HPT guest on a radix host, the SLB
    was not being loaded correctly, causing the guest to crash.
    
    The SLB is now loaded much later in the guest entry path, after the
    LPCR is loaded, which for a secondary thread is after it sees that
    the primary thread has switched the MMU to the guest.  The loop that
    waits for the primary thread has a branch out to the exit code that
    is taken if it sees that other threads have commenced exiting the
    guest.  Since we have now not loaded the SLB at this point, we make
    this path branch to a new label 'guest_bypass' and we move the SLB
    unload code to before this label.
    Signed-off-by: default avatarPaul Mackerras <paulus@ozlabs.org>
    6964e6a4
book3s_hv_rmhandlers.S 81.8 KB