From e139bc4b1772575e1f2dcf8e3dbe1df2b684ef1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Tue, 1 Apr 2025 16:43:32 +0200 Subject: [PATCH 1/6] tcg: Allocate TEMP_VAL_MEM frame in temp_load() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Be sure to allocate the temp frame if it wasn't. In the resolved issues, incomplete dead code elimination left a load at the top of an unreachable loop. We simply need to allocate the stack slot to avoid crashing. Fixes: c896fe29d6c ("TCG code generator") Reported-by: Michael Tokarev Reported-by: Helge Konetzka Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2891 Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2899 Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Signed-off-by: Richard Henderson Message-ID: <20250401144332.41615-1-philmd@linaro.org> --- tcg/tcg.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tcg/tcg.c b/tcg/tcg.c index e8950df2ad..dfd48b8264 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -4671,6 +4671,9 @@ static void temp_load(TCGContext *s, TCGTemp *ts, TCGRegSet desired_regs, ts->mem_coherent = 0; break; case TEMP_VAL_MEM: + if (!ts->mem_allocated) { + temp_allocate_frame(s, ts); + } reg = tcg_reg_alloc(s, desired_regs, allocated_regs, preferred_regs, ts->indirect_base); tcg_out_ld(s, ts->type, reg, ts->mem_base->reg, ts->mem_offset); From 4412d713822b6a0d87efd428ae164e80618ca2d2 Mon Sep 17 00:00:00 2001 From: Pierrick Bouvier Date: Thu, 3 Apr 2025 22:32:37 +0200 Subject: [PATCH 2/6] tests/functional/test_aarch64_rme_virt: fix sporadic failure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This test was randomly failing on our CI, and on dev machines, especially with QEMU debug builds. >From the information collected, it's related to an implementation choice in edk2 QEMU virt support. The workaround is to disable KASLR, to avoid accessing protected memory. Note: this is *not* needed for the similar test_aarch64_rme_sbsaref. More information is available on the associated GitLab issue. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2823 Signed-off-by: Pierrick Bouvier Reviewed-by: Alex Bennée Reviewed-by: Richard Henderson Message-ID: <20250328183816.2687925-1-pierrick.bouvier@linaro.org> Signed-off-by: Philippe Mathieu-Daudé Acked-by: Michael S. Tsirkin Signed-off-by: Richard Henderson Message-ID: <20250403203241.46692-2-philmd@linaro.org> --- tests/functional/test_aarch64_rme_virt.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/functional/test_aarch64_rme_virt.py b/tests/functional/test_aarch64_rme_virt.py index f4ad4d33d5..a1abf584f0 100755 --- a/tests/functional/test_aarch64_rme_virt.py +++ b/tests/functional/test_aarch64_rme_virt.py @@ -87,7 +87,9 @@ class Aarch64RMEVirtMachine(QemuSystemTest): self.vm.add_args('-fsdev', f'local,security_model=none,path={rme_stack},id=shr0') self.vm.add_args('-device', 'virtio-net-pci,netdev=net0') self.vm.add_args('-netdev', 'user,id=net0') - self.vm.add_args('-append', 'root=/dev/vda') + # We need to add nokaslr to avoid triggering this sporadic bug: + # https://gitlab.com/qemu-project/qemu/-/issues/2823 + self.vm.add_args('-append', 'root=/dev/vda nokaslr') self.vm.launch() # Wait for host VM boot to complete. From 00f119f4c4f776e5e36e8ea99bb3ff865cc52c09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Thu, 3 Apr 2025 22:32:38 +0200 Subject: [PATCH 3/6] tests/functional: Add a decorator for skipping tests on particular OS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since tests might be failing on some operating systems, introduce the skipIfOperatingSystem() decorator. Acked-by: Michael S. Tsirkin Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson Message-ID: <20250403203241.46692-3-philmd@linaro.org> --- tests/functional/qemu_test/__init__.py | 2 +- tests/functional/qemu_test/decorators.py | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/tests/functional/qemu_test/__init__.py b/tests/functional/qemu_test/__init__.py index 45f7befa37..af41c2c6a2 100644 --- a/tests/functional/qemu_test/__init__.py +++ b/tests/functional/qemu_test/__init__.py @@ -15,6 +15,6 @@ from .testcase import QemuBaseTest, QemuUserTest, QemuSystemTest from .linuxkernel import LinuxKernelTest from .decorators import skipIfMissingCommands, skipIfNotMachine, \ skipFlakyTest, skipUntrustedTest, skipBigDataTest, skipSlowTest, \ - skipIfMissingImports + skipIfMissingImports, skipIfOperatingSystem from .archive import archive_extract from .uncompress import uncompress diff --git a/tests/functional/qemu_test/decorators.py b/tests/functional/qemu_test/decorators.py index 1651eb739a..50d29de533 100644 --- a/tests/functional/qemu_test/decorators.py +++ b/tests/functional/qemu_test/decorators.py @@ -5,7 +5,7 @@ import importlib import os import platform -from unittest import skipUnless +from unittest import skipIf, skipUnless from .cmd import which @@ -26,6 +26,19 @@ def skipIfMissingCommands(*args): return skipUnless(has_cmds, 'required command(s) "%s" not installed' % ", ".join(args)) +''' +Decorator to skip execution of a test if the current +host operating system does match one of the prohibited +ones. +Example + + @skipIfOperatingSystem("Linux", "Darwin") +''' +def skipIfOperatingSystem(*args): + return skipIf(platform.system() in args, + 'running on an OS (%s) that is not able to run this test' % + ", ".join(args)) + ''' Decorator to skip execution of a test if the current host machine does not match one of the permitted From bd20bc46fe88e6ade710b688e97515d4ed9d1d50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Thu, 3 Apr 2025 22:32:39 +0200 Subject: [PATCH 4/6] tests/functional: Skip aarch64_replay test on macOS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As of v10.0.0-rc2 this test is still failing on macos: $ make check-functional-aarch64 V=1 ... ERROR:../../replay/replay-internal.c:235:replay_mutex_unlock: assertion failed: (replay_mutex_locked()) Bail out! ERROR:../../replay/replay-internal.c:235:replay_mutex_unlock: assertion failed: (replay_mutex_locked()) This is tracked as https://gitlab.com/qemu-project/qemu/-/issues/2907 Signed-off-by: Philippe Mathieu-Daudé Acked-by: Michael S. Tsirkin Acked-by: Richard Henderson Signed-off-by: Richard Henderson Message-ID: <20250403203241.46692-4-philmd@linaro.org> --- tests/functional/test_aarch64_replay.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/functional/test_aarch64_replay.py b/tests/functional/test_aarch64_replay.py index 04cde433bc..029fef3cbf 100755 --- a/tests/functional/test_aarch64_replay.py +++ b/tests/functional/test_aarch64_replay.py @@ -5,7 +5,7 @@ # # SPDX-License-Identifier: GPL-2.0-or-later -from qemu_test import Asset +from qemu_test import Asset, skipIfOperatingSystem from replay_kernel import ReplayKernelBase @@ -16,6 +16,8 @@ class Aarch64Replay(ReplayKernelBase): 'releases/29/Everything/aarch64/os/images/pxeboot/vmlinuz'), '7e1430b81c26bdd0da025eeb8fbd77b5dc961da4364af26e771bd39f379cbbf7') + # Failing on Darwin: https://gitlab.com/qemu-project/qemu/-/issues/2907 + @skipIfOperatingSystem('Darwin') def test_aarch64_virt(self): self.set_machine('virt') self.cpu = 'cortex-a53' From 51514a34b3dbc2cccf0c70aee07001ebbb804d20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Thu, 3 Apr 2025 22:32:40 +0200 Subject: [PATCH 5/6] tests/qtest: Skip Aarch64 VMapple machine MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit First, the VMapple machine only works with the ARM 'host' CPU type, which isn't accepted for QTest: $ qemu-system-aarch64 -M vmapple -accel qtest qemu-system-aarch64: The 'host' CPU type can only be used with KVM or HVF Second, the QTest framework expects machines to be createable without specifying optional arguments, however the VMapple machine requires few of them: $ qemu-system-aarch64 -M vmapple -accel qtest qemu-system-aarch64: No firmware specified $ qemu-system-aarch64 -M vmapple -accel qtest -bios /dev/null qemu-system-aarch64: No AUX device. Please specify one as pflash drive. Restrict this machine with QTest so we can at least run check-qtest, otherwise we get: $ make check-qtest-aarch64 qemu-system-aarch64: The 'host' CPU type can only be used with KVM or HVF Broken pipe ../tests/qtest/libqtest.c:199: kill_qemu() tried to terminate QEMU process but encountered exit status 1 (expected 0) ... 7/26 qemu:qtest+qtest-aarch64 / qtest-aarch64/test-hmp ERROR 24.71s killed by signal 6 SIGABRT 2/26 qemu:qtest+qtest-aarch64 / qtest-aarch64/qom-test ERROR 71.23s killed by signal 6 SIGABRT Suggested-by: Fabiano Rosas Signed-off-by: Philippe Mathieu-Daudé Acked-by: Michael S. Tsirkin Reviewed-by: Richard Henderson Reviewed-by: Thomas Huth Signed-off-by: Richard Henderson Message-ID: <20250403203241.46692-5-philmd@linaro.org> --- tests/qtest/libqtest.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index 2750067861..fad307d125 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -1788,6 +1788,7 @@ void qtest_cb_for_every_machine(void (*cb)(const char *machine), if (!strncmp("xenfv", machines[i].name, 5) || g_str_equal("xenpv", machines[i].name) || g_str_equal("xenpvh", machines[i].name) || + g_str_equal("vmapple", machines[i].name) || g_str_equal("nitro-enclave", machines[i].name)) { continue; } From 49551752e860f5e403cdacac11ee1d218141fd3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Thu, 3 Apr 2025 22:32:41 +0200 Subject: [PATCH 6/6] hw/arm: Do not build VMapple machine by default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Unfortunately as of v10.0.0-rc2 the VMapple machine is unusable: $ qemu-system-aarch64 -M vmapple [...] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[PGIOSurfaceHostDeviceDescriptor setMapMemory:]: unrecognized selector sent to instance 0x600001ede820' *** First throw call stack: ( 0 CoreFoundation 0x000000019c759df0 __exceptionPreprocess + 176 1 libobjc.A.dylib 0x000000019c21eb60 objc_exception_throw + 88 2 CoreFoundation 0x000000019c816ce0 -[NSObject(NSObject) __retain_OA] + 0 3 CoreFoundation 0x000000019c6c7efc ___forwarding___ + 1500 4 CoreFoundation 0x000000019c6c7860 _CF_forwarding_prep_0 + 96 5 qemu-system-aarch64 0x000000010486dbd0 apple_gfx_mmio_realize + 200 6 qemu-system-aarch64 0x0000000104e6ab5c device_set_realized + 352 7 qemu-system-aarch64 0x0000000104e7250c property_set_bool + 100 8 qemu-system-aarch64 0x0000000104e7023c object_property_set + 136 9 qemu-system-aarch64 0x0000000104e74870 object_property_set_qobject + 60 10 qemu-system-aarch64 0x0000000104e70748 object_property_set_bool + 60 11 qemu-system-aarch64 0x0000000104e69bd8 qdev_realize_and_unref + 20 12 qemu-system-aarch64 0x0000000104e258e0 mach_vmapple_init + 1728 13 qemu-system-aarch64 0x000000010481b0ac machine_run_board_init + 1892 14 qemu-system-aarch64 0x0000000104a4def8 qmp_x_exit_preconfig + 260 15 qemu-system-aarch64 0x0000000104a51ba8 qemu_init + 14460 16 qemu-system-aarch64 0x0000000104f7cef8 main + 36 17 dyld 0x000000019c25eb4c start + 6000 ) libc++abi: terminating due to uncaught exception of type NSException Abort trap: 6 Disable the machine so it isn't built by default. This is tracked as https://gitlab.com/qemu-project/qemu/-/issues/2913 Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Signed-off-by: Richard Henderson Message-ID: <20250403203241.46692-6-philmd@linaro.org> --- configs/devices/aarch64-softmmu/default.mak | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/devices/aarch64-softmmu/default.mak b/configs/devices/aarch64-softmmu/default.mak index 93f4022ad6..ad8028cfd4 100644 --- a/configs/devices/aarch64-softmmu/default.mak +++ b/configs/devices/aarch64-softmmu/default.mak @@ -9,3 +9,4 @@ include ../arm-softmmu/default.mak # CONFIG_XLNX_VERSAL=n # CONFIG_SBSA_REF=n # CONFIG_NPCM8XX=n +CONFIG_VMAPPLE=n