KVM: selftests: Add a helper to read kvm boolean module parameters
authorLike Xu <likexu@tencent.com>
Tue, 14 Feb 2023 08:49:19 +0000 (16:49 +0800)
committerSean Christopherson <seanjc@google.com>
Fri, 24 Mar 2023 15:27:04 +0000 (08:27 -0700)
Add a helper function for reading kvm boolean module parameters values.
No functional change intended.

Signed-off-by: Like Xu <likexu@tencent.com>
Link: https://lore.kernel.org/r/20230214084920.59787-2-likexu@tencent.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
tools/testing/selftests/kvm/include/kvm_util_base.h
tools/testing/selftests/kvm/lib/kvm_util.c

index fbc2a79..a089c35 100644 (file)
@@ -213,6 +213,7 @@ extern const struct vm_guest_mode_params vm_guest_mode_params[];
 int open_path_or_exit(const char *path, int flags);
 int open_kvm_dev_path_or_exit(void);
 
+bool get_kvm_param_bool(const char *param);
 bool get_kvm_intel_param_bool(const char *param);
 bool get_kvm_amd_param_bool(const char *param);
 
index 8ec20ac..298c437 100644 (file)
@@ -80,6 +80,11 @@ static bool get_module_param_bool(const char *module_name, const char *param)
        TEST_FAIL("Unrecognized value '%c' for boolean module param", value);
 }
 
+bool get_kvm_param_bool(const char *param)
+{
+       return get_module_param_bool("kvm", param);
+}
+
 bool get_kvm_intel_param_bool(const char *param)
 {
        return get_module_param_bool("kvm_intel", param);