• Paul Mackerras's avatar
    KVM: PPC: Book3S HV: Handle hypercalls correctly when nested · 4bad7779
    Paul Mackerras authored
    When we are running as a nested hypervisor, we use a hypercall to
    enter the guest rather than code in book3s_hv_rmhandlers.S.  This means
    that the hypercall handlers listed in hcall_real_table never get called.
    There are some hypercalls that are handled there and not in
    kvmppc_pseries_do_hcall(), which therefore won't get processed for
    a nested guest.
    
    To fix this, we add cases to kvmppc_pseries_do_hcall() to handle those
    hypercalls, with the following exceptions:
    
    - The HPT hypercalls (H_ENTER, H_REMOVE, etc.) are not handled because
      we only support radix mode for nested guests.
    
    - H_CEDE has to be handled specially because the cede logic in
      kvmhv_run_single_vcpu assumes that it has been processed by the time
      that kvmhv_p9_guest_entry() returns.  Therefore we put a special
      case for H_CEDE in kvmhv_p9_guest_entry().
    
    For the XICS hypercalls, if real-mode processing is enabled, then the
    virtual-mode handlers assume that they are being called only to finish
    up the operation.  Therefore we turn off the real-mode flag in the XICS
    code when running as a nested hypervisor.
    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>
    4bad7779
book3s_xics.c 36.1 KB