Skip to contentSkip to conversation

Disable qemu user emulation for host variant on MIPS64

PATCH New Thomas Petazzoni 1 participant 5 messages Apr 1, 2018 – Apr 28, 2018

lore
Share & tools
lore
#0 lore raw

v2 cover Disable qemu user emulation for host variant on MIPS64

Hello,

This is a new iteration of the patch sent by Adam [1]. Changes compared to Adam's version:

- According to Qemu's TODO list, both n32 and n64 don't work for user mode emulation on mips64, so basically mips64 can't be used.

- Adam's patches was not properly propagating the new architecture dependency to the "select" that selects the user-mode emulation if the system emulation is not selected. Solving this required quite a few changes to how architecture dependencies are expressed in the host-qemu package.

[1] https://patchwork.ozlabs.org/patch/828190/

Thanks,

Thomas

Adam Duskett (1):
qemu: disable qemu user emulation on MIPS64 for host variant

Thomas Petazzoni (2):
qemu: rewrite BR2_PACKAGE_HOST_QEMU_ARCH_SUPPORTS to be more readable
qemu: introduce BR2_PACKAGE_HOST_QEMU_{SYSTEM,USER}_ARCH_SUPPORTS

 package/qemu/Config.in.host | 39 +++++++++++++++++++++++++++++++--------
 1 file changed, 31 insertions(+), 8 deletions(-)
Signature · 1 line
2.14.3
#1 lore raw

PATCH v2 1/3 qemu: rewrite BR2_PACKAGE_HOST_QEMU_ARCH_SUPPORTS to be more readable

---
 package/qemu/Config.in.host | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)
package/qemu/Config.in.host +17 -6
index 0ef4c700b0..160778c834 100644
@@ -1,11 +1,22 @@
 config BR2_PACKAGE_HOST_QEMU_ARCH_SUPPORTS
 	bool
-	default y if BR2_arm || BR2_armeb       || BR2_aarch64      || \
-		BR2_i386         || BR2_m68k        || BR2_microblazeel || \
-		BR2_microblazebe || BR2_mips        || BR2_mipsel       || \
-		BR2_mips64       || BR2_mips64el    || BR2_powerpc      || \
-		BR2_powerpc64    || BR2_powerpc64le || BR2_sh           || \
-		BR2_sparc        || BR2_x86_64
+	default y if BR2_arm
+	default y if BR2_armeb
+	default y if BR2_aarch64
+	default y if BR2_i386
+	default y if BR2_m68k
+	default y if BR2_microblazeel
+	default y if BR2_microblazebe
+	default y if BR2_mips
+	default y if BR2_mipsel
+	default y if BR2_mips64
+	default y if BR2_mips64el
+	default y if BR2_powerpc
+	default y if BR2_powerpc64
+	default y if BR2_powerpc64le
+	default y if BR2_sh
+	default y if BR2_sparc
+	default y if BR2_x86_64
 	depends on !BR2_powerpc_620 && !BR2_powerpc_630 && !BR2_powerpc_970
 
 config BR2_PACKAGE_HOST_QEMU
Signature · 1 line
2.14.3
#3 lore raw

PATCH v2 2/3 qemu: introduce BR2_PACKAGE_HOST_QEMU_{SYSTEM, USER}_ARCH_SUPPORTS

In reply to Thomas Petazzoni

Not all architectures are supported by both the system emulation and user-mode emulation in Qemu, so a single BR2_PACKAGE_HOST_QEMU_ARCH_SUPPORTS doesn't work very well.

Therefore, this commit introduces the BR2_PACKAGE_HOST_QEMU_{SYSTEM,USER}_ARCH_SUPPORTS hidden options. We keep the BR2_PACKAGE_HOST_QEMU_ARCH_SUPPORTS option for the (numerous) architectures supported by both system emulation and user-mode emulation.

The 'select' logic to make sure that at least either system emulation or user-mode emulation is selected is reworked, and done carefully to avoid recursive Kconfig dependencies.

For now BR2_PACKAGE_HOST_QEMU_SYSTEM_ARCH_SUPPORTS and BR2_PACKAGE_HOST_QEMU_USER_ARCH_SUPPORTS are the same, but they will become different in a follow-up commit.

---
 package/qemu/Config.in.host | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
package/qemu/Config.in.host +14 -2
index 160778c834..78ff052983 100644
@@ -19,11 +19,21 @@ config BR2_PACKAGE_HOST_QEMU_ARCH_SUPPORTS
 	default y if BR2_x86_64
 	depends on !BR2_powerpc_620 && !BR2_powerpc_630 && !BR2_powerpc_970
 
+config BR2_PACKAGE_HOST_QEMU_SYSTEM_ARCH_SUPPORTS
+	bool
+	default y if BR2_PACKAGE_HOST_QEMU_ARCH_SUPPORTS
+
+config BR2_PACKAGE_HOST_QEMU_USER_ARCH_SUPPORTS
+	bool
+	default y if BR2_PACKAGE_HOST_QEMU_ARCH_SUPPORTS
+
 config BR2_PACKAGE_HOST_QEMU
 	bool "host qemu"
-	depends on BR2_PACKAGE_HOST_QEMU_ARCH_SUPPORTS
+	depends on BR2_PACKAGE_HOST_QEMU_SYSTEM_ARCH_SUPPORTS || BR2_PACKAGE_HOST_QEMU_USER_ARCH_SUPPORTS
 	select BR2_PACKAGE_HOST_QEMU_LINUX_USER_MODE \
-		if !BR2_PACKAGE_HOST_QEMU_SYSTEM_MODE
+		if !BR2_PACKAGE_HOST_QEMU_SYSTEM_MODE && BR2_PACKAGE_HOST_QEMU_USER_ARCH_SUPPORTS
+	select BR2_PACKAGE_HOST_QEMU_SYSTEM_MODE \
+		if !BR2_PACKAGE_HOST_QEMU_USER_ARCH_SUPPORTS
 	help
 	  QEMU is a generic and open source machine emulator and
 	  virtualizer.
@@ -38,12 +48,14 @@ comment "Emulators selection"
 
 config BR2_PACKAGE_HOST_QEMU_SYSTEM_MODE
 	bool "Enable system emulation"
+	depends on BR2_PACKAGE_HOST_QEMU_SYSTEM_ARCH_SUPPORTS
 	help
 	  Enables the build of the system emulator, which allows to
 	  boot an entire system in Qemu.
 
 config BR2_PACKAGE_HOST_QEMU_LINUX_USER_MODE
 	bool "Enable Linux user-land emulation"
+	depends on BR2_PACKAGE_HOST_QEMU_USER_ARCH_SUPPORTS
 	help
 	  Enables the build of the user-land emulator, which allows to
 	  run user-space applications.
Signature · 1 line
2.14.3
#4 lore raw

PATCH v2 3/3 qemu: disable qemu user emulation on MIPS64 for host variant

In reply to Thomas Petazzoni

From: Adam Duskett <[email protected]>

According to target/mips/TODO in the Qemu sources:

===
MIPS64
------
- Userland emulation (both n32 and n64) not functional.
===

And indeed, trying to run a mips64n32 binary under qemu user emulation results in:

Invalid ELF image for this architecture

So we move the BR2_mips64(el) dependency from BR2_PACKAGE_HOST_QEMU_ARCH_SUPPORTS to BR2_PACKAGE_HOST_QEMU_SYSTEM_ARCH_SUPPORTS, so that only the system emulation is available on mips64, and not the user-mode emulation.

---
 package/qemu/Config.in.host | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
package/qemu/Config.in.host +2 -2
index 78ff052983..957c7d2ae1 100644
@@ -9,8 +9,6 @@ config BR2_PACKAGE_HOST_QEMU_ARCH_SUPPORTS
 	default y if BR2_microblazebe
 	default y if BR2_mips
 	default y if BR2_mipsel
-	default y if BR2_mips64
-	default y if BR2_mips64el
 	default y if BR2_powerpc
 	default y if BR2_powerpc64
 	default y if BR2_powerpc64le
@@ -22,6 +20,8 @@ config BR2_PACKAGE_HOST_QEMU_ARCH_SUPPORTS
 config BR2_PACKAGE_HOST_QEMU_SYSTEM_ARCH_SUPPORTS
 	bool
 	default y if BR2_PACKAGE_HOST_QEMU_ARCH_SUPPORTS
+	default y if BR2_mips64
+	default y if BR2_mips64el
 
 config BR2_PACKAGE_HOST_QEMU_USER_ARCH_SUPPORTS
 	bool
Signature · 1 line
2.14.3
author Applied
#2 lore raw

PATCH v2 1/3 qemu: rewrite BR2_PACKAGE_HOST_QEMU_ARCH_SUPPORTS to be more readable

In reply to Thomas Petazzoni

Hello,

Quoted 4 lines · Thomas Petazzoni
---
 package/qemu/Config.in.host | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

I've applied this series to master.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com