Skip to content

virt: add initial KVM validation coverage#437

Open
smuppand wants to merge 2 commits intoqualcomm-linux:mainfrom
smuppand:kvm-tests
Open

virt: add initial KVM validation coverage#437
smuppand wants to merge 2 commits intoqualcomm-linux:mainfrom
smuppand:kvm-tests

Conversation

@smuppand
Copy link
Copy Markdown
Contributor

@smuppand smuppand commented May 3, 2026

Add the first set of KVM validation tests under the new Virtualization/KVM suite.

Why this is needed:

  • KVM enablement needs validation across kernel config, runtime device node, EL2 DTB/runtime evidence, and QEMU userspace infrastructure.
  • Existing tests do not validate /dev/kvm usability through the KVM ioctl API.
  • Qualcomm EL2 DTB validation should be dynamic and based on live DT/sysfs evidence, rather than hardcoding each target.
  • Remoteproc/PIL validation already exists elsewhere, so the KVM tests only log remoteproc state and validate EL2 remoteproc/IOMMU evidence without performing stop/start/reset operations.

Changes:

  • Add Runner/utils/lib_kvm.sh with shared KVM-specific helpers.
  • Add KVM_Boot_Up to validate:
    • CONFIG_VIRTUALIZATION
    • CONFIG_KVM
    • /dev/kvm presence/access
    • KVM/EL2 boot dmesg
  • Add KVM_Driver to validate:
    • /dev/kvm usability
    • KVM_GET_API_VERSION == 12
    • KVM_CREATE_VM
  • Add KVM_EL2_DTB to validate:
    • dynamic live DT identity
    • remoteproc state logging
    • remoteproc/IOMMU EL2 DT/runtime evidence
    • KVM/EL2 dmesg
  • Add KVM_Infra to validate:
    • QEMU system binary availability
    • qemu-img availability
    • QEMU KVM acceleration support
    • optional /dev/net/tun and /dev/vhost-net infrastructure

Notes:

  • Unsupported or intentionally unavailable features report SKIP instead of FAIL.
  • KVM_EL2_DTB does not duplicate secure PIL or remoteproc lifecycle tests.

Add Runner/utils/lib_kvm.sh with shared helpers for KVM and virtualization
tests.

The helper library provides KVM-specific checks for:
- /dev/kvm presence and permissions
- KVM ioctl API validation
- KVM/EL2 dmesg scanning
- dynamic EL2 DTB remoteproc/IOMMU evidence
- QEMU binary discovery and KVM acceleration checks
- optional tun/vhost-net infrastructure checks

The library is intended to be sourced after functestlib.sh and reuses the
existing common logging, dependency, kernel config, dmesg, and remoteproc
helpers instead of duplicating generic testkit functionality.

Signed-off-by: Srikanth Muppandam <smuppand@qti.qualcomm.com>
Comment thread Runner/suites/Virtualization/KVM/KVM_Boot_Up/run.sh Outdated
log_info "-------------------Starting $TESTNAME Testcase----------------------------"
log_info "=== Test Initialization ==="

if command -v detect_platform >/dev/null 2>&1; then
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this condition be removed? in else condition wait_for_path is again implemented which would nullify the advantage of defining a function

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this condition be removed? in else condition wait_for_path is again implemented which would nullify the advantage of defining a function

I do not see wait_for_path in this KVM path. The guard is for optional detect_platform support so the test can still run on minimal images. I moved dependency checks before this block, but kept the fallback platform logging.

Comment thread Runner/suites/Virtualization/KVM/KVM_Boot_Up/run.sh Outdated
Comment thread Runner/suites/Virtualization/KVM/KVM_Boot_Up/run.sh Outdated
Comment thread Runner/suites/Virtualization/KVM/KVM_Boot_Up/run.sh Outdated
Comment thread Runner/suites/Virtualization/KVM/KVM_Boot_Up/run.sh Outdated
Comment thread Runner/suites/Virtualization/KVM/KVM_Driver/README.md Outdated
Comment thread Runner/suites/Virtualization/KVM/KVM_Driver/README.md Outdated
Comment thread Runner/suites/Virtualization/KVM/KVM_Driver/run.sh
Comment thread Runner/suites/Virtualization/KVM/KVM_EL2_DTB/run.sh
Comment thread Runner/suites/Virtualization/KVM/KVM_Infra/run.sh
log_info "-------------------Starting $TESTNAME Testcase----------------------------"
log_info "=== Test Initialization ==="

if command -v detect_platform >/dev/null 2>&1; then
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this condition be removed? in else condition wait_for_path is again implemented which would nullify the advantage of defining a function

Comment thread Runner/suites/Virtualization/KVM/KVM_Driver/run.sh Outdated
Comment thread Runner/suites/Virtualization/KVM/KVM_Driver/run.sh
Add the first set of KVM validation tests under the Virtualization/KVM
suite.

This introduces:
- KVM_Driver to validate /dev/kvm usability through KVM_GET_API_VERSION
  and KVM_CREATE_VM
- KVM_EL2_DTB to dynamically validate EL2 DTB remoteproc/IOMMU runtime
  evidence without hardcoding target names
- KVM_Infra to validate QEMU availability, KVM acceleration support,
  and optional VM host infrastructure such as tun/vhost-net

The tests follow the qcom-linux-testkit conventions, reuse functestlib.sh,
source the shared KVM helper library, and report SKIP for unsupported or
missing optional KVM/virtualization components.

Signed-off-by: Srikanth Muppandam <smuppand@qti.qualcomm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants