@@ -98,6 +98,7 @@ tests_aarch64_system_thorough = [
'aarch64_tuxrun',
'aarch64_virt',
'aarch64_virt_gpu',
+ 'aarch64_virt_split',
'aarch64_xen',
'aarch64_xlnx_versal',
'multiprocess',
new file mode 100644
@@ -0,0 +1,69 @@
+#!/usr/bin/env python3
+#
+# Copyright (c) 2024 Linaro Ltd.
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+import os
+import re
+
+from qemu_test import QemuSystemTest, Asset
+from qemu_test import exec_command, wait_for_console_pattern
+from qemu_test import exec_command_and_wait_for_pattern
+
+def test_nested_guest(test_instance):
+
+ # TODO:
+ # - kvm-unit-tests
+ # - boot KVM guest
+ pass
+
+def get_accel_transitions(vm):
+ hmp = vm.cmd('human-monitor-command', command_line='info accel')
+ for line in hmp.split('\r\n'):
+ match = re.search(r'Transitions: (\d+)', line)
+ if match is not None:
+ return int(match[1])
+ return 0
+
+
+class Aarch64VirtSplit(QemuSystemTest):
+
+ ASSET_KERNEL = Asset(
+ ('https://fileserver.linaro.org/s/Jao8KCct246QFy2/'
+ 'download/Image-6.14.5+initramfs_with_kvm_unit_tests.xz'),
+ '9cc074434b41bce61f0534381dd6912ca6f33524077b02b5f4062a5e696d1b30')
+
+ def test_aarch64_virt_split(self):
+ self.set_machine('virt')
+ self.require_accelerator('split')
+
+ self.vm.set_console()
+
+ kernel = self.uncompress(self.ASSET_KERNEL)
+
+ self.vm.add_args('-accel', 'split')
+ self.vm.add_args('-cpu', 'host')
+ self.vm.add_args('-m', '2G')
+ self.vm.add_args('-M', 'virtualization=on,'
+ 'gic-version=max')
+ self.vm.add_args('-kernel', kernel)
+ self.vm.add_args('-netdev', 'user,id=net0')
+ self.vm.add_args('-append', 'console=ttyAMA0 '
+ 'kvm-arm.mode=nvhe')
+
+ self.vm.launch()
+ wait_for_console_pattern(self, "CPU: All CPU(s) started at EL2")
+ wait_for_console_pattern(self, "kvm [1]: Hyp nVHE mode initialized")
+ wait_for_console_pattern(self, 'Welcome to Buildroot',
+ failure_message='Synchronous Exception at')
+ exec_command_and_wait_for_pattern(self, 'root', '#')
+
+ self.assertGreater(get_accel_transitions(self.vm), 13,
+ "Not enough accel transitions")
+
+ test_nested_guest(self)
+
+
+if __name__ == '__main__':
+ QemuSystemTest.main()
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- tests/functional/meson.build | 1 + tests/functional/test_aarch64_virt_split.py | 69 +++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 tests/functional/test_aarch64_virt_split.py