[LTP] [PATCH v1] kvm: Add needs_driver support to check for kvm driver

Kushal Chand K
2026-01-22T15:09:33Z

This patch adds needs_driver field in kvm testcases to check for kvm driver

Signed-off-by: Kushal Chand K <kushalkataria5@gmail.com>
---
testcases/kernel/kvm/kvm_pagefault01.c | 4 ++++
testcases/kernel/kvm/kvm_svm01.c | 4 ++++
testcases/kernel/kvm/kvm_svm02.c | 4 ++++
testcases/kernel/kvm/kvm_svm03.c | 4 ++++
testcases/kernel/kvm/kvm_svm04.c | 4 ++++
testcases/kernel/kvm/kvm_vmx01.c | 4 ++++
testcases/kernel/kvm/kvm_vmx02.c | 4 ++++
7 files changed, 28 insertions(+)

diff --git a/testcases/kernel/kvm/kvm_pagefault01.c b/testcases/kernel/kvm/kvm_pagefault01.c
index db526cb7e..2b477f7af 100644
--- a/testcases/kernel/kvm/kvm_pagefault01.c
+++ b/testcases/kernel/kvm/kvm_pagefault01.c
@@ -165,6 +165,10 @@ static struct tst_test test = {
.setup = setup,
.cleanup = tst_kvm_cleanup,
.needs_root = 1,
+ .needs_drivers = (const char *const []) {
+ "kvm",
+ NULL
+ },
.supported_archs = (const char *const []) {
"x86_64",
NULL
diff --git a/testcases/kernel/kvm/kvm_svm01.c b/testcases/kernel/kvm/kvm_svm01.c
index 32d15526b..f81602567 100644
--- a/testcases/kernel/kvm/kvm_svm01.c
+++ b/testcases/kernel/kvm/kvm_svm01.c
@@ -108,6 +108,10 @@ static struct tst_test test = {
.test_all = tst_kvm_run,
.setup = tst_kvm_setup,
.cleanup = tst_kvm_cleanup,
+ .needs_drivers = (const char *const []) {
+ "kvm",
+ NULL
+ },
.supported_archs = (const char *const []) {
"x86_64",
"x86",
diff --git a/testcases/kernel/kvm/kvm_svm02.c b/testcases/kernel/kvm/kvm_svm02.c
index 6914fdcba..701f2731d 100644
--- a/testcases/kernel/kvm/kvm_svm02.c
+++ b/testcases/kernel/kvm/kvm_svm02.c
@@ -129,6 +129,10 @@ static struct tst_test test = {
.test_all = tst_kvm_run,
.setup = tst_kvm_setup,
.cleanup = tst_kvm_cleanup,
+ .needs_drivers = (const char *const []) {
+ "kvm",
+ NULL
+ },
.supported_archs = (const char *const []) {
"x86_64",
"x86",
diff --git a/testcases/kernel/kvm/kvm_svm03.c b/testcases/kernel/kvm/kvm_svm03.c
index 87164d013..faafaf7cf 100644
--- a/testcases/kernel/kvm/kvm_svm03.c
+++ b/testcases/kernel/kvm/kvm_svm03.c
@@ -154,6 +154,10 @@ static struct tst_test test = {
.test_all = run,
.setup = setup,
.cleanup = cleanup,
+ .needs_drivers = (const char *const []) {
+ "kvm",
+ NULL
+ },
.min_cpus = 2,
.supported_archs = (const char *const []) {
"x86_64",
diff --git a/testcases/kernel/kvm/kvm_svm04.c b/testcases/kernel/kvm/kvm_svm04.c
index 75fcbfdcf..af3c8b1c6 100644
--- a/testcases/kernel/kvm/kvm_svm04.c
+++ b/testcases/kernel/kvm/kvm_svm04.c
@@ -295,6 +295,10 @@ static struct tst_test test = {
.test_all = tst_kvm_run,
.setup = tst_kvm_setup,
.cleanup = tst_kvm_cleanup,
+ .needs_drivers = (const char *const []) {
+ "kvm",
+ NULL
+ },
.supported_archs = (const char *const []) {
"x86_64",
"x86",
diff --git a/testcases/kernel/kvm/kvm_vmx01.c b/testcases/kernel/kvm/kvm_vmx01.c
index 5bffbe946..d0c4913c9 100644
--- a/testcases/kernel/kvm/kvm_vmx01.c
+++ b/testcases/kernel/kvm/kvm_vmx01.c
@@ -269,6 +269,10 @@ static struct tst_test test = {
.setup = setup,
.cleanup = tst_kvm_cleanup,
.needs_root = 1,
+ .needs_drivers = (const char *const []) {
+ "kvm",
+ NULL
+ },
.supported_archs = (const char *const []) {
"x86_64",
"x86",
diff --git a/testcases/kernel/kvm/kvm_vmx02.c b/testcases/kernel/kvm/kvm_vmx02.c
index 3fcfebb3b..4ce225e56 100644
--- a/testcases/kernel/kvm/kvm_vmx02.c
+++ b/testcases/kernel/kvm/kvm_vmx02.c
@@ -183,6 +183,10 @@ static struct tst_test test = {
.setup = setup,
.cleanup = tst_kvm_cleanup,
.needs_root = 1,
+ .needs_drivers = (const char *const []) {
+ "kvm",
+ NULL
+ },
.supported_archs = (const char *const []) {
"x86_64",
"x86",
--
2.43.0