-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TDVM should be not launched while disable EPT Signed-off-by: Xudong Hao <[email protected]>
- Loading branch information
Showing
2 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
- td_disable_ept: | ||
virt_test_type = qemu | ||
type = td_disable_ept | ||
vm_accelerator = kvm | ||
machine_type_extra_params = "kernel-irqchip=split" | ||
vm_secure_guest_type = tdx | ||
start_vm = no | ||
vga = std | ||
auto_cpu_model = "no" | ||
cpu_model = host | ||
xfail = "yes" | ||
expected_status = 'N' | ||
default_status = 'Y' | ||
parameter_name = 'ept' | ||
pre_command = 'modprobe -r kvm_intel && modprobe kvm_intel ${parameter_name}=${expected_status}' | ||
post_command = 'modprobe -r kvm_intel && modprobe kvm_intel ${parameter_name}=${default_status}' | ||
check_status_cmd = 'cat /sys/module/kvm_intel/parameters/${parameter_name}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/usr/bin/python3 | ||
|
||
# SPDX-License-Identifier: GPL-2.0-only | ||
# Copyright (c) 2024 Intel Corporation | ||
|
||
# Author: Xudong Hao <[email protected]> | ||
# | ||
# History: Jun. 2024 - Xudong Hao - creation | ||
from avocado.utils import process | ||
|
||
from virttest import env_process | ||
|
||
|
||
def run(test, params, env): | ||
""" | ||
Boot TD after disable ept: | ||
1) Disable ept | ||
2) Boot up TDVM | ||
3) TDVM can not be lanuch as expect | ||
:param test: QEMU test object | ||
:param params: Dictionary with the test parameters | ||
:param env: Dictionary with test environment | ||
""" | ||
xfail = False | ||
if (params.get("xfail") is not None) and (params.get("xfail") == "yes"): | ||
xfail = True | ||
|
||
output = process.getoutput(params["check_status_cmd"]) | ||
if output != params["expected_status"]: | ||
test.fail("Disable %s failed" % params["parameter_name"]) | ||
|
||
params["start_vm"] = 'yes' | ||
has_error = False | ||
try: | ||
env_process.preprocess_vm(test, params, env, params["main_vm"]) | ||
except: | ||
has_error = True | ||
if xfail is False: | ||
raise | ||
|
||
if (has_error is False) and (xfail is True): | ||
test.fail("Test was expected to fail, but it didn't") |