Skip to contentSkip to conversation

multi-target 20261024

GIT PULL Applied Pierrick Bouvier 3 participants 25 messages Oct 24 – Oct 27

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

The following changes since commit d73149283205645625bfa9fe029cfb68e4c4a9ae:

Merge tag 'samuel-thibault' of https://people.debian.org/~sthibault/qemu into staging (2026-10-24 16:09:37 +0200)

are available in the Git repository at:

https://gitlab.com/p-b-o/qemu tags/pbouvier/pr/multi_target-20261024

for you to fetch changes up to 59f954f8277e80065b1286bfe89ca8861c08d1c5:

meson.build: list all remaining softmmu targets as comments (2026-10-24 17:36:09 +0000)

----------------------------------------------------------------
Changes:
- [PATCH v2 00/11] multi-target: prefix helpers with target prefix (Pierrick Bouvier <[email protected]>)

- [PATCH v3 0/9] multi-target: add riscv64-softmmu (Pierrick Bouvier <[email protected]>)

----------------------------------------------------------------
Pierrick Bouvier (20):
target/rx: define and call helpers using HELPER macro
tcg: introduce HELPER_INFO macro
target/sparc: define crypto helpers using HELPER macro
tcg: prefix helpers with target base architecture target/alpha: remove explicit target specific prefix target/hexagon: remove explicit target specific prefix target/hppa: remove explicit target specific prefix target/microblaze: remove explicit target specific prefix target/or1k: remove explicit target specific prefix target/rx: remove explicit target specific prefix target/tricore: remove explicit target specific prefix
target-info: add target_base_riscv
hw/riscv/virt: make machine available for riscv targets only test/unit/multi-target: check QOM types can be initialized with any target hw/riscv/virt: restrict scope of virt_is_acpi_enabled to this file target/riscv: rename virt_acpi_setup to riscv_virt_acpi_setup target/riscv/tcg: restrict tcg-accel-riscv-cpu to riscv targets target/riscv/kvm: restrict kvm-accel-riscv-cpu to riscv targets meson.build: add riscv64-softmmu to multi-target
meson.build: list all remaining softmmu targets as comments

 hw/riscv/virt-acpi-build.c         |  2 +-
 hw/riscv/virt.c                    | 14 +++++----
 include/exec/helper-gen-common.h   |  7 +++++
 include/exec/helper-gen.h.inc      | 48 +++++++++++++++---------------
 include/exec/helper-head.h.inc     |  8 ++++-
 include/exec/helper-info.c.inc     | 16 +++++-----
 include/exec/helper-proto-common.h |  7 +++++
 include/hw/riscv/virt.h            |  3 +-
 include/qemu/target-info.h         |  7 +++++
 meson.build                        | 20 +++++++++++++
 target-info.c                      | 11 +++++++
 target/alpha/fpu_helper.c          |  2 +-
 target/alpha/helper.h              |  2 +-
 target/alpha/translate.c           |  4 +--
 target/hexagon/gen_tcg.h           |  2 +-
 target/hexagon/gen_tcg_sys.h       |  2 +-
 target/hexagon/helper.h            |  4 +--
 target/hexagon/op_helper.c         |  4 +--
 target/hexagon/translate.c         |  4 +--
 target/hppa/helper.h               |  6 ++--
 target/hppa/op_helper.c            |  4 +--
 target/hppa/sys_helper.c           |  8 ++---
 target/hppa/translate.c            |  6 ++--
 target/microblaze/helper.h         | 10 +++----
 target/microblaze/op_helper.c      | 10 +++----
 target/microblaze/translate.c      | 10 +++----
 target/or1k/helper.h               |  2 +-
 target/or1k/interrupt_helper.c     |  2 +-
 target/or1k/translate.c            |  2 +-
 target/riscv/kvm/kvm-cpu.c         |  2 ++
 target/riscv/tcg/tcg-cpu.c         |  1 +
 target/rx/helper.h                 | 12 ++++----
 target/rx/op_helper.c              | 60 +++++++++++++++++++-------------------
 target/rx/translate.c              | 14 ++++-----
 target/sparc/crypto_helper.c       | 30 +++++++++----------
 target/tricore/fpu_helper.c        | 12 ++++----
 target/tricore/helper.h            | 14 ++++-----
 target/tricore/translate.c         | 14 ++++-----
 tests/unit/test-multi-target.c     | 34 ++++++++++++++++-----
 39 files changed, 250 insertions(+), 170 deletions(-)
#1 lore raw

[PULL 01/20] target/rx: define and call helpers using HELPER macro

In a upcoming commit, we'll prefix all helpers and helper_info with target prefix, to disambiguate symbols between targets. As a first step, we need to make sure all usages are using the existing HELPER macro.

---
 target/rx/op_helper.c | 52 +++++++++++++++++++++----------------------
 1 file changed, 26 insertions(+), 26 deletions(-)
target/rx/op_helper.c +26 -26
index 06841088ac0..5f4f0a14027 100644
@@ -46,17 +46,17 @@ static void _set_psw(CPURXState *env, uint32_t psw, uint32_t rte)
     }
 }
 
-void helper_set_psw(CPURXState *env, uint32_t psw)
+void HELPER(set_psw)(CPURXState *env, uint32_t psw)
 {
     _set_psw(env, psw, 0);
 }
 
-void helper_set_psw_rte(CPURXState *env, uint32_t psw)
+void HELPER(set_psw_rte)(CPURXState *env, uint32_t psw)
 {
     _set_psw(env, psw, 1);
 }
 
-uint32_t helper_pack_psw(CPURXState *env)
+uint32_t HELPER(pack_psw)(CPURXState *env)
 {
     return rx_cpu_pack_psw(env);
 }
@@ -120,7 +120,7 @@ static void update_fpsw(CPURXState *env, float32 ret, uintptr_t retaddr)
     }
 }
 
-void helper_set_fpsw(CPURXState *env, uint32_t val)
+void HELPER(set_fpsw)(CPURXState *env, uint32_t val)
 {
     static const int roundmode[] = {
         float_round_nearest_even,
@@ -139,7 +139,7 @@ void helper_set_fpsw(CPURXState *env, uint32_t val)
 }
 
 #define FLOATOP(op, func)                                           \
-    float32 helper_##op(CPURXState *env, float32 t0, float32 t1)    \
+    float32 HELPER(op)(CPURXState *env, float32 t0, float32 t1)     \
     {                                                               \
         float32 ret;                                                \
         ret = func(t0, t1, &env->fp_status);                        \
@@ -152,7 +152,7 @@ FLOATOP(rx_fsub, float32_sub)
 FLOATOP(rx_fmul, float32_mul)
 FLOATOP(rx_fdiv, float32_div)
 
-void helper_rx_fcmp(CPURXState *env, float32 t0, float32 t1)
+void HELPER(rx_fcmp)(CPURXState *env, float32 t0, float32 t1)
 {
     int st;
     st = float32_compare(t0, t1, &env->fp_status);
@@ -172,7 +172,7 @@ void helper_rx_fcmp(CPURXState *env, float32 t0, float32 t1)
     }
 }
 
-uint32_t helper_ftoi(CPURXState *env, float32 t0)
+uint32_t HELPER(ftoi)(CPURXState *env, float32 t0)
 {
     uint32_t ret;
     ret = float32_to_int32_round_to_zero(t0, &env->fp_status);
@@ -180,7 +180,7 @@ uint32_t helper_ftoi(CPURXState *env, float32 t0)
     return ret;
 }
 
-uint32_t helper_round(CPURXState *env, float32 t0)
+uint32_t HELPER(round)(CPURXState *env, float32 t0)
 {
     uint32_t ret;
     ret = float32_to_int32(t0, &env->fp_status);
@@ -188,7 +188,7 @@ uint32_t helper_round(CPURXState *env, float32 t0)
     return ret;
 }
 
-float32 helper_itof(CPURXState *env, uint32_t t0)
+float32 HELPER(itof)(CPURXState *env, uint32_t t0)
 {
     float32 ret;
     ret = int32_to_float32(t0, &env->fp_status);
@@ -197,7 +197,7 @@ float32 helper_itof(CPURXState *env, uint32_t t0)
 }
 
 /* string operations */
-void helper_scmpu(CPURXState *env)
+void HELPER(scmpu)(CPURXState *env)
 {
     uint8_t tmp0, tmp1;
     if (env->regs[3] == 0) {
@@ -234,7 +234,7 @@ static void (* const cpu_stfn[])(CPUArchState *env,
     cpu_stb_data_ra, cpu_stw_le_data_ra, cpu_stl_le_data_ra,
 };
 
-void helper_sstr(CPURXState *env, uint32_t sz)
+void HELPER(sstr)(CPURXState *env, uint32_t sz)
 {
     tcg_debug_assert(sz < 3);
     while (env->regs[3] != 0) {
@@ -266,23 +266,23 @@ static void smov(uint32_t mode, CPURXState *env)
     }
 }
 
-void helper_smovu(CPURXState *env)
+void HELPER(smovu)(CPURXState *env)
 {
     smov(OP_SMOVU, env);
 }
 
-void helper_smovf(CPURXState *env)
+void HELPER(smovf)(CPURXState *env)
 {
     smov(OP_SMOVF, env);
 }
 
-void helper_smovb(CPURXState *env)
+void HELPER(smovb)(CPURXState *env)
 {
     smov(OP_SMOVB, env);
 }
 
 
-void helper_suntil(CPURXState *env, uint32_t sz)
+void HELPER(suntil)(CPURXState *env, uint32_t sz)
 {
     uint32_t tmp;
     tcg_debug_assert(sz < 3);
@@ -301,7 +301,7 @@ void helper_suntil(CPURXState *env, uint32_t sz)
     env->psw_c = (tmp <= env->regs[2]);
 }
 
-void helper_swhile(CPURXState *env, uint32_t sz)
+void HELPER(swhile)(CPURXState *env, uint32_t sz)
 {
     uint32_t tmp;
     tcg_debug_assert(sz < 3);
@@ -321,7 +321,7 @@ void helper_swhile(CPURXState *env, uint32_t sz)
 }
 
 /* accumulator operations */
-void helper_rmpa(CPURXState *env, uint32_t sz)
+void HELPER(rmpa)(CPURXState *env, uint32_t sz)
 {
     uint64_t result_l, prev;
     int32_t result_h;
@@ -363,7 +363,7 @@ void helper_rmpa(CPURXState *env, uint32_t sz)
     env->regs[4] = result_l & 0xffffffff;
 }
 
-void helper_racw(CPURXState *env, uint32_t imm)
+void HELPER(racw)(CPURXState *env, uint32_t imm)
 {
     int64_t acc;
     acc = env->acc;
@@ -379,7 +379,7 @@ void helper_racw(CPURXState *env, uint32_t imm)
     env->acc = acc;
 }
 
-void helper_satr(CPURXState *env)
+void HELPER(satr)(CPURXState *env)
 {
     if (env->psw_o >> 31) {
         if ((int)env->psw_s < 0) {
@@ -395,7 +395,7 @@ void helper_satr(CPURXState *env)
 }
 
 /* div */
-uint32_t helper_div(CPURXState *env, uint32_t num, uint32_t den)
+uint32_t HELPER(div)(CPURXState *env, uint32_t num, uint32_t den)
 {
     uint32_t ret = num;
     if (!((num == INT_MIN && den == -1) || den == 0)) {
@@ -407,7 +407,7 @@ uint32_t helper_div(CPURXState *env, uint32_t num, uint32_t den)
     return ret;
 }
 
-uint32_t helper_rx_divu(CPURXState *env, uint32_t num, uint32_t den)
+uint32_t HELPER(rx_divu)(CPURXState *env, uint32_t num, uint32_t den)
 {
     uint32_t ret = num;
     if (den != 0) {
@@ -430,22 +430,22 @@ void raise_exception(CPURXState *env, int index,
     cpu_loop_exit_restore(cs, retaddr);
 }
 
-G_NORETURN void helper_raise_privilege_violation(CPURXState *env)
+G_NORETURN void HELPER(raise_privilege_violation)(CPURXState *env)
 {
     raise_exception(env, RX_EXCP_PRIVILEGE_VIOLATION, GETPC());
 }
 
-G_NORETURN void helper_raise_access_fault(CPURXState *env)
+G_NORETURN void HELPER(raise_access_fault)(CPURXState *env)
 {
     raise_exception(env, RX_EXCP_ACCESS, GETPC());
 }
 
-G_NORETURN void helper_raise_illegal_instruction(CPURXState *env)
+G_NORETURN void HELPER(raise_illegal_instruction)(CPURXState *env)
 {
     raise_exception(env, RX_EXCP_ILLEGAL_INSTRUCTION, GETPC());
 }
 
-G_NORETURN void helper_wait(CPURXState *env)
+G_NORETURN void HELPER(wait)(CPURXState *env)
 {
     CPUState *cs = env_cpu(env);
 
@@ -455,7 +455,7 @@ G_NORETURN void helper_wait(CPURXState *env)
     raise_exception(env, EXCP_HLT, 0);
 }
 
-G_NORETURN void helper_trap(CPURXState *env, uint32_t vec)
+G_NORETURN void HELPER(trap)(CPURXState *env, uint32_t vec)
 {
     raise_exception(env, RX_EXCP_TRAP_BASE + vec, 0);
 }
Signature · 1 line
2.43.0
#2 lore raw

[PULL 07/20] target/hppa: remove explicit target specific prefix

In reply to Pierrick Bouvier

Now that we have a generic mechanism to prefix all helpers, we can undo the recent changes that fixed conflicts between targets in multi-target set.

This reverts commit cd095f35b148f3fa0b2000a36af0c9efe2299806 "target/hppa: prefix helpers conflicting with other arch"

---
 target/hppa/helper.h     | 6 +++---
 target/hppa/op_helper.c  | 4 ++--
 target/hppa/sys_helper.c | 8 ++++----
 target/hppa/translate.c  | 6 +++---
 4 files changed, 12 insertions(+), 12 deletions(-)
target/hppa/helper.h +3 -3
index 8d7fa1ae348..8369855d78e 100644
@@ -1,4 +1,4 @@
-DEF_HELPER_2(hppa_excp, noreturn, env, int)
+DEF_HELPER_2(excp, noreturn, env, int)
 
 DEF_HELPER_FLAGS_3(stby_b, TCG_CALL_NO_WG, void, env, tl, tl)
 DEF_HELPER_FLAGS_3(stby_b_parallel, TCG_CALL_NO_WG, void, env, tl, tl)
@@ -82,8 +82,8 @@ DEF_HELPER_FLAGS_4(fmpynfadd_d, TCG_CALL_NO_RWG, i64, env, i64, i64, i64)
 DEF_HELPER_FLAGS_0(read_interval_timer, TCG_CALL_NO_RWG, tl)
 
 #ifndef CONFIG_USER_ONLY
-DEF_HELPER_1(hppa_halt, noreturn, env)
-DEF_HELPER_1(hppa_reset, noreturn, env)
+DEF_HELPER_1(halt, noreturn, env)
+DEF_HELPER_1(reset, noreturn, env)
 DEF_HELPER_1(rfi, void, env)
 DEF_HELPER_1(rfi_r, void, env)
 DEF_HELPER_FLAGS_2(b_gate_priv, TCG_CALL_NO_WG, i64, env, i64)
target/hppa/op_helper.c +2 -2
index ea0680aa9eb..ec7f2a48e4d 100644
@@ -30,7 +30,7 @@
 #include "user/page-protection.h"
 #endif
 
-G_NORETURN void HELPER(hppa_excp)(CPUHPPAState *env, int excp)
+G_NORETURN void HELPER(excp)(CPUHPPAState *env, int excp)
 {
     CPUState *cs = env_cpu(env);
 
@@ -341,7 +341,7 @@ target_ulong HELPER(probe)(CPUHPPAState *env, target_ulong addr,
         if (excp == EXCP_DTLB_MISS) {
             excp = EXCP_NA_DTLB_MISS;
         }
-        HELPER(hppa_excp)(env, excp);
+        HELPER(excp)(env, excp);
     }
     return (want & prot) != 0;
 #endif
target/hppa/sys_helper.c +4 -4
index ccfc2b48816..4a8bbf32591 100644
@@ -48,16 +48,16 @@ void HELPER(write_interval_timer)(CPUHPPAState *env, target_ulong val)
     timer_mod(cpu->alarm_timer, timeout);
 }
 
-void HELPER(hppa_halt)(CPUHPPAState *env)
+void HELPER(halt)(CPUHPPAState *env)
 {
     qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN);
-    HELPER(hppa_excp)(env, EXCP_HLT);
+    HELPER(excp)(env, EXCP_HLT);
 }
 
-void HELPER(hppa_reset)(CPUHPPAState *env)
+void HELPER(reset)(CPUHPPAState *env)
 {
     qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
-    HELPER(hppa_excp)(env, EXCP_HLT);
+    HELPER(excp)(env, EXCP_HLT);
 }
 
 target_ulong HELPER(swap_system_mask)(CPUHPPAState *env, target_ulong nsm)
target/hppa/translate.c +3 -3
index befdb58e9a6..41300c0dd73 100644
@@ -726,7 +726,7 @@ static void install_link(DisasContext *ctx, unsigned link, bool with_sr0)
 
 static void gen_excp_1(int exception)
 {
-    gen_helper_hppa_excp(tcg_env, tcg_constant_i32(exception));
+    gen_helper_excp(tcg_env, tcg_constant_i32(exception));
 }
 
 static void gen_excp(DisasContext *ctx, int exception)
@@ -2450,7 +2450,7 @@ static bool trans_halt(DisasContext *ctx, arg_halt *a)
 #ifndef CONFIG_USER_ONLY
     set_psw_xb(ctx, 0);
     nullify_over(ctx);
-    gen_helper_hppa_halt(tcg_env);
+    gen_helper_halt(tcg_env);
     ctx->base.is_jmp = DISAS_NORETURN;
     return nullify_end(ctx);
 #endif
@@ -2462,7 +2462,7 @@ static bool trans_reset(DisasContext *ctx, arg_reset *a)
 #ifndef CONFIG_USER_ONLY
     set_psw_xb(ctx, 0);
     nullify_over(ctx);
-    gen_helper_hppa_reset(tcg_env);
+    gen_helper_reset(tcg_env);
     ctx->base.is_jmp = DISAS_NORETURN;
     return nullify_end(ctx);
 #endif
Signature · 1 line
2.43.0
#3 lore raw

[PULL 04/20] tcg: prefix helpers with target base architecture

In reply to Pierrick Bouvier

Now we made sure all helpers and helper_info are defined and used using HELPER/HELPER_INFO macros, we are ready to introduce a target prefix.

We can't reuse TARGET_ARCH since it's not defined for common code, and it's also poisoned. So introduce a new TARGET_ARCH_PREFIX which is defined for all target code (whether it's common or target specific), and use it as prefix.

On some hosts (found it on sparc), predefined macros exist for the base architecture names we use, and their value is 1. (#define sparc 1). So, we can't use them directly or it would create a illformed identifier for function names. So to prevent any problem, use additional "target", which gives -DTARGET_ARCH_PREFIX=target_<TARGET_ARCH>.

Finally there is one last catch: beyond target helpers, tcg also has common helpers. For those ones, we want an empty prefix, since they are defined on tcg side and not target side.

With this, we now have target prefixed helpers, preventing symbol conflicts when linking targets together.

---
 include/exec/helper-gen-common.h   | 7 +++++++
 include/exec/helper-head.h.inc     | 9 +++++++--
 include/exec/helper-proto-common.h | 7 +++++++
 meson.build                        | 2 ++
 4 files changed, 23 insertions(+), 2 deletions(-)
include/exec/helper-gen-common.h +7 -0
index 834590dc4e5..12e220c8ce9 100644
@@ -7,8 +7,15 @@
 #ifndef HELPER_GEN_COMMON_H
 #define HELPER_GEN_COMMON_H
 
+#include "exec/helper-head.h.inc"
+
+/* Common helpers are built once, without a target prefix. */
+#pragma push_macro("HELPER_PREFIX")
+#undef HELPER_PREFIX
+#define HELPER_PREFIX
 #define HELPER_H "accel/tcg/tcg-runtime.h"
 #include "exec/helper-gen.h.inc"
 #undef  HELPER_H
+#pragma pop_macro("HELPER_PREFIX")
 
 #endif /* HELPER_GEN_COMMON_H */
include/exec/helper-head.h.inc +7 -2
index be1d79cf017..fd03b1f1704 100644
@@ -8,8 +8,13 @@
 
 #include "fpu/softfloat-types.h"
 
-#define HELPER(name) glue(helper_, name)
-#define HELPER_INFO(name) glue(helper_info_, name)
+#ifdef TARGET_ARCH_PREFIX
+ #define HELPER_PREFIX glue(TARGET_ARCH_PREFIX, _)
+#else
+ #define HELPER_PREFIX
+#endif
+#define HELPER(name) glue(HELPER_PREFIX, glue(helper_, name))
+#define HELPER_INFO(name) glue(HELPER_PREFIX, glue(helper_info_, name))
 
 /* Some types that make sense in C, but not for TCG.  */
 #define dh_alias_i32 i32
include/exec/helper-proto-common.h +7 -0
index 76e6c25becb..4433ba47a82 100644
@@ -9,9 +9,16 @@
 
 #include "qemu/atomic128.h"  /* for HAVE_CMPXCHG128 */
 
+#include "exec/helper-head.h.inc"
+
+/* Common helpers are built once, without a target prefix. */
+#pragma push_macro("HELPER_PREFIX")
+#undef HELPER_PREFIX
+#define HELPER_PREFIX
 #define HELPER_H "accel/tcg/tcg-runtime.h"
 #include "exec/helper-proto.h.inc"
 #undef  HELPER_H
+#pragma pop_macro("HELPER_PREFIX")
 
 #include "accel/tcg/getpc.h"
 
meson.build +2 -0
index 4f29bc6cc33..ad537e0c18f 100644
@@ -4167,6 +4167,7 @@ foreach target_base_arch, config_base_arch : config_base_arch_mak
   # prevent common code to access cpu compile time definition,
   # but still allow access to cpu.h
   target_c_args = ['-DCPU_DEFS_H']
+  target_c_args += ['-DTARGET_ARCH_PREFIX=target_' + target_base_arch.to_lower()]
   target_system_c_args = target_c_args + ['-DCOMPILING_SYSTEM_VS_USER', '-DCONFIG_SOFTMMU']
 
   if target_base_arch in target_common_arch
@@ -4290,6 +4291,7 @@ foreach target : target_dirs
   arch_deps = []
   c_args = ['-DCOMPILING_PER_TARGET',
             '-DCONFIG_TARGET="@[email protected]"'.format(target),
+            '-DTARGET_ARCH_PREFIX=target_' + target_base_arch.to_lower(),
   ]
   link_args = emulator_link_args
 
Signature · 1 line
2.43.0
#4 lore raw

[PULL 17/20] target/riscv/tcg: restrict tcg-accel-riscv-cpu to riscv targets

In reply to Pierrick Bouvier
$ ./build/tests/unit/test-multi-target
Type 'tcg-accel-riscv-cpu' is missing its parent 'accel-riscv-cpu'
Aborted

Parent type is conditionally registered from current target:
register_accel_target_type uses '"accel-" + target_cpu_type()' as type name. Multi-target test takes the first target available, which is not riscv in current state.

---
 target/riscv/tcg/tcg-cpu.c | 1 +
 1 file changed, 1 insertion(+)
target/riscv/tcg/tcg-cpu.c +1 -0
index 80c04636175..cbff18afb5c 100644
@@ -1748,6 +1748,7 @@ static const TypeInfo riscv_tcg_cpu_accel_type_info = {
 
     .parent = TYPE_ACCEL_CPU,
     .class_init = riscv_tcg_cpu_accel_class_init,
+    .is_available = target_base_riscv,
     .abstract = true,
 };
 
Signature · 1 line
2.43.0
#5 lore raw

[PULL 06/20] target/hexagon: remove explicit target specific prefix

In reply to Pierrick Bouvier

Now that we have a generic mechanism to prefix all helpers, we can undo the recent changes that fixed conflicts between targets in multi-target set.

This reverts commit 086150a223a6dfeae85e8bb925c5df0ca3061ed5 "target/hexagon: prefix helpers conflicting with other arch"

---
 target/hexagon/gen_tcg.h     | 2 +-
 target/hexagon/gen_tcg_sys.h | 2 +-
 target/hexagon/helper.h      | 4 ++--
 target/hexagon/op_helper.c   | 4 ++--
 target/hexagon/translate.c   | 4 ++--
 5 files changed, 8 insertions(+), 8 deletions(-)
target/hexagon/gen_tcg.h +1 -1
index ed05f97efed..80d8a7b6bac 100644
@@ -1135,7 +1135,7 @@
 #define fGEN_TCG_J2_pause(SHORTCODE) \
     do { \
         uiV = uiV; \
-        gen_helper_hexagon_raise_exception(tcg_env, \
+        gen_helper_raise_exception(tcg_env, \
             tcg_constant_i32(EXCP_YIELD), \
             tcg_constant_i32(ctx->next_PC)); \
     } while (0)
target/hexagon/gen_tcg_sys.h +1 -1
index 3760b671adf..413ccc97f7b 100644
@@ -80,7 +80,7 @@
 #define fGEN_TCG_Y2_wait(SHORTCODE) \
     do { \
         RsV = RsV; \
-        gen_helper_hexagon_wait(tcg_env); \
+        gen_helper_wait(tcg_env); \
     } while (0)
 
 #define fGEN_TCG_Y2_resume(SHORTCODE) \
target/hexagon/helper.h +2 -2
index 28591417040..47958c48ea9 100644
@@ -18,7 +18,7 @@
 #include "internal.h"
 #include "helper_protos_generated.h.inc"
 
-DEF_HELPER_FLAGS_3(hexagon_raise_exception, TCG_CALL_NO_RETURN, noreturn, env, i32, i32)
+DEF_HELPER_FLAGS_3(raise_exception, TCG_CALL_NO_RETURN, noreturn, env, i32, i32)
 DEF_HELPER_2(commit_store, void, env, int)
 DEF_HELPER_3(gather_store, void, env, i32, int)
 DEF_HELPER_1(commit_hvx_stores, void, env)
@@ -138,7 +138,7 @@ DEF_HELPER_3(sreg_write_masked, void, env, i32, i32)
 DEF_HELPER_3(setprio, void, env, i32, i32)
 DEF_HELPER_2(start, void, env, i32)
 DEF_HELPER_1(stop, void, env)
-DEF_HELPER_1(hexagon_wait, void, env)
+DEF_HELPER_1(wait, void, env)
 DEF_HELPER_2(resume, void, env, i32)
 DEF_HELPER_1(resched, void, env)
 DEF_HELPER_3(modify_ssr, void, env, i32, i32)
target/hexagon/op_helper.c +2 -2
index 9850dc07289..82d38dc0b08 100644
@@ -93,7 +93,7 @@ G_NORETURN void hexagon_raise_exception_err(CPUHexagonState *env,
     do_raise_exception(env, exception, pc, 0);
 }
 
-G_NORETURN void HELPER(hexagon_raise_exception)(CPUHexagonState *env, uint32_t excp,
+G_NORETURN void HELPER(raise_exception)(CPUHexagonState *env, uint32_t excp,
                                         uint32_t PC)
 {
     hexagon_raise_exception_err(env, excp, PC);
@@ -1839,7 +1839,7 @@ void HELPER(resched)(CPUHexagonState *env)
     resched(env);
 }
 
-void HELPER(hexagon_wait)(CPUHexagonState *env)
+void HELPER(wait)(CPUHexagonState *env)
 {
     BQL_LOCK_GUARD();
 
target/hexagon/translate.c +2 -2
index 2c18f5eebff..e2a5038a1a5 100644
@@ -139,7 +139,7 @@ intptr_t ctx_tmp_vreg_off(DisasContext *ctx, int regnum,
 static void gen_precise_exception(int cause, uint32_t PC)
 {
     tcg_gen_movi_i32(hex_cause_code, cause);
-    gen_helper_hexagon_raise_exception(tcg_env, tcg_constant_i32(HEX_EVENT_PRECISE),
+    gen_helper_raise_exception(tcg_env, tcg_constant_i32(HEX_EVENT_PRECISE),
                                tcg_constant_i32(PC));
 }
 
@@ -1146,7 +1146,7 @@ static void check_imprecise_exception(DisasContext *ctx)
     TCGLabel *label = gen_new_label();
 
     tcg_gen_brcondi_tl(TCG_COND_EQ, hex_imprecise_exception, 0, label);
-    gen_helper_hexagon_raise_exception(tcg_env, hex_imprecise_exception, PC);
+    gen_helper_raise_exception(tcg_env, hex_imprecise_exception, PC);
     gen_set_label(label);
 }
 #endif
Signature · 1 line
2.43.0
#6 lore raw

[PULL 02/20] tcg: introduce HELPER_INFO macro

In reply to Pierrick Bouvier

In next commit, we'll prefix all helpers and helper_info with target base architecture. Make sure helper_info symbol name is defined in a single place before that.

---
 include/exec/helper-gen.h.inc  | 48 +++++++++++++++++-----------------
 include/exec/helper-head.h.inc |  1 +
 include/exec/helper-info.c.inc | 16 ++++++------
 3 files changed, 33 insertions(+), 32 deletions(-)
include/exec/helper-gen.h.inc +24 -24
index dabe138e205..95715bde1ef 100644
@@ -11,88 +11,88 @@
 #include "exec/helper-head.h.inc"
 
 #define DEF_HELPER_FLAGS_0(name, flags, ret)                            \
-extern TCGHelperInfo glue(helper_info_, name);                          \
+extern TCGHelperInfo HELPER_INFO(name);                                 \
 static inline void glue(gen_helper_, name)(dh_retvar_decl0(ret))        \
 {                                                                       \
-    tcg_gen_call0(glue(helper_info_,name).func,                         \
-                  &glue(helper_info_,name), dh_retvar(ret));            \
+    tcg_gen_call0(HELPER_INFO(name).func,                               \
+                  &HELPER_INFO(name), dh_retvar(ret));                  \
 }
 
 #define DEF_HELPER_FLAGS_1(name, flags, ret, t1)                        \
-extern TCGHelperInfo glue(helper_info_, name);                          \
+extern TCGHelperInfo HELPER_INFO(name);                                 \
 static inline void glue(gen_helper_, name)(dh_retvar_decl(ret)          \
     dh_arg_decl(t1, 1))                                                 \
 {                                                                       \
-    tcg_gen_call1(glue(helper_info_,name).func,                         \
-                  &glue(helper_info_,name), dh_retvar(ret),             \
+    tcg_gen_call1(HELPER_INFO(name).func,                               \
+                  &HELPER_INFO(name), dh_retvar(ret),                   \
                   dh_arg(t1, 1));                                       \
 }
 
 #define DEF_HELPER_FLAGS_2(name, flags, ret, t1, t2)                    \
-extern TCGHelperInfo glue(helper_info_, name);                          \
+extern TCGHelperInfo HELPER_INFO(name);                                 \
 static inline void glue(gen_helper_, name)(dh_retvar_decl(ret)          \
     dh_arg_decl(t1, 1), dh_arg_decl(t2, 2))                             \
 {                                                                       \
-    tcg_gen_call2(glue(helper_info_,name).func,                         \
-                  &glue(helper_info_,name), dh_retvar(ret),             \
+    tcg_gen_call2(HELPER_INFO(name).func,                               \
+                  &HELPER_INFO(name), dh_retvar(ret),                   \
                   dh_arg(t1, 1), dh_arg(t2, 2));                        \
 }
 
 #define DEF_HELPER_FLAGS_3(name, flags, ret, t1, t2, t3)                \
-extern TCGHelperInfo glue(helper_info_, name);                          \
+extern TCGHelperInfo HELPER_INFO(name);                                 \
 static inline void glue(gen_helper_, name)(dh_retvar_decl(ret)          \
     dh_arg_decl(t1, 1), dh_arg_decl(t2, 2), dh_arg_decl(t3, 3))         \
 {                                                                       \
-    tcg_gen_call3(glue(helper_info_,name).func,                         \
-                  &glue(helper_info_,name), dh_retvar(ret),             \
+    tcg_gen_call3(HELPER_INFO(name).func,                               \
+                  &HELPER_INFO(name), dh_retvar(ret),                   \
                   dh_arg(t1, 1), dh_arg(t2, 2), dh_arg(t3, 3));         \
 }
 
 #define DEF_HELPER_FLAGS_4(name, flags, ret, t1, t2, t3, t4)            \
-extern TCGHelperInfo glue(helper_info_, name);                          \
+extern TCGHelperInfo HELPER_INFO(name);                                 \
 static inline void glue(gen_helper_, name)(dh_retvar_decl(ret)          \
     dh_arg_decl(t1, 1), dh_arg_decl(t2, 2),                             \
     dh_arg_decl(t3, 3), dh_arg_decl(t4, 4))                             \
 {                                                                       \
-    tcg_gen_call4(glue(helper_info_,name).func,                         \
-                  &glue(helper_info_,name), dh_retvar(ret),             \
+    tcg_gen_call4(HELPER_INFO(name).func,                               \
+                  &HELPER_INFO(name), dh_retvar(ret),                   \
                   dh_arg(t1, 1), dh_arg(t2, 2),                         \
                   dh_arg(t3, 3), dh_arg(t4, 4));                        \
 }
 
 #define DEF_HELPER_FLAGS_5(name, flags, ret, t1, t2, t3, t4, t5)        \
-extern TCGHelperInfo glue(helper_info_, name);                          \
+extern TCGHelperInfo HELPER_INFO(name);                                 \
 static inline void glue(gen_helper_, name)(dh_retvar_decl(ret)          \
     dh_arg_decl(t1, 1), dh_arg_decl(t2, 2), dh_arg_decl(t3, 3),         \
     dh_arg_decl(t4, 4), dh_arg_decl(t5, 5))                             \
 {                                                                       \
-    tcg_gen_call5(glue(helper_info_,name).func,                         \
-                  &glue(helper_info_,name), dh_retvar(ret),             \
+    tcg_gen_call5(HELPER_INFO(name).func,                               \
+                  &HELPER_INFO(name), dh_retvar(ret),                   \
                   dh_arg(t1, 1), dh_arg(t2, 2), dh_arg(t3, 3),          \
                   dh_arg(t4, 4), dh_arg(t5, 5));                        \
 }
 
 #define DEF_HELPER_FLAGS_6(name, flags, ret, t1, t2, t3, t4, t5, t6)    \
-extern TCGHelperInfo glue(helper_info_, name);                          \
+extern TCGHelperInfo HELPER_INFO(name);                                 \
 static inline void glue(gen_helper_, name)(dh_retvar_decl(ret)          \
     dh_arg_decl(t1, 1), dh_arg_decl(t2, 2), dh_arg_decl(t3, 3),         \
     dh_arg_decl(t4, 4), dh_arg_decl(t5, 5), dh_arg_decl(t6, 6))         \
 {                                                                       \
-    tcg_gen_call6(glue(helper_info_,name).func,                         \
-                  &glue(helper_info_,name), dh_retvar(ret),             \
+    tcg_gen_call6(HELPER_INFO(name).func,                               \
+                  &HELPER_INFO(name), dh_retvar(ret),                   \
                   dh_arg(t1, 1), dh_arg(t2, 2), dh_arg(t3, 3),          \
                   dh_arg(t4, 4), dh_arg(t5, 5), dh_arg(t6, 6));         \
 }
 
 #define DEF_HELPER_FLAGS_7(name, flags, ret, t1, t2, t3, t4, t5, t6, t7)\
-extern TCGHelperInfo glue(helper_info_, name);                          \
+extern TCGHelperInfo HELPER_INFO(name);                                 \
 static inline void glue(gen_helper_, name)(dh_retvar_decl(ret)          \
     dh_arg_decl(t1, 1), dh_arg_decl(t2, 2), dh_arg_decl(t3, 3),         \
     dh_arg_decl(t4, 4), dh_arg_decl(t5, 5), dh_arg_decl(t6, 6),         \
     dh_arg_decl(t7, 7))                                                 \
 {                                                                       \
-    tcg_gen_call7(glue(helper_info_,name).func,                         \
-                  &glue(helper_info_,name), dh_retvar(ret),             \
+    tcg_gen_call7(HELPER_INFO(name).func,                               \
+                  &HELPER_INFO(name), dh_retvar(ret),                   \
                   dh_arg(t1, 1), dh_arg(t2, 2), dh_arg(t3, 3),          \
                   dh_arg(t4, 4), dh_arg(t5, 5), dh_arg(t6, 6),          \
                   dh_arg(t7, 7));                                       \
include/exec/helper-head.h.inc +1 -0
index 7dec5f5b067..be1d79cf017 100644
@@ -9,6 +9,7 @@
 #include "fpu/softfloat-types.h"
 
 #define HELPER(name) glue(helper_, name)
+#define HELPER_INFO(name) glue(helper_info_, name)
 
 /* Some types that make sense in C, but not for TCG.  */
 #define dh_alias_i32 i32
include/exec/helper-info.c.inc +8 -8
index c551736d49f..4e1ab61e5ce 100644
@@ -16,21 +16,21 @@
 #define str(s) #s
 
 #define DEF_HELPER_FLAGS_0(NAME, FLAGS, RET)                            \
-    TCGHelperInfo glue(helper_info_, NAME) = {                          \
+    TCGHelperInfo HELPER_INFO(NAME) = {                                 \
         .func = HELPER(NAME), .name = str(NAME),                        \
         .flags = FLAGS | dh_callflag(RET),                              \
         .typemask = dh_typemask(RET, 0)                                 \
     };
 
 #define DEF_HELPER_FLAGS_1(NAME, FLAGS, RET, T1)                        \
-    TCGHelperInfo glue(helper_info_, NAME) = {                          \
+    TCGHelperInfo HELPER_INFO(NAME) = {                                 \
         .func = HELPER(NAME), .name = str(NAME),                        \
         .flags = FLAGS | dh_callflag(RET),                              \
         .typemask = dh_typemask(RET, 0) | dh_typemask(T1, 1)            \
     };
 
 #define DEF_HELPER_FLAGS_2(NAME, FLAGS, RET, T1, T2)                    \
-    TCGHelperInfo glue(helper_info_, NAME) = {                          \
+    TCGHelperInfo HELPER_INFO(NAME) = {                                 \
         .func = HELPER(NAME), .name = str(NAME),                        \
         .flags = FLAGS | dh_callflag(RET),                              \
         .typemask = dh_typemask(RET, 0) | dh_typemask(T1, 1)            \
@@ -38,7 +38,7 @@
     };
 
 #define DEF_HELPER_FLAGS_3(NAME, FLAGS, RET, T1, T2, T3)                \
-    TCGHelperInfo glue(helper_info_, NAME) = {                          \
+    TCGHelperInfo HELPER_INFO(NAME) = {                                 \
         .func = HELPER(NAME), .name = str(NAME),                        \
         .flags = FLAGS | dh_callflag(RET),                              \
         .typemask = dh_typemask(RET, 0) | dh_typemask(T1, 1)            \
@@ -46,7 +46,7 @@
     };
 
 #define DEF_HELPER_FLAGS_4(NAME, FLAGS, RET, T1, T2, T3, T4)            \
-    TCGHelperInfo glue(helper_info_, NAME) = {                          \
+    TCGHelperInfo HELPER_INFO(NAME) = {                                 \
         .func = HELPER(NAME), .name = str(NAME),                        \
         .flags = FLAGS | dh_callflag(RET),                              \
         .typemask = dh_typemask(RET, 0) | dh_typemask(T1, 1)            \
@@ -55,7 +55,7 @@
     };
 
 #define DEF_HELPER_FLAGS_5(NAME, FLAGS, RET, T1, T2, T3, T4, T5)        \
-    TCGHelperInfo glue(helper_info_, NAME) = {                          \
+    TCGHelperInfo HELPER_INFO(NAME) = {                                 \
         .func = HELPER(NAME), .name = str(NAME),                        \
         .flags = FLAGS | dh_callflag(RET),                              \
         .typemask = dh_typemask(RET, 0) | dh_typemask(T1, 1)            \
@@ -64,7 +64,7 @@
     };
 
 #define DEF_HELPER_FLAGS_6(NAME, FLAGS, RET, T1, T2, T3, T4, T5, T6)    \
-    TCGHelperInfo glue(helper_info_, NAME) = {                          \
+    TCGHelperInfo HELPER_INFO(NAME) = {                                 \
         .func = HELPER(NAME), .name = str(NAME),                        \
         .flags = FLAGS | dh_callflag(RET),                              \
         .typemask = dh_typemask(RET, 0) | dh_typemask(T1, 1)            \
@@ -74,7 +74,7 @@
     };
 
 #define DEF_HELPER_FLAGS_7(NAME, FLAGS, RET, T1, T2, T3, T4, T5, T6, T7) \
-    TCGHelperInfo glue(helper_info_, NAME) = {                          \
+    TCGHelperInfo HELPER_INFO(NAME) = {                                 \
         .func = HELPER(NAME), .name = str(NAME),                        \
         .flags = FLAGS | dh_callflag(RET),                              \
         .typemask = dh_typemask(RET, 0) | dh_typemask(T1, 1)            \
Signature · 1 line
2.43.0
#7 lore raw

[PULL 18/20] target/riscv/kvm: restrict kvm-accel-riscv-cpu to riscv targets

In reply to Pierrick Bouvier

On riscv hosts:

$ ./build/tests/unit/test-multi-target
Type 'kvm-accel-riscv-cpu' is missing its parent 'accel-riscv-cpu'
Aborted

Parent type is conditionally registered from current target:
register_accel_target_type uses '"accel-" + target_cpu_type()' as type name. Thus, accelerator specific cpu types must only be registered for riscv targets.

---
 target/riscv/kvm/kvm-cpu.c | 2 ++
 1 file changed, 2 insertions(+)
target/riscv/kvm/kvm-cpu.c +2 -0
index 45ad5e1525a..f28d9115c82 100644
@@ -26,6 +26,7 @@
 #include "qapi/error.h"
 #include "qemu/error-report.h"
 #include "qemu/main-loop.h"
+#include "qemu/target-info.h"
 #include "qapi/visitor.h"
 #include "system/system.h"
 #include "system/kvm.h"
@@ -2208,6 +2209,7 @@ static const TypeInfo kvm_cpu_accel_type_info = {
 
     .parent = TYPE_ACCEL_CPU,
     .class_init = kvm_cpu_accel_class_init,
+    .is_available = target_base_riscv,
     .abstract = true,
 };
 static void kvm_cpu_accel_register_types(void)
Signature · 1 line
2.43.0
#8 lore raw

Re: [PULL 18/20] target/riscv/kvm: restrict kvm-accel-riscv-cpu to riscv targets

Hi Pierrick

Sorry to bother, but this has not Review-By yet, is that reviewed by others offline?

Quoted 41 lines · Pierrick Bouvier

On riscv hosts:

$ ./build/tests/unit/test-multi-target
Type 'kvm-accel-riscv-cpu' is missing its parent 'accel-riscv-cpu'
Aborted

Parent type is conditionally registered from current target:
register_accel_target_type uses '"accel-" + target_cpu_type()' as type name. Thus, accelerator specific cpu types must only be registered for riscv targets.

---
 target/riscv/kvm/kvm-cpu.c | 2 ++
 1 file changed, 2 insertions(+)
target/riscv/kvm/kvm-cpu.c +2 -1
index 45ad5e1525a..f28d9115c82 100644
@@ -26,6 +26,7 @@
 #include "qapi/error.h"
 #include "qemu/error-report.h"
 #include "qemu/main-loop.h"
+#include "qemu/target-info.h"
 #include "qapi/visitor.h"
 #include "system/system.h"
 #include "system/kvm.h"
@@ -2208,6 +2209,7 @@ static const TypeInfo kvm_cpu_accel_type_info = {
 
     .parent = TYPE_ACCEL_CPU,
     .class_init = kvm_cpu_accel_class_init,
+    .is_available = target_base_riscv,
     .abstract = true,
 };
 static void kvm_cpu_accel_register_types(void)
--

2.43.0

Signature · 6 lines
         此致
礼
罗勇刚
Yours
    sincerely,
Yonggang Luo
#9 lore raw

Re: [PULL 18/20] target/riscv/kvm: restrict kvm-accel-riscv-cpu to riscv targets

Quoted 5 lines · Yonggang Luo

Hi Pierrick

Sorry to bother, but this has not Review-By yet, is that reviewed by others offline?

This pattern has been reviewed-by for tcg accel cpu, and I would like to move on with this series.

I saw your answer, and mentioned previously I would ignore from now on any message with inline patches or external links to branches or patches. So that's why I didn't answer. If you want to send a change, feel free to post a series with this change and discuss it there.

Regards,
Pierrick

#10 lore raw

Re: [PULL 18/20] target/riscv/kvm: restrict kvm-accel-riscv-cpu to riscv targets

Quoted 8 lines · Pierrick Bouvier
Quoted 5 lines · Yonggang Luo

Hi Pierrick

Sorry to bother, but this has not Review-By yet, is that reviewed by others offline?

Quoted 8 lines

This pattern has been reviewed-by for tcg accel cpu, and I would like to move on with this series.

I saw your answer, and mentioned previously I would ignore from now on any message with inline patches or external links to branches or patches. So that's why I didn't answer.
If you want to send a change, feel free to post a series with this change and discuss it there.

Hi Pierrick
Sorry for the late response, I am working on other things.
I am still learning how to contribute with QEMU community's style, I am hesitate to send new patches because I received too much negative feedback, I need to learn
how to send them(the patches) so it's easily accepted. I also received you email about
suggest to me how to send patches properly( I am still studying and learning on it).
I just learned not to "do external links to branches or patches.", and the "inline patches"
I have already avoided.

About the " external links", I have seen in other patches, misleading me that I thought
it's fine to do " external links".

Quoted 3 lines

Regards,
Pierrick

Signature · 6 lines
         此致
礼
罗勇刚
Yours
    sincerely,
Yonggang Luo
#11 lore raw

[PULL 11/20] target/tricore: remove explicit target specific prefix

In reply to Pierrick Bouvier

Now that we have a generic mechanism to prefix all helpers, we can undo the recent changes that fixed conflicts between targets in multi-target set.

This reverts commit 7858012634be7b987d9cb4c4520e55ccffedb2db "target/tricore: prefix helpers conflicting with other arch"

---
 target/tricore/fpu_helper.c | 12 ++++++------
 target/tricore/helper.h     | 14 +++++++-------
 target/tricore/translate.c  | 14 +++++++-------
 3 files changed, 20 insertions(+), 20 deletions(-)
target/tricore/fpu_helper.c +6 -6
index 9d323a9b664..81fec300ff9 100644
@@ -118,7 +118,7 @@ static void f_update_psw_flags(CPUTriCoreState *env, uint8_t flags)
 }
 
 #define FADD_SUB(op)                                                           \
-uint32_t HELPER(tricore_f##op)(CPUTriCoreState *env, uint32_t r1, uint32_t r2) \
+uint32_t HELPER(f##op)(CPUTriCoreState *env, uint32_t r1, uint32_t r2)         \
 {                                                                              \
     float32 arg1 = make_float32(r1);                                           \
     float32 arg2 = make_float32(r2);                                           \
@@ -144,7 +144,7 @@ uint32_t HELPER(tricore_f##op)(CPUTriCoreState *env, uint32_t r1, uint32_t r2) \
 FADD_SUB(add)
 FADD_SUB(sub)
 
-uint32_t HELPER(tricore_fmul)(CPUTriCoreState *env, uint32_t r1, uint32_t r2)
+uint32_t HELPER(fmul)(CPUTriCoreState *env, uint32_t r1, uint32_t r2)
 {
     uint32_t flags;
     float32 arg1 = make_float32(r1);
@@ -251,7 +251,7 @@ uint32_t HELPER(qseed)(CPUTriCoreState *env, uint32_t r1)
     return (uint32_t) result;
 }
 
-uint32_t HELPER(tricore_fdiv)(CPUTriCoreState *env, uint32_t r1, uint32_t r2)
+uint32_t HELPER(fdiv)(CPUTriCoreState *env, uint32_t r1, uint32_t r2)
 {
     uint32_t flags;
     float32 arg1 = make_float32(r1);
@@ -331,7 +331,7 @@ uint32_t HELPER(fmsub)(CPUTriCoreState *env, uint32_t r1,
     return (uint32_t)f_result;
 }
 
-uint32_t HELPER(tricore_fcmp)(CPUTriCoreState *env, uint32_t r1, uint32_t r2)
+uint32_t HELPER(fcmp)(CPUTriCoreState *env, uint32_t r1, uint32_t r2)
 {
     uint32_t result, flags;
     float32 arg1 = make_float32(r1);
@@ -354,7 +354,7 @@ uint32_t HELPER(tricore_fcmp)(CPUTriCoreState *env, uint32_t r1, uint32_t r2)
     return result;
 }
 
-uint32_t HELPER(tricore_ftoi)(CPUTriCoreState *env, uint32_t arg)
+uint32_t HELPER(ftoi)(CPUTriCoreState *env, uint32_t arg)
 {
     float32 f_arg = make_float32(arg);
     int32_t result, flags;
@@ -447,7 +447,7 @@ uint32_t HELPER(ftohp)(CPUTriCoreState *env, uint32_t arg)
     return result;
 }
 
-uint32_t HELPER(tricore_itof)(CPUTriCoreState *env, uint32_t arg)
+uint32_t HELPER(itof)(CPUTriCoreState *env, uint32_t arg)
 {
     float32 f_result;
     uint32_t flags;
target/tricore/helper.h +7 -7
index 6073fd70379..1d97d078b00 100644
@@ -102,18 +102,18 @@ DEF_HELPER_FLAGS_1(parity, TCG_CALL_NO_RWG_SE, i32, i32)
 /* float */
 DEF_HELPER_FLAGS_4(pack, TCG_CALL_NO_RWG_SE, i32, i32, i32, i32, i32)
 DEF_HELPER_1(unpack, i64, i32)
-DEF_HELPER_3(tricore_fadd, i32, env, i32, i32)
-DEF_HELPER_3(tricore_fsub, i32, env, i32, i32)
-DEF_HELPER_3(tricore_fmul, i32, env, i32, i32)
-DEF_HELPER_3(tricore_fdiv, i32, env, i32, i32)
+DEF_HELPER_3(fadd, i32, env, i32, i32)
+DEF_HELPER_3(fsub, i32, env, i32, i32)
+DEF_HELPER_3(fmul, i32, env, i32, i32)
+DEF_HELPER_3(fdiv, i32, env, i32, i32)
 DEF_HELPER_4(fmadd, i32, env, i32, i32, i32)
 DEF_HELPER_4(fmsub, i32, env, i32, i32, i32)
-DEF_HELPER_3(tricore_fcmp, i32, env, i32, i32)
+DEF_HELPER_3(fcmp, i32, env, i32, i32)
 DEF_HELPER_2(qseed, i32, env, i32)
-DEF_HELPER_2(tricore_ftoi, i32, env, i32)
+DEF_HELPER_2(ftoi, i32, env, i32)
 DEF_HELPER_2(ftohp, i32, env, i32)
 DEF_HELPER_2(hptof, i32, env, i32)
-DEF_HELPER_2(tricore_itof, i32, env, i32)
+DEF_HELPER_2(itof, i32, env, i32)
 DEF_HELPER_2(utof, i32, env, i32)
 DEF_HELPER_2(ftoiz, i32, env, i32)
 DEF_HELPER_2(ftou, i32, env, i32)
target/tricore/translate.c +7 -7
index 81db388e5ee..8cd6b58f66b 100644
@@ -6290,10 +6290,10 @@ static void decode_rr_divide(DisasContext *ctx)
         }
         break;
     case OPC2_32_RR_MUL_F:
-        gen_helper_tricore_fmul(cpu_gpr_d[r3], tcg_env, cpu_gpr_d[r1], cpu_gpr_d[r2]);
+        gen_helper_fmul(cpu_gpr_d[r3], tcg_env, cpu_gpr_d[r1], cpu_gpr_d[r2]);
         break;
     case OPC2_32_RR_DIV_F:
-        gen_helper_tricore_fdiv(cpu_gpr_d[r3], tcg_env, cpu_gpr_d[r1], cpu_gpr_d[r2]);
+        gen_helper_fdiv(cpu_gpr_d[r3], tcg_env, cpu_gpr_d[r1], cpu_gpr_d[r2]);
         break;
     case OPC2_32_RR_FTOHP:
         if (has_feature(ctx, TRICORE_FEATURE_162)) {
@@ -6310,13 +6310,13 @@ static void decode_rr_divide(DisasContext *ctx)
         }
         break;
     case OPC2_32_RR_CMP_F:
-        gen_helper_tricore_fcmp(cpu_gpr_d[r3], tcg_env, cpu_gpr_d[r1], cpu_gpr_d[r2]);
+        gen_helper_fcmp(cpu_gpr_d[r3], tcg_env, cpu_gpr_d[r1], cpu_gpr_d[r2]);
         break;
     case OPC2_32_RR_FTOI:
-        gen_helper_tricore_ftoi(cpu_gpr_d[r3], tcg_env, cpu_gpr_d[r1]);
+        gen_helper_ftoi(cpu_gpr_d[r3], tcg_env, cpu_gpr_d[r1]);
         break;
     case OPC2_32_RR_ITOF:
-        gen_helper_tricore_itof(cpu_gpr_d[r3], tcg_env, cpu_gpr_d[r1]);
+        gen_helper_itof(cpu_gpr_d[r3], tcg_env, cpu_gpr_d[r1]);
         break;
     case OPC2_32_RR_FTOU:
         gen_helper_ftou(cpu_gpr_d[r3], tcg_env, cpu_gpr_d[r1]);
@@ -6725,10 +6725,10 @@ static void decode_rrr_divide(DisasContext *ctx)
         }
         break;
     case OPC2_32_RRR_ADD_F:
-        gen_helper_tricore_fadd(cpu_gpr_d[r4], tcg_env, cpu_gpr_d[r1], cpu_gpr_d[r3]);
+        gen_helper_fadd(cpu_gpr_d[r4], tcg_env, cpu_gpr_d[r1], cpu_gpr_d[r3]);
         break;
     case OPC2_32_RRR_SUB_F:
-        gen_helper_tricore_fsub(cpu_gpr_d[r4], tcg_env, cpu_gpr_d[r1], cpu_gpr_d[r3]);
+        gen_helper_fsub(cpu_gpr_d[r4], tcg_env, cpu_gpr_d[r1], cpu_gpr_d[r3]);
         break;
     case OPC2_32_RRR_MADD_F:
         gen_helper_fmadd(cpu_gpr_d[r4], tcg_env, cpu_gpr_d[r1],
Signature · 1 line
2.43.0
#12 lore raw

[PULL 03/20] target/sparc: define crypto helpers using HELPER macro

In reply to Pierrick Bouvier

Crypto helpers were added after the conversion of target/sparc to the HELPER macro. Convert them too, before helpers get prefixed with target base architecture.

---
 target/sparc/crypto_helper.c | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)
target/sparc/crypto_helper.c +15 -15
index 6b6c843b3d8..9c9e951c40b 100644
@@ -52,42 +52,42 @@ static uint64_t aes_round(uint64_t key, uint64_t s2, uint64_t s3,
     return r.d[out];
 }
 
-uint64_t helper_aes_eround01(uint64_t key, uint64_t s2, uint64_t s3)
+uint64_t HELPER(aes_eround01)(uint64_t key, uint64_t s2, uint64_t s3)
 {
     return aes_round(key, s2, s3, 0, false, false);
 }
 
-uint64_t helper_aes_eround23(uint64_t key, uint64_t s2, uint64_t s3)
+uint64_t HELPER(aes_eround23)(uint64_t key, uint64_t s2, uint64_t s3)
 {
     return aes_round(key, s2, s3, 1, false, false);
 }
 
-uint64_t helper_aes_dround01(uint64_t key, uint64_t s2, uint64_t s3)
+uint64_t HELPER(aes_dround01)(uint64_t key, uint64_t s2, uint64_t s3)
 {
     return aes_round(key, s2, s3, 0, true, false);
 }
 
-uint64_t helper_aes_dround23(uint64_t key, uint64_t s2, uint64_t s3)
+uint64_t HELPER(aes_dround23)(uint64_t key, uint64_t s2, uint64_t s3)
 {
     return aes_round(key, s2, s3, 1, true, false);
 }
 
-uint64_t helper_aes_eround01_l(uint64_t key, uint64_t s2, uint64_t s3)
+uint64_t HELPER(aes_eround01_l)(uint64_t key, uint64_t s2, uint64_t s3)
 {
     return aes_round(key, s2, s3, 0, false, true);
 }
 
-uint64_t helper_aes_eround23_l(uint64_t key, uint64_t s2, uint64_t s3)
+uint64_t HELPER(aes_eround23_l)(uint64_t key, uint64_t s2, uint64_t s3)
 {
     return aes_round(key, s2, s3, 1, false, true);
 }
 
-uint64_t helper_aes_dround01_l(uint64_t key, uint64_t s2, uint64_t s3)
+uint64_t HELPER(aes_dround01_l)(uint64_t key, uint64_t s2, uint64_t s3)
 {
     return aes_round(key, s2, s3, 0, true, true);
 }
 
-uint64_t helper_aes_dround23_l(uint64_t key, uint64_t s2, uint64_t s3)
+uint64_t HELPER(aes_dround23_l)(uint64_t key, uint64_t s2, uint64_t s3)
 {
     return aes_round(key, s2, s3, 1, true, true);
 }
@@ -114,7 +114,7 @@ static uint32_t aes_subword(uint32_t x)
  * AES Cryptographic Operations 4-operand (Section 7.3)
  * AES key expansion with RotWord, SubWord, and RCON.
  */
-uint64_t helper_aes_kexpand1(uint64_t rs1, uint64_t rs2, uint32_t imm)
+uint64_t HELPER(aes_kexpand1)(uint64_t rs1, uint64_t rs2, uint32_t imm)
 {
     static const uint8_t rcon[10] = {
         0x01, 0x02, 0x04, 0x08, 0x10,
@@ -135,7 +135,7 @@ uint64_t helper_aes_kexpand1(uint64_t rs1, uint64_t rs2, uint32_t imm)
  * AES Cryptographic Operations 3-operand (Section 7.4)
  * AES key expansion with SubWord, without RotWord or RCON.
  */
-uint64_t helper_aes_kexpand0(uint64_t rs1, uint64_t rs2)
+uint64_t HELPER(aes_kexpand0)(uint64_t rs1, uint64_t rs2)
 {
     return aes_kexpand(rs1, aes_subword(rs2));
 }
@@ -144,7 +144,7 @@ uint64_t helper_aes_kexpand0(uint64_t rs1, uint64_t rs2)
  * AES Cryptographic Operations 3-operand (Section 7.4)
  * AES key expansion without SubWord, RotWord, or RCON.
  */
-uint64_t helper_aes_kexpand2(uint64_t rs1, uint64_t rs2)
+uint64_t HELPER(aes_kexpand2)(uint64_t rs1, uint64_t rs2)
 {
     return aes_kexpand(rs1, (uint32_t)rs2);
 }
@@ -153,7 +153,7 @@ uint64_t helper_aes_kexpand2(uint64_t rs1, uint64_t rs2)
  * CRC32C Operation 3-operand (Section 7.19)
  * Accumulate CRC32C over the eight bytes of rs2, most significant first.
  */
-uint64_t helper_crc32c(uint64_t rs1, uint64_t rs2)
+uint64_t HELPER(crc32c)(uint64_t rs1, uint64_t rs2)
 {
     uint8_t buf[8];
     /* IV and result are byte-swapped in the register. */
@@ -172,7 +172,7 @@ uint64_t helper_crc32c(uint64_t rs1, uint64_t rs2)
  * Compress one SHA-1 block from f8-f23 into f0-f4.
  * Clear f5 to match SPARC M7 behavior.
  */
-void helper_sha1(CPUSPARCState *env)
+void HELPER(sha1)(CPUSPARCState *env)
 {
     uint32_t a = env->fpr[0].l.upper;
     uint32_t b = env->fpr[0].l.lower;
@@ -396,7 +396,7 @@ static void sha512_compress(uint64_t state[8], const uint64_t block[16])
 }
 
 /* Compress one SHA-256 block from f8-f23 into f0-f7. */
-void helper_sha256(CPUSPARCState *env)
+void HELPER(sha256)(CPUSPARCState *env)
 {
     uint32_t state[8], block[16];
 
@@ -422,7 +422,7 @@ void helper_sha256(CPUSPARCState *env)
  * Compress one SHA-512 block from FD16, FD18, ..., FD46
  * into FD0, FD2, ..., FD14.
  */
-void helper_sha512(CPUSPARCState *env)
+void HELPER(sha512)(CPUSPARCState *env)
 {
     uint64_t state[8], block[16];
 
Signature · 1 line
2.43.0
#13 lore raw

[PULL 05/20] target/alpha: remove explicit target specific prefix

In reply to Pierrick Bouvier

Now that we have a generic mechanism to prefix all helpers, we can undo the recent changes that fixed conflicts between targets in multi-target set.

This reverts commit e39401e0b4005389790bf847949c9e5950f5fa55 "target/alpha: prefix divs helper"

---
 target/alpha/fpu_helper.c | 2 +-
 target/alpha/helper.h     | 2 +-
 target/alpha/translate.c  | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)
target/alpha/fpu_helper.c +1 -1
index 61166396f6e..9eb64058765 100644
@@ -248,7 +248,7 @@ uint64_t HELPER(muls)(CPUAlphaState *env, uint64_t a, uint64_t b)
     return float32_to_s(fr);
 }
 
-uint64_t HELPER(alpha_divs)(CPUAlphaState *env, uint64_t a, uint64_t b)
+uint64_t HELPER(divs)(CPUAlphaState *env, uint64_t a, uint64_t b)
 {
     float32 fa, fb, fr;
 
target/alpha/helper.h +1 -1
index e2f0b96db7c..954a5c8294c 100644
@@ -47,7 +47,7 @@ DEF_HELPER_FLAGS_1(memory_to_s, TCG_CALL_NO_RWG_SE, i64, i32)
 DEF_HELPER_FLAGS_3(adds, TCG_CALL_NO_RWG, i64, env, i64, i64)
 DEF_HELPER_FLAGS_3(subs, TCG_CALL_NO_RWG, i64, env, i64, i64)
 DEF_HELPER_FLAGS_3(muls, TCG_CALL_NO_RWG, i64, env, i64, i64)
-DEF_HELPER_FLAGS_3(alpha_divs, TCG_CALL_NO_RWG, i64, env, i64, i64)
+DEF_HELPER_FLAGS_3(divs, TCG_CALL_NO_RWG, i64, env, i64, i64)
 DEF_HELPER_FLAGS_2(sqrts, TCG_CALL_NO_RWG, i64, env, i64)
 
 DEF_HELPER_FLAGS_3(addt, TCG_CALL_NO_RWG, i64, env, i64, i64)
target/alpha/translate.c +2 -2
index ac57e4d2623..c66e3f9c146 100644
@@ -790,7 +790,7 @@ static inline void glue(gen_, name)(DisasContext *ctx,                  \
 IEEE_ARITH3(adds)
 IEEE_ARITH3(subs)
 IEEE_ARITH3(muls)
-IEEE_ARITH3(alpha_divs)
+IEEE_ARITH3(divs)
 IEEE_ARITH3(addt)
 IEEE_ARITH3(subt)
 IEEE_ARITH3(mult)
@@ -2086,7 +2086,7 @@ static DisasJumpType translate_one(DisasContext *ctx, uint32_t insn)
         case 0x03:
             /* DIVS */
             REQUIRE_FEN;
-            gen_alpha_divs(ctx, ra, rb, rc, fn11);
+            gen_divs(ctx, ra, rb, rc, fn11);
             break;
         case 0x20:
             /* ADDT */
Signature · 1 line
2.43.0
#14 lore raw

[PULL 19/20] meson.build: add riscv64-softmmu to multi-target

In reply to Pierrick Bouvier
---
 meson.build | 1 +
 1 file changed, 1 insertion(+)
meson.build +1 -0
index ad537e0c18f..cd328251829 100644
@@ -4278,6 +4278,7 @@ multi_target_supported_targets = [
   'm68k-softmmu',
   'microblaze-softmmu',
   'or1k-softmmu',
+  'riscv64-softmmu',
   'rx-softmmu',
   'tricore-softmmu',
 ]
Signature · 1 line
2.43.0
#15 lore raw

[PULL 08/20] target/microblaze: remove explicit target specific prefix

In reply to Pierrick Bouvier

Now that we have a generic mechanism to prefix all helpers, we can undo the recent changes that fixed conflicts between targets in multi-target set.

This reverts commit 4da3423973e8faa544744777f629ac82dedc0869 "target/microblaze: prefix helper conflicting with other arch"

---
 target/microblaze/helper.h    | 10 +++++-----
 target/microblaze/op_helper.c | 10 +++++-----
 target/microblaze/translate.c | 10 +++++-----
 3 files changed, 15 insertions(+), 15 deletions(-)
target/microblaze/helper.h +5 -5
index 63a94ac4bbc..1429c1727ef 100644
@@ -1,15 +1,15 @@
-DEF_HELPER_FLAGS_2(microblaze_raise_exception, TCG_CALL_NO_WG, noreturn, env, i32)
+DEF_HELPER_FLAGS_2(raise_exception, TCG_CALL_NO_WG, noreturn, env, i32)
 
 DEF_HELPER_FLAGS_3(divs, TCG_CALL_NO_WG, i32, env, i32, i32)
 DEF_HELPER_FLAGS_3(divu, TCG_CALL_NO_WG, i32, env, i32, i32)
 
-DEF_HELPER_FLAGS_3(microblaze_fadd, TCG_CALL_NO_WG, i32, env, i32, i32)
+DEF_HELPER_FLAGS_3(fadd, TCG_CALL_NO_WG, i32, env, i32, i32)
 DEF_HELPER_FLAGS_3(frsub, TCG_CALL_NO_WG, i32, env, i32, i32)
-DEF_HELPER_FLAGS_3(microblaze_fmul, TCG_CALL_NO_WG, i32, env, i32, i32)
-DEF_HELPER_FLAGS_3(microblaze_fdiv, TCG_CALL_NO_WG, i32, env, i32, i32)
+DEF_HELPER_FLAGS_3(fmul, TCG_CALL_NO_WG, i32, env, i32, i32)
+DEF_HELPER_FLAGS_3(fdiv, TCG_CALL_NO_WG, i32, env, i32, i32)
 DEF_HELPER_FLAGS_2(flt, TCG_CALL_NO_WG, i32, env, i32)
 DEF_HELPER_FLAGS_2(fint, TCG_CALL_NO_WG, i32, env, i32)
-DEF_HELPER_FLAGS_2(microblaze_fsqrt, TCG_CALL_NO_WG, i32, env, i32)
+DEF_HELPER_FLAGS_2(fsqrt, TCG_CALL_NO_WG, i32, env, i32)
 
 DEF_HELPER_FLAGS_3(fcmp_un, TCG_CALL_NO_WG, i32, env, i32, i32)
 DEF_HELPER_FLAGS_3(fcmp_lt, TCG_CALL_NO_WG, i32, env, i32, i32)
target/microblaze/op_helper.c +5 -5
index c53103ecd79..eb244faa7ee 100644
@@ -62,7 +62,7 @@ uint32_t HELPER(get)(uint32_t id, uint32_t ctrl)
     return 0xdead0000 | id;
 }
 
-void HELPER(microblaze_raise_exception)(CPUMBState *env, uint32_t index)
+void HELPER(raise_exception)(CPUMBState *env, uint32_t index)
 {
     CPUState *cs = env_cpu(env);
 
@@ -154,7 +154,7 @@ static void update_fpu_flags(CPUMBState *env, int flags, uintptr_t ra)
     }
 }
 
-uint32_t HELPER(microblaze_fadd)(CPUMBState *env, uint32_t a, uint32_t b)
+uint32_t HELPER(fadd)(CPUMBState *env, uint32_t a, uint32_t b)
 {
     CPU_FloatU fd, fa, fb;
     int flags;
@@ -183,7 +183,7 @@ uint32_t HELPER(frsub)(CPUMBState *env, uint32_t a, uint32_t b)
     return fd.l;
 }
 
-uint32_t HELPER(microblaze_fmul)(CPUMBState *env, uint32_t a, uint32_t b)
+uint32_t HELPER(fmul)(CPUMBState *env, uint32_t a, uint32_t b)
 {
     CPU_FloatU fd, fa, fb;
     int flags;
@@ -198,7 +198,7 @@ uint32_t HELPER(microblaze_fmul)(CPUMBState *env, uint32_t a, uint32_t b)
     return fd.l;
 }
 
-uint32_t HELPER(microblaze_fdiv)(CPUMBState *env, uint32_t a, uint32_t b)
+uint32_t HELPER(fdiv)(CPUMBState *env, uint32_t a, uint32_t b)
 {
     CPU_FloatU fd, fa, fb;
     int flags;
@@ -352,7 +352,7 @@ uint32_t HELPER(fint)(CPUMBState *env, uint32_t a)
     return r;
 }
 
-uint32_t HELPER(microblaze_fsqrt)(CPUMBState *env, uint32_t a)
+uint32_t HELPER(fsqrt)(CPUMBState *env, uint32_t a)
 {
     CPU_FloatU fd, fa;
     int flags;
target/microblaze/translate.c +5 -5
index 16794059a22..8b219afb5dd 100644
@@ -100,7 +100,7 @@ static void t_sync_flags(DisasContext *dc)
 
 static void gen_raise_exception(DisasContext *dc, uint32_t index)
 {
-    gen_helper_microblaze_raise_exception(tcg_env, tcg_constant_i32(index));
+    gen_helper_raise_exception(tcg_env, tcg_constant_i32(index));
     dc->base.is_jmp = DISAS_NORETURN;
 }
 
@@ -421,10 +421,10 @@ static void gen_cmpu(TCGv_i32 out, TCGv_i32 ina, TCGv_i32 inb)
 DO_TYPEA(cmp, false, gen_cmp)
 DO_TYPEA(cmpu, false, gen_cmpu)
 
-ENV_WRAPPER3(gen_fadd, gen_helper_microblaze_fadd)
+ENV_WRAPPER3(gen_fadd, gen_helper_fadd)
 ENV_WRAPPER3(gen_frsub, gen_helper_frsub)
-ENV_WRAPPER3(gen_fmul, gen_helper_microblaze_fmul)
-ENV_WRAPPER3(gen_fdiv, gen_helper_microblaze_fdiv)
+ENV_WRAPPER3(gen_fmul, gen_helper_fmul)
+ENV_WRAPPER3(gen_fdiv, gen_helper_fdiv)
 ENV_WRAPPER3(gen_fcmp_un, gen_helper_fcmp_un)
 ENV_WRAPPER3(gen_fcmp_lt, gen_helper_fcmp_lt)
 ENV_WRAPPER3(gen_fcmp_eq, gen_helper_fcmp_eq)
@@ -447,7 +447,7 @@ DO_TYPEA_CFG(fcmp_ge, use_fpu, true, gen_fcmp_ge)
 
 ENV_WRAPPER2(gen_flt, gen_helper_flt)
 ENV_WRAPPER2(gen_fint, gen_helper_fint)
-ENV_WRAPPER2(gen_fsqrt, gen_helper_microblaze_fsqrt)
+ENV_WRAPPER2(gen_fsqrt, gen_helper_fsqrt)
 
 DO_TYPEA0_CFG(flt, use_fpu >= 2, true, gen_flt)
 DO_TYPEA0_CFG(fint, use_fpu >= 2, true, gen_fint)
Signature · 1 line
2.43.0
#16 lore raw

[PULL 15/20] hw/riscv/virt: restrict scope of virt_is_acpi_enabled to this file

In reply to Pierrick Bouvier

This removes conflict with the same function from target/arm. To the opposite of arm target, there is no external caller for this function.

---
 hw/riscv/virt.c         | 10 +++++-----
 include/hw/riscv/virt.h |  1 -
 2 files changed, 5 insertions(+), 6 deletions(-)
hw/riscv/virt.c +5 -5
index 894cdd97976..2c6f983f83f 100644
@@ -72,6 +72,11 @@ static bool virt_use_kvm_aia_aplic_imsic(RISCVVirtAIAType aia_type)
     return riscv_is_kvm_aia_aplic_imsic(msimode);
 }
 
+static bool virt_is_acpi_enabled(RISCVVirtState *s)
+{
+    return s->acpi != ON_OFF_AUTO_OFF;
+}
+
 static bool virt_use_emulated_aplic(RISCVVirtAIAType aia_type)
 {
     bool msimode = aia_type == VIRT_AIA_TYPE_APLIC_IMSIC;
@@ -1067,11 +1072,6 @@ static void virt_set_iommu_sys(Object *obj, Visitor *v, const char *name,
     visit_type_OnOffAuto(v, name, &s->iommu_sys, errp);
 }
 
-bool virt_is_acpi_enabled(RISCVVirtState *s)
-{
-    return s->acpi != ON_OFF_AUTO_OFF;
-}
-
 static void virt_get_acpi(Object *obj, Visitor *v, const char *name,
                           void *opaque, Error **errp)
 {
include/hw/riscv/virt.h +0 -1
index e516898f9ad..16d86edfcfc 100644
@@ -121,7 +121,6 @@ enum {
 #define VIRT_PLIC_SIZE(__num_context) \
     (VIRT_PLIC_CONTEXT_BASE + (__num_context) * VIRT_PLIC_CONTEXT_STRIDE)
 
-bool virt_is_acpi_enabled(RISCVVirtState *s);
 bool virt_is_iommu_sys_enabled(RISCVVirtState *s);
 void virt_acpi_setup(RISCVVirtState *vms);
 
Signature · 1 line
2.43.0
#17 lore raw

[PULL 13/20] hw/riscv/virt: make machine available for riscv targets only

In reply to Pierrick Bouvier
---
 hw/riscv/virt.c | 2 ++
 1 file changed, 2 insertions(+)
hw/riscv/virt.c +2 -0
index d4b501802f6..894cdd97976 100644
@@ -22,6 +22,7 @@
 #include "qemu/units.h"
 #include "qemu/error-report.h"
 #include "qemu/guest-random.h"
+#include "qemu/target-info.h"
 #include "qapi/error.h"
 #include "hw/core/boards.h"
 #include "hw/core/loader.h"
@@ -1203,6 +1204,7 @@ static const TypeInfo virt_machine_typeinfo = {
     .instance_init = virt_machine_instance_init,
     .instance_finalize = virt_machine_instance_finalize,
     .instance_size = sizeof(RISCVVirtState),
+    .is_available = target_base_riscv,
     .interfaces = (const InterfaceInfo[]) {
          { TYPE_HOTPLUG_HANDLER },
          { }
Signature · 1 line
2.43.0
#18 lore raw

[PULL 10/20] target/rx: remove explicit target specific prefix

In reply to Pierrick Bouvier

Now that we have a generic mechanism to prefix all helpers, we can undo the recent changes that fixed conflicts between targets in multi-target set.

This reverts commit 5490e0e4a5dcada1aabfc7df772ddee54f9022c5 "target/rx: prefix helpers conflicting with other arch"

---
 target/rx/helper.h    | 12 ++++++------
 target/rx/op_helper.c | 12 ++++++------
 target/rx/translate.c | 14 +++++++-------
 3 files changed, 19 insertions(+), 19 deletions(-)
target/rx/helper.h +6 -6
index 13f019ff81a..f3897ce7619 100644
@@ -3,11 +3,11 @@ DEF_HELPER_1(raise_access_fault, noreturn, env)
 DEF_HELPER_1(raise_privilege_violation, noreturn, env)
 DEF_HELPER_1(wait, noreturn, env)
 DEF_HELPER_2(trap, noreturn, env, i32)
-DEF_HELPER_3(rx_fadd, f32, env, f32, f32)
-DEF_HELPER_3(rx_fsub, f32, env, f32, f32)
-DEF_HELPER_3(rx_fmul, f32, env, f32, f32)
-DEF_HELPER_3(rx_fdiv, f32, env, f32, f32)
-DEF_HELPER_3(rx_fcmp, void, env, f32, f32)
+DEF_HELPER_3(fadd, f32, env, f32, f32)
+DEF_HELPER_3(fsub, f32, env, f32, f32)
+DEF_HELPER_3(fmul, f32, env, f32, f32)
+DEF_HELPER_3(fdiv, f32, env, f32, f32)
+DEF_HELPER_3(fcmp, void, env, f32, f32)
 DEF_HELPER_2(ftoi, i32, env, f32)
 DEF_HELPER_2(round, i32, env, f32)
 DEF_HELPER_2(itof, f32, env, i32)
@@ -17,7 +17,7 @@ DEF_HELPER_2(set_psw_rte, void, env, i32)
 DEF_HELPER_2(set_psw, void, env, i32)
 DEF_HELPER_1(pack_psw, i32, env)
 DEF_HELPER_3(div, i32, env, i32, i32)
-DEF_HELPER_3(rx_divu, i32, env, i32, i32)
+DEF_HELPER_3(divu, i32, env, i32, i32)
 DEF_HELPER_1(scmpu, void, env)
 DEF_HELPER_1(smovu, void, env)
 DEF_HELPER_1(smovf, void, env)
target/rx/op_helper.c +6 -6
index 5f4f0a14027..1281d69c461 100644
@@ -147,12 +147,12 @@ void HELPER(set_fpsw)(CPURXState *env, uint32_t val)
         return ret;                                                 \
     }
 
-FLOATOP(rx_fadd, float32_add)
-FLOATOP(rx_fsub, float32_sub)
-FLOATOP(rx_fmul, float32_mul)
-FLOATOP(rx_fdiv, float32_div)
+FLOATOP(fadd, float32_add)
+FLOATOP(fsub, float32_sub)
+FLOATOP(fmul, float32_mul)
+FLOATOP(fdiv, float32_div)
 
-void HELPER(rx_fcmp)(CPURXState *env, float32 t0, float32 t1)
+void HELPER(fcmp)(CPURXState *env, float32 t0, float32 t1)
 {
     int st;
     st = float32_compare(t0, t1, &env->fp_status);
@@ -407,7 +407,7 @@ uint32_t HELPER(div)(CPURXState *env, uint32_t num, uint32_t den)
     return ret;
 }
 
-uint32_t HELPER(rx_divu)(CPURXState *env, uint32_t num, uint32_t den)
+uint32_t HELPER(divu)(CPURXState *env, uint32_t num, uint32_t den)
 {
     uint32_t ret = num;
     if (den != 0) {
target/rx/translate.c +7 -7
index a350f6b4d26..1bacc7adf92 100644
@@ -1252,7 +1252,7 @@ static void rx_div(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2)
 
 static void rx_divu(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2)
 {
-    gen_helper_rx_divu(ret, tcg_env, arg1, arg2);
+    gen_helper_divu(ret, tcg_env, arg1, arg2);
 }
 
 /* div #imm, rd */
@@ -1864,16 +1864,16 @@ static bool trans_SATR(DisasContext *ctx, arg_SATR *a)
         return true;                                            \
     }
 
-FOP(FADD, rx_fadd)
-FOP(FSUB, rx_fsub)
-FOP(FMUL, rx_fmul)
-FOP(FDIV, rx_fdiv)
+FOP(FADD, fadd)
+FOP(FSUB, fsub)
+FOP(FMUL, fmul)
+FOP(FDIV, fdiv)
 
 /* fcmp #imm, rd */
 static bool trans_FCMP_ir(DisasContext *ctx, arg_FCMP_ir * a)
 {
     TCGv_i32 imm = tcg_constant_i32(li(ctx, 0));
-    gen_helper_rx_fcmp(tcg_env, cpu_regs[a->rd], imm);
+    gen_helper_fcmp(tcg_env, cpu_regs[a->rd], imm);
     return true;
 }
 
@@ -1884,7 +1884,7 @@ static bool trans_FCMP_mr(DisasContext *ctx, arg_FCMP_mr *a)
     TCGv_i32 val, mem;
     mem = tcg_temp_new_i32();
     val = rx_load_source(ctx, mem, a->ld, MO_32, a->rs);
-    gen_helper_rx_fcmp(tcg_env, cpu_regs[a->rd], val);
+    gen_helper_fcmp(tcg_env, cpu_regs[a->rd], val);
     return true;
 }
 
Signature · 1 line
2.43.0
#19 lore raw

[PULL 12/20] target-info: add target_base_riscv

In reply to Pierrick Bouvier
---
 include/qemu/target-info.h |  7 +++++++
 target-info.c              | 11 +++++++++++
 2 files changed, 18 insertions(+)
include/qemu/target-info.h +7 -0
index 923c00c917c..2cd4cc5671b 100644
@@ -120,6 +120,13 @@ bool target_ppc64(void);
  */
 bool target_s390x(void);
 
+/**
+ * target_base_riscv:
+ *
+ * Returns whether the target architecture is RISC-V 32-bit or 64-bit.
+ */
+bool target_base_riscv(void);
+
 /**
  * target_riscv64:
  *
target-info.c +11 -0
index b8a4a7ebf7a..e67d7bed520 100644
@@ -110,6 +110,17 @@ bool target_s390x(void)
     return target_arch() == SYS_EMU_TARGET_S390X;
 }
 
+bool target_base_riscv(void)
+{
+    switch (target_arch()) {
+    case SYS_EMU_TARGET_RISCV32:
+    case SYS_EMU_TARGET_RISCV64:
+        return true;
+    default:
+        return false;
+    }
+}
+
 bool target_riscv64(void)
 {
     return target_arch() == SYS_EMU_TARGET_RISCV64;
Signature · 1 line
2.43.0
#20 lore raw

[PULL 16/20] target/riscv: rename virt_acpi_setup to riscv_virt_acpi_setup

In reply to Pierrick Bouvier

This removes conflict with same function from target/arm.

---
 hw/riscv/virt-acpi-build.c | 2 +-
 hw/riscv/virt.c            | 2 +-
 include/hw/riscv/virt.h    | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
hw/riscv/virt-acpi-build.c +1 -1
index 0475dcb5c60..4565359e908 100644
@@ -1021,7 +1021,7 @@ static const VMStateDescription vmstate_virt_acpi_build = {
     },
 };
 
-void virt_acpi_setup(RISCVVirtState *s)
+void riscv_virt_acpi_setup(RISCVVirtState *s)
 {
     AcpiBuildTables tables;
     AcpiBuildState *build_state;
hw/riscv/virt.c +1 -1
index 2c6f983f83f..de1c92463ad 100644
@@ -712,7 +712,7 @@ static void virt_machine_done(Notifier *notifier, void *data)
     virt_build_smbios(s);
 
     if (virt_is_acpi_enabled(s)) {
-        virt_acpi_setup(s);
+        riscv_virt_acpi_setup(s);
     }
 }
 
include/hw/riscv/virt.h +1 -1
index 16d86edfcfc..6e4fbf4b647 100644
@@ -122,7 +122,7 @@ enum {
     (VIRT_PLIC_CONTEXT_BASE + (__num_context) * VIRT_PLIC_CONTEXT_STRIDE)
 
 bool virt_is_iommu_sys_enabled(RISCVVirtState *s);
-void virt_acpi_setup(RISCVVirtState *vms);
+void riscv_virt_acpi_setup(RISCVVirtState *vms);
 
 /*
  * The virt machine physical address space used by some of the devices
Signature · 1 line
2.43.0
#21 lore raw

[PULL 14/20] test/unit/multi-target: check QOM types can be initialized with any target

In reply to Pierrick Bouvier

Currently, we are initializing QOM type after having set target to the first one available. That's not enough to catch conflicts among types within targets. Indeed, we'll miss some conflicts since some types are registered conditionnally through .is_available.

To ensure full coverage, we detect all targets available, and generate a sub test for each of them. Then, using g_test_trap_subprocess(), we can recursively call only this test in a children process.

---
 tests/unit/test-multi-target.c | 34 ++++++++++++++++++++++++++--------
 1 file changed, 26 insertions(+), 8 deletions(-)
tests/unit/test-multi-target.c +26 -8
index 89b55bb1632..c7559827a08 100644
@@ -30,13 +30,20 @@
 /* stub for system/main.c */
 int (*qemu_main)(void);
 
-static void test_qom_types_are_unique(void)
+static void test_qom_types_are_unique(const void *data)
 {
-    module_call_init(MODULE_INIT_TARGET_INFO);
-    g_autoptr(GSList) targets = object_class_get_list(TYPE_TARGET_INFO, false);
-    g_assert(targets);
-    const TargetInfo *first_ti = TARGET_INFO_CLASS(targets->data)->target_info;
-    target_info_qom_set_target_info(first_ti);
+    const TargetInfo *ti = data;
+
+    /* QOM types can be initialized only once, so do it in a subprocess. */
+    if (!g_test_subprocess()) {
+        /* parent process path - respawn this exact test path */
+        g_test_trap_subprocess(NULL, 0, G_TEST_SUBPROCESS_INHERIT_STDERR);
+        g_test_trap_assert_passed();
+        return;
+    }
+    /* child process path */
+
+    target_info_qom_set_target_info(ti);
 
     /* register all types */
     module_call_init(MODULE_INIT_QOM);
@@ -47,7 +54,18 @@ static void test_qom_types_are_unique(void)
 int main(int argc, char **argv)
 {
     g_test_init(&argc, &argv, NULL);
-    g_test_add_func("/multi-targets/qom-types-are-unique",
-                   test_qom_types_are_unique);
+
+    module_call_init(MODULE_INIT_TARGET_INFO);
+    g_autoptr(GSList) targets = object_class_get_list_sorted(TYPE_TARGET_INFO,
+                                                             false);
+    g_assert(targets);
+    for (GSList *elem = targets; elem; elem = elem->next) {
+        const TargetInfo *ti = TARGET_INFO_CLASS(elem->data)->target_info;
+        g_autofree char *path =
+            g_strdup_printf("/multi-targets/qom-types-are-unique/%s",
+                            ti->target_name);
+        g_test_add_data_func(path, ti, test_qom_types_are_unique);
+    }
+
     return g_test_run();
 }
Signature · 1 line
2.43.0
#22 lore raw

[PULL 09/20] target/or1k: remove explicit target specific prefix

In reply to Pierrick Bouvier

Now that we have a generic mechanism to prefix all helpers, we can undo the recent changes that fixed conflicts between targets in multi-target set.

This reverts commit f24061e40d2978a51bf15d7c6fcd7576c709c099 "target/or1k: prefix symbols conflicting with other arch"

---
 target/or1k/helper.h           | 2 +-
 target/or1k/interrupt_helper.c | 2 +-
 target/or1k/translate.c        | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
target/or1k/helper.h +1 -1
index 9f74bed93af..e0a8d402271 100644
@@ -59,7 +59,7 @@ FOP_CMP(ult)
 #undef FOP_CMP
 
 /* interrupt */
-DEF_HELPER_FLAGS_1(or1k_rfe, 0, void, env)
+DEF_HELPER_FLAGS_1(rfe, 0, void, env)
 
 /* sys */
 DEF_HELPER_FLAGS_3(mtspr, 0, void, env, i32, i32)
target/or1k/interrupt_helper.c +1 -1
index 91dd2227442..1553ebc71b0 100644
@@ -22,7 +22,7 @@
 #include "cpu.h"
 #include "exec/helper-proto.h"
 
-void HELPER(or1k_rfe)(CPUOpenRISCState *env)
+void HELPER(rfe)(CPUOpenRISCState *env)
 {
     env->pc = env->epcr;
     env->lock_addr = -1;
target/or1k/translate.c +1 -1
index 6972dc7d630..e00ef45b9b7 100644
@@ -1110,7 +1110,7 @@ static bool trans_l_rfe(DisasContext *dc, arg_l_rfe *a)
     if (is_user(dc)) {
         gen_illegal_exception(dc);
     } else {
-        gen_helper_or1k_rfe(tcg_env);
+        gen_helper_rfe(tcg_env);
         dc->base.is_jmp = DISAS_EXIT;
     }
     return true;
Signature · 1 line
2.43.0
#23 lore raw

[PULL 20/20] meson.build: list all remaining softmmu targets as comments

In reply to Pierrick Bouvier
---
 meson.build | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
meson.build +17 -0
index cd328251829..671511c4194 100644
@@ -4275,12 +4275,29 @@ multi_target_supported_targets = [
   'avr-softmmu',
   'hexagon-softmmu',
   'hppa-softmmu',
+  # 'i386-softmmu',
+  # 'loongarch64-softmmu',
   'm68k-softmmu',
   'microblaze-softmmu',
+  # 'mips-softmmu',
+  # 'mips64-softmmu',
+  # 'mips64el-softmmu',
+  # 'mipsel-softmmu',
   'or1k-softmmu',
+  # 'ppc-softmmu',
+  # 'ppc64-softmmu',
+  # 'riscv32-softmmu',
   'riscv64-softmmu',
   'rx-softmmu',
+  # 's390x-softmmu',
+  # 'sh4-softmmu',
+  # 'sh4eb-softmmu',
+  # 'sparc-softmmu',
+  # 'sparc64-softmmu',
   'tricore-softmmu',
+  # 'x86_64-softmmu',
+  # 'xtensa-softmmu',
+  # 'xtensaeb-softmmu',
 ]
 
 emulators = {}
Signature · 1 line
2.43.0
#24 lore raw
In reply to Pierrick Bouvier
Quoted 12 lines · Pierrick Bouvier

The following changes since commit d73149283205645625bfa9fe029cfb68e4c4a9ae:

   Merge tag 'samuel-thibault' ofhttps://people.debian.org/~sthibault/qemu into staging (2026-10-24 16:09:37 +0200)

are available in the Git repository at:

   https://gitlab.com/p-b-o/qemu tags/pbouvier/pr/multi_target-20261024

for you to fetch changes up to 59f954f8277e80065b1286bfe89ca8861c08d1c5:

meson.build: list all remaining softmmu targets as comments (2026-10-24 17:36:09 +0000)

Quoted 8 lines

----------------------------------------------------------------
Changes:
- [PATCH v2 00/11] multi-target: prefix helpers with target prefix (Pierrick Bouvier<[email protected]>)

[email protected]
- [PATCH v3 0/9] multi-target: add riscv64-softmmu (Pierrick Bouvier<[email protected]>)

[email protected]

Applied, thanks.

r~