From: Zhenzhong Duan <zhenzhong.duan@xxxxxxxxx> Define a special group 'tdx' for those test cases supported by TDX. So that when group 'tdx' specified, these test cases run in TDX protected environment if EFI_TDX=y. For example: EFI_TDX=y ./run_tests.sh -g tdx Signed-off-by: Zhenzhong Duan <zhenzhong.duan@xxxxxxxxx> Reviewed-by: Yu Zhang <yu.c.zhang@xxxxxxxxx> Link: https://lore.kernel.org/r/20220303071907.650203-18-zhenzhong.duan@xxxxxxxxx Co-developed-by: Qian Wen <qian.wen@xxxxxxxxx> Signed-off-by: Qian Wen <qian.wen@xxxxxxxxx> --- README.md | 6 ++++++ x86/unittests.cfg | 17 ++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6e82dc22..a84460e9 100644 --- a/README.md +++ b/README.md @@ -137,6 +137,12 @@ when the user does not provide an environ, then an environ generated from the ./errata.txt file and the host's kernel version is provided to all unit tests. +# Unit test in TDX environment + + All the test cases supported by TDX belong to 'tdx' group, by this + command: "EFI_TDX=y ./run_tests.sh -g tdx", all these test cases run + in a TDX protected environment. + # Contributing ## Directory structure diff --git a/x86/unittests.cfg b/x86/unittests.cfg index 8a3830d8..ac1f3273 100644 --- a/x86/unittests.cfg +++ b/x86/unittests.cfg @@ -69,10 +69,12 @@ arch = i386 [smptest] file = smptest.flat smp = 2 +groups = tdx [smptest3] file = smptest.flat smp = 3 +groups = tdx [vmexit_cpuid] file = vmexit.flat @@ -186,6 +188,7 @@ file = hypercall.flat [idt_test] file = idt_test.flat arch = x86_64 +groups = tdx #[init] #file = init.flat @@ -194,6 +197,7 @@ arch = x86_64 file = memory.flat extra_params = -cpu max arch = x86_64 +groups = tdx [msr] # Use GenuineIntel to ensure SYSENTER MSRs are fully preserved, and to test @@ -202,6 +206,7 @@ arch = x86_64 # will fail due to shortcomings in KVM. file = msr.flat extra_params = -cpu max,vendor=GenuineIntel +groups = tdx [pmu] file = pmu.flat @@ -241,6 +246,7 @@ file = s3.flat [setjmp] file = setjmp.flat +groups = tdx [sieve] file = sieve.flat @@ -250,10 +256,12 @@ timeout = 180 file = syscall.flat arch = x86_64 extra_params = -cpu Opteron_G1,vendor=AuthenticAMD +groups = tdx [tsc] file = tsc.flat extra_params = -cpu max +groups = tdx [tsc_adjust] file = tsc_adjust.flat @@ -263,10 +271,12 @@ extra_params = -cpu max file = xsave.flat arch = x86_64 extra_params = -cpu max +groups = tdx [rmap_chain] file = rmap_chain.flat arch = x86_64 +groups = tdx [svm] file = svm.flat @@ -306,7 +316,7 @@ extra_params = --append "10000000 `date +%s`" file = pcid.flat extra_params = -cpu qemu64,+pcid,+invpcid arch = x86_64 -groups = pcid +groups = pcid tdx [pcid-disabled] file = pcid.flat @@ -324,10 +334,12 @@ groups = pcid file = rdpru.flat extra_params = -cpu max arch = x86_64 +groups = tdx [umip] file = umip.flat extra_params = -cpu qemu64,+umip +groups = tdx [la57] file = la57.flat @@ -447,6 +459,7 @@ check = /sys/module/kvm_intel/parameters/allow_smaller_maxphyaddr=Y [debug] file = debug.flat arch = x86_64 +groups = tdx [hyperv_synic] file = hyperv_synic.flat @@ -485,6 +498,7 @@ extra_params = -M q35,kernel-irqchip=split -device intel-iommu,intremap=on,eim=o file = tsx-ctrl.flat extra_params = -cpu max groups = tsx-ctrl +groups = tdx [intel_cet] file = cet.flat @@ -495,3 +509,4 @@ extra_params = -enable-kvm -m 2048 -cpu host [intel_tdx] file = intel_tdx.flat arch = x86_64 +groups = tdx nodefault -- 2.25.1