* [PATCH for-12.0 0/1] Hexagon: systests + linux boot test
@ 2026-12-01 19:48 Brian Cain
2026-12-01 19:48 ` [PATCH for-12.0 1/1] tests/functional/hexagon: run the rest of the tests Brian Cain
0 siblings, 1 reply; 5+ messages in thread
From: Brian Cain @ 2026-12-01 19:48 UTC (permalink / raw)
To: qemu-devel; +Cc: Brian Cain, Pierrick Bouvier
The large suite of systests provided in the tarball haven't been run,
were waiting for fixes + features to land. Those various fixes/features
landed throughout 11.2 and now we can run the omitted tests.
Also: a linux boot test
Brian Cain (1):
tests/functional/hexagon: run the rest of the tests
tests/functional/hexagon/meson.build | 2 +
tests/functional/hexagon/test_arch_tests.py | 96 +++++++-
tests/functional/hexagon/test_linux.py | 62 +++++
tests/functional/hexagon/test_systests.py | 240 +++++++++++++++++++-
4 files changed, 394 insertions(+), 6 deletions(-)
create mode 100755 tests/functional/hexagon/test_linux.py
--
2.34.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH for-12.0 1/1] tests/functional/hexagon: run the rest of the tests
2026-12-01 19:48 [PATCH for-12.0 0/1] Hexagon: systests + linux boot test Brian Cain
@ 2026-12-01 19:48 ` Brian Cain
2026-12-02 21:44 ` Pierrick Bouvier
0 siblings, 1 reply; 5+ messages in thread
From: Brian Cain @ 2026-12-01 19:48 UTC (permalink / raw)
To: qemu-devel; +Cc: Brian Cain, Pierrick Bouvier
The arch and systest tarballs carry more binaries than were being run.
Run the missing test cases, and add a Linux boot test for the QCS6490
CDSP machine.
With this many tests in the one file, a busy host sometimes stalled the
whole file until the test timeout. The guest starts to print to the
console as soon as it is launched, and does so with the BQL held. If the
test has not started to read the console by the time the socket is full,
the guest blocks holding the BQL. QMP is answered by the main loop, which
needs the BQL, so the test cannot get a reply to a QMP command until it
reads the console, and it cannot read the console while it waits for the
reply. Start the guest paused, and read the console while it is resumed.
Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
---
tests/functional/hexagon/meson.build | 2 +
tests/functional/hexagon/test_arch_tests.py | 96 +++++++-
tests/functional/hexagon/test_linux.py | 62 +++++
tests/functional/hexagon/test_systests.py | 240 +++++++++++++++++++-
4 files changed, 394 insertions(+), 6 deletions(-)
create mode 100755 tests/functional/hexagon/test_linux.py
diff --git a/tests/functional/hexagon/meson.build b/tests/functional/hexagon/meson.build
index 3dd40ed0463..565a056a951 100644
--- a/tests/functional/hexagon/meson.build
+++ b/tests/functional/hexagon/meson.build
@@ -5,6 +5,7 @@ tests_hexagon_system_thorough = [
'qcom_dsp_firmware',
'systests',
'hlx',
+ 'linux',
'minivm',
]
@@ -13,4 +14,5 @@ test_hexagon_timeouts = {
'qcom_dsp_firmware': 240,
'systests': 180,
'hlx': 180,
+ 'linux': 240,
}
diff --git a/tests/functional/hexagon/test_arch_tests.py b/tests/functional/hexagon/test_arch_tests.py
index a437e4d4aac..9f8835e0614 100755
--- a/tests/functional/hexagon/test_arch_tests.py
+++ b/tests/functional/hexagon/test_arch_tests.py
@@ -4,6 +4,8 @@
#
# SPDX-License-Identifier: GPL-2.0-or-later
+import threading
+
from qemu_test import QemuSystemTest, Asset
from qemu_test.cmd import wait_for_console_pattern
@@ -32,6 +34,23 @@ class ArchTestsUart(QemuSystemTest):
"64053b31e8e3acf7c97e7e82209b6bda",
)
+ def launch_and_wait_for_pass(self) -> None:
+ """
+ Run the guest until it prints PASS on the console.
+
+ Start the guest paused and read the console while resuming it, so
+ that a guest blocked on a full console socket cannot deadlock QMP.
+ """
+ self.vm.add_args("-S")
+ self.vm.launch()
+ resume = threading.Thread(target=self.vm.cmd, args=("cont",),
+ daemon=True)
+ resume.start()
+ try:
+ wait_for_console_pattern(self, "PASS")
+ finally:
+ resume.join(timeout=30)
+
def run_uart_test(self, test_name: str,
machine: str = "virt") -> None:
"""
@@ -44,8 +63,7 @@ def run_uart_test(self, test_name: str,
self.vm.set_console()
self.set_vm_arg("-display", "none")
self.set_vm_arg("-kernel", target_bin)
- self.vm.launch()
- wait_for_console_pattern(self, "PASS")
+ self.launch_and_wait_for_pass()
def run_semihosting_test(self, test_name: str,
machine: str = "V81QA_1") -> None:
@@ -56,8 +74,7 @@ def run_semihosting_test(self, test_name: str,
self.vm.set_console(semihosting=True)
self.set_vm_arg("-display", "none")
self.set_vm_arg("-kernel", target_bin)
- self.vm.launch()
- wait_for_console_pattern(self, "PASS")
+ self.launch_and_wait_for_pass()
def test_exceptions(self) -> None:
"""Tests exception delivery for trap instructions, privilege
@@ -101,6 +118,58 @@ def test_sys_regs_v81(self) -> None:
"""Tests V81-specific system register masks."""
self.run_semihosting_test("test_sys_regs")
+ def test_cache_v81(self) -> None:
+ """Tests cache operations on the V81 machine."""
+ self.run_semihosting_test("test_cache")
+
+ def test_exceptions_v81(self) -> None:
+ """Tests exception delivery on the V81 machine."""
+ self.run_semihosting_test("test_exceptions")
+
+ def test_guest_mode_v81(self) -> None:
+ """Tests guest mode on the V81 machine."""
+ self.run_semihosting_test("test_guest_mode")
+
+ def test_hvx_context_v81(self) -> None:
+ """Tests the HVX coprocessor context on the V81 machine."""
+ self.run_semihosting_test("test_hvx_context")
+
+ def test_int_steering_v81(self) -> None:
+ """Tests interrupt steering on the V81 machine."""
+ self.run_semihosting_test("test_int_steering")
+
+ def test_interrupts_v81(self) -> None:
+ """Tests interrupt delivery on the V81 machine."""
+ self.run_semihosting_test("test_interrupts")
+
+ def test_l2vic_v81(self) -> None:
+ """Tests the L2VIC on the V81 machine."""
+ self.run_semihosting_test("test_l2vic")
+
+ def test_pagecross_tlbmissx_v81(self) -> None:
+ """Tests page-crossing instruction TLB misses on the V81 machine."""
+ self.run_semihosting_test("test_pagecross_tlbmissx")
+
+ def test_pmu_v81(self) -> None:
+ """Tests the performance counters on the V81 machine."""
+ self.run_semihosting_test("test_pmu")
+
+ def test_threads_v81(self) -> None:
+ """Tests hardware thread management on the V81 machine."""
+ self.run_semihosting_test("test_threads")
+
+ def test_timer_v81(self) -> None:
+ """Tests the system timer on the V81 machine."""
+ self.run_semihosting_test("test_timer")
+
+ def test_tlb_mmu_v81(self) -> None:
+ """Tests TLB/MMU operations on the V81 machine."""
+ self.run_semihosting_test("test_tlb_mmu")
+
+ def test_user_mode_v81(self) -> None:
+ """Tests user mode transitions on the V81 machine."""
+ self.run_semihosting_test("test_user_mode")
+
def test_threads(self) -> None:
"""Tests hardware thread management: start/stop, MODECTL state,
per-thread HTID, shared memory, wait/resume, STID priority, and
@@ -115,6 +184,25 @@ def test_tlb_mmu(self) -> None:
"""
self.run_uart_test("test_tlb_mmu")
+ def test_pagecross_tlbmissx(self) -> None:
+ """Tests instruction TLB misses for packets that cross a page
+ boundary: the next page missing, both pages missing, and the
+ default handler.
+ """
+ self.run_uart_test("test_pagecross_tlbmissx")
+
+ def test_pmu(self) -> None:
+ """Tests the performance counters: PCYCLE incrementing, its high
+ and low halves, enabling and disabling it, and UPCYCLE.
+ """
+ self.run_uart_test("test_pmu")
+
+ def test_timer(self) -> None:
+ """Tests the system timer: QTimer reads, monotonicity, version, and
+ using PCYCLE as a timer.
+ """
+ self.run_uart_test("test_timer")
+
def test_user_mode(self) -> None:
"""Tests user mode / privilege transitions: supervisor mode,
SSR UM/IE/XE/CE/PE bits, and the trap0 user-mode exit handler.
diff --git a/tests/functional/hexagon/test_linux.py b/tests/functional/hexagon/test_linux.py
new file mode 100755
index 00000000000..68b08eeff71
--- /dev/null
+++ b/tests/functional/hexagon/test_linux.py
@@ -0,0 +1,62 @@
+#!/usr/bin/env python3
+#
+# Boot Linux on the QCS6490 CDSP machine, using H2 as the Hexagon VM host
+#
+# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+from qemu_test import QemuSystemTest, Asset
+from qemu_test import exec_command_and_wait_for_pattern
+from qemu_test import wait_for_console_pattern
+
+
+class HexagonLinuxQcs6490Cdsp(QemuSystemTest):
+ """
+ Boot a Hexagon Linux kernel with an initramfs. The H2 "loadlinux"
+ firmware runs the kernel as a guest of the Hexagon VM interface and
+ hands it the device tree that QEMU generated.
+ """
+
+ timeout = 240
+
+ ASSET_KERNEL = Asset(
+ 'https://artifacts.codelinaro.org/artifactory/'
+ 'codelinaro-toolchain-for-hexagon/23.1.2/qcs6490-cdsp/vmlinux',
+ '1908e9c684df4eb44d700c4096e1b2f73af6652a874e377cd8c6af0f5760d66a')
+ ASSET_INITRD = Asset(
+ 'https://artifacts.codelinaro.org/artifactory/'
+ 'codelinaro-toolchain-for-hexagon/23.1.2/qcs6490-cdsp/initrd',
+ '2b958945b38db54145051f76b886f42dd5dee70db399f6222ccc54808d6bdd6b')
+
+ # The H2 hypervisor and its loadlinux, built for this machine's DDR
+ # carve-out; it hands the device tree in r1:r0 on to the kernel.
+ ASSET_H2 = Asset(
+ 'https://github.com/qualcomm/qemu-hexagon-testing/releases/'
+ 'download/v0.2.17b-h2/loadlinux_qcs6490-cdsp',
+ 'ad667005c7ae286de5a79f79613341f6e928da74cea31ced14772d5a94cb1716')
+
+ def test_linux_boot(self):
+ self.set_machine('qcs6490-cdsp')
+
+ self.vm.set_console()
+ self.vm.add_args(
+ '-bios', self.ASSET_H2.fetch(),
+ '-kernel', self.ASSET_KERNEL.fetch(),
+ '-initrd', self.ASSET_INITRD.fetch(),
+ '-append', 'console=ttyAMA0 mem=240M lpj=89124080 rdinit=/init',
+ )
+ self.vm.launch()
+
+ # The initramfs has no login: init prints this and starts a root shell
+ wait_for_console_pattern(self, 'Please press Enter to activate this '
+ 'console.', failure_message='Kernel panic')
+ exec_command_and_wait_for_pattern(self, '', '# ')
+
+ # All six hardware threads are Linux CPUs
+ exec_command_and_wait_for_pattern(self, 'nproc', '6')
+ exec_command_and_wait_for_pattern(self, 'uname -m', 'hexagon')
+
+
+if __name__ == '__main__':
+ QemuSystemTest.main()
diff --git a/tests/functional/hexagon/test_systests.py b/tests/functional/hexagon/test_systests.py
index 4130c1b4ee1..3252892d987 100755
--- a/tests/functional/hexagon/test_systests.py
+++ b/tests/functional/hexagon/test_systests.py
@@ -36,14 +36,15 @@ def binary(self, name):
self.assertTrue(os.path.exists(path))
return path
- def run_exit_zero(self, binary_name, *extra_args, machine="sim"):
+ def run_exit_zero(self, binary_name, *extra_args, machine="sim",
+ timeout=60.0):
self.set_machine(machine)
self.set_vm_arg("-display", "none")
self.set_vm_arg("-kernel", self.binary(binary_name))
for flag, value in zip(extra_args[::2], extra_args[1::2]):
self.set_vm_arg(flag, value)
self.vm.launch()
- self.vm.wait(timeout=60.0)
+ self.vm.wait(timeout=timeout)
self.assertEqual(self.vm.exitcode(), 0,
f"Test {binary_name} exited with "
f"code {self.vm.exitcode()}, expected 0")
@@ -62,6 +63,52 @@ def run_console_pattern(self, binary_name, pattern, *extra_args,
finally:
self.vm.kill()
+ def run_expect_crash(self, binary_name, log_pattern, *extra_args,
+ machine="sim"):
+ """Run a test that is meant to crash.
+
+ The standalone CRT exits with 255 from its unhandled-exception
+ handler, which also reports the cause in the log.
+ """
+ self.set_machine(machine)
+ self.set_vm_arg("-display", "none")
+ self.set_vm_arg("-kernel", self.binary(binary_name))
+ for flag, value in zip(extra_args[::2], extra_args[1::2]):
+ self.set_vm_arg(flag, value)
+ self.vm.launch()
+ self.vm.wait(timeout=60.0)
+ self.assertEqual(self.vm.exitcode(), 255,
+ f"{binary_name} exited with {self.vm.exitcode()}, "
+ "expected 255")
+ log = self.vm.get_log() or ""
+ self.assertTrue(re.search(log_pattern, log),
+ f"{log_pattern!r} not in the log of {binary_name}:"
+ f"\n{log}")
+
+ def wait_for_log_pattern(self, pattern, count=1, timeout=30.0):
+ """Wait until the log of the running VM has @pattern @count times."""
+ deadline = time.monotonic() + timeout
+ log_path = self.vm._qemu_log_path
+ while time.monotonic() < deadline:
+ with open(log_path, "r", encoding="utf-8",
+ errors="replace") as f:
+ if f.read().count(pattern) >= count:
+ return
+ time.sleep(0.1)
+ self.fail(f"Timed out waiting for {count} of {pattern!r} in the log")
+
+ def run_hang_log_pattern(self, binary_name, pattern):
+ """Run a test that is meant to hang, and expect @pattern logged."""
+ self.set_machine("sim")
+ self.set_vm_arg("-display", "none")
+ self.set_vm_arg("-kernel", self.binary(binary_name))
+ self.set_vm_arg("-d", "guest_errors")
+ self.vm.launch()
+ try:
+ self.wait_for_log_pattern(pattern)
+ finally:
+ self.vm.kill()
+
def test_fopen(self):
"""fopen reads a file passed via --append and verifies its contents."""
import tempfile
@@ -140,5 +187,194 @@ def test_lock_verify(self):
def test_single_step(self):
self.run_exit_zero("single_step")
+ def test_start(self):
+ """The start instruction resets the threads it names but not the
+ thread executing it."""
+ self.run_exit_zero("start")
+
+ def test_test_thread(self):
+ """Eight threads start, record their ids, and exit."""
+ self.run_exit_zero("test-thread", "-smp", "cpus=8")
+
+ def test_test_thread_single_threaded_tcg(self):
+ """test_thread with the vCPUs sharing one host thread."""
+ self.run_exit_zero("test-thread", "-smp", "cpus=8",
+ "-accel", "tcg,thread=single")
+
+ def test_k0locklock(self):
+ """Locking k0 twice in a row hangs the thread, and is reported."""
+ self.run_hang_log_pattern("k0locklock", "Double k0lock at PC")
+
+ def test_tlblocklock(self):
+ """Locking the TLB twice in a row hangs the thread, and is reported."""
+ self.run_hang_log_pattern("tlblocklock", "Double tlblock at PC")
+
+ def test_inf_loop(self):
+ """Four threads start, spin forever, and start again after a
+ system reset."""
+ self.set_machine("sim")
+ self.set_vm_arg("-display", "none")
+ self.set_vm_arg("-kernel", self.binary("inf-loop"))
+ self.vm.launch()
+ try:
+ for i in range(4):
+ self.wait_for_log_pattern(f"Starting thread {i}")
+ self.vm.qmp("system_reset")
+ for i in range(4):
+ self.wait_for_log_pattern(f"Starting thread {i}", count=2)
+ finally:
+ self.vm.kill()
+
+ def test_unaligned(self):
+ """A misaligned load raises the misaligned load exception."""
+ self.run_expect_crash("unaligned", "Misaligned Load")
+
+ def test_hvx_nocoproc(self):
+ """An HVX instruction with SSR:XE clear raises the coprocessor
+ exception."""
+ self.run_expect_crash("hvx_nocoproc",
+ "Illegal Execution of Coprocessor Instruction")
+
+ def test_neg_no_hmx(self):
+ """HMX instructions are invalid on a machine without HMX."""
+ self.run_expect_crash("neg-no-hmx", "Invalid packet",
+ machine="V68N_1024")
+
+ def test_badva(self):
+ """Dual memory operations and TLB exceptions record the right BADVA."""
+ self.run_exit_zero("badva")
+
+ def test_checkforpriv(self):
+ """Privileged instructions raise a privilege exception in user mode."""
+ self.run_exit_zero("checkforpriv")
+
+ def test_ciad_siad(self):
+ """The ciad and siad instructions clear and set interrupt state."""
+ self.run_exit_zero("ciad-siad")
+
+ def test_fastint(self):
+ """The fast L2VIC interface handles a large number of interrupts."""
+ self.run_exit_zero("fastint")
+
+ def test_fastl2vic(self):
+ """The fast L2VIC interface sets and clears interrupt enables."""
+ self.run_exit_zero("fastl2vic")
+
+ def test_getcwd(self):
+ """The getcwd semihosting call fills a buffer with a valid path."""
+ self.run_exit_zero("getcwd")
+
+ def test_gregs(self):
+ """Guest registers g0-g31 keep or reject written values."""
+ self.run_exit_zero("gregs")
+
+ def test_hvx_64b(self):
+ """HVX 64-byte mode accesses raise the expected exceptions."""
+ self.run_exit_zero("hvx_64b")
+
+ def test_hvx_ext(self):
+ """HVX extension bits and qfloat operations across revisions."""
+ self.run_exit_zero("hvx_ext")
+
+ def test_int_range(self):
+ """The L2VIC interrupt range 1-1024 can be enabled and cleared."""
+ self.run_exit_zero("int_range")
+
+ def test_invalid_insn_for_rev(self):
+ """Instructions invalid for the revision raise an exception."""
+ self.run_exit_zero("invalid_insn_for_rev")
+
+ def test_invalid_opcode(self):
+ """Invalid opcodes raise an exception."""
+ self.run_exit_zero("invalid_opcode")
+
+ def test_k0lock(self):
+ """k0lock and k0unlock serialize several threads."""
+ self.run_exit_zero("k0lock")
+
+ def test_k0lock_syscfg(self):
+ """k0lock interacts correctly with SYSCFG changes."""
+ self.run_exit_zero("k0lock-syscfg")
+
+ def test_levelint(self):
+ """Level-triggered interrupts are delivered and cleared."""
+ self.run_exit_zero("levelint")
+
+ def test_mmu_asids(self):
+ """TLB entries with different ASIDs translate independently."""
+ self.run_exit_zero("mmu_asids")
+
+ def test_mmu_overlap(self):
+ """Overlapping TLB entries are rejected by the TLB write."""
+ self.run_exit_zero("mmu_overlap")
+
+ def test_mmu_page_size(self):
+ """Every page size from 4KB to 1GB translates data and code."""
+ self.run_exit_zero("mmu_page_size")
+
+ def test_mmu_permissions(self):
+ """TLB permission bits raise miss and permission exceptions."""
+ self.run_exit_zero("mmu_permissions")
+
+ def test_nmi_cross_thread(self):
+ """An NMI sent to another thread is delivered there."""
+ self.run_exit_zero("nmi_cross_thread")
+
+ def test_pendalot(self):
+ """1023 interrupts are pended, taken, and logged."""
+ self.run_exit_zero("pendalot")
+
+ def test_pend_wake_wait(self):
+ """Worker threads wait while software interrupts cycle."""
+ self.run_exit_zero("pend_wake_wait")
+
+ def test_qfloat_test(self):
+ """HVX qfloat arithmetic, comparisons, min/max, and conversions."""
+ self.run_exit_zero("qfloat_test")
+
+ def test_reg_reads(self):
+ """Reading the PMU registers and counting HVX packets."""
+ self.run_exit_zero("reg-reads")
+
+ def test_standalone_hw(self):
+ """The hardware thread and monitor instructions work."""
+ self.run_exit_zero("standalone_hw")
+
+ def test_swi(self):
+ """Software interrupts are delivered to the expected threads."""
+ self.run_exit_zero("swi")
+
+ def test_swi2(self):
+ """Software interrupts under load while masks and priorities change."""
+ self.run_exit_zero("swi2")
+
+ def test_swi_wait(self):
+ """Software interrupts wake threads in wait mode."""
+ self.run_exit_zero("swi_wait")
+
+ def test_sys_atomics(self):
+ """Load-linked/store-conditional increments across threads."""
+ self.run_exit_zero("sys_atomics")
+
+ def test_thread_scheduling(self):
+ """Threads are scheduled and make progress."""
+ self.run_exit_zero("thread_scheduling")
+
+ def test_tlblock(self):
+ """tlblock and tlbunlock serialize several threads."""
+ self.run_exit_zero("tlblock")
+
+ def test_vid_reg(self):
+ """The VID register accepts valid values and rejects invalid ones."""
+ self.run_exit_zero("vid_reg")
+
+ def test_vtcm_error(self):
+ """VTCM accesses outside the window raise an error."""
+ self.run_exit_zero("vtcm_error")
+
+ def test_rev(self):
+ """The revision register reports the V81 of the machine."""
+ self.run_console_pattern("rev", "0x81", machine="V81QA_1")
+
if __name__ == "__main__":
QemuSystemTest.main()
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH for-12.0 1/1] tests/functional/hexagon: run the rest of the tests
2026-12-01 19:48 ` [PATCH for-12.0 1/1] tests/functional/hexagon: run the rest of the tests Brian Cain
@ 2026-12-02 21:44 ` Pierrick Bouvier
2026-12-03 1:30 ` Brian Cain
0 siblings, 1 reply; 5+ messages in thread
From: Pierrick Bouvier @ 2026-12-02 21:44 UTC (permalink / raw)
To: Brian Cain, qemu-devel
On 12/1/2026 11:48 AM, Brian Cain wrote:
> The arch and systest tarballs carry more binaries than were being run.
> Run the missing test cases, and add a Linux boot test for the QCS6490
> CDSP machine.
>
> With this many tests in the one file, a busy host sometimes stalled the
> whole file until the test timeout. The guest starts to print to the
> console as soon as it is launched, and does so with the BQL held. If the
> test has not started to read the console by the time the socket is full,
> the guest blocks holding the BQL. QMP is answered by the main loop, which
> needs the BQL, so the test cannot get a reply to a QMP command until it
> reads the console, and it cannot read the console while it waits for the
> reply. Start the guest paused, and read the console while it is resumed.
>
> Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
> ---
> tests/functional/hexagon/meson.build | 2 +
> tests/functional/hexagon/test_arch_tests.py | 96 +++++++-
> tests/functional/hexagon/test_linux.py | 62 +++++
> tests/functional/hexagon/test_systests.py | 240 +++++++++++++++++++-
> 4 files changed, 394 insertions(+), 6 deletions(-)
> create mode 100755 tests/functional/hexagon/test_linux.py
>
> diff --git a/tests/functional/hexagon/meson.build b/tests/functional/hexagon/meson.build
> index 3dd40ed0463..565a056a951 100644
> --- a/tests/functional/hexagon/meson.build
> +++ b/tests/functional/hexagon/meson.build
> @@ -5,6 +5,7 @@ tests_hexagon_system_thorough = [
> 'qcom_dsp_firmware',
> 'systests',
> 'hlx',
> + 'linux',
> 'minivm',
> ]
>
> @@ -13,4 +14,5 @@ test_hexagon_timeouts = {
> 'qcom_dsp_firmware': 240,
> 'systests': 180,
> 'hlx': 180,
> + 'linux': 240,
> }
> diff --git a/tests/functional/hexagon/test_arch_tests.py b/tests/functional/hexagon/test_arch_tests.py
> index a437e4d4aac..9f8835e0614 100755
> --- a/tests/functional/hexagon/test_arch_tests.py
> +++ b/tests/functional/hexagon/test_arch_tests.py
> @@ -4,6 +4,8 @@
> #
> # SPDX-License-Identifier: GPL-2.0-or-later
>
> +import threading
> +
> from qemu_test import QemuSystemTest, Asset
> from qemu_test.cmd import wait_for_console_pattern
>
> @@ -32,6 +34,23 @@ class ArchTestsUart(QemuSystemTest):
> "64053b31e8e3acf7c97e7e82209b6bda",
> )
>
> + def launch_and_wait_for_pass(self) -> None:
> + """
> + Run the guest until it prints PASS on the console.
> +
> + Start the guest paused and read the console while resuming it, so
> + that a guest blocked on a full console socket cannot deadlock QMP.
> + """
> + self.vm.add_args("-S")
> + self.vm.launch()
> + resume = threading.Thread(target=self.vm.cmd, args=("cont",),
> + daemon=True)
> + resume.start()
This looks like a genuine race condition in test framework, no?
I wonder if it should be the default for vm.launch().
> + try:
> + wait_for_console_pattern(self, "PASS")
> + finally:
> + resume.join(timeout=30)
> +
...
> diff --git a/tests/functional/hexagon/test_linux.py b/tests/functional/hexagon/test_linux.py
> new file mode 100755
> index 00000000000..68b08eeff71
> --- /dev/null
> +++ b/tests/functional/hexagon/test_linux.py
> @@ -0,0 +1,62 @@
> +#!/usr/bin/env python3
> +#
> +# Boot Linux on the QCS6490 CDSP machine, using H2 as the Hexagon VM host
> +#
> +# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
> +#
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +
> +from qemu_test import QemuSystemTest, Asset
> +from qemu_test import exec_command_and_wait_for_pattern
> +from qemu_test import wait_for_console_pattern
> +
> +
> +class HexagonLinuxQcs6490Cdsp(QemuSystemTest):
> + """
> + Boot a Hexagon Linux kernel with an initramfs. The H2 "loadlinux"
> + firmware runs the kernel as a guest of the Hexagon VM interface and
> + hands it the device tree that QEMU generated.
> + """
> +
> + timeout = 240
> +
> + ASSET_KERNEL = Asset(
> + 'https://artifacts.codelinaro.org/artifactory/'
> + 'codelinaro-toolchain-for-hexagon/23.1.2/qcs6490-cdsp/vmlinux',
> + '1908e9c684df4eb44d700c4096e1b2f73af6652a874e377cd8c6af0f5760d66a')
> + ASSET_INITRD = Asset(
> + 'https://artifacts.codelinaro.org/artifactory/'
> + 'codelinaro-toolchain-for-hexagon/23.1.2/qcs6490-cdsp/initrd',
> + '2b958945b38db54145051f76b886f42dd5dee70db399f6222ccc54808d6bdd6b')
> +
> + # The H2 hypervisor and its loadlinux, built for this machine's DDR
> + # carve-out; it hands the device tree in r1:r0 on to the kernel.
> + ASSET_H2 = Asset(
> + 'https://github.com/qualcomm/qemu-hexagon-testing/releases/'
> + 'download/v0.2.17b-h2/loadlinux_qcs6490-cdsp',
> + 'ad667005c7ae286de5a79f79613341f6e928da74cea31ced14772d5a94cb1716')
> +
> + def test_linux_boot(self):
> + self.set_machine('qcs6490-cdsp')
> +
> + self.vm.set_console()
> + self.vm.add_args(
> + '-bios', self.ASSET_H2.fetch(),
> + '-kernel', self.ASSET_KERNEL.fetch(),
> + '-initrd', self.ASSET_INITRD.fetch(),
> + '-append', 'console=ttyAMA0 mem=240M lpj=89124080 rdinit=/init',
> + )
> + self.vm.launch()
> +
> + # The initramfs has no login: init prints this and starts a root shell
> + wait_for_console_pattern(self, 'Please press Enter to activate this '
> + 'console.', failure_message='Kernel panic')
> + exec_command_and_wait_for_pattern(self, '', '# ')
> +
> + # All six hardware threads are Linux CPUs
> + exec_command_and_wait_for_pattern(self, 'nproc', '6')
> + exec_command_and_wait_for_pattern(self, 'uname -m', 'hexagon')
> +
yeah!
Regards,
Pierrick
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH for-12.0 1/1] tests/functional/hexagon: run the rest of the tests
2026-12-02 21:44 ` Pierrick Bouvier
@ 2026-12-03 1:30 ` Brian Cain
2026-12-03 17:09 ` Pierrick Bouvier
0 siblings, 1 reply; 5+ messages in thread
From: Brian Cain @ 2026-12-03 1:30 UTC (permalink / raw)
To: Pierrick Bouvier, qemu-devel
On 12/2/2026 3:44 PM, Pierrick Bouvier wrote:
> On 12/1/2026 11:48 AM, Brian Cain wrote:
>> The arch and systest tarballs carry more binaries than were being run.
>> Run the missing test cases, and add a Linux boot test for the QCS6490
>> CDSP machine.
>>
>> With this many tests in the one file, a busy host sometimes stalled the
>> whole file until the test timeout. The guest starts to print to the
>> console as soon as it is launched, and does so with the BQL held. If the
>> test has not started to read the console by the time the socket is full,
>> the guest blocks holding the BQL. QMP is answered by the main loop, which
>> needs the BQL, so the test cannot get a reply to a QMP command until it
>> reads the console, and it cannot read the console while it waits for the
>> reply. Start the guest paused, and read the console while it is resumed.
>>
>> Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
>> ---
>> tests/functional/hexagon/meson.build | 2 +
>> tests/functional/hexagon/test_arch_tests.py | 96 +++++++-
>> tests/functional/hexagon/test_linux.py | 62 +++++
>> tests/functional/hexagon/test_systests.py | 240 +++++++++++++++++++-
>> 4 files changed, 394 insertions(+), 6 deletions(-)
>> create mode 100755 tests/functional/hexagon/test_linux.py
>>
>> diff --git a/tests/functional/hexagon/meson.build b/tests/functional/hexagon/meson.build
>> index 3dd40ed0463..565a056a951 100644
>> --- a/tests/functional/hexagon/meson.build
>> +++ b/tests/functional/hexagon/meson.build
>> @@ -5,6 +5,7 @@ tests_hexagon_system_thorough = [
>> 'qcom_dsp_firmware',
>> 'systests',
>> 'hlx',
>> + 'linux',
>> 'minivm',
>> ]
>>
>> @@ -13,4 +14,5 @@ test_hexagon_timeouts = {
>> 'qcom_dsp_firmware': 240,
>> 'systests': 180,
>> 'hlx': 180,
>> + 'linux': 240,
>> }
>> diff --git a/tests/functional/hexagon/test_arch_tests.py b/tests/functional/hexagon/test_arch_tests.py
>> index a437e4d4aac..9f8835e0614 100755
>> --- a/tests/functional/hexagon/test_arch_tests.py
>> +++ b/tests/functional/hexagon/test_arch_tests.py
>> @@ -4,6 +4,8 @@
>> #
>> # SPDX-License-Identifier: GPL-2.0-or-later
>>
>> +import threading
>> +
>> from qemu_test import QemuSystemTest, Asset
>> from qemu_test.cmd import wait_for_console_pattern
>>
>> @@ -32,6 +34,23 @@ class ArchTestsUart(QemuSystemTest):
>> "64053b31e8e3acf7c97e7e82209b6bda",
>> )
>>
>> + def launch_and_wait_for_pass(self) -> None:
>> + """
>> + Run the guest until it prints PASS on the console.
>> +
>> + Start the guest paused and read the console while resuming it, so
>> + that a guest blocked on a full console socket cannot deadlock QMP.
>> + """
>> + self.vm.add_args("-S")
>> + self.vm.launch()
>> + resume = threading.Thread(target=self.vm.cmd, args=("cont",),
>> + daemon=True)
>> + resume.start()
> This looks like a genuine race condition in test framework, no?
> I wonder if it should be the default for vm.launch().
I felt like that would change the general testing too much to make it
the default to start halted.
IIUC Hexagon is the first/only architecture using semihosting for many
functional tests and that could be a factor in why we're uniquely
encountering this. Then again, it might be plausible that a fast enough
guest could cause a similar issue with a UART.
>> + try:
>> + wait_for_console_pattern(self, "PASS")
>> + finally:
>> + resume.join(timeout=30)
>> +
> ...
>
>> diff --git a/tests/functional/hexagon/test_linux.py b/tests/functional/hexagon/test_linux.py
>> new file mode 100755
>> index 00000000000..68b08eeff71
>> --- /dev/null
>> +++ b/tests/functional/hexagon/test_linux.py
>> @@ -0,0 +1,62 @@
>> +#!/usr/bin/env python3
>> +#
>> +# Boot Linux on the QCS6490 CDSP machine, using H2 as the Hexagon VM host
>> +#
>> +# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
>> +#
>> +# SPDX-License-Identifier: GPL-2.0-or-later
>> +
>> +from qemu_test import QemuSystemTest, Asset
>> +from qemu_test import exec_command_and_wait_for_pattern
>> +from qemu_test import wait_for_console_pattern
>> +
>> +
>> +class HexagonLinuxQcs6490Cdsp(QemuSystemTest):
>> + """
>> + Boot a Hexagon Linux kernel with an initramfs. The H2 "loadlinux"
>> + firmware runs the kernel as a guest of the Hexagon VM interface and
>> + hands it the device tree that QEMU generated.
>> + """
>> +
>> + timeout = 240
>> +
>> + ASSET_KERNEL = Asset(
>> + 'https://artifacts.codelinaro.org/artifactory/'
>> + 'codelinaro-toolchain-for-hexagon/23.1.2/qcs6490-cdsp/vmlinux',
>> + '1908e9c684df4eb44d700c4096e1b2f73af6652a874e377cd8c6af0f5760d66a')
>> + ASSET_INITRD = Asset(
>> + 'https://artifacts.codelinaro.org/artifactory/'
>> + 'codelinaro-toolchain-for-hexagon/23.1.2/qcs6490-cdsp/initrd',
>> + '2b958945b38db54145051f76b886f42dd5dee70db399f6222ccc54808d6bdd6b')
>> +
>> + # The H2 hypervisor and its loadlinux, built for this machine's DDR
>> + # carve-out; it hands the device tree in r1:r0 on to the kernel.
>> + ASSET_H2 = Asset(
>> + 'https://github.com/qualcomm/qemu-hexagon-testing/releases/'
>> + 'download/v0.2.17b-h2/loadlinux_qcs6490-cdsp',
>> + 'ad667005c7ae286de5a79f79613341f6e928da74cea31ced14772d5a94cb1716')
>> +
>> + def test_linux_boot(self):
>> + self.set_machine('qcs6490-cdsp')
>> +
>> + self.vm.set_console()
>> + self.vm.add_args(
>> + '-bios', self.ASSET_H2.fetch(),
>> + '-kernel', self.ASSET_KERNEL.fetch(),
>> + '-initrd', self.ASSET_INITRD.fetch(),
>> + '-append', 'console=ttyAMA0 mem=240M lpj=89124080 rdinit=/init',
>> + )
>> + self.vm.launch()
>> +
>> + # The initramfs has no login: init prints this and starts a root shell
>> + wait_for_console_pattern(self, 'Please press Enter to activate this '
>> + 'console.', failure_message='Kernel panic')
>> + exec_command_and_wait_for_pattern(self, '', '# ')
>> +
>> + # All six hardware threads are Linux CPUs
>> + exec_command_and_wait_for_pattern(self, 'nproc', '6')
>> + exec_command_and_wait_for_pattern(self, 'uname -m', 'hexagon')
>> +
> yeah!
>
> Regards,
> Pierrick
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH for-12.0 1/1] tests/functional/hexagon: run the rest of the tests
2026-12-03 1:30 ` Brian Cain
@ 2026-12-03 17:09 ` Pierrick Bouvier
0 siblings, 0 replies; 5+ messages in thread
From: Pierrick Bouvier @ 2026-12-03 17:09 UTC (permalink / raw)
To: Brian Cain, qemu-devel
On 12/2/2026 5:30 PM, Brian Cain wrote:
>
> On 12/2/2026 3:44 PM, Pierrick Bouvier wrote:
>> On 12/1/2026 11:48 AM, Brian Cain wrote:
>>> The arch and systest tarballs carry more binaries than were being run.
>>> Run the missing test cases, and add a Linux boot test for the QCS6490
>>> CDSP machine.
>>>
>>> With this many tests in the one file, a busy host sometimes stalled the
>>> whole file until the test timeout. The guest starts to print to the
>>> console as soon as it is launched, and does so with the BQL held. If
>>> the
>>> test has not started to read the console by the time the socket is full,
>>> the guest blocks holding the BQL. QMP is answered by the main loop,
>>> which
>>> needs the BQL, so the test cannot get a reply to a QMP command until it
>>> reads the console, and it cannot read the console while it waits for the
>>> reply. Start the guest paused, and read the console while it is
>>> resumed.
>>>
>>> Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
>>> ---
>>> tests/functional/hexagon/meson.build | 2 +
>>> tests/functional/hexagon/test_arch_tests.py | 96 +++++++-
>>> tests/functional/hexagon/test_linux.py | 62 +++++
>>> tests/functional/hexagon/test_systests.py | 240 +++++++++++++++++++-
>>> 4 files changed, 394 insertions(+), 6 deletions(-)
>>> create mode 100755 tests/functional/hexagon/test_linux.py
>>>
>>> diff --git a/tests/functional/hexagon/meson.build b/tests/functional/
>>> hexagon/meson.build
>>> index 3dd40ed0463..565a056a951 100644
>>> --- a/tests/functional/hexagon/meson.build
>>> +++ b/tests/functional/hexagon/meson.build
>>> @@ -5,6 +5,7 @@ tests_hexagon_system_thorough = [
>>> 'qcom_dsp_firmware',
>>> 'systests',
>>> 'hlx',
>>> + 'linux',
>>> 'minivm',
>>> ]
>>> @@ -13,4 +14,5 @@ test_hexagon_timeouts = {
>>> 'qcom_dsp_firmware': 240,
>>> 'systests': 180,
>>> 'hlx': 180,
>>> + 'linux': 240,
>>> }
>>> diff --git a/tests/functional/hexagon/test_arch_tests.py b/tests/
>>> functional/hexagon/test_arch_tests.py
>>> index a437e4d4aac..9f8835e0614 100755
>>> --- a/tests/functional/hexagon/test_arch_tests.py
>>> +++ b/tests/functional/hexagon/test_arch_tests.py
>>> @@ -4,6 +4,8 @@
>>> #
>>> # SPDX-License-Identifier: GPL-2.0-or-later
>>> +import threading
>>> +
>>> from qemu_test import QemuSystemTest, Asset
>>> from qemu_test.cmd import wait_for_console_pattern
>>> @@ -32,6 +34,23 @@ class ArchTestsUart(QemuSystemTest):
>>> "64053b31e8e3acf7c97e7e82209b6bda",
>>> )
>>> + def launch_and_wait_for_pass(self) -> None:
>>> + """
>>> + Run the guest until it prints PASS on the console.
>>> +
>>> + Start the guest paused and read the console while resuming
>>> it, so
>>> + that a guest blocked on a full console socket cannot
>>> deadlock QMP.
>>> + """
>>> + self.vm.add_args("-S")
>>> + self.vm.launch()
>>> + resume = threading.Thread(target=self.vm.cmd, args=("cont",),
>>> + daemon=True)
>>> + resume.start()
>> This looks like a genuine race condition in test framework, no?
>> I wonder if it should be the default for vm.launch().
>
> I felt like that would change the general testing too much to make it
> the default to start halted.
>
> IIUC Hexagon is the first/only architecture using semihosting for many
> functional tests and that could be a factor in why we're uniquely
> encountering this. Then again, it might be plausible that a fast enough
> guest could cause a similar issue with a UART.
>
Fair enough.
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Regards,
Pierrick
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-12-03 17:09 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01 19:48 [PATCH for-12.0 0/1] Hexagon: systests + linux boot test Brian Cain
2026-12-01 19:48 ` [PATCH for-12.0 1/1] tests/functional/hexagon: run the rest of the tests Brian Cain
2026-12-02 21:44 ` Pierrick Bouvier
2026-12-03 1:30 ` Brian Cain
2026-12-03 17:09 ` Pierrick Bouvier
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.