Add the lock_verify test case to verify the k0/tlblock behavior, add the
minivm tests to cover start() and more.

Reviewed-by: Pierrick Bouvier <[email protected]>
Signed-off-by: Brian Cain <[email protected]>
---
 tests/functional/hexagon/meson.build      |  1 +
 tests/functional/hexagon/test_minivm.py   | 48 +++++++++++++++++++++++
 tests/functional/hexagon/test_systests.py |  3 ++
 3 files changed, 52 insertions(+)
 create mode 100755 tests/functional/hexagon/test_minivm.py

diff --git a/tests/functional/hexagon/meson.build 
b/tests/functional/hexagon/meson.build
index 44053e64676..e182bc98a06 100644
--- a/tests/functional/hexagon/meson.build
+++ b/tests/functional/hexagon/meson.build
@@ -3,6 +3,7 @@
 tests_hexagon_system_thorough = [
   'arch_tests',
   'systests',
+  'minivm',
 ]
 
 test_hexagon_timeouts = {
diff --git a/tests/functional/hexagon/test_minivm.py 
b/tests/functional/hexagon/test_minivm.py
new file mode 100755
index 00000000000..115f3cf3710
--- /dev/null
+++ b/tests/functional/hexagon/test_minivm.py
@@ -0,0 +1,48 @@
+#!/usr/bin/env python3
+#
+# Copyright(c) 2024-2025 Qualcomm Innovation Center, Inc. All Rights Reserved.
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+from qemu_test import QemuSystemTest, Asset
+
+class MiniVMTest(QemuSystemTest):
+    '''
+    minivm is a Hexagon hypervisor that implements the Hexagon VM
+    specification.  These test cases boot minivm and then load test cases
+    to the address specified by MiniVMTest.GUEST_ENTRY and
+    execute a minvm-guest program to exercise minivm virtualization
+    features.
+    '''
+    timeout = 180
+    GUEST_ENTRY = 0xc0000000
+    ASSET_TARBALL = Asset(
+        'https://github.com/qualcomm/qemu-hexagon-testing/releases/'
+        'download/v0.2.21/hexagon_minivm.tar.gz',
+        '5980740c5fa505f55cacd1646088831202df4ccbf9e2ddc34b690673574169ba')
+
+    def run_minivm_test(self, test_case):
+        self.set_machine('sim')
+        self.archive_extract(self.ASSET_TARBALL)
+        rootfs_path = self.scratch_file('hexagon-unknown-linux-musl-rootfs')
+        kernel_path = f'{rootfs_path}/boot/minivm'
+
+        vm = self.get_vm(name=test_case)
+        vm.add_args('-kernel', kernel_path, '-device',
+                    f'loader,addr={hex(self.GUEST_ENTRY)},'
+                    f'file={rootfs_path}/boot/{test_case}')
+        vm.launch()
+        vm.wait()
+        self.assertEqual(vm.exitcode(), 0)
+
+    def test_mmu(self):
+        self.run_minivm_test('test_mmu')
+
+    def test_interrupts(self):
+        self.run_minivm_test('test_interrupts')
+
+    def test_processors(self):
+        self.run_minivm_test('test_processors')
+
+if __name__ == '__main__':
+    QemuSystemTest.main()
diff --git a/tests/functional/hexagon/test_systests.py 
b/tests/functional/hexagon/test_systests.py
index 20c58f84f67..0489db0af91 100755
--- a/tests/functional/hexagon/test_systests.py
+++ b/tests/functional/hexagon/test_systests.py
@@ -108,5 +108,8 @@ def test_hvx_multi(self):
     def test_standalone_vec(self):
         self.run_exit_zero("standalone_vec")
 
+    def test_lock_verify(self):
+        self.run_exit_zero("lock_verify")
+
 if __name__ == "__main__":
     QemuSystemTest.main()
-- 
2.34.1

Reply via email to