lkml.org 
[lkml]   [2022]   [Oct]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v10 074/108] KVM: TDX: complete interrupts after tdexit
    Date
    From: Isaku Yamahata <isaku.yamahata@intel.com>

    This corresponds to VMX __vmx_complete_interrupts(). Because TDX
    virtualize vAPIC, KVM only needs to care NMI injection.

    Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com>
    Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
    ---
    arch/x86/kvm/vmx/tdx.c | 10 ++++++++++
    1 file changed, 10 insertions(+)

    diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c
    index f35ccf2b502d..af13c19af339 100644
    --- a/arch/x86/kvm/vmx/tdx.c
    +++ b/arch/x86/kvm/vmx/tdx.c
    @@ -456,6 +456,14 @@ void tdx_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event)
    vcpu->kvm->vm_bugged = true;
    }

    +static void tdx_complete_interrupts(struct kvm_vcpu *vcpu)
    +{
    + /* Avoid costly SEAMCALL if no nmi was injected */
    + if (vcpu->arch.nmi_injected)
    + vcpu->arch.nmi_injected = td_management_read8(to_tdx(vcpu),
    + TD_VCPU_PEND_NMI);
    +}
    +
    struct tdx_uret_msr {
    u32 msr;
    unsigned int slot;
    @@ -524,6 +532,8 @@ fastpath_t tdx_vcpu_run(struct kvm_vcpu *vcpu)
    vcpu->arch.regs_avail &= ~VMX_REGS_LAZY_LOAD_SET;
    trace_kvm_exit(vcpu, KVM_ISA_VMX);

    + tdx_complete_interrupts(vcpu);
    +
    return EXIT_FASTPATH_NONE;
    }

    --
    2.25.1
    \
     
     \ /
      Last update: 2022-10-30 07:32    [W:4.051 / U:0.116 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site