[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z62cGysScanH4dcT@intel.com>
Date: Thu, 13 Feb 2025 15:15:39 +0800
From: Chao Gao <chao.gao@...el.com>
To: Binbin Wu <binbin.wu@...ux.intel.com>
CC: <pbonzini@...hat.com>, <seanjc@...gle.com>, <kvm@...r.kernel.org>,
<rick.p.edgecombe@...el.com>, <kai.huang@...el.com>,
<adrian.hunter@...el.com>, <reinette.chatre@...el.com>,
<xiaoyao.li@...el.com>, <tony.lindgren@...el.com>,
<isaku.yamahata@...el.com>, <yan.y.zhao@...el.com>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 04/17] KVM: TDX: Implement non-NMI interrupt injection
>--- a/arch/x86/kvm/vmx/tdx.c
>+++ b/arch/x86/kvm/vmx/tdx.c
>@@ -685,6 +685,10 @@ int tdx_vcpu_create(struct kvm_vcpu *vcpu)
> if ((kvm_tdx->xfam & XFEATURE_MASK_XTILE) == XFEATURE_MASK_XTILE)
> vcpu->arch.xfd_no_write_intercept = true;
>
>+
remove this newline.
>+ tdx->vt.pi_desc.nv = POSTED_INTR_VECTOR;
>+ __pi_set_sn(&tdx->vt.pi_desc);
>+
> tdx->state = VCPU_TD_STATE_UNINITIALIZED;
>
> return 0;
>@@ -694,6 +698,7 @@ void tdx_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
> {
> struct vcpu_tdx *tdx = to_tdx(vcpu);
>
>+ vmx_vcpu_pi_load(vcpu, cpu);
> if (vcpu->cpu == cpu)
> return;
>
>@@ -950,6 +955,9 @@ fastpath_t tdx_vcpu_run(struct kvm_vcpu *vcpu, bool force_immediate_exit)
>
> trace_kvm_entry(vcpu, force_immediate_exit);
>
>+ if (pi_test_on(&vt->pi_desc))
>+ apic->send_IPI_self(POSTED_INTR_VECTOR);
>+
> tdx_vcpu_enter_exit(vcpu);
>
> if (vt->host_debugctlmsr & ~TDX_DEBUGCTL_PRESERVED)
>@@ -1607,6 +1615,16 @@ int tdx_sept_remove_private_spte(struct kvm *kvm, gfn_t gfn,
> return tdx_sept_drop_private_spte(kvm, gfn, level, pfn_to_page(pfn));
> }
>
>+void tdx_deliver_interrupt(struct kvm_lapic *apic, int delivery_mode,
>+ int trig_mode, int vector)
>+{
>+ struct kvm_vcpu *vcpu = apic->vcpu;
>+ struct vcpu_tdx *tdx = to_tdx(vcpu);
>+
>+ /* TDX supports only posted interrupt. No lapic emulation. */
>+ __vmx_deliver_posted_interrupt(vcpu, &tdx->vt.pi_desc, vector);
trace_kvm_apicv_accept_irq() is missing compared to the VMX counterpart.
Powered by blists - more mailing lists