Skip to contentSkip to conversation

target/riscv: Only build qemu-system-riscv$$ on rv$$ host

PATCH Applied Philippe Mathieu-Daudé 3 participants 7 messages Jun 27, 2023 – Jul 3, 2023 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

cover target/riscv: Only build qemu-system-riscv$$ on rv$$ host

Per Anup Patel in [*]:

Quoted 5 lines

Currently, we only support running rv64 guest on rv64 host and rv32 guest on rv32 host.

In the future, we might support running rv32 guest on rv64 host but as of now we don't see a strong push for it.

Therefore, when only using the KVM accelerator it is pointless to build qemu-system-riscv32 on a rv64 host (or qemu-system-riscv64 on a rv32 host). Restrict meson to only build the correct binary, avoiding to waste ressources building unusable code.

[*] https://lore.kernel.org/qemu-devel/CAAhSdy2JeRHeeoEc1XKQhPO3aDz4YKeyQsPT4S8yKJcYTA+AiQ@mail.gmail.com/

Based-on: <[email protected]> "target/riscv: Allow building without TCG (KVM-only so far)"
https://lore.kernel.org/qemu-devel/[email protected]/

Philippe Mathieu-Daudé (2):
target/riscv: Only unify 'riscv32/64' -> 'riscv' for host cpu in meson target/riscv: Only build KVM guest with same wordsize as host

 meson.build | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)
Signature · 1 line
2.38.1
#1 lore raw

PATCH 1/2 target/riscv: Only unify 'riscv32/64' -> 'riscv' for host cpu in meson

We want to keep the ability to distinct between 32/64-bit host.

---
 meson.build | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
meson.build +4 -7
index fc3c14a810..649de244c6 100644
@@ -55,16 +55,11 @@ qapi_trace_events = []
 
 bsd_oses = ['gnu/kfreebsd', 'freebsd', 'netbsd', 'openbsd', 'dragonfly', 'darwin']
 supported_oses = ['windows', 'freebsd', 'netbsd', 'openbsd', 'darwin', 'sunos', 'linux']
-supported_cpus = ['ppc', 'ppc64', 's390x', 'riscv', 'x86', 'x86_64',
+supported_cpus = ['ppc', 'ppc64', 's390x', 'riscv32', 'riscv64', 'x86', 'x86_64',
   'arm', 'aarch64', 'loongarch64', 'mips', 'mips64', 'sparc64']
 
 cpu = host_machine.cpu_family()
 
-# Unify riscv* to a single family.
-if cpu in ['riscv32', 'riscv64']
-  cpu = 'riscv'
-endif
-
 target_dirs = config_host['TARGET_DIRS'].split()
 have_linux_user = false
 have_bsd_user = false
@@ -99,6 +94,8 @@ elif cpu == 'x86'
   host_arch = 'i386'
 elif cpu == 'mips64'
   host_arch = 'mips'
+elif cpu in ['riscv32', 'riscv64']
+  host_arch = 'riscv'
 else
   host_arch = cpu
 endif
@@ -113,7 +110,7 @@ elif cpu in ['ppc', 'ppc64']
   kvm_targets = ['ppc-softmmu', 'ppc64-softmmu']
 elif cpu in ['mips', 'mips64']
   kvm_targets = ['mips-softmmu', 'mipsel-softmmu', 'mips64-softmmu', 'mips64el-softmmu']
-elif cpu in ['riscv']
+elif cpu in ['riscv32', 'riscv64']
   kvm_targets = ['riscv32-softmmu', 'riscv64-softmmu']
 else
   kvm_targets = []
Signature · 1 line
2.38.1
#2 lore raw

PATCH 2/2 target/riscv: Only build KVM guest with same wordsize as host

In reply to Philippe Mathieu-Daudé

Per Anup Patel in [*]:

Quoted 5 lines

Currently, we only support running rv64 guest on rv64 host and rv32 guest on rv32 host.

In the future, we might support running rv32 guest on rv64 host but as of now we don't see a strong push for it.

Therefore, when only using the KVM accelerator it is pointless to build qemu-system-riscv32 on a rv64 host (or qemu-system-riscv64 on a rv32 host). Restrict meson to only build the correct binary, avoiding to waste ressources building unusable code.

[*] https://lore.kernel.org/qemu-devel/CAAhSdy2JeRHeeoEc1XKQhPO3aDz4YKeyQsPT4S8yKJcYTA+AiQ@mail.gmail.com/

---
 meson.build | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
meson.build +4 -2
index 649de244c6..a3ab614235 100644
@@ -110,8 +110,10 @@ elif cpu in ['ppc', 'ppc64']
   kvm_targets = ['ppc-softmmu', 'ppc64-softmmu']
 elif cpu in ['mips', 'mips64']
   kvm_targets = ['mips-softmmu', 'mipsel-softmmu', 'mips64-softmmu', 'mips64el-softmmu']
-elif cpu in ['riscv32', 'riscv64']
-  kvm_targets = ['riscv32-softmmu', 'riscv64-softmmu']
+elif cpu in ['riscv32']
+  kvm_targets = ['riscv32-softmmu']
+elif cpu in ['riscv64']
+  kvm_targets = ['riscv64-softmmu']
 else
   kvm_targets = []
 endif
Signature · 1 line
2.38.1
Reviewed-by on the v1 series
#3 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 19 lines · Philippe Mathieu-Daudé

Per Anup Patel in [*]:

Quoted 5 lines

Currently, we only support running rv64 guest on rv64 host and rv32 guest on rv32 host.

In the future, we might support running rv32 guest on rv64 host but as of now we don't see a strong push for it.

Therefore, when only using the KVM accelerator it is pointless to build qemu-system-riscv32 on a rv64 host (or qemu-system-riscv64 on a rv32 host). Restrict meson to only build the correct binary, avoiding to waste ressources building unusable code.

[*] https://lore.kernel.org/qemu-devel/CAAhSdy2JeRHeeoEc1XKQhPO3aDz4YKeyQsPT4S8yKJcYTA+AiQ@mail.gmail.com/

Based-on: <[email protected]> "target/riscv: Allow building without TCG (KVM-only so far)"
https://lore.kernel.org/qemu-devel/[email protected]/

Quoted 7 lines

Philippe Mathieu-Daudé (2):
target/riscv: Only unify 'riscv32/64' -> 'riscv' for host cpu in meson target/riscv: Only build KVM guest with same wordsize as host

  meson.build | 15 +++++++--------
  1 file changed, 7 insertions(+), 8 deletions(-)

r~

#4 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 13 lines · Philippe Mathieu-Daudé

Per Anup Patel in [*]:

Quoted 5 lines

Currently, we only support running rv64 guest on rv64 host and rv32 guest on rv32 host.

In the future, we might support running rv32 guest on rv64 host but as of now we don't see a strong push for it.

Therefore, when only using the KVM accelerator it is pointless to build qemu-system-riscv32 on a rv64 host (or qemu-system-riscv64 on a rv32 host). Restrict meson to only build the correct binary, avoiding to waste ressources building unusable code.

Quoted 5 lines

[*] https://lore.kernel.org/qemu-devel/CAAhSdy2JeRHeeoEc1XKQhPO3aDz4YKeyQsPT4S8yKJcYTA+AiQ@mail.gmail.com/

Based-on: <[email protected]> "target/riscv: Allow building without TCG (KVM-only so far)"
https://lore.kernel.org/qemu-devel/[email protected]/

Alistair: I just noticed there is no strict dependency with the other series (aimed for 8.2), so this can get merged for 8.1.

Reviewed-by on the v1 series
#5 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 16 lines · Philippe Mathieu-Daudé

Per Anup Patel in [*]:

Quoted 5 lines

Currently, we only support running rv64 guest on rv64 host and rv32 guest on rv32 host.

In the future, we might support running rv32 guest on rv64 host but as of now we don't see a strong push for it.

Therefore, when only using the KVM accelerator it is pointless to build qemu-system-riscv32 on a rv64 host (or qemu-system-riscv64 on a rv32 host). Restrict meson to only build the correct binary, avoiding to waste ressources building unusable code.

[*] https://lore.kernel.org/qemu-devel/CAAhSdy2JeRHeeoEc1XKQhPO3aDz4YKeyQsPT4S8yKJcYTA+AiQ@mail.gmail.com/

Quoted 7 lines

Based-on: <[email protected]> "target/riscv: Allow building without TCG (KVM-only so far)"
https://lore.kernel.org/qemu-devel/[email protected]/

Philippe Mathieu-Daudé (2):
target/riscv: Only unify 'riscv32/64' -> 'riscv' for host cpu in meson target/riscv: Only build KVM guest with same wordsize as host

Alistair

Quoted 8 lines
 meson.build | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

--
2.38.1

#6 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 16 lines · Philippe Mathieu-Daudé

Per Anup Patel in [*]:

Quoted 5 lines

Currently, we only support running rv64 guest on rv64 host and rv32 guest on rv32 host.

In the future, we might support running rv32 guest on rv64 host but as of now we don't see a strong push for it.

Therefore, when only using the KVM accelerator it is pointless to build qemu-system-riscv32 on a rv64 host (or qemu-system-riscv64 on a rv32 host). Restrict meson to only build the correct binary, avoiding to waste ressources building unusable code.

[*] https://lore.kernel.org/qemu-devel/CAAhSdy2JeRHeeoEc1XKQhPO3aDz4YKeyQsPT4S8yKJcYTA+AiQ@mail.gmail.com/

Quoted 7 lines

Based-on: <[email protected]> "target/riscv: Allow building without TCG (KVM-only so far)"
https://lore.kernel.org/qemu-devel/[email protected]/

Philippe Mathieu-Daudé (2):
target/riscv: Only unify 'riscv32/64' -> 'riscv' for host cpu in meson target/riscv: Only build KVM guest with same wordsize as host

Thanks!

Applied to riscv-to-apply.next

Alistair

Quoted 8 lines
 meson.build | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

--
2.38.1