[PATCH v3 63/70] i386/tdx: LMCE is not supported for TDX

Xiaoyao Li
2023-11-15T07:23:39Z

LMCE is not supported TDX since KVM doesn't provide emulation for
MSR_IA32_FEAT_CTL.

Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
---
target/i386/kvm/kvm-cpu.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/target/i386/kvm/kvm-cpu.c b/target/i386/kvm/kvm-cpu.c
index 9c791b7b0520..8c618869533c 100644
--- a/target/i386/kvm/kvm-cpu.c
+++ b/target/i386/kvm/kvm-cpu.c
@@ -15,6 +15,7 @@
#include "sysemu/sysemu.h"
#include "hw/boards.h"

+#include "tdx.h"
#include "kvm_i386.h"
#include "hw/core/accel-cpu.h"

@@ -60,6 +61,10 @@ static bool lmce_supported(void)
if (kvm_ioctl(kvm_state, KVM_X86_GET_MCE_CAP_SUPPORTED, &mce_cap) < 0) {
return false;
}
+
+ if (is_tdx_vm())
+ return false;
+
return !!(mce_cap & MCG_LMCE_P);
}

--
2.34.1