Skip to content

Commit

Permalink
Fixup: tdx-compliance: Fix some cases and related pre-condition funct…
Browse files Browse the repository at this point in the history
…ion.

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]>
  • Loading branch information
CrescentLove authored and ysun committed Mar 16, 2023
1 parent 79d12ae commit ed2a569
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tdx-compliance/tdx-compliance-cr.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ static int pre_cond_cr4_cet(struct test_cr *c)
run_cpuid(&cpuid_cet);

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

#define DEF_XCH_CR4(_mask, _excp, _precond) \
{ \
.name = "CR4_XCH" #_mask, \
.name = "CR4_XCH_" #_mask, \
.reg.mask = _mask, \
.excp.expect = _excp, \
.run_cr_set = set_cr4_exchange_bit, \
Expand Down Expand Up @@ -224,11 +224,11 @@ struct test_cr cr_list[] = {
* TD modification of CR4 bit CET(23) is prevented,
* depending on TD's XFAM.
*/
DEF_XCH_CR4(X86_CR4_CET, X86_TRAP_GP, pre_cond_cr4_cet),
DEF_XCH_CR4(X86_CR4_CET, NO_EXCP, pre_cond_cr4_cet),

/*
* TD modification of CR4 bit UINT(25) is prevented,
* depending on TD's XFAM
*/
DEF_XCH_CR4(X86_CR4_UINT, X86_TRAP_GP, pre_cond_cr4_uint),
DEF_XCH_CR4(X86_CR4_UINT, NO_EXCP, pre_cond_cr4_uint),
};

0 comments on commit ed2a569

Please sign in to comment.