Skip to contentSkip to conversation

Support disabling TCG on ARM (part 2)

PATCH In review Philippe Mathieu-Daudé 7 participants 35 messages Sep 29, 2020 – Jan 29, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v4 cover Support disabling TCG on ARM (part 2)

Cover from Samuel Ortiz from (part 1) [1]:

This patchset allows for building and running ARM targets with TCG disabled. [...]

The rationale behind this work comes from the NEMU project where we're trying to only support x86 and ARM 64-bit architectures, without including the TCG code base. We can only do so if we can build and run ARM binaries with TCG disabled.

v4 almost 2 years later... [2]:
- Rebased on Meson
- Addressed Richard review comments
- Addressed Claudio review comments

v3 almost 18 months later [3]:
- Rebased
- Addressed Thomas review comments
- Added Travis-CI job to keep building --disable-tcg on ARM

v2 [4]:
- Addressed review comments from Richard and Thomas from v1 [1]

Regards,

Phil.

[1]: https://lists.gnu.org/archive/html/qemu-devel/2018-11/msg02451.html
[2]: https://www.mail-archive.com/[email protected]/msg689168.html
[3]: https://www.mail-archive.com/[email protected]/msg641796.html
[4]: https://lists.gnu.org/archive/html/qemu-devel/2019-08/msg05003.html

Green CI:
- https://cirrus-ci.com/build/4572961761918976
- https://gitlab.com/philmd/qemu/-/pipelines/196047779
- https://travis-ci.org/github/philmd/qemu/builds/731370972

Based-on: <[email protected]> "hw/arm: Restrict APEI tables generation to the 'virt' machine"
https://www.mail-archive.com/[email protected]/msg745792.html

Philippe Mathieu-Daudé (10):
accel/tcg: Add stub for cpu_loop_exit()
meson: Allow optional target/${ARCH}/Kconfig target/arm: Select SEMIHOSTING if TCG is available target/arm: Restrict ARMv4 cpus to TCG accel target/arm: Restrict ARMv5 cpus to TCG accel target/arm: Restrict ARMv6 cpus to TCG accel target/arm: Restrict ARMv7 R-profile cpus to TCG accel target/arm: Restrict ARMv7 M-profile cpus to TCG accel target/arm: Reorder meson.build rules .travis.yml: Add a KVM-only Aarch64 job

Samuel Ortiz (1):
target/arm: Do not build TCG objects when TCG is off

Thomas Huth (1):
target/arm: Make m_helper.c optional via CONFIG_ARM_V7M

 default-configs/arm-softmmu.mak |  3 --
 meson.build                     |  8 +++-
 target/arm/cpu.h                | 12 ------
 accel/stubs/tcg-stub.c          |  5 +++
 target/arm/cpu_tcg.c            |  4 +-
 target/arm/helper.c             |  7 ----
 target/arm/m_helper-stub.c      | 73 +++++++++++++++++++++++++++++++++
 .travis.yml                     | 35 ++++++++++++++++
 hw/arm/Kconfig                  | 32 +++++++++++++++
 target/arm/Kconfig              |  4 ++
 target/arm/meson.build          | 40 +++++++++++-------
 11 files changed, 184 insertions(+), 39 deletions(-)
 create mode 100644 target/arm/m_helper-stub.c
 create mode 100644 target/arm/Kconfig
Signature · 1 line
2.26.2
#1 lore raw

PATCH v4 1/12 accel/tcg: Add stub for cpu_loop_exit()

Since the support of SYS_READC in commit 8de702cb67 the semihosting code is strongly depedent of the TCG accelerator via a call to cpu_loop_exit().

Ideally we would only build semihosting support when TCG is available, but unfortunately this is not trivial because semihosting is used by many targets in different configurations. For now add a simple stub to avoid link failure when building with --disable-tcg:

hw/semihosting/console.c:160: undefined reference to `cpu_loop_exit'

---
 accel/stubs/tcg-stub.c | 5 +++++
 1 file changed, 5 insertions(+)
accel/stubs/tcg-stub.c +5 -0
index e4bbf997aa..1eec7fb90e 100644
@@ -29,3 +29,8 @@ void *probe_access(CPUArchState *env, target_ulong addr, int size,
      /* Handled by hardware accelerator. */
      g_assert_not_reached();
 }
+
+void cpu_loop_exit(CPUState *cpu)
+{
+    g_assert_not_reached();
+}
Signature · 1 line
2.26.2
Reviewed-by on v4 1/12
#2 lore raw

Re: [PATCH v4 01/12] accel/tcg: Add stub for cpu_loop_exit()

Quoted 24 lines · Philippe Mathieu-Daudé

Since the support of SYS_READC in commit 8de702cb67 the semihosting code is strongly depedent of the TCG accelerator via a call to cpu_loop_exit().

Ideally we would only build semihosting support when TCG is available, but unfortunately this is not trivial because semihosting is used by many targets in different configurations. For now add a simple stub to avoid link failure when building with --disable-tcg:

hw/semihosting/console.c:160: undefined reference to `cpu_loop_exit'

---
 accel/stubs/tcg-stub.c | 5 +++++
 1 file changed, 5 insertions(+)
accel/stubs/tcg-stub.c +0 -0
index e4bbf997aa..1eec7fb90e 100644

accel/stubs/tcg-stub.c void *probe_access(CPUArchState *env, target_ulong addr, int size, · line 36

Quoted 8 lines
accel/stubs/tcg-stub.c +5 -0
@@ -29,3 +29,8 @@ void *probe_access(CPUArchState *env, target_ulong addr, int size,
      /* Handled by hardware accelerator. */
      g_assert_not_reached();
 }
+
+void cpu_loop_exit(CPUState *cpu)
+{
+    g_assert_not_reached();
+}
Reviewed-by on v4 1/12
#3 lore raw

Re: [PATCH v4 01/12] accel/tcg: Add stub for cpu_loop_exit()

In reply to Philippe Mathieu-Daudé
Quoted 10 lines · Philippe Mathieu-Daudé

Since the support of SYS_READC in commit 8de702cb67 the semihosting code is strongly depedent of the TCG accelerator via a call to cpu_loop_exit().

Ideally we would only build semihosting support when TCG is available, but unfortunately this is not trivial because semihosting is used by many targets in different configurations. For now add a simple stub to avoid link failure when building with --disable-tcg:

Quoted 7 lines

hw/semihosting/console.c:160: undefined reference to `cpu_loop_exit'

---
 accel/stubs/tcg-stub.c | 5 +++++
 1 file changed, 5 insertions(+)

r~

#4 lore raw

PATCH v4 2/12 meson: Allow optional target/${ARCH}/Kconfig

In reply to Philippe Mathieu-Daudé

Extend the generic Meson script to pass optional target Kconfig file to the minikconf script.

---
We could use fs.exists() but is_file() is more specific (can not be a directory).

Cc Paolo Bonzini <[email protected]>
Cc Claudio Fontana <[email protected]>
---
 meson.build | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
meson.build +7 -1
index d36dd085b5..9ab5d514d7 100644
@@ -529,6 +529,7 @@ kconfig_external_symbols = [
 ]
 ignored = ['TARGET_XML_FILES', 'TARGET_ABI_DIR', 'TARGET_DIRS']
 
+fs = import('fs')
 foreach target : target_dirs
   config_target = keyval.load(meson.current_build_dir() / target / 'config-target.mak')
 
@@ -569,8 +570,13 @@ foreach target : target_dirs
     endforeach
 
     config_devices_mak = target + '-config-devices.mak'
+    target_kconfig = 'target' / config_target['TARGET_BASE_ARCH'] / 'Kconfig'
+    minikconf_input = ['default-configs' / target + '.mak', 'Kconfig']
+    if fs.is_file(target_kconfig)
+      minikconf_input += [target_kconfig]
+    endif
     config_devices_mak = configure_file(
-      input: ['default-configs' / target + '.mak', 'Kconfig'],
+      input: minikconf_input,
       output: config_devices_mak,
       depfile: config_devices_mak + '.d',
       capture: true,
Signature · 1 line
2.26.2
#5 lore raw

Re: [PATCH v4 02/12] meson: Allow optional target/${ARCH}/Kconfig

Quoted 32 lines · Philippe Mathieu-Daudé

Extend the generic Meson script to pass optional target Kconfig file to the minikconf script.

---
We could use fs.exists() but is_file() is more specific (can not be a directory).

Cc Paolo Bonzini <[email protected]>
Cc Claudio Fontana <[email protected]>
---
 meson.build | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
meson.build +2 -0
index d36dd085b5..9ab5d514d7 100644
@@ -529,6 +529,7 @@ kconfig_external_symbols = [
 ]
 ignored = ['TARGET_XML_FILES', 'TARGET_ABI_DIR', 'TARGET_DIRS']
 
+fs = import('fs')
 foreach target : target_dirs
   config_target = keyval.load(meson.current_build_dir() / target / 'config-target.mak')
 
@@ -569,8 +570,13 @@ foreach target : target_dirs
     endforeach
 
     config_devices_mak = target + '-config-devices.mak'
+    target_kconfig = 'target' / config_target['TARGET_BASE_ARCH'] / 'Kconfig'

meson.build foreach target : target_dirs · line 582

Quoted 10 lines
meson.build +5 -1
+    minikconf_input = ['default-configs' / target + '.mak', 'Kconfig']
+    if fs.is_file(target_kconfig)
+      minikconf_input += [target_kconfig]
+    endif
     config_devices_mak = configure_file(
-      input: ['default-configs' / target + '.mak', 'Kconfig'],
+      input: minikconf_input,
       output: config_devices_mak,
       depfile: config_devices_mak + '.d',
       capture: true,

I can't say I understand it, but the general idea seems right to me.

Ciao,

Claudio

maintainer Acked-by
#6 lore raw

Re: [PATCH v4 02/12] meson: Allow optional target/${ARCH}/Kconfig

Quoted 30 lines · Claudio Fontana
Quoted 29 lines · Philippe Mathieu-Daudé

Extend the generic Meson script to pass optional target Kconfig file to the minikconf script.

---
We could use fs.exists() but is_file() is more specific (can not be a directory).

Cc Paolo Bonzini <[email protected]>
Cc Claudio Fontana <[email protected]>
---
 meson.build | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
meson.build +1 -0
index d36dd085b5..9ab5d514d7 100644
@@ -529,6 +529,7 @@ kconfig_external_symbols = [
 ]
 ignored = ['TARGET_XML_FILES', 'TARGET_ABI_DIR', 'TARGET_DIRS']
 
+fs = import('fs')
 foreach target : target_dirs
   config_target = keyval.load(meson.current_build_dir() / target / 'config-target.mak')
 
@@ -569,8 +570,13 @@ foreach target : target_dirs
     endforeach
 
Quoted 15 lines

meson.build foreach target : target_dirs · line 582

Quoted 13 lines
meson.build +6 -1
     config_devices_mak = target + '-config-devices.mak'
+    target_kconfig = 'target' / config_target['TARGET_BASE_ARCH'] / 'Kconfig'
+    minikconf_input = ['default-configs' / target + '.mak', 'Kconfig']
+    if fs.is_file(target_kconfig)
+      minikconf_input += [target_kconfig]
+    endif
     config_devices_mak = configure_file(
-      input: ['default-configs' / target + '.mak', 'Kconfig'],
+      input: minikconf_input,
       output: config_devices_mak,
       depfile: config_devices_mak + '.d',
       capture: true,

I can't say I understand it, but the general idea seems right to me.

#7 lore raw

Re: [PATCH v4 02/12] meson: Allow optional target/${ARCH}/Kconfig

In reply to Philippe Mathieu-Daudé

meson.build kconfig_external_symbols = [ · line 532

Quoted 6 lines · Philippe Mathieu-Daudé

+++ b/meson.build

meson.build +1 -0
@@ -529,6 +529,7 @@ kconfig_external_symbols = [
 ]
 ignored = ['TARGET_XML_FILES', 'TARGET_ABI_DIR', 'TARGET_DIRS']
 
+fs = import('fs')

Note that I have this in the capstone update, and I placed it closer to the top of the file with some other imports.

meson.build foreach target : target_dirs · line 575

Quoted 10 lines
meson.build +3 -0
 foreach target : target_dirs
   config_target = keyval.load(meson.current_build_dir() / target / 'config-target.mak')
 
@@ -569,8 +570,13 @@ foreach target : target_dirs
     endforeach
 
     config_devices_mak = target + '-config-devices.mak'
+    target_kconfig = 'target' / config_target['TARGET_BASE_ARCH'] / 'Kconfig'
+    minikconf_input = ['default-configs' / target + '.mak', 'Kconfig']
+    if fs.is_file(target_kconfig)

Missing a meson.current_source_dir()? Leastwise that was a comment that Paolo had for me.

r~

maintainer
#8 lore raw

Re: [PATCH v4 02/12] meson: Allow optional target/${ARCH}/Kconfig

Quoted 5 lines · Richard Henderson

meson.build foreach target : target_dirs · line 575

Quoted 3 lines
meson.build +3 -0
+    target_kconfig = 'target' / config_target['TARGET_BASE_ARCH'] / 'Kconfig'
+    minikconf_input = ['default-configs' / target + '.mak', 'Kconfig']
+    if fs.is_file(target_kconfig)

Missing a meson.current_source_dir()? Leastwise that was a comment that Paolo had for me.

Not sure, but it was the only way I thought the BSD build could fail; unless the capstone submodule really was not present in Peter's checkout and submodule update was disabled.

Paolo

#9 lore raw

Re: [PATCH v4 02/12] meson: Allow optional target/${ARCH}/Kconfig

Quoted 10 lines · Paolo Bonzini
Quoted 5 lines · Richard Henderson

meson.build foreach target : target_dirs · line 575

Quoted 3 lines
meson.build +3 -0
+    target_kconfig = 'target' / config_target['TARGET_BASE_ARCH'] / 'Kconfig'
+    minikconf_input = ['default-configs' / target + '.mak', 'Kconfig']
+    if fs.is_file(target_kconfig)

Missing a meson.current_source_dir()? Leastwise that was a comment that Paolo had for me.

Not sure, but it was the only way I thought the BSD build could fail; unless the capstone submodule really was not present in Peter's checkout and submodule update was disabled.

I don't think the build actually failed, I think it was just the cmake warning from the missing method: to which Peter objected.

FWIW with and without source_dir work for me when testing, and I'm about to include it in the v3 pull for an abundance of caution.

r~

#10 lore raw

PATCH v4 3/12 target/arm: Select SEMIHOSTING if TCG is available

In reply to Philippe Mathieu-Daudé

Add a kconfig entry which not explicitly selected by another entry, but which selects SEMIHOSTING if TCG is available.

This avoids:

/usr/bin/ld: libqemu-aarch64-softmmu.fa.p/target_arm_arm-semi.c.o: in function `do_arm_semihosting':
target/arm/arm-semi.c:784: undefined reference to qemu_semihosting_console_outc' target/arm/arm-semi.c:787: undefined reference to qemu_semihosting_console_outs' /usr/bin/ld: target/arm/arm-semi.c:815: undefined reference to `qemu_semihosting_console_inc'

---
 target/arm/Kconfig | 4 ++++
 1 file changed, 4 insertions(+)
 create mode 100644 target/arm/Kconfig
target/arm/Kconfig new file +4 -0
new file mode 100644
index 0000000000..972d9a1b9a
@@ -0,0 +1,4 @@
+# arch-specific rule to select SEMIHOSTING if ARM && TCG
+config ARM_SEMIHOSTING
+    default y if TCG
+    select SEMIHOSTING
Signature · 1 line
2.26.2
Reviewed-by on v4 3/12
#11 lore raw

Re: [PATCH v4 03/12] target/arm: Select SEMIHOSTING if TCG is available

Quoted 10 lines · Philippe Mathieu-Daudé

Add a kconfig entry which not explicitly selected by another entry, but which selects SEMIHOSTING if TCG is available.

This avoids:

/usr/bin/ld: libqemu-aarch64-softmmu.fa.p/target_arm_arm-semi.c.o: in function `do_arm_semihosting':
target/arm/arm-semi.c:784: undefined reference to qemu_semihosting_console_outc' target/arm/arm-semi.c:787: undefined reference to qemu_semihosting_console_outs' /usr/bin/ld: target/arm/arm-semi.c:815: undefined reference to `qemu_semihosting_console_inc'

Quoted 5 lines
---
 target/arm/Kconfig | 4 ++++
 1 file changed, 4 insertions(+)
 create mode 100644 target/arm/Kconfig

r~

#12 lore raw

PATCH v4 4/12 target/arm: Restrict ARMv4 cpus to TCG accel

In reply to Philippe Mathieu-Daudé

KVM requires a cpu based on (at least) the ARMv7 architecture.

Only enable the following ARMv4 CPUs when TCG is available:

- StrongARM (SA1100/1110)
- OMAP1510 (TI925T)

---
 hw/arm/Kconfig | 6 ++++++
 1 file changed, 6 insertions(+)
hw/arm/Kconfig +6 -0
index 7d040827af..b546b20654 100644
@@ -1,3 +1,7 @@
+config ARM_V4
+    bool
+    select TCG
+
 config ARM_VIRT
     bool
     imply PCI_DEVICES
@@ -30,6 +34,7 @@ config ARM_VIRT
 
 config CHEETAH
     bool
+    select ARM_V4
     select OMAP
     select TSC210X
 
@@ -244,6 +249,7 @@ config COLLIE
 
 config SX1
     bool
+    select ARM_V4
     select OMAP
 
 config VERSATILE
Signature · 1 line
2.26.2
#13 lore raw

Re: [PATCH v4 04/12] target/arm: Restrict ARMv4 cpus to TCG accel

Quoted 17 lines · Philippe Mathieu-Daudé

KVM requires a cpu based on (at least) the ARMv7 architecture.

Only enable the following ARMv4 CPUs when TCG is available:

- StrongARM (SA1100/1110)
- OMAP1510 (TI925T)

---
 hw/arm/Kconfig | 6 ++++++
 1 file changed, 6 insertions(+)
hw/arm/Kconfig +0 -0
index 7d040827af..b546b20654 100644

hw/arm/Kconfig line 3

Quoted 3 lines
hw/arm/Kconfig +3 -0
@@ -1,3 +1,7 @@
+config ARM_V4
+    bool
+    select TCG

This should be 'depends on TCG' because we can not *select* TCG, either we enabled it or not.

The problem is the machines are already selected in default-configs/arm-softmmu.mak, so we can not build the current config without TCG.

Quoted 21 lines
hw/arm/Kconfig +3 -0
+
 config ARM_VIRT
     bool
     imply PCI_DEVICES
@@ -30,6 +34,7 @@ config ARM_VIRT
 
 config CHEETAH
     bool
+    select ARM_V4
     select OMAP
     select TSC210X
 
@@ -244,6 +249,7 @@ config COLLIE
 
 config SX1
     bool
+    select ARM_V4
     select OMAP
 
 config VERSATILE
#14 lore raw

Re: [PATCH v4 04/12] target/arm: Restrict ARMv4 cpus to TCG accel

Quoted 25 lines · Philippe Mathieu-Daudé
Quoted 17 lines · Philippe Mathieu-Daudé

KVM requires a cpu based on (at least) the ARMv7 architecture.

Only enable the following ARMv4 CPUs when TCG is available:

- StrongARM (SA1100/1110)
- OMAP1510 (TI925T)

---
  hw/arm/Kconfig | 6 ++++++
  1 file changed, 6 insertions(+)
hw/arm/Kconfig +0 -0
index 7d040827af..b546b20654 100644

hw/arm/Kconfig line 3

Quoted 3 lines
hw/arm/Kconfig +3 -0
@@ -1,3 +1,7 @@
+config ARM_V4
+    bool
+    select TCG

This should be 'depends on TCG' because we can not *select* TCG, either we enabled it or not.

Quoted 3 lines

The problem is the machines are already selected in default-configs/arm-softmmu.mak, so we can not build the current config without TCG.

Is it really a problem? If the users disabled TCG and still have these machines in their arm-softmmu.mak, it's a configuration issue on their side, so it's ok if they get an error in that case.

Thomas

#15 lore raw

PATCH v4 5/12 target/arm: Restrict ARMv5 cpus to TCG accel

In reply to Philippe Mathieu-Daudé

KVM requires a cpu based on (at least) the ARMv7 architecture.

Only enable the following ARMv5 CPUs when TCG is available:

- ARM926
- ARM946
- ARM1026
- XScale (PXA250/255/260/261/262/270)

---
 hw/arm/Kconfig | 11 +++++++++++
 1 file changed, 11 insertions(+)
hw/arm/Kconfig +11 -0
index b546b20654..d2876b2c8b 100644
@@ -2,6 +2,10 @@ config ARM_V4
     bool
     select TCG
 
+config ARM_V5
+    bool
+    select TCG
+
 config ARM_VIRT
     bool
     imply PCI_DEVICES
@@ -44,6 +48,7 @@ config CUBIEBOARD
 
 config DIGIC
     bool
+    select ARM_V5
     select PTIMER
     select PFLASH_CFI02
 
@@ -73,6 +78,7 @@ config HIGHBANK
 
 config INTEGRATOR
     bool
+    select ARM_V5
     select ARM_TIMER
     select INTEGRATOR_DEBUG
     select PL011 # UART
@@ -99,6 +105,7 @@ config MUSCA
 
 config MUSICPAL
     bool
+    select ARM_V5
     select BITBANG_I2C
     select MARVELL_88W8618
     select PTIMER
@@ -138,6 +145,7 @@ config OMAP
 
 config PXA2XX
     bool
+    select ARM_V5
     select FRAMEBUFFER
     select I2C
     select SERIAL
@@ -254,6 +262,7 @@ config SX1
 
 config VERSATILE
     bool
+    select ARM_V5
     select ARM_TIMER # sp804
     select PFLASH_CFI01
     select LSI_SCSI_PCI
@@ -373,6 +382,7 @@ config NPCM7XX
 
 config FSL_IMX25
     bool
+    select ARM_V5
     select IMX
     select IMX_FEC
     select IMX_I2C
@@ -399,6 +409,7 @@ config FSL_IMX6
 
 config ASPEED_SOC
     bool
+    select ARM_V5
     select DS1338
     select FTGMAC100
     select I2C
Signature · 1 line
2.26.2
#16 lore raw

PATCH v4 6/12 target/arm: Restrict ARMv6 cpus to TCG accel

In reply to Philippe Mathieu-Daudé

KVM requires a cpu based on (at least) the ARMv7 architecture.

Only enable the following ARMv6 CPUs when TCG is available:

- ARM1136
- ARM1176
- ARM11MPCore
- Cortex-M0

---
 hw/arm/Kconfig | 6 ++++++
 1 file changed, 6 insertions(+)
hw/arm/Kconfig +6 -0
index d2876b2c8b..e01eb55bc0 100644
@@ -6,6 +6,10 @@ config ARM_V5
     bool
     select TCG
 
+config ARM_V6
+    bool
+    select TCG
+
 config ARM_VIRT
     bool
     imply PCI_DEVICES
@@ -123,6 +127,7 @@ config NETDUINOPLUS2
 
 config NSERIES
     bool
+    select ARM_V6
     select OMAP
     select TMP105   # tempature sensor
     select BLIZZARD # LCD/TV controller
@@ -391,6 +396,7 @@ config FSL_IMX25
 
 config FSL_IMX31
     bool
+    select ARM_V6
     select SERIAL
     select IMX
     select IMX_I2C
Signature · 1 line
2.26.2
#17 lore raw

PATCH v4 7/12 target/arm: Restrict ARMv7 R-profile cpus to TCG accel

In reply to Philippe Mathieu-Daudé

A KVM-only build won't be able to run R-profile cpus.

Only enable the following ARMv7 R-Profile CPUs when TCG is available:

- Cortex-R5
- Cortex-R5F

---
 hw/arm/Kconfig | 5 +++++
 1 file changed, 5 insertions(+)
hw/arm/Kconfig +5 -0
index e01eb55bc0..7f19872722 100644
@@ -10,6 +10,10 @@ config ARM_V6
     bool
     select TCG
 
+config ARM_V7R
+    bool
+    select TCG
+
 config ARM_VIRT
     bool
     imply PCI_DEVICES
@@ -358,6 +362,7 @@ config XLNX_ZYNQMP_ARM
     bool
     select AHCI
     select ARM_GIC
+    select ARM_V7R
     select CADENCE
     select DDC
     select DPCD
Signature · 1 line
2.26.2
#18 lore raw

PATCH v4 8/12 target/arm: Restrict ARMv7 M-profile cpus to TCG accel

In reply to Philippe Mathieu-Daudé

A KVM-only build won't be able to run M-profile cpus.

Only enable the following ARMv7 M-Profile CPUs when TCG is available:

- Cortex-M0
- Cortex-M3
- Cortex-M4
- Cortex-M33

We don't need to enforce CONFIG_ARM_V7M in default-configs because all machines using a Cortex-M are already explicitly selected.

---
 default-configs/arm-softmmu.mak | 3 ---
 hw/arm/Kconfig                  | 4 ++++
 2 files changed, 4 insertions(+), 3 deletions(-)
default-configs/arm-softmmu.mak +0 -3
index 08a32123b4..002c97862b 100644
@@ -1,8 +1,5 @@
 # Default configuration for arm-softmmu
 
-# TODO: ARM_V7M is currently always required - make this more flexible!
-CONFIG_ARM_V7M=y
-
 # CONFIG_PCI_DEVICES=n
 # CONFIG_TEST_DEVICES=n
 
hw/arm/Kconfig +4 -0
index 7f19872722..15faa2f2d7 100644
@@ -14,6 +14,10 @@ config ARM_V7R
     bool
     select TCG
 
+config ARM_V7M
+    bool
+    select TCG
+
 config ARM_VIRT
     bool
     imply PCI_DEVICES
Signature · 1 line
2.26.2
#19 lore raw

PATCH v4 9/12 target/arm: Make m_helper.c optional via CONFIG_ARM_V7M

In reply to Philippe Mathieu-Daudé

From: Thomas Huth <[email protected]>

We've already got the CONFIG_ARM_V7M switch, but it currently can not be disabled yet. The m_helper.c code should not be compiled into the binary if the switch is not enabled. We also have to provide some stubs in a separate file to make sure that we still can link the other code without CONFIG_ARM_V7M.

Message-Id: <[email protected]>

[PMD: Keep m_helper-stub.c but extend it, rewrite the rest]

---
Rewrite since v3, therefore removed Richard R-b tag.

---
 target/arm/cpu.h           | 12 -------
 target/arm/cpu_tcg.c       |  4 ++-
 target/arm/helper.c        |  7 ----
 target/arm/m_helper-stub.c | 73 ++++++++++++++++++++++++++++++++++++++
 target/arm/meson.build     |  4 ++-
 5 files changed, 79 insertions(+), 21 deletions(-)
 create mode 100644 target/arm/m_helper-stub.c
target/arm/cpu.h +0 -12
index 6036f61d60..c5f4c1b181 100644
@@ -2117,12 +2117,6 @@ uint32_t arm_phys_excp_target_el(CPUState *cs, uint32_t excp_idx,
 /* Interface between CPU and Interrupt controller.  */
 #ifndef CONFIG_USER_ONLY
 bool armv7m_nvic_can_take_pending_exception(void *opaque);
-#else
-static inline bool armv7m_nvic_can_take_pending_exception(void *opaque)
-{
-    return true;
-}
-#endif
 /**
  * armv7m_nvic_set_pending: mark the specified exception as pending
  * @opaque: the NVIC
@@ -2228,13 +2222,7 @@ int armv7m_nvic_raw_execution_priority(void *opaque);
  * @secure: the security state to test
  * This corresponds to the pseudocode IsReqExecPriNeg().
  */
-#ifndef CONFIG_USER_ONLY
 bool armv7m_nvic_neg_prio_requested(void *opaque, bool secure);
-#else
-static inline bool armv7m_nvic_neg_prio_requested(void *opaque, bool secure)
-{
-    return false;
-}
 #endif
 
 /* Interface for defining coprocessor registers.
target/arm/cpu_tcg.c +3 -1
index 00b0e08f33..563b0e82bc 100644
@@ -15,6 +15,7 @@
 /* CPU models. These are not needed for the AArch64 linux-user build. */
 #if !defined(CONFIG_USER_ONLY) || !defined(TARGET_AARCH64)
 
+#ifndef CONFIG_USER_ONLY
 static bool arm_v7m_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
 {
     CPUClass *cc = CPU_GET_CLASS(cs);
@@ -38,6 +39,7 @@ static bool arm_v7m_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
     }
     return ret;
 }
+#endif /* CONFIG_USER_ONLY */
 
 static void arm926_initfn(Object *obj)
 {
@@ -602,9 +604,9 @@ static void arm_v7m_class_init(ObjectClass *oc, void *data)
     acc->info = data;
 #ifndef CONFIG_USER_ONLY
     cc->do_interrupt = arm_v7m_cpu_do_interrupt;
+    cc->cpu_exec_interrupt = arm_v7m_cpu_exec_interrupt;
 #endif
 
-    cc->cpu_exec_interrupt = arm_v7m_cpu_exec_interrupt;
     cc->gdb_core_xml_file = "arm-m-profile.xml";
 }
 
target/arm/helper.c +0 -7
index 88bd9dd35d..5196a17bdb 100644
@@ -12653,13 +12653,6 @@ int arm_mmu_idx_to_el(ARMMMUIdx mmu_idx)
     }
 }
 
-#ifndef CONFIG_TCG
-ARMMMUIdx arm_v7m_mmu_idx_for_secstate(CPUARMState *env, bool secstate)
-{
-    g_assert_not_reached();
-}
-#endif
-
 ARMMMUIdx arm_mmu_idx_el(CPUARMState *env, int el)
 {
     if (arm_feature(env, ARM_FEATURE_M)) {
target/arm/m_helper-stub.c new file +73 -0

73 lines not on this page · raw message

target/arm/meson.build +3 -1
index f5de2a77b8..f6a88297a8 100644
@@ -21,7 +21,6 @@ arm_ss.add(files(
   'gdbstub.c',
   'helper.c',
   'iwmmxt_helper.c',
-  'm_helper.c',
   'neon_helper.c',
   'op_helper.c',
   'tlb_helper.c',
@@ -30,9 +29,12 @@ arm_ss.add(files(
   'vfp_helper.c',
   'cpu_tcg.c',
 ))
+arm_ss.add(when: 'CONFIG_ARM_V7M', if_true: files('m_helper.c'), if_false: files('m_helper-stub.c'))
+
 arm_ss.add(zlib)
 
 arm_ss.add(when: 'CONFIG_TCG', if_true: files('arm-semi.c'))
+arm_ss.add(when: 'CONFIG_TCG', if_false: files('m_helper-stub.c'))
 
 arm_ss.add(when: 'CONFIG_KVM', if_true: files('kvm.c', 'kvm64.c'), if_false: files('kvm-stub.c'))
 
Signature · 1 line
2.26.2
#20 lore raw

Re: [PATCH v4 09/12] target/arm: Make m_helper.c optional via CONFIG_ARM_V7M

target/arm/meson.build arm_ss.add(files( · line 37

Quoted 6 lines · Philippe Mathieu-Daudé
target/arm/meson.build +3 -0
+arm_ss.add(when: 'CONFIG_ARM_V7M', if_true: files('m_helper.c'), if_false: files('m_helper-stub.c'))
+
 arm_ss.add(zlib)
 
 arm_ss.add(when: 'CONFIG_TCG', if_true: files('arm-semi.c'))
+arm_ss.add(when: 'CONFIG_TCG', if_false: files('m_helper-stub.c'))

I'm a bit surprised about adding the file twice. Since ARM_V7M depends on TCG, isn't the second line redundant?

r~

#21 lore raw

Re: [PATCH v4 09/12] target/arm: Make m_helper.c optional via CONFIG_ARM_V7M

Quoted 10 lines · Richard Henderson

target/arm/meson.build arm_ss.add(files( · line 37

Quoted 6 lines · Philippe Mathieu-Daudé
target/arm/meson.build +3 -0
+arm_ss.add(when: 'CONFIG_ARM_V7M', if_true: files('m_helper.c'), if_false: files('m_helper-stub.c'))
+
 arm_ss.add(zlib)
 
 arm_ss.add(when: 'CONFIG_TCG', if_true: files('arm-semi.c'))
+arm_ss.add(when: 'CONFIG_TCG', if_false: files('m_helper-stub.c'))

I'm a bit surprised about adding the file twice. Since ARM_V7M depends on TCG, isn't the second line redundant?

This does:

if TCG

    if CONFIG_ARM_V7M
        files('m_helper.c')
    else #!V7M
        files('m_helper-stub.c'))
    endif
else #!TCG
    files('m_helper-stub.c'))

endif

So:

if !TCG or !V7M

    files('m_helper-stub.c'))
else
    files('m_helper.c')

endif

There might be a better way to express that in Meson... I only understood how to do AND with arrays, but not OR.

Paolo/Marc-André, is it possible?

Thanks,

Phil.

#22 lore raw

PATCH v4 10/12 target/arm: Do not build TCG objects when TCG is off

In reply to Philippe Mathieu-Daudé

From: Samuel Ortiz <[email protected]>

We can now safely turn all TCG dependent build off when CONFIG_TCG is off. This allows building ARM binaries with --disable-tcg.

[PMD: Heavily rebased during almost 2 years then finally rewritten =) ]
---
 target/arm/meson.build | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)
target/arm/meson.build +17 -7
index f6a88297a8..9b7727d4bb 100644
@@ -16,24 +16,29 @@ arm_ss = ss.source_set()
 arm_ss.add(gen)
 arm_ss.add(files(
   'cpu.c',
-  'crypto_helper.c',
-  'debug_helper.c',
   'gdbstub.c',
   'helper.c',
+  'vfp_helper.c',
+))
+
+arm_tcg_ss = ss.source_set()
+arm_tcg_ss.add(files(
+  'arm-semi.c',
+  'cpu_tcg.c',
+  'crypto_helper.c',
+  'debug_helper.c',
   'iwmmxt_helper.c',
   'neon_helper.c',
   'op_helper.c',
   'tlb_helper.c',
   'translate.c',
   'vec_helper.c',
-  'vfp_helper.c',
-  'cpu_tcg.c',
 ))
-arm_ss.add(when: 'CONFIG_ARM_V7M', if_true: files('m_helper.c'), if_false: files('m_helper-stub.c'))
+
+arm_tcg_ss.add(when: 'CONFIG_ARM_V7M', if_true: files('m_helper.c'), if_false: files('m_helper-stub.c'))
 
 arm_ss.add(zlib)
 
-arm_ss.add(when: 'CONFIG_TCG', if_true: files('arm-semi.c'))
 arm_ss.add(when: 'CONFIG_TCG', if_false: files('m_helper-stub.c'))
 
 arm_ss.add(when: 'CONFIG_KVM', if_true: files('kvm.c', 'kvm64.c'), if_false: files('kvm-stub.c'))
@@ -41,6 +46,9 @@ arm_ss.add(when: 'CONFIG_KVM', if_true: files('kvm.c', 'kvm64.c'), if_false: fil
 arm_ss.add(when: 'TARGET_AARCH64', if_true: files(
   'cpu64.c',
   'gdbstub64.c',
+))
+
+arm_tcg_ss.add(when: 'TARGET_AARCH64', if_true: files(
   'helper-a64.c',
   'mte_helper.c',
   'pauth_helper.c',
@@ -49,14 +57,16 @@ arm_ss.add(when: 'TARGET_AARCH64', if_true: files(
   'translate-sve.c',
 ))
 
+arm_ss.add_all(when: 'CONFIG_TCG', if_true: arm_tcg_ss)
+
 arm_softmmu_ss = ss.source_set()
 arm_softmmu_ss.add(files(
   'arch_dump.c',
   'arm-powerctl.c',
   'machine.c',
   'monitor.c',
-  'psci.c',
 ))
+arm_softmmu_ss.add(when: 'CONFIG_TCG', if_true: files('psci.c'))
 
 target_arch += {'arm': arm_ss}
 target_softmmu_arch += {'arm': arm_softmmu_ss}
Signature · 1 line
2.26.2
Reviewed-by on v4 10/12
#23 lore raw

Re: [PATCH v4 10/12] target/arm: Do not build TCG objects when TCG is off

Quoted 1 line · Philippe Mathieu-Daudé

-arm_ss.add(when: 'CONFIG_TCG', if_true: files('arm-semi.c'))

Aha, so you remove the line in the next patch anyway. I suspect that you can not add it in the previous.

r~

#24 lore raw

PATCH v4 11/12 target/arm: Reorder meson.build rules

In reply to Philippe Mathieu-Daudé

Reorder the rules to make this file easier to modify.

---
I prefer to not squash that with the previous patch, as it makes it harder to review.

---
 target/arm/meson.build | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)
target/arm/meson.build +10 -12
index 9b7727d4bb..341af8f2ca 100644
@@ -14,6 +14,7 @@ gen = [
 
 arm_ss = ss.source_set()
 arm_ss.add(gen)
+arm_ss.add(zlib)
 arm_ss.add(files(
   'cpu.c',
   'gdbstub.c',
@@ -21,6 +22,13 @@ arm_ss.add(files(
   'vfp_helper.c',
 ))
 
+arm_ss.add(when: 'CONFIG_KVM', if_true: files('kvm.c', 'kvm64.c'), if_false: files('kvm-stub.c'))
+
+arm_ss.add(when: 'TARGET_AARCH64', if_true: files(
+  'cpu64.c',
+  'gdbstub64.c',
+))
+
 arm_tcg_ss = ss.source_set()
 arm_tcg_ss.add(files(
   'arm-semi.c',
@@ -35,26 +43,16 @@ arm_tcg_ss.add(files(
   'vec_helper.c',
 ))
 
-arm_tcg_ss.add(when: 'CONFIG_ARM_V7M', if_true: files('m_helper.c'), if_false: files('m_helper-stub.c'))
-
-arm_ss.add(zlib)
-
 arm_ss.add(when: 'CONFIG_TCG', if_false: files('m_helper-stub.c'))
-
-arm_ss.add(when: 'CONFIG_KVM', if_true: files('kvm.c', 'kvm64.c'), if_false: files('kvm-stub.c'))
-
-arm_ss.add(when: 'TARGET_AARCH64', if_true: files(
-  'cpu64.c',
-  'gdbstub64.c',
-))
+arm_tcg_ss.add(when: 'CONFIG_ARM_V7M', if_true: files('m_helper.c'), if_false: files('m_helper-stub.c'))
 
 arm_tcg_ss.add(when: 'TARGET_AARCH64', if_true: files(
   'helper-a64.c',
   'mte_helper.c',
   'pauth_helper.c',
-  'sve_helper.c',
   'translate-a64.c',
   'translate-sve.c',
+  'sve_helper.c',
 ))
 
 arm_ss.add_all(when: 'CONFIG_TCG', if_true: arm_tcg_ss)
Signature · 1 line
2.26.2
Reviewed-by on v4 11/12
#25 lore raw

Re: [PATCH v4 11/12] target/arm: Reorder meson.build rules

Quoted 9 lines · Philippe Mathieu-Daudé

Reorder the rules to make this file easier to modify.

---
I prefer to not squash that with the previous patch, as it makes it harder to review.

---
 target/arm/meson.build | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

r~

#26 lore raw

PATCH v4 12/12 .travis.yml: Add a KVM-only Aarch64 job

In reply to Philippe Mathieu-Daudé

Add a job to build QEMU on Aarch64 with TCG disabled, so this configuration won't bitrot over time.

We explicitly modify default-configs/aarch64-softmmu.mak to only select the 'virt' and 'SBSA-REF' machines.

---
Job ran for 7 min 30 sec
https://travis-ci.org/github/philmd/qemu/jobs/731428859

---
 .travis.yml | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
.travis.yml +35 -0
index c75221dca3..cad65cf181 100644
@@ -402,6 +402,41 @@ jobs:
         - CONFIG="--disable-containers --target-list=${MAIN_SOFTMMU_TARGETS}"
         - UNRELIABLE=true
 
+    - name: "[aarch64] GCC (disable-tcg)"
+      arch: arm64
+      dist: bionic
+      addons:
+        apt_packages:
+          - libaio-dev
+          - libattr1-dev
+          - libcap-ng-dev
+          - libgcrypt20-dev
+          - libgnutls28-dev
+          - libiscsi-dev
+          - liblttng-ust-dev
+          - libnfs-dev
+          - libnss3-dev
+          - libpixman-1-dev
+          - libpng-dev
+          - librados-dev
+          - libseccomp-dev
+          - liburcu-dev
+          - libusb-1.0-0-dev
+          - libvdeplug-dev
+          - libvte-2.91-dev
+          # Tests dependencies
+          - genisoimage
+      env:
+        - CONFIG="--disable-containers --disable-tcg --enable-kvm --disable-tools"
+        - TEST_CMD="make check-unit"
+        - CACHE_NAME="${TRAVIS_BRANCH}-linux-gcc-aarch64"
+      before_script:
+        # Only use the 'virt' and 'sbsa-ref' machine which don't need TCG.
+        - echo CONFIG_ARM_VIRT=y > default-configs/aarch64-softmmu.mak
+        - echo CONFIG_SBSA_REF=y >> default-configs/aarch64-softmmu.mak
+        - mkdir -p ${BUILD_DIR} && cd ${BUILD_DIR}
+        - ${SRC_DIR}/configure ${BASE_CONFIG} ${CONFIG} || { cat config.log && exit 1; }
+
     - name: "[ppc64] GCC check-tcg"
       arch: ppc64le
       dist: xenial
Signature · 1 line
2.26.2
#27 lore raw

Re: [PATCH v4 12/12] .travis.yml: Add a KVM-only Aarch64 job

Quoted 5 lines · Philippe Mathieu-Daudé

Add a job to build QEMU on Aarch64 with TCG disabled, so this configuration won't bitrot over time.

We explicitly modify default-configs/aarch64-softmmu.mak to only select the 'virt' and 'SBSA-REF' machines.

I really wish we didn't have to do this.

Can't we e.g. *not* list all of the arm boards explicitly in default-configs, but use the Kconfig "default y if ..."?

Seems like that would let --disable-tcg work as expected. One should still be able to create custom configs with e.g. CONFIG_EXYNOS4=n or CONIFIG_ARM_V4=n, correct?

r~

#28 lore raw

Re: [PATCH v4 12/12] .travis.yml: Add a KVM-only Aarch64 job

Quoted 7 lines · Richard Henderson
Quoted 5 lines · Philippe Mathieu-Daudé

Add a job to build QEMU on Aarch64 with TCG disabled, so this configuration won't bitrot over time.

We explicitly modify default-configs/aarch64-softmmu.mak to only select the 'virt' and 'SBSA-REF' machines.

Quoted 8 lines

I really wish we didn't have to do this.

Can't we e.g. *not* list all of the arm boards explicitly in default-configs, but use the Kconfig "default y if ..."?

Seems like that would let --disable-tcg work as expected. One should still be able to create custom configs with e.g. CONFIG_EXYNOS4=n or CONIFIG_ARM_V4=n, correct?

But that would be different from how we handle all other targets currently...
IMHO we shoud go into a different direction instead, e.g. by adding a "--kconfig-dir" switch to the configure script. If it has not been specified, the configs will be read from default-configs/ (or maybe we should then rename it to configs/default/). But if the switch has been specified with a directory as parameter, the config files will be read from that directory instead. We could then have folders like:

- configs/default (current default-configs)
- configs/no-tcg (all machines that work without tcg)
- configs/lean-kvm (for "nemu"-style minimalistic settings)

etc.

What do you think?

Thomas

#29 lore raw

Re: [PATCH v4 12/12] .travis.yml: Add a KVM-only Aarch64 job

Quoted 10 lines · Thomas Huth
Quoted 9 lines · Richard Henderson
Quoted 5 lines · Philippe Mathieu-Daudé

Add a job to build QEMU on Aarch64 with TCG disabled, so this configuration won't bitrot over time.

We explicitly modify default-configs/aarch64-softmmu.mak to only select the 'virt' and 'SBSA-REF' machines.

I really wish we didn't have to do this.

Quoted 8 lines
Quoted 6 lines

Can't we e.g. *not* list all of the arm boards explicitly in default-configs, but use the Kconfig "default y if ..."?

Seems like that would let --disable-tcg work as expected. One should still be able to create custom configs with e.g. CONFIG_EXYNOS4=n or CONIFIG_ARM_V4=n, correct?

But that would be different from how we handle all other targets currently...

So? Does that automatically mean they're golden? Perhaps they should be doing it the other way around too.

Quoted 7 lines

IMHO we shoud go into a different direction instead, e.g. by adding a "--kconfig-dir" switch to the configure script. If it has not been specified, the configs will be read from default-configs/ (or maybe we should then rename it to configs/default/). But if the switch has been specified with a directory as parameter, the config files will be read from that directory instead. We could then have folders like:

Quoted 7 lines

- configs/default (current default-configs)
- configs/no-tcg (all machines that work without tcg)
- configs/lean-kvm (for "nemu"-style minimalistic settings)

etc.

What do you think?

I don't really understand the suggestion. My first reaction is that this is more confusing than --disable-tcg, and trying to automatically dtrt with that.

r~

#30 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 9 lines · On Wed, 30 Sep 2020 00:43:43 +0200 Philippe Mathieu-Daudé <[email protected]>…

Cover from Samuel Ortiz from (part 1) [1]:

This patchset allows for building and running ARM targets with TCG disabled. [...]

The rationale behind this work comes from the NEMU project where we're trying to only support x86 and ARM 64-bit architectures, without including the TCG code base. We can only do so if we can build and run ARM binaries with TCG disabled.

I don't recall exact reason but TCG variant is used by bios-tables-test to test arm/virt so it will probably break that
(it has something to do with how KVM uses CPU/GIC, which was making ACPI tables not stable (i.e. depend on host), so comparison with master tables was failing)

Quoted 65 lines

v4 almost 2 years later... [2]:
- Rebased on Meson
- Addressed Richard review comments
- Addressed Claudio review comments

v3 almost 18 months later [3]:
- Rebased
- Addressed Thomas review comments
- Added Travis-CI job to keep building --disable-tcg on ARM

v2 [4]:
- Addressed review comments from Richard and Thomas from v1 [1]

Regards,

Phil.

[1]: https://lists.gnu.org/archive/html/qemu-devel/2018-11/msg02451.html
[2]: https://www.mail-archive.com/[email protected]/msg689168.html
[3]: https://www.mail-archive.com/[email protected]/msg641796.html
[4]: https://lists.gnu.org/archive/html/qemu-devel/2019-08/msg05003.html

Green CI:
- https://cirrus-ci.com/build/4572961761918976
- https://gitlab.com/philmd/qemu/-/pipelines/196047779
- https://travis-ci.org/github/philmd/qemu/builds/731370972

Based-on: <[email protected]> "hw/arm: Restrict APEI tables generation to the 'virt' machine"
https://www.mail-archive.com/[email protected]/msg745792.html

Philippe Mathieu-Daudé (10):
accel/tcg: Add stub for cpu_loop_exit()
meson: Allow optional target/${ARCH}/Kconfig target/arm: Select SEMIHOSTING if TCG is available target/arm: Restrict ARMv4 cpus to TCG accel target/arm: Restrict ARMv5 cpus to TCG accel target/arm: Restrict ARMv6 cpus to TCG accel target/arm: Restrict ARMv7 R-profile cpus to TCG accel target/arm: Restrict ARMv7 M-profile cpus to TCG accel target/arm: Reorder meson.build rules .travis.yml: Add a KVM-only Aarch64 job

Samuel Ortiz (1):
target/arm: Do not build TCG objects when TCG is off

Thomas Huth (1):
target/arm: Make m_helper.c optional via CONFIG_ARM_V7M

 default-configs/arm-softmmu.mak |  3 --
 meson.build                     |  8 +++-
 target/arm/cpu.h                | 12 ------
 accel/stubs/tcg-stub.c          |  5 +++
 target/arm/cpu_tcg.c            |  4 +-
 target/arm/helper.c             |  7 ----
 target/arm/m_helper-stub.c      | 73 +++++++++++++++++++++++++++++++++
 .travis.yml                     | 35 ++++++++++++++++
 hw/arm/Kconfig                  | 32 +++++++++++++++
 target/arm/Kconfig              |  4 ++
 target/arm/meson.build          | 40 +++++++++++-------
 11 files changed, 184 insertions(+), 39 deletions(-)
 create mode 100644 target/arm/m_helper-stub.c
 create mode 100644 target/arm/Kconfig
#31 lore raw
Quoted 13 lines · Igor Mammedov
Quoted 9 lines · On Wed, 30 Sep 2020 00:43:43 +0200 Philippe Mathieu-Daudé <[email protected]>…

Cover from Samuel Ortiz from (part 1) [1]:

This patchset allows for building and running ARM targets with TCG disabled. [...]

The rationale behind this work comes from the NEMU project where we're trying to only support x86 and ARM 64-bit architectures, without including the TCG code base. We can only do so if we can build and run ARM binaries with TCG disabled.

Quoted 5 lines

I don't recall exact reason but TCG variant is used by bios-tables-test to test arm/virt so it will probably break that
(it has something to do with how KVM uses CPU/GIC, which was making ACPI tables not stable (i.e. depend on host), so comparison with master tables was failing)

Not a problem, we can restrict bios-tables-test to TCG.

I don't expect the KVM-only build being able to run many of our current tests, as most of them expect TCG.

I'll have a look at restricting the TCG-dependent tests after this series get accepted.

Quoted 67 lines
Quoted 66 lines

v4 almost 2 years later... [2]:
- Rebased on Meson
- Addressed Richard review comments
- Addressed Claudio review comments

v3 almost 18 months later [3]:
- Rebased
- Addressed Thomas review comments
- Added Travis-CI job to keep building --disable-tcg on ARM

v2 [4]:
- Addressed review comments from Richard and Thomas from v1 [1]

Regards,

Phil.

[1]: https://lists.gnu.org/archive/html/qemu-devel/2018-11/msg02451.html
[2]: https://www.mail-archive.com/[email protected]/msg689168.html
[3]: https://www.mail-archive.com/[email protected]/msg641796.html
[4]: https://lists.gnu.org/archive/html/qemu-devel/2019-08/msg05003.html

Green CI:
- https://cirrus-ci.com/build/4572961761918976
- https://gitlab.com/philmd/qemu/-/pipelines/196047779
- https://travis-ci.org/github/philmd/qemu/builds/731370972

Based-on: <[email protected]> "hw/arm: Restrict APEI tables generation to the 'virt' machine"
https://www.mail-archive.com/[email protected]/msg745792.html

Philippe Mathieu-Daudé (10):
accel/tcg: Add stub for cpu_loop_exit()
meson: Allow optional target/${ARCH}/Kconfig target/arm: Select SEMIHOSTING if TCG is available target/arm: Restrict ARMv4 cpus to TCG accel target/arm: Restrict ARMv5 cpus to TCG accel target/arm: Restrict ARMv6 cpus to TCG accel target/arm: Restrict ARMv7 R-profile cpus to TCG accel target/arm: Restrict ARMv7 M-profile cpus to TCG accel target/arm: Reorder meson.build rules .travis.yml: Add a KVM-only Aarch64 job

Samuel Ortiz (1):
target/arm: Do not build TCG objects when TCG is off

Thomas Huth (1):
target/arm: Make m_helper.c optional via CONFIG_ARM_V7M

 default-configs/arm-softmmu.mak |  3 --
 meson.build                     |  8 +++-
 target/arm/cpu.h                | 12 ------
 accel/stubs/tcg-stub.c          |  5 +++
 target/arm/cpu_tcg.c            |  4 +-
 target/arm/helper.c             |  7 ----
 target/arm/m_helper-stub.c      | 73 +++++++++++++++++++++++++++++++++
 .travis.yml                     | 35 ++++++++++++++++
 hw/arm/Kconfig                  | 32 +++++++++++++++
 target/arm/Kconfig              |  4 ++
 target/arm/meson.build          | 40 +++++++++++-------
 11 files changed, 184 insertions(+), 39 deletions(-)
 create mode 100644 target/arm/m_helper-stub.c
 create mode 100644 target/arm/Kconfig
#32 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 10 lines · Philippe Mathieu-Daudé

Cover from Samuel Ortiz from (part 1) [1]:

This patchset allows for building and running ARM targets with TCG disabled. [...]

The rationale behind this work comes from the NEMU project where we're trying to only support x86 and ARM 64-bit architectures, without including the TCG code base. We can only do so if we can build and run ARM binaries with TCG disabled.

Quoted 4 lines

v4 almost 2 years later... [2]:
- Rebased on Meson
- Addressed Richard review comments
- Addressed Claudio review comments

Have you re-based recently because I was having a look but ran into merge conflicts. I'd like to get the merged at some point because I ran into similar issues with the Xen only build without TCG.

Quoted 59 lines

v3 almost 18 months later [3]:
- Rebased
- Addressed Thomas review comments
- Added Travis-CI job to keep building --disable-tcg on ARM

v2 [4]:
- Addressed review comments from Richard and Thomas from v1 [1]

Regards,

Phil.

[1]: https://lists.gnu.org/archive/html/qemu-devel/2018-11/msg02451.html
[2]: https://www.mail-archive.com/[email protected]/msg689168.html
[3]: https://www.mail-archive.com/[email protected]/msg641796.html
[4]: https://lists.gnu.org/archive/html/qemu-devel/2019-08/msg05003.html

Green CI:
- https://cirrus-ci.com/build/4572961761918976
- https://gitlab.com/philmd/qemu/-/pipelines/196047779
- https://travis-ci.org/github/philmd/qemu/builds/731370972

Based-on: <[email protected]> "hw/arm: Restrict APEI tables generation to the 'virt' machine"
https://www.mail-archive.com/[email protected]/msg745792.html

Philippe Mathieu-Daudé (10):
accel/tcg: Add stub for cpu_loop_exit()
meson: Allow optional target/${ARCH}/Kconfig target/arm: Select SEMIHOSTING if TCG is available target/arm: Restrict ARMv4 cpus to TCG accel target/arm: Restrict ARMv5 cpus to TCG accel target/arm: Restrict ARMv6 cpus to TCG accel target/arm: Restrict ARMv7 R-profile cpus to TCG accel target/arm: Restrict ARMv7 M-profile cpus to TCG accel target/arm: Reorder meson.build rules .travis.yml: Add a KVM-only Aarch64 job

Samuel Ortiz (1):
target/arm: Do not build TCG objects when TCG is off

Thomas Huth (1):
target/arm: Make m_helper.c optional via CONFIG_ARM_V7M

 default-configs/arm-softmmu.mak |  3 --
 meson.build                     |  8 +++-
 target/arm/cpu.h                | 12 ------
 accel/stubs/tcg-stub.c          |  5 +++
 target/arm/cpu_tcg.c            |  4 +-
 target/arm/helper.c             |  7 ----
 target/arm/m_helper-stub.c      | 73 +++++++++++++++++++++++++++++++++
 .travis.yml                     | 35 ++++++++++++++++
 hw/arm/Kconfig                  | 32 +++++++++++++++
 target/arm/Kconfig              |  4 ++
 target/arm/meson.build          | 40 +++++++++++-------
 11 files changed, 184 insertions(+), 39 deletions(-)
 create mode 100644 target/arm/m_helper-stub.c
 create mode 100644 target/arm/Kconfig
Signature · 1 line
Alex Bennée
#33 lore raw

Hi Alex,

Quoted 12 lines · Alex Bennée
Quoted 10 lines · Philippe Mathieu-Daudé

Cover from Samuel Ortiz from (part 1) [1]:

This patchset allows for building and running ARM targets with TCG disabled. [...]

The rationale behind this work comes from the NEMU project where we're trying to only support x86 and ARM 64-bit architectures, without including the TCG code base. We can only do so if we can build and run ARM binaries with TCG disabled.

Quoted 8 lines
Quoted 4 lines

v4 almost 2 years later... [2]:
- Rebased on Meson
- Addressed Richard review comments
- Addressed Claudio review comments

Have you re-based recently because I was having a look but ran into merge conflicts. I'd like to get the merged at some point because I ran into similar issues with the Xen only build without TCG.

I addressed most of this review comments locally. Since Claudio's accelerator series was getting more attention (and is bigger) I was waiting it gets merged first. He just respun v14:
https://lists.gnu.org/archive/html/qemu-devel/2021-01/msg07171.html

#34 lore raw
Quoted 20 lines · Philippe Mathieu-Daudé

Hi Alex,

Quoted 17 lines · Alex Bennée
Quoted 14 lines · Philippe Mathieu-Daudé

Cover from Samuel Ortiz from (part 1) [1]:

This patchset allows for building and running ARM targets with TCG disabled. [...]

The rationale behind this work comes from the NEMU project where we're trying to only support x86 and ARM 64-bit architectures, without including the TCG code base. We can only do so if we can build and run ARM binaries with TCG disabled.

v4 almost 2 years later... [2]:
- Rebased on Meson
- Addressed Richard review comments
- Addressed Claudio review comments

Quoted 8 lines
Quoted 3 lines

Have you re-based recently because I was having a look but ran into merge conflicts. I'd like to get the merged at some point because I ran into similar issues with the Xen only build without TCG.

I addressed most of this review comments locally. Since Claudio's accelerator series was getting more attention (and is bigger) I was waiting it gets merged first. He just respun v14:
https://lists.gnu.org/archive/html/qemu-devel/2021-01/msg07171.html

OK I'll have a look at Claudio's first ;-)

Signature · 1 line
Alex Bennée