Skip to content

Commit 79d12ae

Browse files
committed
Fixup: tdx-compliance: Fix some case due to the spec change.
According to the latest TDX v1.5 specifications, certain adjustments are required in some cases to prevent false failures. Signed-off-by: Yi Sun <yi.sun@intel.com>
1 parent 9fb44d2 commit 79d12ae

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

tdx-compliance/tdx-compliance-cpuid.h

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ struct test_cpuid *fetch_cpuid_test(int leaf, int subleaf)
100100
void initial_cpuid(void)
101101
{
102102
/* CPUID(0x0) */
103-
EXP_CPUID_BYTE(0x0, 0, eax, 0x00000023); //"MaxIndex"
103+
EXP_CPUID_BYTE(0x0, 0, eax, 0x00000021); //"MaxIndex"
104104
EXP_CPUID_BYTE(0x0, 0, ebx, 0x756e6547); //"Genu"
105105
EXP_CPUID_BYTE(0x0, 0, ecx, 0x6c65746e); //"ntel"
106106
EXP_CPUID_BYTE(0x0, 0, edx, 0x49656e69); //"ineI"
@@ -285,7 +285,7 @@ void initial_cpuid(void)
285285
EXP_CPUID_RES_BITS(0x4, 4, edx, 3, 31); //Reserved
286286

287287
/* CPUID(0x7, 0x0).EAX */
288-
EXP_CPUID_BYTE(0x7, 0, eax, 2); //Max Sub-Leaves
288+
EXP_CPUID_BYTE(0x7, 0, eax, 1); //Max Sub-Leaves
289289

290290
/* CPUID(0x7, 0x0).EBX */
291291
EXP_CPUID_BIT(0x7, 0x0, ebx, 0, 1); //FSGSBASE
@@ -328,7 +328,6 @@ void initial_cpuid(void)
328328
EXP_CPUID_BIT(0x7, 0x0, edx, 21, 0); //Reserved
329329
EXP_CPUID_BIT(0x7, 0x0, edx, 26, 1); //IBRS
330330
EXP_CPUID_BIT(0x7, 0x0, edx, 27, 1); //STIBP
331-
EXP_CPUID_BIT(0x7, 0x0, edx, 28, 1); //L1D_FLUSH. IA32_FLUSH_CMD support.
332331
EXP_CPUID_BIT(0x7, 0x0, edx, 29, 1); //IA32_ARCH_CAPABILITIES Support
333332
EXP_CPUID_BIT(0x7, 0x0, edx, 30, 1); //IA32_CORE_CAPABILITIES Present
334333
EXP_CPUID_BIT(0x7, 0x0, edx, 31, 1); //SSBD(Speculative Store Bypass Disable)
@@ -361,11 +360,10 @@ void initial_cpuid(void)
361360
EXP_CPUID_RES_BITS(0x7, 0x2, ecx, 0, 31); //Reserved
362361

363362
/* CPUID(0x7, 0x2).EDX */
364-
EXP_CPUID_BIT(0x7, 0x2, edx, 0, 1); //PSFD
365-
EXP_CPUID_BIT(0x7, 0x2, edx, 1, 1); //IPRED_CTRL
366-
EXP_CPUID_BIT(0x7, 0x2, edx, 2, 1); //RRSBA_CTRL
367-
EXP_CPUID_BIT(0x7, 0x2, edx, 4, 1); //DDPD
368-
EXP_CPUID_RES_BITS(0x7, 0x2, edx, 6, 31); //Reserved
363+
EXP_CPUID_RES_BITS(0x7, 0x2, eax, 0, 31); //Reserved
364+
EXP_CPUID_RES_BITS(0x7, 0x2, ebx, 0, 31); //Reserved
365+
EXP_CPUID_RES_BITS(0x7, 0x2, ecx, 0, 31); //Reserved
366+
EXP_CPUID_RES_BITS(0x7, 0x2, edx, 0, 31); //Reserved
369367

370368
/* CPUID(0x8) */
371369
EXP_CPUID_RES_BITS(0x8, 0x0, eax, 0, 31); //Reserved

tdx-compliance/tdx-compliance.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ static struct dentry *f_tdx_tests, *d_tdx;
5555
#define OPMASK_SINGLE 0x8000
5656

5757
#define CPUID_DUMP_PATTERN \
58-
"eax(%016x) ebx(%016x) ecx(%016x) edx(%016x)\n"
58+
"eax(%08x) ebx(%08x) ecx(%08x) edx(%08x)\n"
5959

6060
static char *result_str(int ret)
6161
{
@@ -387,6 +387,7 @@ tdx_tests_proc_write(struct file *file,
387387
stat_total - stat_pass - stat_fail);
388388

389389
kfree(str_input);
390+
operation = 0;
390391
return count;
391392
}
392393

0 commit comments

Comments
 (0)