]> git.baikalelectronics.ru Git - kernel.git/commitdiff
KVM: selftests: Add TEST_REQUIRE macros to reduce skipping copy+paste
authorSean Christopherson <seanjc@google.com>
Fri, 27 May 2022 23:24:02 +0000 (16:24 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Sat, 11 Jun 2022 15:47:29 +0000 (11:47 -0400)
Add TEST_REQUIRE() and __TEST_REQUIRE() to replace the myriad open coded
instances of selftests exiting with KSFT_SKIP after printing an
informational message.  In addition to reducing the amount of boilerplate
code in selftests, the UPPERCASE macro names make it easier to visually
identify a test's requirements.

Convert usage that erroneously uses something other than print_skip()
and/or "exits" with '0' or some other non-KSFT_SKIP value.

Intentionally drop a kvm_vm_free() in aarch64/debug-exceptions.c as part
of the conversion.  All memory and file descriptors are freed on process
exit, so the explicit free is superfluous.

Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
48 files changed:
tools/testing/selftests/kvm/aarch64/arch_timer.c
tools/testing/selftests/kvm/aarch64/debug-exceptions.c
tools/testing/selftests/kvm/aarch64/get-reg-list.c
tools/testing/selftests/kvm/aarch64/psci_test.c
tools/testing/selftests/kvm/aarch64/vcpu_width_config.c
tools/testing/selftests/kvm/aarch64/vgic_init.c
tools/testing/selftests/kvm/aarch64/vgic_irq.c
tools/testing/selftests/kvm/access_tracking_perf_test.c
tools/testing/selftests/kvm/include/test_util.h
tools/testing/selftests/kvm/kvm_binary_stats_test.c
tools/testing/selftests/kvm/kvm_create_max_vcpus.c
tools/testing/selftests/kvm/lib/kvm_util.c
tools/testing/selftests/kvm/lib/x86_64/processor.c
tools/testing/selftests/kvm/lib/x86_64/svm.c
tools/testing/selftests/kvm/lib/x86_64/vmx.c
tools/testing/selftests/kvm/rseq_test.c
tools/testing/selftests/kvm/s390x/memop.c
tools/testing/selftests/kvm/s390x/sync_regs_test.c
tools/testing/selftests/kvm/steal_time.c
tools/testing/selftests/kvm/system_counter_offset_test.c
tools/testing/selftests/kvm/x86_64/amx_test.c
tools/testing/selftests/kvm/x86_64/cr4_cpuid_sync_test.c
tools/testing/selftests/kvm/x86_64/debug_regs.c
tools/testing/selftests/kvm/x86_64/emulator_error_test.c
tools/testing/selftests/kvm/x86_64/evmcs_test.c
tools/testing/selftests/kvm/x86_64/fix_hypercall_test.c
tools/testing/selftests/kvm/x86_64/get_msr_index_features.c
tools/testing/selftests/kvm/x86_64/hyperv_cpuid.c
tools/testing/selftests/kvm/x86_64/hyperv_svm_test.c
tools/testing/selftests/kvm/x86_64/kvm_clock_test.c
tools/testing/selftests/kvm/x86_64/kvm_pv_test.c
tools/testing/selftests/kvm/x86_64/mmio_warning_test.c
tools/testing/selftests/kvm/x86_64/mmu_role_test.c
tools/testing/selftests/kvm/x86_64/platform_info_test.c
tools/testing/selftests/kvm/x86_64/pmu_event_filter_test.c
tools/testing/selftests/kvm/x86_64/set_boot_cpu_id.c
tools/testing/selftests/kvm/x86_64/sev_migrate_tests.c
tools/testing/selftests/kvm/x86_64/sync_regs_test.c
tools/testing/selftests/kvm/x86_64/triple_fault_event_test.c
tools/testing/selftests/kvm/x86_64/tsc_scaling_sync.c
tools/testing/selftests/kvm/x86_64/vmx_exception_with_invalid_guest_state.c
tools/testing/selftests/kvm/x86_64/vmx_nested_tsc_scaling_test.c
tools/testing/selftests/kvm/x86_64/vmx_pmu_caps_test.c
tools/testing/selftests/kvm/x86_64/vmx_preemption_timer_test.c
tools/testing/selftests/kvm/x86_64/vmx_set_nested_state_test.c
tools/testing/selftests/kvm/x86_64/xen_shinfo_test.c
tools/testing/selftests/kvm/x86_64/xen_vmcall_test.c
tools/testing/selftests/kvm/x86_64/xss_msr_test.c

index ca4c08b4e353b21661fc597eb89e431b44b0b9ff..f68019be67c0c24308c94ec8f1118a55ef5b2074 100644 (file)
@@ -375,10 +375,7 @@ static struct kvm_vm *test_vm_create(void)
        ucall_init(vm, NULL);
        test_init_timer_irq(vm);
        gic_fd = vgic_v3_setup(vm, nr_vcpus, 64, GICD_BASE_GPA, GICR_BASE_GPA);
-       if (gic_fd < 0) {
-               print_skip("Failed to create vgic-v3");
-               exit(KSFT_SKIP);
-       }
+       __TEST_REQUIRE(gic_fd >= 0, "Failed to create vgic-v3");
 
        /* Make all the test's cmdline args visible to the guest */
        sync_global_to_guest(vm, test_args);
@@ -468,10 +465,8 @@ int main(int argc, char *argv[])
        if (!parse_args(argc, argv))
                exit(KSFT_SKIP);
 
-       if (test_args.migration_freq_ms && get_nprocs() < 2) {
-               print_skip("At least two physical CPUs needed for vCPU migration");
-               exit(KSFT_SKIP);
-       }
+       __TEST_REQUIRE(!test_args.migration_freq_ms || get_nprocs() >= 2,
+                      "At least two physical CPUs needed for vCPU migration");
 
        vm = test_vm_create();
        test_run(vm);
index c27352b90ccf0c727b09f454e98a1c1c96ac10d5..b8072b40ccc89c743b98e561f9e757f1ae2b5a53 100644 (file)
@@ -259,11 +259,8 @@ int main(int argc, char *argv[])
        vm_init_descriptor_tables(vm);
        vcpu_init_descriptor_tables(vcpu);
 
-       if (debug_version(vcpu) < 6) {
-               print_skip("Armv8 debug architecture not supported.");
-               kvm_vm_free(vm);
-               exit(KSFT_SKIP);
-       }
+       __TEST_REQUIRE(debug_version(vcpu) >= 6,
+                      "Armv8 debug architecture not supported.");
 
        vm_install_sync_handler(vm, VECTOR_SYNC_CURRENT,
                                ESR_EC_BRK_INS, guest_sw_bp_handler);
index 8bc10b9acbbc896646052713bacb556a62fb1a96..d287dd2cac0a5e22d622d810f3af579b8f6fe673 100644 (file)
@@ -395,10 +395,12 @@ static void check_supported(struct vcpu_config *c)
        struct reg_sublist *s;
 
        for_each_sublist(c, s) {
-               if (s->capability && !kvm_has_cap(s->capability)) {
-                       fprintf(stderr, "%s: %s not available, skipping tests\n", config_name(c), s->name);
-                       exit(KSFT_SKIP);
-               }
+               if (!s->capability)
+                       continue;
+
+               __TEST_REQUIRE(kvm_has_cap(s->capability),
+                              "%s: %s not available, skipping tests\n",
+                              config_name(c), s->name);
        }
 }
 
index 7928c62635fdab80bd398d731346d33f4e45955c..a889e1cf5e4dc69375f6ee8af1939377c784a66a 100644 (file)
@@ -192,10 +192,7 @@ static void host_test_system_suspend(void)
 
 int main(void)
 {
-       if (!kvm_check_cap(KVM_CAP_ARM_SYSTEM_SUSPEND)) {
-               print_skip("KVM_CAP_ARM_SYSTEM_SUSPEND not supported");
-               exit(KSFT_SKIP);
-       }
+       TEST_REQUIRE(kvm_check_cap(KVM_CAP_ARM_SYSTEM_SUSPEND));
 
        host_test_cpu_on();
        host_test_system_suspend();
index fff02c442610e9e24d335a0a20cfb46c1aeddc43..80b74c6f152b8e0fcaadb4fcd7b1c478ef4966bb 100644 (file)
@@ -82,10 +82,7 @@ int main(void)
        struct kvm_vm *vm;
        int ret;
 
-       if (!kvm_has_cap(KVM_CAP_ARM_EL1_32BIT)) {
-               print_skip("KVM_CAP_ARM_EL1_32BIT is not supported");
-               exit(KSFT_SKIP);
-       }
+       TEST_REQUIRE(kvm_has_cap(KVM_CAP_ARM_EL1_32BIT));
 
        /* Get the preferred target type and copy that to init1 for later use */
        vm = vm_create_barebones();
index 02402802b163a2f8e526b324b216d84b2db9f219..e8cab9840aa3785970450a9f01034fc32ae20cae 100644 (file)
@@ -703,13 +703,9 @@ int main(int ac, char **av)
        }
 
        ret = test_kvm_device(KVM_DEV_TYPE_ARM_VGIC_V2);
-       if (!ret) {
-               pr_info("Running GIC_v2 tests.\n");
-               run_tests(KVM_DEV_TYPE_ARM_VGIC_V2);
-               return 0;
-       }
+       __TEST_REQUIRE(!ret, "No GICv2 nor GICv3 support");
 
-       print_skip("No GICv2 nor GICv3 support");
-       exit(KSFT_SKIP);
+       pr_info("Running GIC_v2 tests.\n");
+       run_tests(KVM_DEV_TYPE_ARM_VGIC_V2);
        return 0;
 }
index 90dbba61d72a4336c530a8b64df3a009a2a78383..046ba4fde6484d39bebb3d2a17f5cf83e046f862 100644 (file)
@@ -768,10 +768,7 @@ static void test_vgic(uint32_t nr_irqs, bool level_sensitive, bool eoi_split)
 
        gic_fd = vgic_v3_setup(vm, 1, nr_irqs,
                        GICD_BASE_GPA, GICR_BASE_GPA);
-       if (gic_fd < 0) {
-               print_skip("Failed to create vgic-v3, skipping");
-               exit(KSFT_SKIP);
-       }
+       __TEST_REQUIRE(gic_fd >= 0, "Failed to create vgic-v3, skipping");
 
        vm_install_exception_handler(vm, VECTOR_IRQ_CURRENT,
                guest_irq_handlers[args.eoi_split][args.level_sensitive]);
index 1c771378f7f4e23365bd53f7a45cebf94a52941c..1c2749b1481ac2f8a3e94f80ff67a3a753a5717d 100644 (file)
@@ -104,10 +104,7 @@ static uint64_t lookup_pfn(int pagemap_fd, struct kvm_vm *vm, uint64_t gva)
                return 0;
 
        pfn = entry & PAGEMAP_PFN_MASK;
-       if (!pfn) {
-               print_skip("Looking up PFNs requires CAP_SYS_ADMIN");
-               exit(KSFT_SKIP);
-       }
+       __TEST_REQUIRE(pfn, "Looking up PFNs requires CAP_SYS_ADMIN");
 
        return pfn;
 }
@@ -380,10 +377,8 @@ int main(int argc, char *argv[])
        }
 
        page_idle_fd = open("/sys/kernel/mm/page_idle/bitmap", O_RDWR);
-       if (page_idle_fd < 0) {
-               print_skip("CONFIG_IDLE_PAGE_TRACKING is not enabled");
-               exit(KSFT_SKIP);
-       }
+       __TEST_REQUIRE(page_idle_fd >= 0,
+                      "CONFIG_IDLE_PAGE_TRACKING is not enabled");
        close(page_idle_fd);
 
        for_each_guest_mode(run_test, &params);
index 99e0dcdc923fa2330ab13cd77171d7da7149a0b7..493b2a799a615296cc128e1066b88b053fe49ba9 100644 (file)
@@ -34,6 +34,15 @@ static inline int _no_printf(const char *format, ...) { return 0; }
 #endif
 
 void print_skip(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
+#define __TEST_REQUIRE(f, fmt, ...)            \
+do {                                           \
+       if (!(f)) {                             \
+               print_skip(fmt, ##__VA_ARGS__); \
+               exit(KSFT_SKIP);                \
+       }                                       \
+} while (0)
+
+#define TEST_REQUIRE(f) __TEST_REQUIRE(f, "Requirement not met: %s", #f)
 
 ssize_t test_write(int fd, const void *buf, size_t count);
 ssize_t test_read(int fd, void *buf, size_t count);
index 8754b78ae78587bd3feed1248b8c8338ee96edad..1baabf955d634dc3dc86b8d23a9b11852026867e 100644 (file)
@@ -213,10 +213,7 @@ int main(int argc, char *argv[])
        }
 
        /* Check the extension for binary stats */
-       if (!kvm_has_cap(KVM_CAP_BINARY_STATS_FD)) {
-               print_skip("Binary form statistics interface is not supported");
-               exit(KSFT_SKIP);
-       }
+       TEST_REQUIRE(kvm_has_cap(KVM_CAP_BINARY_STATS_FD));
 
        /* Create VMs and VCPUs */
        vms = malloc(sizeof(vms[0]) * max_vm);
index 3ae0237e96b2eee09b3339b5c16903f3c3eaefc5..31b3cb24b9a75cdf0cc9e71f1f0cf820ec20edae 100644 (file)
@@ -64,11 +64,9 @@ int main(int argc, char *argv[])
                        rl.rlim_max = nr_fds_wanted;
 
                        int r = setrlimit(RLIMIT_NOFILE, &rl);
-                       if (r < 0) {
-                               printf("RLIMIT_NOFILE hard limit is too low (%d, wanted %d)\n",
+                       __TEST_REQUIRE(r >= 0,
+                                      "RLIMIT_NOFILE hard limit is too low (%d, wanted %d)\n",
                                       old_rlim_max, nr_fds_wanted);
-                               exit(KSFT_SKIP);
-                       }
                } else {
                        TEST_ASSERT(!setrlimit(RLIMIT_NOFILE, &rl), "setrlimit() failed!");
                }
index f93b0d9334e5bbe9562f91ffac144660203285eb..cca89d9a83eab99522fd0c02a8b4cb640870e628 100644 (file)
@@ -26,10 +26,7 @@ int open_path_or_exit(const char *path, int flags)
        int fd;
 
        fd = open(path, flags);
-       if (fd < 0) {
-               print_skip("%s not available (errno: %d)", path, errno);
-               exit(KSFT_SKIP);
-       }
+       __TEST_REQUIRE(fd >= 0, "%s not available (errno: %d)", path, errno);
 
        return fd;
 }
@@ -93,10 +90,7 @@ static void vm_open(struct kvm_vm *vm)
 {
        vm->kvm_fd = _open_kvm_dev_path_or_exit(O_RDWR);
 
-       if (!kvm_has_cap(KVM_CAP_IMMEDIATE_EXIT)) {
-               print_skip("immediate_exit not available");
-               exit(KSFT_SKIP);
-       }
+       TEST_REQUIRE(kvm_has_cap(KVM_CAP_IMMEDIATE_EXIT));
 
        vm->fd = __kvm_ioctl(vm->kvm_fd, KVM_CREATE_VM, vm->type);
        TEST_ASSERT(vm->fd >= 0, KVM_IOCTL_ERROR(KVM_CREATE_VM, vm->fd));
index a54910adea98e90abe20bab35e17588e92d75daa..4a7de11d6f377f3e283646708a50f56ce35b9fe0 100644 (file)
@@ -609,14 +609,14 @@ void vm_xsave_req_perm(int bit)
        kvm_fd = open_kvm_dev_path_or_exit();
        rc = __kvm_ioctl(kvm_fd, KVM_GET_DEVICE_ATTR, &attr);
        close(kvm_fd);
+
        if (rc == -1 && (errno == ENXIO || errno == EINVAL))
                exit(KSFT_SKIP);
        TEST_ASSERT(rc == 0, "KVM_GET_DEVICE_ATTR(0, KVM_X86_XCOMP_GUEST_SUPP) error: %ld", rc);
-       if (!(bitmask & (1ULL << bit)))
-               exit(KSFT_SKIP);
 
-       if (!is_xfd_supported())
-               exit(KSFT_SKIP);
+       TEST_REQUIRE(bitmask & (1ULL << bit));
+
+       TEST_REQUIRE(is_xfd_supported());
 
        rc = syscall(SYS_arch_prctl, ARCH_REQ_XCOMP_GUEST_PERM, bit);
 
index 01a9d831da13a9dbc422457721f52475fb5c2a8b..37e9c0a923e08de8e823ab46f65fed3cf2e15b45 100644 (file)
@@ -174,10 +174,7 @@ bool nested_svm_supported(void)
 
 void nested_svm_check_supported(void)
 {
-       if (!nested_svm_supported()) {
-               print_skip("nested SVM not enabled");
-               exit(KSFT_SKIP);
-       }
+       TEST_REQUIRE(nested_svm_supported());
 }
 
 /*
index 2cbfe9962fb1520a218452397569b764557bf545..381432741df4b85e076bd2840e53493ac54ec85c 100644 (file)
@@ -391,10 +391,7 @@ bool nested_vmx_supported(void)
 
 void nested_vmx_check_supported(void)
 {
-       if (!nested_vmx_supported()) {
-               print_skip("nested VMX not enabled");
-               exit(KSFT_SKIP);
-       }
+       TEST_REQUIRE(nested_vmx_supported());
 }
 
 static void nested_create_pte(struct kvm_vm *vm,
index 68c0c8bb206e996bc1213c79797ee45de9de035c..aba7be178dab6610e39a65f27906bc32bc9d2fe0 100644 (file)
@@ -171,12 +171,11 @@ static void *migration_worker(void *ign)
        return NULL;
 }
 
-static int calc_min_max_cpu(void)
+static void calc_min_max_cpu(void)
 {
        int i, cnt, nproc;
 
-       if (CPU_COUNT(&possible_mask) < 2)
-               return -EINVAL;
+       TEST_REQUIRE(CPU_COUNT(&possible_mask) >= 2);
 
        /*
         * CPU_SET doesn't provide a FOR_EACH helper, get the min/max CPU that
@@ -198,7 +197,8 @@ static int calc_min_max_cpu(void)
                cnt++;
        }
 
-       return (cnt < 2) ? -EINVAL : 0;
+       __TEST_REQUIRE(cnt >= 2,
+                      "Only one usable CPU, task migration not possible");
 }
 
 int main(int argc, char *argv[])
@@ -215,10 +215,7 @@ int main(int argc, char *argv[])
        TEST_ASSERT(!r, "sched_getaffinity failed, errno = %d (%s)", errno,
                    strerror(errno));
 
-       if (calc_min_max_cpu()) {
-               print_skip("Only one usable CPU, task migration not possible");
-               exit(KSFT_SKIP);
-       }
+       calc_min_max_cpu();
 
        sys_rseq(0);
 
index 22b0bb78559133475f79b0b4437f5641c4818f07..a8f9b74b91449fc5fd048b056f7db4d1f1617058 100644 (file)
@@ -756,20 +756,17 @@ struct testdef {
 
 int main(int argc, char *argv[])
 {
-       int memop_cap, extension_cap, idx;
+       int extension_cap, idx;
+
+       TEST_REQUIRE(kvm_has_cap(KVM_CAP_S390_MEM_OP));
 
        setbuf(stdout, NULL);   /* Tell stdout not to buffer its content */
 
        ksft_print_header();
 
-       memop_cap = kvm_check_cap(KVM_CAP_S390_MEM_OP);
-       extension_cap = kvm_check_cap(KVM_CAP_S390_MEM_OP_EXTENSION);
-       if (!memop_cap) {
-               ksft_exit_skip("CAP_S390_MEM_OP not supported.\n");
-       }
-
        ksft_set_plan(ARRAY_SIZE(testlist));
 
+       extension_cap = kvm_check_cap(KVM_CAP_S390_MEM_OP_EXTENSION);
        for (idx = 0; idx < ARRAY_SIZE(testlist); idx++) {
                if (testlist[idx].extension >= extension_cap) {
                        testlist[idx].test();
index 4b2eb5edde5e3b77cda38d05f1b9970a06d34150..b69710822c4746a9a956963fad902ce48ea96c3c 100644 (file)
@@ -229,14 +229,13 @@ int main(int argc, char *argv[])
        struct kvm_vm *vm;
        int idx;
 
+       TEST_REQUIRE(kvm_check_cap(KVM_CAP_SYNC_REGS));
+
        /* Tell stdout not to buffer its content */
        setbuf(stdout, NULL);
 
        ksft_print_header();
 
-       if (!kvm_check_cap(KVM_CAP_SYNC_REGS))
-               ksft_exit_skip("CAP_SYNC_REGS not supported");
-
        ksft_set_plan(ARRAY_SIZE(testlist));
 
        /* Create VM */
index 398819d4074f80b4dd19e5d5005a828ecea497e9..d122f1e05cdd18831cb7ad3b8c4039893f704afa 100644 (file)
@@ -271,10 +271,7 @@ int main(int ac, char **av)
        virt_map(vm, ST_GPA_BASE, ST_GPA_BASE, gpages);
        ucall_init(vm, NULL);
 
-       if (!is_steal_time_supported(vcpus[0])) {
-               print_skip("steal-time not supported");
-               exit(KSFT_SKIP);
-       }
+       TEST_REQUIRE(is_steal_time_supported(vcpus[0]));
 
        /* Run test on each VCPU */
        for (i = 0; i < NR_VCPUS; ++i) {
index 7c8be09307376bd69b808f515c5c6f29c537c79e..862a8e93e070b9c97f5b2e1e0a1c4306527c2401 100644 (file)
@@ -28,11 +28,9 @@ static struct test_case test_cases[] = {
 
 static void check_preconditions(struct kvm_vcpu *vcpu)
 {
-       if (!__vcpu_has_device_attr(vcpu, KVM_VCPU_TSC_CTRL, KVM_VCPU_TSC_OFFSET))
-               return;
-
-       print_skip("KVM_VCPU_TSC_OFFSET not supported; skipping test");
-       exit(KSFT_SKIP);
+       __TEST_REQUIRE(!__vcpu_has_device_attr(vcpu, KVM_VCPU_TSC_CTRL,
+                                              KVM_VCPU_TSC_OFFSET),
+                      "KVM_VCPU_TSC_OFFSET not supported; skipping test");
 }
 
 static void setup_system_counter(struct kvm_vcpu *vcpu, struct test_case *test)
index b421c8369dbac52b9ca849a83eff9e01f1b9dc9b..dab4ca16a2df09a379a660c0307ef175b95e4480 100644 (file)
@@ -317,7 +317,6 @@ int main(int argc, char *argv[])
 {
        struct kvm_cpuid_entry2 *entry;
        struct kvm_regs regs1, regs2;
-       bool amx_supported = false;
        struct kvm_vcpu *vcpu;
        struct kvm_vm *vm;
        struct kvm_run *run;
@@ -334,21 +333,15 @@ int main(int argc, char *argv[])
        vm = vm_create_with_one_vcpu(&vcpu, guest_code);
 
        entry = kvm_get_supported_cpuid_entry(1);
-       if (!(entry->ecx & X86_FEATURE_XSAVE)) {
-               print_skip("XSAVE feature not supported");
-               exit(KSFT_SKIP);
-       }
+       TEST_REQUIRE(entry->ecx & X86_FEATURE_XSAVE);
 
-       if (kvm_get_cpuid_max_basic() >= 0xd) {
-               entry = kvm_get_supported_cpuid_index(0xd, 0);
-               amx_supported = entry && !!(entry->eax & XFEATURE_MASK_XTILE);
-               if (!amx_supported) {
-                       print_skip("AMX is not supported by the vCPU (eax=0x%x)", entry->eax);
-                       exit(KSFT_SKIP);
-               }
-               /* Get xsave/restore max size */
-               xsave_restore_size = entry->ecx;
-       }
+       TEST_REQUIRE(kvm_get_cpuid_max_basic() >= 0xd);
+
+       entry = kvm_get_supported_cpuid_index(0xd, 0);
+       TEST_REQUIRE(entry->eax & XFEATURE_MASK_XTILE);
+
+       /* Get xsave/restore max size */
+       xsave_restore_size = entry->ecx;
 
        run = vcpu->run;
        vcpu_regs_get(vcpu, &regs1);
index 1635aae970e9291f0864d660f121dc866f276c61..a80940ac420fd7f837e50d61b15b78b801716920 100644 (file)
@@ -70,10 +70,7 @@ int main(int argc, char *argv[])
        struct ucall uc;
 
        entry = kvm_get_supported_cpuid_entry(1);
-       if (!(entry->ecx & X86_FEATURE_XSAVE)) {
-               print_skip("XSAVE feature not supported");
-               return 0;
-       }
+       TEST_REQUIRE(entry->ecx & X86_FEATURE_XSAVE);
 
        /* Tell stdout not to buffer its content */
        setbuf(stdout, NULL);
index bba811edef96f9d74c8539a4f0a3cb2c9a154d3a..7ef99c3359a0db8eda4bde8026fc831a62f33a93 100644 (file)
@@ -95,10 +95,7 @@ int main(void)
                1,              /* cli */
        };
 
-       if (!kvm_has_cap(KVM_CAP_SET_GUEST_DEBUG)) {
-               print_skip("KVM_CAP_SET_GUEST_DEBUG not supported");
-               return 0;
-       }
+       TEST_REQUIRE(kvm_has_cap(KVM_CAP_SET_GUEST_DEBUG));
 
        vm = vm_create_with_one_vcpu(&vcpu, guest_code);
        run = vcpu->run;
index 119bcb1158d5910b2b4ac9aaf134e44f747bce33..bfff2d271c48e0240492bfef7c45db60c3fdb6bb 100644 (file)
@@ -162,10 +162,7 @@ int main(int argc, char *argv[])
        /* Tell stdout not to buffer its content */
        setbuf(stdout, NULL);
 
-       if (!kvm_has_cap(KVM_CAP_SMALLER_MAXPHYADDR)) {
-               printf("module parameter 'allow_smaller_maxphyaddr' is not set.  Skipping test.\n");
-               return 0;
-       }
+       TEST_REQUIRE(kvm_has_cap(KVM_CAP_SMALLER_MAXPHYADDR));
 
        vm = vm_create_with_one_vcpu(&vcpu, guest_code);
 
index a6da1ccbee4e3e244949f5aa4db60fcd25df8f14..8dda527cc0809b19a96642204a5b30dd5d5a7594 100644 (file)
@@ -208,12 +208,9 @@ int main(int argc, char *argv[])
 
        vm = vm_create_with_one_vcpu(&vcpu, guest_code);
 
-       if (!nested_vmx_supported() ||
-           !kvm_has_cap(KVM_CAP_NESTED_STATE) ||
-           !kvm_has_cap(KVM_CAP_HYPERV_ENLIGHTENED_VMCS)) {
-               print_skip("Enlightened VMCS is unsupported");
-               exit(KSFT_SKIP);
-       }
+       TEST_REQUIRE(nested_vmx_supported());
+       TEST_REQUIRE(kvm_has_cap(KVM_CAP_NESTED_STATE));
+       TEST_REQUIRE(kvm_has_cap(KVM_CAP_HYPERV_ENLIGHTENED_VMCS));
 
        vcpu_set_hv_cpuid(vcpu);
        vcpu_enable_evmcs(vcpu);
index 137759547720564b3f4ed2148185d2cba8665999..f6f251ce59e19162c99f4daaa0ba99a3ca7bdafd 100644 (file)
@@ -156,10 +156,7 @@ static void test_fix_hypercall_disabled(void)
 
 int main(void)
 {
-       if (!(kvm_check_cap(KVM_CAP_DISABLE_QUIRKS2) & KVM_X86_QUIRK_FIX_HYPERCALL_INSN)) {
-               print_skip("KVM_X86_QUIRK_HYPERCALL_INSN not supported");
-               exit(KSFT_SKIP);
-       }
+       TEST_REQUIRE(kvm_check_cap(KVM_CAP_DISABLE_QUIRKS2) & KVM_X86_QUIRK_FIX_HYPERCALL_INSN);
 
        test_fix_hypercall();
        test_fix_hypercall_disabled();
index 1e366fdfe7bef7cbb1c2e25b9a21eacdd947848c..d09b3cbcadc6b4e55df99fed239c7b9df31c5654 100644 (file)
@@ -25,10 +25,7 @@ int main(int argc, char *argv[])
         * will cover the "regular" list of MSRs, the coverage here is purely
         * opportunistic and not interesting on its own.
         */
-       if (!kvm_check_cap(KVM_CAP_GET_MSR_FEATURES)) {
-               print_skip("KVM_CAP_GET_MSR_FEATURES not supported");
-               exit(KSFT_SKIP);
-       }
+       TEST_REQUIRE(kvm_has_cap(KVM_CAP_GET_MSR_FEATURES));
 
        (void)kvm_get_msr_index_list();
 
index e2fac752d354508a18cd87824c81108fef7b7c08..cbd4a7d36189e4f1601a3a84683ccc7ffb83c59e 100644 (file)
@@ -137,10 +137,7 @@ int main(int argc, char *argv[])
        /* Tell stdout not to buffer its content */
        setbuf(stdout, NULL);
 
-       if (!kvm_has_cap(KVM_CAP_HYPERV_CPUID)) {
-               print_skip("KVM_CAP_HYPERV_CPUID not supported");
-               exit(KSFT_SKIP);
-       }
+       TEST_REQUIRE(kvm_has_cap(KVM_CAP_HYPERV_CPUID));
 
        vm = vm_create_with_one_vcpu(&vcpu, guest_code);
 
index 171009184c3b7ef9a3e16b0fb6182fafbc2bea20..c5cd9835dbd68ae91f9c7b0b9659d4deaded2f12 100644 (file)
@@ -127,10 +127,8 @@ int main(int argc, char *argv[])
        struct ucall uc;
        int stage;
 
-       if (!nested_svm_supported()) {
-               print_skip("Nested SVM not supported");
-               exit(KSFT_SKIP);
-       }
+       TEST_REQUIRE(nested_svm_supported());
+
        /* Create VM */
        vm = vm_create_with_one_vcpu(&vcpu, guest_code);
        vcpu_set_hv_cpuid(vcpu);
index 6e3c4bd60b76af93c7a6ab69f3cfee996558536d..138455575a11f368e7ac1e13440fdfc787d95ad4 100644 (file)
@@ -181,11 +181,7 @@ int main(void)
        int flags;
 
        flags = kvm_check_cap(KVM_CAP_ADJUST_CLOCK);
-       if (!(flags & KVM_CLOCK_REALTIME)) {
-               print_skip("KVM_CLOCK_REALTIME not supported; flags: %x",
-                          flags);
-               exit(KSFT_SKIP);
-       }
+       TEST_REQUIRE(flags & KVM_CLOCK_REALTIME);
 
        check_clocksource();
 
index 24dad3a472065d9266b11d2b74a34a13d9ceea60..5901ccec7079625e519ad3e583913f020404d5c0 100644 (file)
@@ -204,10 +204,7 @@ int main(void)
        struct kvm_vcpu *vcpu;
        struct kvm_vm *vm;
 
-       if (!kvm_has_cap(KVM_CAP_ENFORCE_PV_FEATURE_CPUID)) {
-               print_skip("KVM_CAP_ENFORCE_PV_FEATURE_CPUID not supported");
-               exit(KSFT_SKIP);
-       }
+       TEST_REQUIRE(kvm_has_cap(KVM_CAP_ENFORCE_PV_FEATURE_CPUID));
 
        vm = vm_create_with_one_vcpu(&vcpu, guest_main);
 
index 31ae837fedb18994dd5d62484d8b3e418646409e..0e4590afd0e1aa9e8730dfe6b30fd73dc6d7e115 100644 (file)
@@ -93,15 +93,9 @@ int main(void)
 {
        int warnings_before, warnings_after;
 
-       if (!is_intel_cpu()) {
-               print_skip("Must be run on an Intel CPU");
-               exit(KSFT_SKIP);
-       }
+       TEST_REQUIRE(is_intel_cpu());
 
-       if (vm_is_unrestricted_guest(NULL)) {
-               print_skip("Unrestricted guest must be disabled");
-               exit(KSFT_SKIP);
-       }
+       TEST_REQUIRE(!vm_is_unrestricted_guest(NULL));
 
        warnings_before = get_warnings_count();
 
index 1404dfda2e9f283641f2aa10d6140e4d01e3c85a..383fff2c9587efc4f8a5bf4ad772bc8fc97e21a3 100644 (file)
@@ -117,16 +117,10 @@ int main(int argc, char *argv[])
                }
        }
 
-       if (!do_gbpages && !do_maxphyaddr) {
-               print_skip("No sub-tests selected");
-               return 0;
-       }
+       __TEST_REQUIRE(do_gbpages || do_maxphyaddr, "No sub-tests selected");
 
        entry = kvm_get_supported_cpuid_entry(0x80000001);
-       if (!(entry->edx & CPUID_GBPAGES)) {
-               print_skip("1gb hugepages not supported");
-               return 0;
-       }
+       TEST_REQUIRE(entry->edx & CPUID_GBPAGES);
 
        if (do_gbpages) {
                pr_info("Test MMIO after toggling CPUID.GBPAGES\n\n");
index 3cb48e4b615bccbf88a330c3c1095665a5b1caa6..76417c7d687bda495b9fc885e4aedf98634cec5d 100644 (file)
@@ -70,17 +70,12 @@ int main(int argc, char *argv[])
 {
        struct kvm_vcpu *vcpu;
        struct kvm_vm *vm;
-       int rv;
        uint64_t msr_platform_info;
 
        /* Tell stdout not to buffer its content */
        setbuf(stdout, NULL);
 
-       rv = kvm_check_cap(KVM_CAP_MSR_PLATFORM_INFO);
-       if (!rv) {
-               print_skip("KVM_CAP_MSR_PLATFORM_INFO not supported");
-               exit(KSFT_SKIP);
-       }
+       TEST_REQUIRE(kvm_has_cap(KVM_CAP_MSR_PLATFORM_INFO));
 
        vm = vm_create_with_one_vcpu(&vcpu, guest_code);
 
index 07fa68a1fdc40c0434f577c62036a84e470df760..656fb2227a81c99ec5854f5a82caab926448e9f8 100644 (file)
@@ -443,39 +443,24 @@ static bool use_amd_pmu(void)
 
 int main(int argc, char *argv[])
 {
-       void (*guest_code)(void) = NULL;
+       void (*guest_code)(void);
        struct kvm_vcpu *vcpu;
        struct kvm_vm *vm;
-       int r;
 
        /* Tell stdout not to buffer its content */
        setbuf(stdout, NULL);
 
-       r = kvm_check_cap(KVM_CAP_PMU_EVENT_FILTER);
-       if (!r) {
-               print_skip("KVM_CAP_PMU_EVENT_FILTER not supported");
-               exit(KSFT_SKIP);
-       }
+       TEST_REQUIRE(kvm_check_cap(KVM_CAP_PMU_EVENT_FILTER));
 
-       if (use_intel_pmu())
-               guest_code = intel_guest_code;
-       else if (use_amd_pmu())
-               guest_code = amd_guest_code;
-
-       if (!guest_code) {
-               print_skip("Don't know how to test this guest PMU");
-               exit(KSFT_SKIP);
-       }
+       TEST_REQUIRE(use_intel_pmu() || use_amd_pmu());
+       guest_code = use_intel_pmu() ? intel_guest_code : amd_guest_code;
 
        vm = vm_create_with_one_vcpu(&vcpu, guest_code);
 
        vm_init_descriptor_tables(vm);
        vcpu_init_descriptor_tables(vcpu);
 
-       if (!sanity_check_pmu(vcpu)) {
-               print_skip("Guest PMU is not functional");
-               exit(KSFT_SKIP);
-       }
+       TEST_REQUIRE(sanity_check_pmu(vcpu));
 
        if (use_amd_pmu())
                test_amd_deny_list(vcpu);
index abf740f08d683b1e55f1a8b3ea7d34421824cfa6..7ef713fdd0a5ab85b72495ff2967f8b09bf32a66 100644 (file)
@@ -123,10 +123,7 @@ static void check_set_bsp_busy(void)
 
 int main(int argc, char *argv[])
 {
-       if (!kvm_has_cap(KVM_CAP_SET_BOOT_CPU_ID)) {
-               print_skip("set_boot_cpu_id not available");
-               return 0;
-       }
+       TEST_REQUIRE(kvm_has_cap(KVM_CAP_SET_BOOT_CPU_ID));
 
        run_vm_bsp(0);
        run_vm_bsp(1);
index ffd8613987ae01bfceb89dadd01396cd6eee943b..76ba6fc80e37d9d2c36245fde06bd3feb1fb7699 100644 (file)
@@ -400,22 +400,15 @@ int main(int argc, char *argv[])
 {
        struct kvm_cpuid_entry2 *cpuid;
 
-       if (!kvm_has_cap(KVM_CAP_VM_MOVE_ENC_CONTEXT_FROM) &&
-           !kvm_has_cap(KVM_CAP_VM_COPY_ENC_CONTEXT_FROM)) {
-               print_skip("Capabilities not available");
-               exit(KSFT_SKIP);
-       }
+       TEST_REQUIRE(kvm_has_cap(KVM_CAP_VM_MOVE_ENC_CONTEXT_FROM));
+       TEST_REQUIRE(kvm_has_cap(KVM_CAP_VM_COPY_ENC_CONTEXT_FROM));
 
        cpuid = kvm_get_supported_cpuid_entry(0x80000000);
-       if (cpuid->eax < 0x8000001f) {
-               print_skip("AMD memory encryption not available");
-               exit(KSFT_SKIP);
-       }
+       TEST_REQUIRE(cpuid->eax >= 0x8000001f);
+
        cpuid = kvm_get_supported_cpuid_entry(0x8000001f);
-       if (!(cpuid->eax & X86_FEATURE_SEV)) {
-               print_skip("AMD SEV not available");
-               exit(KSFT_SKIP);
-       }
+       TEST_REQUIRE(cpuid->eax & X86_FEATURE_SEV);
+
        have_sev_es = !!(cpuid->eax & X86_FEATURE_SEV_ES);
 
        if (kvm_check_cap(KVM_CAP_VM_MOVE_ENC_CONTEXT_FROM)) {
index 773db9d4f22876970283f26ff35a66fd24ee816a..9b6db0b0b13e93163bc7fe8b8e8b122aa1178353 100644 (file)
@@ -94,14 +94,8 @@ int main(int argc, char *argv[])
        setbuf(stdout, NULL);
 
        cap = kvm_check_cap(KVM_CAP_SYNC_REGS);
-       if ((cap & TEST_SYNC_FIELDS) != TEST_SYNC_FIELDS) {
-               print_skip("KVM_CAP_SYNC_REGS not supported");
-               exit(KSFT_SKIP);
-       }
-       if ((cap & INVALID_SYNC_FIELD) != 0) {
-               print_skip("The \"invalid\" field is not invalid");
-               exit(KSFT_SKIP);
-       }
+       TEST_REQUIRE((cap & TEST_SYNC_FIELDS) == TEST_SYNC_FIELDS);
+       TEST_REQUIRE(!(cap & INVALID_SYNC_FIELD));
 
        vm = vm_create_with_one_vcpu(&vcpu, guest_code);
 
index 078bd7a0bbb1f4eed4eacb39616fb1e513cfdfd9..5a202ecb8ea0146df5378ae0a56ad3e27e008ed7 100644 (file)
@@ -46,15 +46,9 @@ int main(void)
        vm_vaddr_t vmx_pages_gva;
        struct ucall uc;
 
-       if (!nested_vmx_supported()) {
-               print_skip("Nested VMX not supported");
-               exit(KSFT_SKIP);
-       }
+       nested_vmx_check_supported();
 
-       if (!kvm_has_cap(KVM_CAP_X86_TRIPLE_FAULT_EVENT)) {
-               print_skip("KVM_CAP_X86_TRIPLE_FAULT_EVENT not supported");
-               exit(KSFT_SKIP);
-       }
+       TEST_REQUIRE(kvm_has_cap(KVM_CAP_X86_TRIPLE_FAULT_EVENT));
 
        vm = vm_create_with_one_vcpu(&vcpu, l1_guest_code);
        vm_enable_cap(vm, KVM_CAP_X86_TRIPLE_FAULT_EVENT, 1);
index fcc713ff75ff3f8d065234ec107b26ee71704a30..47139aab74084b29ba356dd9ddd4d76edb0105eb 100644 (file)
@@ -93,10 +93,7 @@ static void *run_vcpu(void *_cpu_nr)
 
 int main(int argc, char *argv[])
 {
-       if (!kvm_has_cap(KVM_CAP_VM_TSC_CONTROL)) {
-               print_skip("KVM_CAP_VM_TSC_CONTROL not available");
-               exit(KSFT_SKIP);
-       }
+       TEST_REQUIRE(kvm_has_cap(KVM_CAP_VM_TSC_CONTROL));
 
        vm = vm_create(NR_TEST_VCPUS);
        vm_ioctl(vm, KVM_SET_TSC_KHZ, (void *) TEST_TSC_KHZ);
index 5bc2cee0d613a81b1422f9bf7db165d272aa4a5b..2641b286b4ed2707e72e2d0f7868dd9e8d9a1552 100644 (file)
@@ -111,10 +111,8 @@ int main(int argc, char *argv[])
        struct kvm_vcpu *vcpu;
        struct kvm_vm *vm;
 
-       if (!is_intel_cpu() || vm_is_unrestricted_guest(NULL)) {
-               print_skip("Must be run with kvm_intel.unrestricted_guest=0");
-               exit(KSFT_SKIP);
-       }
+       TEST_REQUIRE(is_intel_cpu());
+       TEST_REQUIRE(!vm_is_unrestricted_guest(NULL));
 
        vm = vm_create_with_one_vcpu(&vcpu, guest_code);
        get_set_sigalrm_vcpu(vcpu);
index 190af812467743ab837ba415b1d338b74e2df7a5..ff4644038c557902da2d07d747e5dc363eeddf18 100644 (file)
@@ -116,14 +116,6 @@ static void l1_guest_code(struct vmx_pages *vmx_pages)
        GUEST_DONE();
 }
 
-static void tsc_scaling_check_supported(void)
-{
-       if (!kvm_has_cap(KVM_CAP_TSC_CONTROL)) {
-               print_skip("TSC scaling not supported by the HW");
-               exit(KSFT_SKIP);
-       }
-}
-
 static void stable_tsc_check_supported(void)
 {
        FILE *fp;
@@ -159,7 +151,7 @@ int main(int argc, char *argv[])
        uint64_t l2_tsc_freq = 0;
 
        nested_vmx_check_supported();
-       tsc_scaling_check_supported();
+       TEST_REQUIRE(kvm_has_cap(KVM_CAP_TSC_CONTROL));
        stable_tsc_check_supported();
 
        /*
index a308442458b86e067182c96260730cc43661564d..eb592fae44efe549909bd174aa3596a9d143b54b 100644 (file)
@@ -57,7 +57,6 @@ int main(int argc, char *argv[])
        struct kvm_cpuid2 *cpuid;
        struct kvm_cpuid_entry2 *entry_1_0;
        struct kvm_cpuid_entry2 *entry_a_0;
-       bool pdcm_supported = false;
        struct kvm_vm *vm;
        struct kvm_vcpu *vcpu;
        int ret;
@@ -71,20 +70,14 @@ int main(int argc, char *argv[])
        vm = vm_create_with_one_vcpu(&vcpu, guest_code);
        cpuid = kvm_get_supported_cpuid();
 
-       if (kvm_get_cpuid_max_basic() >= 0xa) {
-               entry_1_0 = kvm_get_supported_cpuid_index(1, 0);
-               entry_a_0 = kvm_get_supported_cpuid_index(0xa, 0);
-               pdcm_supported = entry_1_0 && !!(entry_1_0->ecx & X86_FEATURE_PDCM);
-               eax.full = entry_a_0->eax;
-       }
-       if (!pdcm_supported) {
-               print_skip("MSR_IA32_PERF_CAPABILITIES is not supported by the vCPU");
-               exit(KSFT_SKIP);
-       }
-       if (!eax.split.version_id) {
-               print_skip("PMU is not supported by the vCPU");
-               exit(KSFT_SKIP);
-       }
+       TEST_REQUIRE(kvm_get_cpuid_max_basic() >= 0xa);
+
+       entry_1_0 = kvm_get_supported_cpuid_index(1, 0);
+       entry_a_0 = kvm_get_supported_cpuid_index(0xa, 0);
+       TEST_REQUIRE(entry_1_0->ecx & X86_FEATURE_PDCM);
+
+       eax.full = entry_a_0->eax;
+       __TEST_REQUIRE(eax.split.version_id, "PMU is not supported by the vCPU");
 
        /* testcase 1, set capabilities when we have PDCM bit */
        vcpu_set_cpuid(vcpu, cpuid);
index 7438258511da2a293dd27e687ce2c05b0bb29c58..99e57b0cc2c95c5958abaecc0b4f1e73f281ed65 100644 (file)
@@ -169,10 +169,7 @@ int main(int argc, char *argv[])
         */
        nested_vmx_check_supported();
 
-       if (!kvm_has_cap(KVM_CAP_NESTED_STATE)) {
-               print_skip("KVM_CAP_NESTED_STATE not supported");
-               exit(KSFT_SKIP);
-       }
+       TEST_REQUIRE(kvm_has_cap(KVM_CAP_NESTED_STATE));
 
        /* Create VM */
        vm = vm_create_with_one_vcpu(&vcpu, guest_code);
index 21f280a7c5e17fe891e095a0878077eb2f4069a2..b564b86dfc1d3168cd495ff9bab93fc90bd278d9 100644 (file)
@@ -267,10 +267,7 @@ int main(int argc, char *argv[])
 
        have_evmcs = kvm_check_cap(KVM_CAP_HYPERV_ENLIGHTENED_VMCS);
 
-       if (!kvm_has_cap(KVM_CAP_NESTED_STATE)) {
-               print_skip("KVM_CAP_NESTED_STATE not available");
-               exit(KSFT_SKIP);
-       }
+       TEST_REQUIRE(kvm_has_cap(KVM_CAP_NESTED_STATE));
 
        /*
         * AMD currently does not implement set_nested_state, so for now we
index 4340c2f2300fe3cfc49df73f322820d01a0edf01..bdcb28186ccc3b6040466075031905587bbff8c1 100644 (file)
@@ -362,10 +362,7 @@ int main(int argc, char *argv[])
                               !strncmp(argv[1], "--verbose", 10));
 
        int xen_caps = kvm_check_cap(KVM_CAP_XEN_HVM);
-       if (!(xen_caps & KVM_XEN_HVM_CONFIG_SHARED_INFO) ) {
-               print_skip("KVM_XEN_HVM_CONFIG_SHARED_INFO not available");
-               exit(KSFT_SKIP);
-       }
+       TEST_REQUIRE(xen_caps & KVM_XEN_HVM_CONFIG_SHARED_INFO);
 
        bool do_runstate_tests = !!(xen_caps & KVM_XEN_HVM_CONFIG_RUNSTATE);
        bool do_eventfd_tests = !!(xen_caps & KVM_XEN_HVM_CONFIG_EVTCHN_2LEVEL);
index a91f11fb26f4659dc5207bafce0de97447c40cbc..8b76cade9bcd169c462edb6f5337b60b27ec6633 100644 (file)
@@ -80,14 +80,12 @@ static void guest_code(void)
 
 int main(int argc, char *argv[])
 {
+       unsigned int xen_caps;
        struct kvm_vcpu *vcpu;
        struct kvm_vm *vm;
 
-       if (!(kvm_check_cap(KVM_CAP_XEN_HVM) &
-             KVM_XEN_HVM_CONFIG_INTERCEPT_HCALL) ) {
-               print_skip("KVM_XEN_HVM_CONFIG_INTERCEPT_HCALL not available");
-               exit(KSFT_SKIP);
-       }
+       xen_caps = kvm_check_cap(KVM_CAP_XEN_HVM);
+       TEST_REQUIRE(xen_caps & KVM_XEN_HVM_CONFIG_INTERCEPT_HCALL);
 
        vm = vm_create_with_one_vcpu(&vcpu, guest_code);
        vcpu_set_hv_cpuid(vcpu);
index 1e3506c3deed97487b9b7badb1ccb62d4778d2c1..4e2e08059b9564f16bb35b443e1ba6317c1d1a0c 100644 (file)
@@ -19,7 +19,6 @@
 int main(int argc, char *argv[])
 {
        struct kvm_cpuid_entry2 *entry;
-       bool xss_supported = false;
        bool xss_in_msr_list;
        struct kvm_vm *vm;
        struct kvm_vcpu *vcpu;
@@ -29,14 +28,10 @@ int main(int argc, char *argv[])
        /* Create VM */
        vm = vm_create_with_one_vcpu(&vcpu, NULL);
 
-       if (kvm_get_cpuid_max_basic() >= 0xd) {
-               entry = kvm_get_supported_cpuid_index(0xd, 1);
-               xss_supported = entry && !!(entry->eax & X86_FEATURE_XSAVES);
-       }
-       if (!xss_supported) {
-               print_skip("IA32_XSS is not supported by the vCPU");
-               exit(KSFT_SKIP);
-       }
+       TEST_REQUIRE(kvm_get_cpuid_max_basic() >= 0xd);
+
+       entry = kvm_get_supported_cpuid_index(0xd, 1);
+       TEST_REQUIRE(entry->eax & X86_FEATURE_XSAVES);
 
        xss_val = vcpu_get_msr(vcpu, MSR_IA32_XSS);
        TEST_ASSERT(xss_val == 0,