• Suraj Jitindar Singh's avatar
    KVM: PPC: Book3S HV: Handle virtual mode in XIVE VCPU push code · 7ae9bda7
    Suraj Jitindar Singh authored
    The code in book3s_hv_rmhandlers.S that pushes the XIVE virtual CPU
    context to the hardware currently assumes it is being called in real
    mode, which is usually true.  There is however a path by which it can
    be executed in virtual mode, in the case where indep_threads_mode = N.
    A virtual CPU executing on an offline secondary thread can take a
    hypervisor interrupt in virtual mode and return from the
    kvmppc_hv_entry() call after the kvm_secondary_got_guest label.
    It is possible for it to be given another vcpu to execute before it
    gets to execute the stop instruction.  In that case it will call
    kvmppc_hv_entry() for the second VCPU in virtual mode, and the XIVE
    vCPU push code will be executed in virtual mode.  The result in that
    case will be a host crash due to an unexpected data storage interrupt
    caused by executing the stdcix instruction in virtual mode.
    
    This fixes it by adding a code path for virtual mode, which uses the
    virtual TIMA pointer and normal load/store instructions.
    
    [paulus@ozlabs.org - wrote patch description]
    Signed-off-by: default avatarSuraj Jitindar Singh <sjitindarsingh@gmail.com>
    Signed-off-by: default avatarPaul Mackerras <paulus@ozlabs.org>
    7ae9bda7
book3s_hv_rmhandlers.S 86 KB