// SPDX-License-Identifier: GPL-2.0 /* * Test for x86 KVM_CAP_HYPERV_CPUID * * Copyright (C) 2018, Red Hat, Inc. * * This work is licensed under the terms of the GNU GPL, version 2. *
*/ #include <fcntl.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/ioctl.h>
/* * Note, the CPUID array returned by the system-scoped helper is a one- * time allocation, i.e. must not be freed.
*/ if (vcpu)
free((void *)hv_cpuid_entries);
}
/* Test the vCPU ioctl without an in-kernel local APIC. */
vm = vm_create_barebones();
vcpu = __vm_vcpu_add(vm, 0);
test_hv_cpuid(vcpu, false);
kvm_vm_free(vm);
/* Test vCPU ioctl version */
vm = vm_create_with_one_vcpu(&vcpu, guest_code);
test_hv_cpuid_e2big(vm, vcpu);
test_hv_cpuid(vcpu, false);
if (!kvm_cpu_has(X86_FEATURE_VMX) ||
!kvm_has_cap(KVM_CAP_HYPERV_ENLIGHTENED_VMCS)) {
print_skip("Enlightened VMCS is unsupported"); goto do_sys;
}
vcpu_enable_evmcs(vcpu);
test_hv_cpuid(vcpu, true);
do_sys: /* Test system ioctl version */ if (!kvm_has_cap(KVM_CAP_SYS_HYPERV_CPUID)) {
print_skip("KVM_CAP_SYS_HYPERV_CPUID not supported"); goto out;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.