Re: [PATCH v2 2/3] KVM: TDX: Fix the exit reason handling
Xiaoyao Li <[email protected]>
| Newsgroups | dev.linux.lists.linux-coco,org.kernel.vger.kvm,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
On 8/13/2026 8:16 AM, Sean Christopherson wrote:
> On Tue, Aug 11, 2026, Xiaoyao Li wrote:
>> On 8/11/2026 8:38 AM, Edgecombe, Rick P wrote:
>>> On Mon, 2026-08-10 at 19:21 +0800, Xiaoyao Li wrote:
>>>> ---
>>>> arch/x86/kvm/vmx/tdx.c | 35 ++++++++++++++++++++++-------------
>>>> 1 file changed, 22 insertions(+), 13 deletions(-)
>>>>
>>>> diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c
>>>> index 7338ac0af693..a89885d550c9 100644
>>>> --- a/arch/x86/kvm/vmx/tdx.c
>>>> +++ b/arch/x86/kvm/vmx/tdx.c
>>>> @@ -921,10 +921,10 @@ static __always_inline u32 tdcall_to_vmx_exit_reason(struct kvm_vcpu *vcpu)
>>>> return EXIT_REASON_TDCALL;
>>>> }
>>>> -static __always_inline u32 tdx_to_vmx_exit_reason(struct kvm_vcpu *vcpu)
>>>> +static __always_inline union vmx_exit_reason tdx_to_vmx_exit_reason(struct kvm_vcpu *vcpu)
>>>> {
>>>> struct vcpu_tdx *tdx = to_tdx(vcpu);
>>>> - u32 exit_reason;
>>>> + union vmx_exit_reason exit_reason;
>>>> switch (tdx->vp_enter_ret & TDX_SEAMCALL_STATUS_MASK) {
>>>> case TDX_SUCCESS:
>>>> @@ -934,23 +934,33 @@ static __always_inline u32 tdx_to_vmx_exit_reason(struct kvm_vcpu *vcpu)
>>>> case TDX_NON_RECOVERABLE_TD_WRONG_APIC_MODE:
>>>> break;
>>>> default:
>>>> - return -1u;
>>>> + /*
>>>> + * Synthesize an invalid bogus Exit Reason, as the TDX-Module
>>>
>>> I think this blurb came from Sean, but can we standardize on "TDX module"? The
>>> code currently uses "TDX module" and "TDX-module" and "TDX-module" used much
>>> less. I also don't see why it needs the "-".
>
> FWIW, I like TDX-Module to clearly identify it as _the_ TDX-Module, versus a
> potential TDX module provided the kernel, i.e. a tdx.ko module.
# git grep "TDX-Module" | wc -l
13
# git grep "TDX module" | wc -l
162
#git grep "TDX-Module" | grep kvm | wc -l
9
#git grep "TDX module" | grep kvm | wc -l
42
There are 13 "TDX-Module" vs 162 "TDX module" in the kernel, and
9 "TDX-Module" vs 42 "TDX module" in KVM files. Given this, I changed to
use "TDX module"