Skip to content

Commit ed2a569

Browse files
Crescentloveysun
authored andcommitted
Fixup: tdx-compliance: Fix some cases and related pre-condition function.
According to the latest TDX v1.5 specifications, certain adjustments are required in some cases and related pre-condition function to prevent false failures. Signed-off-by: Dongcheng Yan <[email protected]>
1 parent 79d12ae commit ed2a569

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tdx-compliance/tdx-compliance-cr.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ static int pre_cond_cr4_cet(struct test_cr *c)
8484
run_cpuid(&cpuid_cet);
8585

8686
/* CPUID(0x7,0x0).edx[20] */
87-
if ((cpuid_cet.regs.edx.val & _BITUL(20)) != 0)
87+
if ((cpuid_cet.regs.edx.val & _BITUL(20)) == 0)
8888
c->excp.expect = X86_TRAP_GP;
8989
return 0;
9090
}
@@ -151,7 +151,7 @@ static int pre_cond_cr4_uint(struct test_cr *c)
151151

152152
#define DEF_XCH_CR4(_mask, _excp, _precond) \
153153
{ \
154-
.name = "CR4_XCH" #_mask, \
154+
.name = "CR4_XCH_" #_mask, \
155155
.reg.mask = _mask, \
156156
.excp.expect = _excp, \
157157
.run_cr_set = set_cr4_exchange_bit, \
@@ -224,11 +224,11 @@ struct test_cr cr_list[] = {
224224
* TD modification of CR4 bit CET(23) is prevented,
225225
* depending on TD's XFAM.
226226
*/
227-
DEF_XCH_CR4(X86_CR4_CET, X86_TRAP_GP, pre_cond_cr4_cet),
227+
DEF_XCH_CR4(X86_CR4_CET, NO_EXCP, pre_cond_cr4_cet),
228228

229229
/*
230230
* TD modification of CR4 bit UINT(25) is prevented,
231231
* depending on TD's XFAM
232232
*/
233-
DEF_XCH_CR4(X86_CR4_UINT, X86_TRAP_GP, pre_cond_cr4_uint),
233+
DEF_XCH_CR4(X86_CR4_UINT, NO_EXCP, pre_cond_cr4_uint),
234234
};

0 commit comments

Comments
 (0)