cpuid.1:ecx[5] is expected to be set in this test. Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com> --- tests/vvmx/Makefile | 11 +++++++++++ tests/vvmx/cpuid.c | 24 ++++++++++++++++++++++++ tests/vvmx/extra.cfg.in | 1 + tests/vvmx/main.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 80 insertions(+) create mode 100644 tests/vvmx/Makefile create mode 100644 tests/vvmx/cpuid.c create mode 100644 tests/vvmx/extra.cfg.in create mode 100644 tests/vvmx/main.c
diff --git a/tests/vvmx/Makefile b/tests/vvmx/Makefile new file mode 100644 index 0000000..80a6629 --- /dev/null +++ b/tests/vvmx/Makefile @@ -0,0 +1,11 @@ +include $(ROOT)/build/common.mk + +NAME := vvmx +CATEGORY := functional +TEST-ENVS := hvm64 + +TEST-EXTRA-CFG := extra.cfg.in + +obj-perenv += main.o cpuid.o + +include $(ROOT)/build/gen.mk diff --git a/tests/vvmx/cpuid.c b/tests/vvmx/cpuid.c new file mode 100644 index 0000000..9a4cdae --- /dev/null +++ b/tests/vvmx/cpuid.c @@ -0,0 +1,24 @@ +#include <xtf.h> + +bool test_cpuid_vmx_feat(void) +{ + uint32_t ecx = cpuid_ecx(1); + + if ( !(ecx & X86_FEATURE_VMX) ) + { + xtf_failure("Fail: cpuid.1:ecx[5] is not set.\n"); + return false; + } + + return true; +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */ diff --git a/tests/vvmx/extra.cfg.in b/tests/vvmx/extra.cfg.in new file mode 100644 index 0000000..ae494f8 --- /dev/null +++ b/tests/vvmx/extra.cfg.in @@ -0,0 +1 @@ +nestedhvm = 1 diff --git a/tests/vvmx/main.c b/tests/vvmx/main.c new file mode 100644 index 0000000..8506b7b --- /dev/null +++ b/tests/vvmx/main.c @@ -0,0 +1,44 @@ +/** + * @file tests/vvmx/main.c + * @ref test-vvmx + * + * @page test-vvmx vvmx + * + * Test VMX features (CPUID, MSR, VMX instructions, EPT, APIC etc.) in + * the nested VMX environment. + * + * @see tests/vvmx/main.c + */ +#include <xtf.h> + +const char test_title[] = "Test vvmx"; + +extern bool test_cpuid_vmx_feat(void); + +void test_main(void) +{ + if ( !vendor_is(X86_VENDOR_INTEL) ) + { + xtf_skip("Skip: non-Intel processors\n"); + return; + } + + if ( !test_cpuid_vmx_feat() ) + goto fail; + + xtf_success(NULL); + return; + +fail: + xtf_failure(NULL); +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */ -- 2.10.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel