diff options
author | Ben Gardon <bgardon@google.com> | 2022-06-13 21:25:22 +0000 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2022-06-24 04:51:51 -0400 |
commit | b774da3f2e5761cb85881ce62eb6dc97d15396c4 (patch) | |
tree | e6ee887407e4daa78f11af06fe415757eda2e6b8 /tools/testing/selftests/kvm/include | |
parent | 8448ec5993beee031376e36f77969cc0a07d8c6b (diff) | |
download | linux-stable-b774da3f2e5761cb85881ce62eb6dc97d15396c4.tar.gz linux-stable-b774da3f2e5761cb85881ce62eb6dc97d15396c4.tar.bz2 linux-stable-b774da3f2e5761cb85881ce62eb6dc97d15396c4.zip |
KVM: selftests: Test disabling NX hugepages on a VM
Add an argument to the NX huge pages test to test disabling the feature
on a VM using the new capability.
Reviewed-by: David Matlack <dmatlack@google.com>
Signed-off-by: Ben Gardon <bgardon@google.com>
Message-Id: <20220613212523.3436117-10-bgardon@google.com>
[Handle failure of sudo or setcap more gracefully. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'tools/testing/selftests/kvm/include')
-rw-r--r-- | tools/testing/selftests/kvm/include/kvm_util_base.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/testing/selftests/kvm/include/kvm_util_base.h b/tools/testing/selftests/kvm/include/kvm_util_base.h index c6c1d66136d6..fd2b52850b29 100644 --- a/tools/testing/selftests/kvm/include/kvm_util_base.h +++ b/tools/testing/selftests/kvm/include/kvm_util_base.h @@ -809,4 +809,10 @@ static inline void virt_dump(FILE *stream, struct kvm_vm *vm, uint8_t indent) virt_arch_dump(stream, vm, indent); } + +static inline int __vm_disable_nx_huge_pages(struct kvm_vm *vm) +{ + return __vm_enable_cap(vm, KVM_CAP_VM_DISABLE_NX_HUGE_PAGES, 0); +} + #endif /* SELFTEST_KVM_UTIL_BASE_H */ |