lkml.org 
[lkml]   [2024]   [Apr]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH v19 092/130] KVM: TDX: Implement interrupt injection


    On 2/26/2024 4:26 PM, isaku.yamahata@intel.com wrote:
    > From: Isaku Yamahata<isaku.yamahata@intel.com>
    >
    > TDX supports interrupt inject into vcpu with posted interrupt. Wire up the
    > corresponding kvm x86 operations to posted interrupt. Move
    > kvm_vcpu_trigger_posted_interrupt() from vmx.c to common.h to share the
    > code.
    >
    > VMX can inject interrupt by setting interrupt information field,
    > VM_ENTRY_INTR_INFO_FIELD, of VMCS. TDX supports interrupt injection only
    > by posted interrupt. Ignore the execution path to access
    > VM_ENTRY_INTR_INFO_FIELD.
    >
    > As cpu state is protected and apicv is enabled for the TDX guest, VMM can
    > inject interrupt by updating posted interrupt descriptor. Treat interrupt
    > can be injected always.
    >
    > Signed-off-by: Isaku Yamahata<isaku.yamahata@intel.com>
    > Reviewed-by: Paolo Bonzini<pbonzini@redhat.com>
    > ---
    > arch/x86/kvm/vmx/common.h | 71 ++++++++++++++++++++++++++
    > arch/x86/kvm/vmx/main.c | 93 ++++++++++++++++++++++++++++++----
    > arch/x86/kvm/vmx/posted_intr.c | 2 +-
    > arch/x86/kvm/vmx/posted_intr.h | 2 +
    > arch/x86/kvm/vmx/tdx.c | 25 +++++++++
    > arch/x86/kvm/vmx/vmx.c | 67 +-----------------------
    > arch/x86/kvm/vmx/x86_ops.h | 7 ++-
    > 7 files changed, 190 insertions(+), 77 deletions(-)
    >
    [...]
    >
    > +static void vt_set_interrupt_shadow(struct kvm_vcpu *vcpu, int mask)
    > +{
    > + if (is_td_vcpu(vcpu))
    > + return;

    Please add a blank line.

    > + vmx_set_interrupt_shadow(vcpu, mask);
    > +}
    > +
    [...]
    >
    > @@ -848,6 +853,12 @@ fastpath_t tdx_vcpu_run(struct kvm_vcpu *vcpu)
    >
    > trace_kvm_entry(vcpu);
    >
    > + if (pi_test_on(&tdx->pi_desc)) {
    > + apic->send_IPI_self(POSTED_INTR_VECTOR);
    > +
    > + kvm_wait_lapic_expire(vcpu);
    As Chao pointed out, APIC timer change shouldn't be included in this patch.

    Maybe better to put the splitted patch closer to patch
    "KVM: x86: Assume timer IRQ was injected if APIC state is proteced"
    becasue they are related.

    > + }
    > +
    > tdx_vcpu_enter_exit(tdx);
    >
    > tdx_user_return_update_cache(vcpu);
    > @@ -1213,6 +1224,16 @@ static int tdx_sept_remove_private_spte(struct kvm *kvm, gfn_t gfn,
    > return tdx_sept_drop_private_spte(kvm, gfn, level, pfn);
    > }
    >
    [...]

    \
     
     \ /
      Last update: 2024-05-27 16:28    [W:4.208 / U:0.012 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site