TDX cpuid fix for handling cpuid 0x2
Change-Id: Id576e5f26db5d8777aac3dfb0348bb0d7365063b
diff --git a/arch/x86/coco/tdx/tdx.c b/arch/x86/coco/tdx/tdx.c
index 0de64b3..b9eb500 100644
--- a/arch/x86/coco/tdx/tdx.c
+++ b/arch/x86/coco/tdx/tdx.c
@@ -362,8 +362,14 @@ static int handle_cpuid(struct pt_regs *regs, struct ve_info *ve)
* Return all-zeros for any CPUID outside the range. It matches CPU
* behaviour for non-supported leaf.
*/
- if (regs->ax < 0x40000000 || regs->ax > 0x4FFFFFFF) {
- regs->ax = regs->bx = regs->cx = regs->dx = 0;
+ if ((regs->ax < 0x40000000 || regs->ax > 0x4FFFFFFF)) {
+ if (regs->ax == 0x2) {
+ regs->ax = 0xff01;
+ regs->bx = regs->cx = regs->dx = 0;
+ }
+ else {
+ regs->ax = regs->bx = regs->cx = regs->dx = 0;
+ }
return ve_instr_len(ve);
}