@@ -30,6 +30,12 @@ the env variable `EFI_UEFI`:
EFI_UEFI=/path/to/OVMF.fd ./x86/efi/run ./x86/msr.efi
+### Run test cases with UEFI in TDX environment
+
+To run a test case with UEFI and TDX enabled:
+
+ EFI_TDX=y ./x86/efi/run ./x86/msr.efi
+
## Code structure
### Code from GNU-EFI
@@ -18,6 +18,7 @@ source config.mak
: "${EFI_TEST:=efi-tests}"
: "${EFI_SMP:=1}"
: "${EFI_CASE:=$(basename $1 .efi)}"
+: "${EFI_TDX:=n}"
if [ ! -f "$EFI_UEFI" ]; then
echo "UEFI firmware not found: $EFI_UEFI"
@@ -29,6 +30,24 @@ fi
# Remove the TEST_CASE from $@
shift 1
+# TDX support -kernel QEMU parameter, could utilize the original way of
+# verifying QEMU's configuration. CPU feature customization isn't supported
+# in TDX currently, so pass through all the features with `-cpu host`
+if [ "$EFI_TDX" == "y" ]; then
+ "$TEST_DIR/run" \
+ -device loader,file="$EFI_UEFI",id=fd0 \
+ -object tdx-guest,id=tdx0 \
+ -machine q35,kvm-type=tdx,pic=no,kernel_irqchip=split,confidential-guest-support=tdx0 \
+ -kernel "$EFI_SRC/$EFI_CASE.efi" \
+ -net none \
+ -nographic \
+ -m 256 \
+ "$@" \
+ -cpu host
+
+ exit $?
+fi
+
if [ "$EFI_CASE" = "_NO_FILE_4Uhere_" ]; then
EFI_CASE=dummy
fi