summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/kvm/include
diff options
context:
space:
mode:
authorBen Gardon <bgardon@google.com>2022-06-13 21:25:22 +0000
committerPaolo Bonzini <pbonzini@redhat.com>2022-06-24 04:51:51 -0400
commitb774da3f2e5761cb85881ce62eb6dc97d15396c4 (patch)
treee6ee887407e4daa78f11af06fe415757eda2e6b8 /tools/testing/selftests/kvm/include
parent8448ec5993beee031376e36f77969cc0a07d8c6b (diff)
downloadlinux-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.h6
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 */