Skip to contentSkip to conversation

target/arm: disable-tcg and without-default-devices fixes

PATCH Superseded Fabiano Rosas 2 participants 5 messages May 5, 2023

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover target/arm: disable-tcg and without-default-devices fixes

Since v1:

Used the 'select if TCG' pattern for both build issues.

We don't want to use imply for semihosting because we'd need to unpoison* CONFIG_SEMIHOSTING and include CONFIG_DEVICES from helper.c when building with '--enable-tcg --without-default-devices'.

*- I see the config at build/config-poison.h but the compiler does not
complain about the usage. It just gets ignored. Any idea why?

CI run: https://gitlab.com/farosas/qemu/-/pipelines/857704454

v1:
https://lore.kernel.org/r/[email protected]

Here's the fix for the cdrom test failure that we discussed in the list, plus 2 fixes for the ---without-default-devices build.

When I moved the boards CONFIGs from default.mak to Kconfig, it became possible (due to --without-default-devices) to disable the CONFIGs for all the boards that require ARM_V7M. That breaks the build because ARM_V7M is required to be always set.

Fabiano Rosas (3):
target/arm: Select SEMIHOSTING when using TCG target/arm: Select CONFIG_ARM_V7M when TCG is enabled tests/qtest: Don't run cdrom tests if no accelerator is present

 target/arm/Kconfig       | 9 ++-------
 tests/qtest/cdrom-test.c | 5 +++++
 2 files changed, 7 insertions(+), 7 deletions(-)
Signature · 1 line
2.35.3
#1 lore raw

PATCH v2 1/3 target/arm: Select SEMIHOSTING when using TCG

Semihosting has been made a 'default y' entry in Kconfig, which does not work because when building --without-default-devices, the semihosting code would not be available.

Make semihosting unconditional when TCG is present.

Fixes 29d9efca16 ("arm/Kconfig: Do not build TCG-only boards on a KVM-only build")
---
 target/arm/Kconfig | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
target/arm/Kconfig +1 -7
index 39f05b6420..3fffdcb61b 100644
@@ -1,13 +1,7 @@
 config ARM
     bool
+    select ARM_COMPATIBLE_SEMIHOSTING if TCG
 
 config AARCH64
     bool
     select ARM
-
-# This config exists just so we can make SEMIHOSTING default when TCG
-# is selected without also changing it for other architectures.
-config ARM_SEMIHOSTING
-    bool
-    default y if TCG && ARM
-    select ARM_COMPATIBLE_SEMIHOSTING
Signature · 1 line
2.35.3
#2 lore raw

PATCH v2 2/3 target/arm: Select CONFIG_ARM_V7M when TCG is enabled

In reply to Fabiano Rosas

We cannot allow this config to be disabled at the moment as not all of the relevant code is protected by it.

Commit 29d9efca16 ("arm/Kconfig: Do not build TCG-only boards on a KVM-only build") moved the CONFIGs of several boards to Kconfig, so it is now possible that nothing selects ARM_V7M (e.g. when doing a --without-default-devices build).

Return the CONFIG_ARM_V7M entry to a state where it is always selected whenever TCG is available.

Fixes 29d9efca16 ("arm/Kconfig: Do not build TCG-only boards on a KVM-only build")
---
 target/arm/Kconfig | 1 +
 1 file changed, 1 insertion(+)
target/arm/Kconfig +1 -0
index 3fffdcb61b..5947366f6e 100644
@@ -1,6 +1,7 @@
 config ARM
     bool
     select ARM_COMPATIBLE_SEMIHOSTING if TCG
+    select ARM_V7M if TCG
 
 config AARCH64
     bool
Signature · 1 line
2.35.3
#3 lore raw

PATCH v2 3/3 tests/qtest: Don't run cdrom tests if no accelerator is present

In reply to Fabiano Rosas

On a build configured with: --disable-tcg --enable-xen it is possible to produce a QEMU binary with no TCG nor KVM support. Skip the test if that's the case.

Fixes 0c1ae3ff9d ("tests/qtest: Fix tests when no KVM or TCG are present")
---
 tests/qtest/cdrom-test.c | 5 +++++
 1 file changed, 5 insertions(+)
tests/qtest/cdrom-test.c +5 -0
index 26a2400181..09655e6ff0 100644
@@ -205,6 +205,11 @@ int main(int argc, char **argv)
 
     g_test_init(&argc, &argv, NULL);
 
+    if (!qtest_has_accel("tcg") && !qtest_has_accel("kvm")) {
+        g_test_skip("No KVM or TCG accelerator available");
+        return 0;
+    }
+
     if (exec_genisoimg(genisocheck)) {
         /* genisoimage not available - so can't run tests */
         return g_test_run();
Signature · 1 line
2.35.3
#4 lore raw

Re: [PATCH v2 3/3] tests/qtest: Don't run cdrom tests if no accelerator is present

Quoted 16 lines · Fabiano Rosas

On a build configured with: --disable-tcg --enable-xen it is possible to produce a QEMU binary with no TCG nor KVM support. Skip the test if that's the case.

Fixes 0c1ae3ff9d ("tests/qtest: Fix tests when no KVM or TCG are present")
---
  tests/qtest/cdrom-test.c | 5 +++++
  1 file changed, 5 insertions(+)
tests/qtest/cdrom-test.c +0 -0
index 26a2400181..09655e6ff0 100644

tests/qtest/cdrom-test.c int main(int argc, char **argv) · line 211

Quoted 7 lines
tests/qtest/cdrom-test.c +4 -0
@@ -205,6 +205,11 @@ int main(int argc, char **argv)
 
      g_test_init(&argc, &argv, NULL);
 
+    if (!qtest_has_accel("tcg") && !qtest_has_accel("kvm")) {
+        g_test_skip("No KVM or TCG accelerator available");
+        return 0;
+    }

You only nee to skip the test if running with x86 or s390x, all other targets use only "-accel qtest" IIRC, so those shoul be fine.

Thomas