summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/kvm/x86_64/hyperv_cpuid.c
diff options
context:
space:
mode:
authorLinus Torvalds2019-08-21 20:48:38 +0200
committerLinus Torvalds2019-08-21 20:48:38 +0200
commitbb7ba8069de933d69cb45dd0a5806b61033796a3 (patch)
treea6efe79c2ec068f0445206aedde6bbc839c9dca0 /tools/testing/selftests/kvm/x86_64/hyperv_cpuid.c
parentMerge tag 'nfsd-5.3-1' of git://linux-nfs.org/~bfields/linux (diff)
parentselftests/kvm: make platform_info_test pass on AMD (diff)
downloadkernel-qcow2-linux-bb7ba8069de933d69cb45dd0a5806b61033796a3.tar.gz
kernel-qcow2-linux-bb7ba8069de933d69cb45dd0a5806b61033796a3.tar.xz
kernel-qcow2-linux-bb7ba8069de933d69cb45dd0a5806b61033796a3.zip
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvmHEADmaster
Pull KVM fixes from Paolo Bonzini: "A couple bugfixes, and mostly selftests changes" * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm: selftests/kvm: make platform_info_test pass on AMD Revert "KVM: x86/mmu: Zap only the relevant pages when removing a memslot" selftests: kvm: fix state save/load on processors without XSAVE selftests: kvm: fix vmx_set_nested_state_test selftests: kvm: provide common function to enable eVMCS selftests: kvm: do not try running the VM in vmx_set_nested_state_test KVM: x86: svm: remove redundant assignment of var new_entry MAINTAINERS: add KVM x86 reviewers MAINTAINERS: change list for KVM/s390 kvm: x86: skip populating logical dest map if apic is not sw enabled
Diffstat (limited to 'tools/testing/selftests/kvm/x86_64/hyperv_cpuid.c')
-rw-r--r--tools/testing/selftests/kvm/x86_64/hyperv_cpuid.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/tools/testing/selftests/kvm/x86_64/hyperv_cpuid.c b/tools/testing/selftests/kvm/x86_64/hyperv_cpuid.c
index f72b3043db0e..ee59831fbc98 100644
--- a/tools/testing/selftests/kvm/x86_64/hyperv_cpuid.c
+++ b/tools/testing/selftests/kvm/x86_64/hyperv_cpuid.c
@@ -18,6 +18,7 @@
#include "test_util.h"
#include "kvm_util.h"
#include "processor.h"
+#include "vmx.h"
#define VCPU_ID 0
@@ -106,12 +107,7 @@ int main(int argc, char *argv[])
{
struct kvm_vm *vm;
int rv;
- uint16_t evmcs_ver;
struct kvm_cpuid2 *hv_cpuid_entries;
- struct kvm_enable_cap enable_evmcs_cap = {
- .cap = KVM_CAP_HYPERV_ENLIGHTENED_VMCS,
- .args[0] = (unsigned long)&evmcs_ver
- };
/* Tell stdout not to buffer its content */
setbuf(stdout, NULL);
@@ -136,14 +132,14 @@ int main(int argc, char *argv[])
free(hv_cpuid_entries);
- rv = _vcpu_ioctl(vm, VCPU_ID, KVM_ENABLE_CAP, &enable_evmcs_cap);
-
- if (rv) {
+ if (!kvm_check_cap(KVM_CAP_HYPERV_ENLIGHTENED_VMCS)) {
fprintf(stderr,
"Enlightened VMCS is unsupported, skip related test\n");
goto vm_free;
}
+ vcpu_enable_evmcs(vm, VCPU_ID);
+
hv_cpuid_entries = kvm_get_supported_hv_cpuid(vm);
if (!hv_cpuid_entries)
return 1;