mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-18 03:23:53 -04:00
KVM: selftests: Verify KVM is loaded when getting a KVM module param
Probe /dev/kvm when getting a KVM module param so that attempting to load a module param super early in a selftest generates a SKIP message about KVM not being loaded/enabled, versus some random parameter not existing. E.g. KVM x86's unconditional retrieval of force_emulation_prefix during kvm_selftest_arch_init() generates a rather confusing error message that takes far too much triage to understand. Link: https://lore.kernel.org/r/20250516215909.2551628-2-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
This commit is contained in:
@@ -64,6 +64,9 @@ static ssize_t get_module_param(const char *module_name, const char *param,
|
||||
ssize_t bytes_read;
|
||||
int fd, r;
|
||||
|
||||
/* Verify KVM is loaded, to provide a more helpful SKIP message. */
|
||||
close(open_kvm_dev_path_or_exit());
|
||||
|
||||
r = snprintf(path, path_size, "/sys/module/%s/parameters/%s",
|
||||
module_name, param);
|
||||
TEST_ASSERT(r < path_size,
|
||||
|
||||
Reference in New Issue
Block a user