diff options
author | Sean Christopherson <seanjc@google.com> | 2022-02-16 09:08:00 -0800 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2022-06-11 11:47:02 -0400 |
commit | b8592448370b1235119a0a135e99277430c76d53 (patch) | |
tree | fa0f08eaadaba65791daa820b06838c866faeae3 /tools/testing/selftests/kvm/lib/kvm_util.c | |
parent | KVM: selftests: Make arm64's guest_get_vcpuid() declaration arm64-only (diff) | |
download | linux-dev-b8592448370b1235119a0a135e99277430c76d53.tar.xz linux-dev-b8592448370b1235119a0a135e99277430c76d53.zip |
KVM: selftests: Move vm_is_unrestricted_guest() to x86-64
An "unrestricted guest" is an VMX-only concept, move the relevant helper
to x86-64 code. Assume most readers can correctly convert underscores to
spaces and oppurtunistically trim the function comment.
Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'tools/testing/selftests/kvm/lib/kvm_util.c')
-rw-r--r-- | tools/testing/selftests/kvm/lib/kvm_util.c | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c index f8274ca5fe5b..752731cf4292 100644 --- a/tools/testing/selftests/kvm/lib/kvm_util.c +++ b/tools/testing/selftests/kvm/lib/kvm_util.c @@ -1948,39 +1948,6 @@ void *addr_gva2hva(struct kvm_vm *vm, vm_vaddr_t gva) return addr_gpa2hva(vm, addr_gva2gpa(vm, gva)); } -/* - * Is Unrestricted Guest - * - * Input Args: - * vm - Virtual Machine - * - * Output Args: None - * - * Return: True if the unrestricted guest is set to 'Y', otherwise return false. - * - * Check if the unrestricted guest flag is enabled. - */ -bool vm_is_unrestricted_guest(struct kvm_vm *vm) -{ - char val = 'N'; - size_t count; - FILE *f; - - if (vm == NULL) { - /* Ensure that the KVM vendor-specific module is loaded. */ - close(open_kvm_dev_path_or_exit()); - } - - f = fopen("/sys/module/kvm_intel/parameters/unrestricted_guest", "r"); - if (f) { - count = fread(&val, sizeof(char), 1, f); - TEST_ASSERT(count == 1, "Unable to read from param file."); - fclose(f); - } - - return val == 'Y'; -} - unsigned int vm_get_page_size(struct kvm_vm *vm) { return vm->page_size; |