• Paul Mackerras's avatar
    KVM: PPC: Book3S HV: Allow guest exit path to have MMU on · 53af3ba2
    Paul Mackerras authored
    If we allow LPCR[AIL] to be set for radix guests, then interrupts from
    the guest to the host can be delivered by the hardware with relocation
    on, and thus the code path starting at kvmppc_interrupt_hv can be
    executed in virtual mode (MMU on) for radix guests (previously it was
    only ever executed in real mode).
    
    Most of the code is indifferent to whether the MMU is on or off, but
    the calls to OPAL that use the real-mode OPAL entry code need to
    be switched to use the virtual-mode code instead.  The affected
    calls are the calls to the OPAL XICS emulation functions in
    kvmppc_read_one_intr() and related functions.  We test the MSR[IR]
    bit to detect whether we are in real or virtual mode, and call the
    opal_rm_* or opal_* function as appropriate.
    
    The other place that depends on the MMU being off is the optimization
    where the guest exit code jumps to the external interrupt vector or
    hypervisor doorbell interrupt vector, or returns to its caller (which
    is __kvmppc_vcore_entry).  If the MMU is on and we are returning to
    the caller, then we don't need to use an rfid instruction since the
    MMU is already on; a simple blr suffices.  If there is an external
    or hypervisor doorbell interrupt to handle, we branch to the
    relocation-on version of the interrupt vector.
    Signed-off-by: default avatarPaul Mackerras <paulus@ozlabs.org>
    Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
    53af3ba2
book3s_hv_builtin.c 12.9 KB