Re: [PATCH v2 8/8] KVM: TDX: Handle TDX PV MMIO hypercall
From: Chao Gao
Date: Tue Feb 11 2025 - 21:30:02 EST
>diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c
>index f13da28dd4a2..8f3147c6e602 100644
>--- a/arch/x86/kvm/vmx/tdx.c
>+++ b/arch/x86/kvm/vmx/tdx.c
>@@ -849,8 +849,12 @@ static __always_inline u32 tdx_to_vmx_exit_reason(struct kvm_vcpu *vcpu)
> if (tdvmcall_exit_type(vcpu))
> return EXIT_REASON_VMCALL;
>
>- if (tdvmcall_leaf(vcpu) < 0x10000)
>+ if (tdvmcall_leaf(vcpu) < 0x10000) {
>+ if (tdvmcall_leaf(vcpu) == EXIT_REASON_EPT_VIOLATION)
>+ return EXIT_REASON_EPT_MISCONFIG;
IIRC, a TD-exit may occur due to an EPT MISCONFIG. Do you need to distinguish
between a genuine EPT MISCONFIG and a morphed one, and handle them differently?