[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z62rPgmS2RB/LaC7@intel.com>
Date: Thu, 13 Feb 2025 16:20:14 +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 08/17] KVM: TDX: Complete interrupts after TD exit
>+static void tdx_complete_interrupts(struct kvm_vcpu *vcpu)
>+{
>+ /* Avoid costly SEAMCALL if no NMI was injected. */
>+ if (vcpu->arch.nmi_injected) {
>+ /*
>+ * No need to request KVM_REQ_EVENT because PEND_NMI is still
>+ * set if NMI re-injection needed. No other event types need
>+ * to be handled because TDX doesn't support injection of
>+ * exception, SMI or interrupt (via event injection).
>+ */
>+ vcpu->arch.nmi_injected = td_management_read8(to_tdx(vcpu),
>+ TD_VCPU_PEND_NMI);
>+ }
Why does KVM care whether/when an NMI is injected by the TDX module?
I think we can simply set nmi_injected to false unconditionally here, or even in
tdx_inject_nmi(). From KVM's perspective, NMI injection is complete right after
writing to PEND_NMI. It is the TDX module that should inject the NMI at the
right time and do the re-injection.
>+}
>+
Powered by blists - more mailing lists