struct svm_test_data *vcpu_alloc_svm(struct kvm_vm *vm, vm_vaddr_t *p_svm_gva);
void generic_svm_setup(struct svm_test_data *svm, void *guest_rip, void *guest_rsp);
void run_guest(struct vmcb *vmcb, uint64_t vmcb_gpa);
-bool nested_svm_supported(void);
-void nested_svm_check_supported(void);
static inline bool cpu_has_svm(void)
{
: "r15", "memory");
}
-bool nested_svm_supported(void)
-{
- struct kvm_cpuid_entry2 *entry =
- kvm_get_supported_cpuid_entry(0x80000001);
-
- return entry->ecx & CPUID_SVM;
-}
-
-void nested_svm_check_supported(void)
-{
- TEST_REQUIRE(nested_svm_supported());
-}
-
/*
* Open SEV_DEV_PATH if available, otherwise exit the entire program.
*
struct ucall uc;
int stage;
- TEST_REQUIRE(nested_svm_supported());
+ TEST_REQUIRE(kvm_cpu_has(X86_FEATURE_SVM));
/* Create VM */
vm = vm_create_with_one_vcpu(&vcpu, guest_code);
vcpu_set_msr(vcpu, MSR_IA32_SMBASE, SMRAM_GPA);
if (kvm_has_cap(KVM_CAP_NESTED_STATE)) {
- if (nested_svm_supported())
+ if (kvm_cpu_has(X86_FEATURE_SVM))
vcpu_alloc_svm(vm, &nested_gva);
else if (nested_vmx_supported())
vcpu_alloc_vmx(vm, &nested_gva);
vcpu_regs_get(vcpu, ®s1);
if (kvm_has_cap(KVM_CAP_NESTED_STATE)) {
- if (nested_svm_supported())
+ if (kvm_cpu_has(X86_FEATURE_SVM))
vcpu_alloc_svm(vm, &nested_gva);
else if (nested_vmx_supported())
vcpu_alloc_vmx(vm, &nested_gva);
struct kvm_vm *vm;
struct ucall uc;
- nested_svm_check_supported();
+ TEST_REQUIRE(kvm_cpu_has(X86_FEATURE_SVM));
vm = vm_create_with_one_vcpu(&vcpu, l1_guest_code);
/* Tell stdout not to buffer its content */
setbuf(stdout, NULL);
- nested_svm_check_supported();
+ TEST_REQUIRE(kvm_cpu_has(X86_FEATURE_SVM));
cpuid = kvm_get_supported_cpuid_entry(0x8000000a);
TEST_ASSERT(cpuid->edx & CPUID_NRIPS,
vm_vaddr_t svm_gva;
struct kvm_vm *vm;
- nested_svm_check_supported();
+ TEST_REQUIRE(kvm_cpu_has(X86_FEATURE_SVM));
vm = vm_create_with_one_vcpu(&vcpu, l1_guest_code);