summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorLike Xu <likexu@tencent.com>2023-02-14 16:49:19 +0800
committerSean Christopherson <seanjc@google.com>2023-03-24 08:27:04 -0700
commitd14d9139c023042e63dc869a9a1be4e4eb317396 (patch)
tree610312ef31d174d2428046f42572a7501d924291 /tools
parentf6baabdcadd1080893aa5e49e6959cb070244703 (diff)
downloadlinux-stable-d14d9139c023042e63dc869a9a1be4e4eb317396.tar.gz
linux-stable-d14d9139c023042e63dc869a9a1be4e4eb317396.tar.bz2
linux-stable-d14d9139c023042e63dc869a9a1be4e4eb317396.zip
KVM: selftests: Add a helper to read kvm boolean module parameters
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>
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/selftests/kvm/include/kvm_util_base.h1
-rw-r--r--tools/testing/selftests/kvm/lib/kvm_util.c5
2 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 fbc2a79369b8..a089c356f354 100644
--- a/tools/testing/selftests/kvm/include/kvm_util_base.h
+++ b/tools/testing/selftests/kvm/include/kvm_util_base.h
@@ -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);
diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c
index 8ec20ac33de0..298c4372fb1a 100644
--- a/tools/testing/selftests/kvm/lib/kvm_util.c
+++ b/tools/testing/selftests/kvm/lib/kvm_util.c
@@ -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);