Skip to contentSkip to conversation

Multi-target 20261015

GIT PULL Applied Pierrick Bouvier 2 participants 22 messages Oct 15 – Oct 16

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

The following changes since commit 7e8d3c7fc460fe7cd28a3e423d7466fa292bc269:

Merge tag 'pull-aspeed-20261015' of https://github.com/legoater/qemu into staging (2026-10-15 14:58:28 +0200)

are available in the Git repository at:

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

for you to fetch changes up to 269cab810cd7ee2f6955be2048979b206a711817:

qmp: reimplement qmp_query_cpu_definitions as a dispatcher function (2026-10-15 19:30:24 +0000)

----------------------------------------------------------------
Changes:
- [PATCH v3 00/12] multi-target: add hexagon (Pierrick Bouvier <[email protected]>)

- [PATCH 0/8] multi-target: remove qmp_query_cpu_definitions duplication (Pierrick Bouvier <[email protected]>)

----------------------------------------------------------------
Pierrick Bouvier (20):
target/hexagon: prefix helpers conflicting with other arch
target-info: add target_hexagon
hw/hexagon/virt: make machine available for hexagon target only hw/core/cpu: restrict tcg_ops to CONFIG_TCG only
semihosting: declare semihosting cpu ops
target/riscv/cpu: constify cpu parameter for riscv_cpu_mxl target/riscv: declare semihosting ops
target/hexagon: declare semihosting ops
target/arm: declare semihosting ops
semihosting: use new semihosting ops
semihosting: remove common_* functions
meson.build: add hexagon-softmmu to multi-target
target/arm: rename qmp_query_cpu_definitions to qmp_query_arm_cpu_definitions target/i386: rename qmp_query_cpu_definitions to qmp_query_i386_cpu_definitions target/loongarch: rename to qmp_query_loongarch_cpu_definitions target/mips: rename qmp_query_cpu_definitions to qmp_query_mips_cpu_definitions target/ppc: rename qmp_query_cpu_definitions to qmp_query_ppc_cpu_definitions target/riscv: rename to qmp_query_cpu_definitions to qmp_query_riscv_cpu_definitions target/s390x: rename qmp_query_cpu_definitions to qmp_query_s390x_cpu_definitions
qmp: reimplement qmp_query_cpu_definitions as a dispatcher function

 hw/core/machine-qmp-cmds.c            | 32 ++++++++++++++++++++
 hw/hexagon/virt.c                     |  2 ++
 include/hw/core/cpu.h                 |  8 +++++
 include/qemu/target-info.h            |  7 +++++
 include/semihosting/common-semi.h     | 24 ++++++++++-----
 include/system/qmp-cpu.h              | 20 +++++++++++++
 meson.build                           |  1 +
 semihosting/arm-compat-semi.c         | 56 +++++++++++++++++------------------
 stubs/meson.build                     |  6 ++++
 stubs/qmp-cpu-arm.c                   |  9 ++++++
 stubs/qmp-cpu-i386.c                  |  9 ++++++
 stubs/qmp-cpu-loongarch.c             |  9 ++++++
 stubs/qmp-cpu-mips.c                  |  9 ++++++
 stubs/qmp-cpu-ppc.c                   |  9 ++++++
 stubs/qmp-cpu-riscv.c                 |  9 ++++++
 stubs/qmp-cpu-s390x.c                 |  6 ++++
 stubs/qmp-cpu.c                       |  7 -----
 target-info.c                         |  5 ++++
 target/arm/arm-qmp-cmds.c             |  3 +-
 target/arm/common-semi-target.c       | 33 ++++++++++++++-------
 target/arm/cpu.c                      |  4 +++
 target/arm/internals.h                |  2 ++
 target/hexagon/common-semi-target.c   | 30 ++++++++++++-------
 target/hexagon/cpu.c                  |  2 ++
 target/hexagon/gen_tcg.h              |  2 +-
 target/hexagon/gen_tcg_sys.h          |  2 +-
 target/hexagon/helper.h               |  4 +--
 target/hexagon/hex_mmu.c              |  2 +-
 target/hexagon/hex_mmu.h              |  2 +-
 target/hexagon/internal.h             |  2 ++
 target/hexagon/op_helper.c            |  4 +--
 target/hexagon/translate.c            |  4 +--
 target/i386/cpu.c                     |  3 +-
 target/loongarch/loongarch-qmp-cmds.c |  3 +-
 target/mips/system/mips-qmp-cmds.c    |  3 +-
 target/ppc/ppc-qmp-cmds.c             |  3 +-
 target/riscv/common-semi-target.c     | 37 +++++++++++++++--------
 target/riscv/cpu.c                    |  4 +++
 target/riscv/cpu.h                    |  2 +-
 target/riscv/internals.h              |  2 ++
 target/riscv/riscv-qmp-cmds.c         |  3 +-
 target/s390x/cpu_models_system.c      |  3 +-
 42 files changed, 293 insertions(+), 94 deletions(-)
 create mode 100644 include/system/qmp-cpu.h
 create mode 100644 stubs/qmp-cpu-arm.c
 create mode 100644 stubs/qmp-cpu-i386.c
 create mode 100644 stubs/qmp-cpu-loongarch.c
 create mode 100644 stubs/qmp-cpu-mips.c
 create mode 100644 stubs/qmp-cpu-ppc.c
 create mode 100644 stubs/qmp-cpu-riscv.c
#1 lore raw

[PULL 10/20] semihosting: use new semihosting ops

Now that all targets implement this interface, we can replace function calls with the new interface.

We assume semihosting ops are set on this code path, and do not perform a NULL check.

---
 semihosting/arm-compat-semi.c | 56 +++++++++++++++++------------------
 1 file changed, 28 insertions(+), 28 deletions(-)
semihosting/arm-compat-semi.c +28 -28
index b930a028649..3117eadb3b7 100644
@@ -188,7 +188,7 @@ static LayoutInfo common_semi_find_bases(CPUState *cs)
  */
 
 #define GET_ARG(n) do {                                 \
-    if (is_64bit_semihosting(env)) {                    \
+    if (cs->cc->semi_ops->is_64bit(cs)) {               \
         if (get_user_u64(arg ## n, args + (n) * 8)) {   \
             goto do_fault;                              \
         }                                               \
@@ -200,7 +200,7 @@ static LayoutInfo common_semi_find_bases(CPUState *cs)
 } while (0)
 
 #define SET_ARG(n, val)                                 \
-    (is_64bit_semihosting(env) ?                        \
+    (cs->cc->semi_ops->is_64bit(cs) ?                   \
      put_user_u64(val, args + (n) * 8) :                \
      put_user_u32(val, args + (n) * 4))
 
@@ -237,10 +237,10 @@ void common_semi_cb(CPUState *cs, uint64_t ret, int err)
         ts->swi_errno = err;
 #else
         syscall_err = err;
-        common_semi_set_err(cs, err);
+        cs->cc->semi_ops->set_err(cs, err);
 #endif
     }
-    common_semi_set_ret(cs, ret);
+    cs->cc->semi_ops->set_ret(cs, ret);
 }
 
 /*
@@ -249,7 +249,7 @@ void common_semi_cb(CPUState *cs, uint64_t ret, int err)
  */
 static void common_semi_dead_cb(CPUState *cs, uint64_t ret, int err)
 {
-    common_semi_set_ret(cs, 0xdeadbeef);
+    cs->cc->semi_ops->set_ret(cs, 0xdeadbeef);
 }
 
 /*
@@ -260,7 +260,7 @@ static void common_semi_rw_cb(CPUState *cs, uint64_t ret, int err)
 {
     /* Recover the original length from the third argument. */
     CPUArchState *env G_GNUC_UNUSED = cpu_env(cs);
-    uint64_t args = common_semi_arg(cs, 1);
+    uint64_t args = cs->cc->semi_ops->arg(cs, 1);
     uint64_t arg2;
     GET_ARG(2);
 
@@ -268,7 +268,7 @@ static void common_semi_rw_cb(CPUState *cs, uint64_t ret, int err)
  do_fault:
         ret = 0; /* error: no bytes transmitted */
     }
-    common_semi_set_ret(cs, arg2 - ret);
+    cs->cc->semi_ops->set_ret(cs, arg2 - ret);
 }
 
 /*
@@ -302,7 +302,7 @@ static void common_semi_seek_cb(CPUState *cs, uint64_t ret, int err)
  */
 static uint64_t common_semi_flen_buf(CPUState *cs)
 {
-    vaddr sp = common_semi_stack_bottom(cs);
+    vaddr sp = cs->cc->semi_ops->stack_bottom(cs);
     return sp - 64;
 }
 
@@ -330,7 +330,7 @@ common_semi_readc_cb(CPUState *cs, uint64_t ret, int err)
         CPUArchState *env G_GNUC_UNUSED = cpu_env(cs);
         uint8_t ch;
 
-        if (get_user_u8(ch, common_semi_stack_bottom(cs) - 1)) {
+        if (get_user_u8(ch, cs->cc->semi_ops->stack_bottom(cs) - 1)) {
             ret = -1, err = EFAULT;
         } else {
             ret = ch;
@@ -385,7 +385,7 @@ void semihosting_arm_compatible_init(void)
  */
 void do_common_semihosting(CPUState *cs)
 {
-    CPUArchState *env = cpu_env(cs);
+    CPUArchState *env G_GNUC_UNUSED = cpu_env(cs);
     uint64_t args;
     uint64_t arg0, arg1, arg2, arg3;
     uint64_t ul_ret;
@@ -393,8 +393,8 @@ void do_common_semihosting(CPUState *cs)
     int nr;
     int64_t elapsed;
 
-    nr = common_semi_arg(cs, 0) & 0xffffffffU;
-    args = common_semi_arg(cs, 1);
+    nr = cs->cc->semi_ops->arg(cs, 0) & 0xffffffffU;
+    args = cs->cc->semi_ops->arg(cs, 1);
 
     switch (nr) {
     case TARGET_SYS_OPEN:
@@ -494,15 +494,15 @@ void do_common_semihosting(CPUState *cs)
 
     case TARGET_SYS_READC:
         semihost_sys_read_gf(cs, common_semi_readc_cb, &console_in_gf,
-                             common_semi_stack_bottom(cs) - 1, 1);
+                             cs->cc->semi_ops->stack_bottom(cs) - 1, 1);
         break;
 
     case TARGET_SYS_ISERROR:
     {
         GET_ARG(0);
-        bool ret = is_64bit_semihosting(env) ?
+        bool ret = cs->cc->semi_ops->is_64bit(cs) ?
                    (int64_t)arg0 < 0 : (int32_t)arg0 < 0;
-        common_semi_set_ret(cs, ret);
+        cs->cc->semi_ops->set_ret(cs, ret);
         break;
     }
     case TARGET_SYS_ISTTY:
@@ -533,7 +533,7 @@ void do_common_semihosting(CPUState *cs)
         len = asprintf(&s, "%s/qemu-%x%02x", g_get_tmp_dir(),
                        getpid(), (int)arg1 & 0xff);
         if (len < 0) {
-            common_semi_set_ret(cs, -1);
+            cs->cc->semi_ops->set_ret(cs, -1);
             break;
         }
 
@@ -542,7 +542,7 @@ void do_common_semihosting(CPUState *cs)
         /* Make sure there's enough space in the buffer */
         if (len > arg2) {
             free(s);
-            common_semi_set_ret(cs, -1);
+            cs->cc->semi_ops->set_ret(cs, -1);
             break;
         }
         p = lock_user(VERIFY_WRITE, arg0, len, 0);
@@ -553,7 +553,7 @@ void do_common_semihosting(CPUState *cs)
         memcpy(p, s, len);
         unlock_user(p, arg0, len);
         free(s);
-        common_semi_set_ret(cs, 0);
+        cs->cc->semi_ops->set_ret(cs, 0);
         break;
     }
 
@@ -572,7 +572,7 @@ void do_common_semihosting(CPUState *cs)
         break;
 
     case TARGET_SYS_CLOCK:
-        common_semi_set_ret(cs, clock() / (CLOCKS_PER_SEC / 100));
+        cs->cc->semi_ops->set_ret(cs, clock() / (CLOCKS_PER_SEC / 100));
         break;
 
     case TARGET_SYS_TIME:
@@ -587,7 +587,7 @@ void do_common_semihosting(CPUState *cs)
         break;
 
     case TARGET_SYS_ERRNO:
-        common_semi_set_ret(cs, get_swi_errno(cs));
+        cs->cc->semi_ops->set_ret(cs, get_swi_errno(cs));
         break;
 
     case TARGET_SYS_GET_CMDLINE:
@@ -734,7 +734,7 @@ void do_common_semihosting(CPUState *cs)
             for (i = 0; i < ARRAY_SIZE(retvals); i++) {
                 bool fail;
 
-                if (is_64bit_semihosting(env)) {
+                if (cs->cc->semi_ops->is_64bit(cs)) {
                     fail = put_user_u64(retvals[i], arg0 + i * 8);
                 } else {
                     fail = put_user_u32(retvals[i], arg0 + i * 4);
@@ -745,7 +745,7 @@ void do_common_semihosting(CPUState *cs)
                     goto do_fault;
                 }
             }
-            common_semi_set_ret(cs, 0);
+            cs->cc->semi_ops->set_ret(cs, 0);
         }
         break;
 
@@ -755,7 +755,7 @@ void do_common_semihosting(CPUState *cs)
         uint32_t ret;
 
         if (nr == TARGET_SYS_EXIT_EXTENDED ||
-            common_semi_sys_exit_is_extended(cs)) {
+            cs->cc->semi_ops->sys_exit_is_extended(cs)) {
             /*
              * The A64 version of SYS_EXIT takes a parameter block,
              * so the application-exit type can return a subcode which
@@ -786,7 +786,7 @@ void do_common_semihosting(CPUState *cs)
 
     case TARGET_SYS_ELAPSED:
         elapsed = get_clock() - clock_start;
-        if (is_64bit_semihosting(env)) {
+        if (cs->cc->semi_ops->is_64bit(cs)) {
             if (SET_ARG(0, elapsed)) {
                 goto do_fault;
             }
@@ -796,12 +796,12 @@ void do_common_semihosting(CPUState *cs)
                 goto do_fault;
             }
         }
-        common_semi_set_ret(cs, 0);
+        cs->cc->semi_ops->set_ret(cs, 0);
         break;
 
     case TARGET_SYS_TICKFREQ:
         /* qemu always uses nsec */
-        common_semi_set_ret(cs, 1000000000);
+        cs->cc->semi_ops->set_ret(cs, 1000000000);
         break;
 
     case TARGET_SYS_SYNCCACHE:
@@ -810,8 +810,8 @@ void do_common_semihosting(CPUState *cs)
          * virtual address range. This is a nop for us since we don't
          * implement caches. This is only present on A64.
          */
-        if (common_semi_has_synccache(env)) {
-            common_semi_set_ret(cs, 0);
+        if (cs->cc->semi_ops->has_synccache(cs)) {
+            cs->cc->semi_ops->set_ret(cs, 0);
             break;
         }
         /* fall through */
Signature · 1 line
2.43.0
#2 lore raw

[PULL 01/20] target/hexagon: prefix helpers conflicting with other arch

In reply to Pierrick Bouvier
---
 target/hexagon/gen_tcg.h     | 2 +-
 target/hexagon/gen_tcg_sys.h | 2 +-
 target/hexagon/helper.h      | 4 ++--
 target/hexagon/hex_mmu.c     | 2 +-
 target/hexagon/hex_mmu.h     | 2 +-
 target/hexagon/op_helper.c   | 4 ++--
 target/hexagon/translate.c   | 4 ++--
 7 files changed, 10 insertions(+), 10 deletions(-)
target/hexagon/gen_tcg.h +1 -1
index 80d8a7b6bac..ed05f97efed 100644
@@ -1135,7 +1135,7 @@
 #define fGEN_TCG_J2_pause(SHORTCODE) \
     do { \
         uiV = uiV; \
-        gen_helper_raise_exception(tcg_env, \
+        gen_helper_hexagon_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 c9f6b41a877..91ae3421f64 100644
@@ -80,7 +80,7 @@
 #define fGEN_TCG_Y2_wait(SHORTCODE) \
     do { \
         RsV = RsV; \
-        gen_helper_wait(tcg_env); \
+        gen_helper_hexagon_wait(tcg_env); \
     } while (0)
 
 #define fGEN_TCG_Y2_resume(SHORTCODE) \
target/hexagon/helper.h +2 -2
index 997d87e38e6..b97295f243a 100644
@@ -18,7 +18,7 @@
 #include "internal.h"
 #include "helper_protos_generated.h.inc"
 
-DEF_HELPER_FLAGS_3(raise_exception, TCG_CALL_NO_RETURN, noreturn, env, i32, i32)
+DEF_HELPER_FLAGS_3(hexagon_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)
@@ -136,7 +136,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(wait, void, env)
+DEF_HELPER_1(hexagon_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/hex_mmu.c +1 -1
index 0ca52ed666d..f98585a1d24 100644
@@ -115,7 +115,7 @@ int hex_tlb_check_overlap(CPUHexagonState *env, uint64_t entry, uint64_t index)
 }
 
 #ifdef CONFIG_HMP
-void dump_mmu(MonitorHMP *hmp, CPUHexagonState *env)
+void hexagon_dump_mmu(MonitorHMP *hmp, CPUHexagonState *env)
 {
     HexagonCPU *cpu = env_archcpu(env);
     hexagon_tlb_dump(hmp, cpu->tlb);
target/hexagon/hex_mmu.h +1 -1
index 977a97da31a..2cfcd10949a 100644
@@ -24,5 +24,5 @@ extern int hex_tlb_check_overlap(CPUHexagonState *env, uint64_t entry,
                                  uint64_t index);
 extern void hex_tlb_lock(CPUHexagonState *env, uint32_t PC);
 extern void hex_tlb_unlock(CPUHexagonState *env);
-void dump_mmu(MonitorHMP *hmp, CPUHexagonState *env);
+void hexagon_dump_mmu(MonitorHMP *hmp, CPUHexagonState *env);
 #endif
target/hexagon/op_helper.c +2 -2
index accadd7927a..199a2827f96 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(raise_exception)(CPUHexagonState *env, uint32_t excp,
+G_NORETURN void HELPER(hexagon_raise_exception)(CPUHexagonState *env, uint32_t excp,
                                         uint32_t PC)
 {
     hexagon_raise_exception_err(env, excp, PC);
@@ -1837,7 +1837,7 @@ void HELPER(resched)(CPUHexagonState *env)
     resched(env);
 }
 
-void HELPER(wait)(CPUHexagonState *env)
+void HELPER(hexagon_wait)(CPUHexagonState *env)
 {
     BQL_LOCK_GUARD();
 
target/hexagon/translate.c +2 -2
index cd1abdf1461..ee8588e0677 100644
@@ -140,7 +140,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_raise_exception(tcg_env, tcg_constant_i32(HEX_EVENT_PRECISE),
+    gen_helper_hexagon_raise_exception(tcg_env, tcg_constant_i32(HEX_EVENT_PRECISE),
                                tcg_constant_i32(PC));
 }
 
@@ -1163,7 +1163,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_raise_exception(tcg_env, hex_imprecise_exception, PC);
+    gen_helper_hexagon_raise_exception(tcg_env, hex_imprecise_exception, PC);
     gen_set_label(label);
 }
 #endif
Signature · 1 line
2.43.0
#3 lore raw

[PULL 04/20] hw/core/cpu: restrict tcg_ops to CONFIG_TCG only

In reply to Pierrick Bouvier

We introduce this since upcoming semihosting ops will be in the same ifdef.

---
 include/hw/core/cpu.h | 2 ++
 1 file changed, 2 insertions(+)
include/hw/core/cpu.h +2 -0
index ae66f5e33e3..76801444a16 100644
@@ -183,8 +183,10 @@ struct CPUClass {
     /* when system emulation is not available, this pointer is NULL */
     const struct SysemuCPUOps *sysemu_ops;
 
+#ifdef CONFIG_TCG
     /* when TCG is not available, this pointer is NULL */
     const TCGCPUOps *tcg_ops;
+#endif
 
     /*
      * Keep non-pointer data at the end to minimize holes.
Signature · 1 line
2.43.0
#4 lore raw

[PULL 09/20] target/arm: declare semihosting ops

In reply to Pierrick Bouvier

For now, we keep the global common_* symbols defined.

---
 target/arm/common-semi-target.c | 72 +++++++++++++++++++++++++++------
 target/arm/cpu.c                |  4 ++
 target/arm/internals.h          |  2 +
 3 files changed, 65 insertions(+), 13 deletions(-)
target/arm/common-semi-target.c +59 -13
index 38d52deb3d6..dc5f277a59e 100644
@@ -10,9 +10,10 @@
 #include "qemu/osdep.h"
 #include "cpu.h"
 #include "semihosting/common-semi.h"
+#include "internals.h"
 #include "target/arm/cpu-qom.h"
 
-uint64_t common_semi_arg(CPUState *cs, int argno)
+static uint64_t arm_semi_arg(const CPUState *cs, int argno)
 {
     ARMCPU *cpu = ARM_CPU(cs);
     CPUARMState *env = &cpu->env;
@@ -23,7 +24,7 @@ uint64_t common_semi_arg(CPUState *cs, int argno)
     }
 }
 
-void common_semi_set_ret(CPUState *cs, uint64_t ret)
+static void arm_semi_set_ret(CPUState *cs, uint64_t ret)
 {
     ARMCPU *cpu = ARM_CPU(cs);
     CPUARMState *env = &cpu->env;
@@ -34,29 +35,74 @@ void common_semi_set_ret(CPUState *cs, uint64_t ret)
     }
 }
 
+static void arm_semi_set_err(CPUState *cs, int err)
+{
+}
+
+static bool arm_semi_is_64bit(const CPUState *cs)
+{
+    return is_a64(cpu_env(cs));
+}
+
+static bool arm_semi_sys_exit_is_extended(const CPUState *cs)
+{
+    return is_a64(cpu_env(cs));
+}
+
+static uint64_t arm_semi_stack_bottom(const CPUState *cs)
+{
+    const ARMCPU *cpu = ARM_CPU(cs);
+    const CPUARMState *env = &cpu->env;
+    return is_a64(env) ? env->xregs[31] : env->regs[13];
+}
+
+static bool arm_semi_has_synccache(const CPUState *cs)
+{
+    /* Ok for A64, invalid for A32/T32 */
+    return is_a64(cpu_env(cs));
+}
+
+const SemihostingCPUOps arm_semihosting_ops = {
+    .arg = arm_semi_arg,
+    .set_ret = arm_semi_set_ret,
+    .set_err = arm_semi_set_err,
+    .is_64bit = arm_semi_is_64bit,
+    .sys_exit_is_extended = arm_semi_sys_exit_is_extended,
+    .stack_bottom = arm_semi_stack_bottom,
+    .has_synccache = arm_semi_has_synccache,
+};
+
+uint64_t common_semi_arg(CPUState *cs, int argno)
+{
+    return arm_semi_arg(cs, argno);
+}
+
+void common_semi_set_ret(CPUState *cs, uint64_t ret)
+{
+    arm_semi_set_ret(cs, ret);
+}
+
 void common_semi_set_err(CPUState *cs, int err)
 {
-}
-
-bool common_semi_sys_exit_is_extended(CPUState *cs)
-{
-    return is_a64(cpu_env(cs));
+    arm_semi_set_err(cs, err);
 }
 
 bool is_64bit_semihosting(CPUArchState *env)
 {
-    return is_a64(env);
+    return arm_semi_is_64bit(env_cpu(env));
+}
+
+bool common_semi_sys_exit_is_extended(CPUState *cs)
+{
+    return arm_semi_sys_exit_is_extended(cs);
 }
 
 uint64_t common_semi_stack_bottom(CPUState *cs)
 {
-    ARMCPU *cpu = ARM_CPU(cs);
-    CPUARMState *env = &cpu->env;
-    return is_a64(env) ? env->xregs[31] : env->regs[13];
+    return arm_semi_stack_bottom(cs);
 }
 
 bool common_semi_has_synccache(CPUArchState *env)
 {
-    /* Ok for A64, invalid for A32/T32 */
-    return is_a64(env);
+    return arm_semi_has_synccache(env_cpu(env));
 }
target/arm/cpu.c +4 -0
index 10ac6c98318..81ec1ce21c6 100644
@@ -2663,6 +2663,10 @@ static void arm_cpu_class_init(ObjectClass *oc, const void *data)
 
 #ifdef CONFIG_TCG
     cc->tcg_ops = &arm_tcg_ops;
+#if !defined(CONFIG_USER_ONLY) || defined(CONFIG_LINUX)
+    /* semihosting is not supported for bsd-user */
+    cc->semi_ops = &arm_semihosting_ops;
+#endif
 #endif /* CONFIG_TCG */
 }
 
target/arm/internals.h +2 -0
index c41fa5225c7..e849e357cfe 100644
@@ -437,6 +437,8 @@ bool arm_cpu_exec_halt(CPUState *cs);
 int arm_cpu_mmu_index(CPUState *cs, bool ifetch);
 #endif /* CONFIG_TCG */
 
+extern const struct SemihostingCPUOps arm_semihosting_ops;
+
 typedef enum ARMFPRounding {
     FPROUNDING_TIEEVEN,
     FPROUNDING_POSINF,
Signature · 1 line
2.43.0
#5 lore raw

[PULL 14/20] target/i386: rename qmp_query_cpu_definitions to qmp_query_i386_cpu_definitions

In reply to Pierrick Bouvier
---
 include/system/qmp-cpu.h | 1 +
 target/i386/cpu.c        | 8 +++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)
include/system/qmp-cpu.h +1 -0
index e969aec667a..84b78c3a097 100644
@@ -10,5 +10,6 @@
 #include "qapi/qapi-types-machine.h"
 
 CpuDefinitionInfoList *qmp_query_arm_cpu_definitions(Error **errp);
+CpuDefinitionInfoList *qmp_query_i386_cpu_definitions(Error **errp);
 
 #endif
target/i386/cpu.c +7 -1
index 74eebeabd7a..dc762b802e1 100644
@@ -45,6 +45,7 @@
 #include "monitor/hmp.h"
 #include "system/reset.h"
 #include "qapi/qapi-commands-machine.h"
+#include "system/qmp-cpu.h"
 #include "system/address-spaces.h"
 #include "hw/core/boards.h"
 #include "hw/i386/sgx-epc.h"
@@ -8191,7 +8192,7 @@ static void x86_cpu_definition_entry(gpointer data, gpointer user_data)
     QAPI_LIST_PREPEND(*cpu_list, info);
 }
 
-CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
+CpuDefinitionInfoList *qmp_query_i386_cpu_definitions(Error **errp)
 {
     CpuDefinitionInfoList *cpu_list = NULL;
     GSList *list = get_sorted_cpu_model_list();
@@ -8200,6 +8201,11 @@ CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
     return cpu_list;
 }
 
+CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
+{
+    return qmp_query_i386_cpu_definitions(errp);
+}
+
 #endif /* !CONFIG_USER_ONLY */
 
 static uint8_t x86_cpu_get_host_avx10_version(void)
Signature · 1 line
2.43.0
#6 lore raw

[PULL 08/20] target/hexagon: declare semihosting ops

In reply to Pierrick Bouvier

For now, we keep the global common_* symbols defined.

---
 target/hexagon/common-semi-target.c | 65 ++++++++++++++++++++++++-----
 target/hexagon/cpu.c                |  2 +
 target/hexagon/internal.h           |  2 +
 3 files changed, 59 insertions(+), 10 deletions(-)
target/hexagon/common-semi-target.c +55 -10
index 210d33e54e2..da92ff298a2 100644
@@ -8,44 +8,89 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
-#include "cpu_helper.h"
 #include "semihosting/common-semi.h"
+#include "internal.h"
 
-uint64_t common_semi_arg(CPUState *cs, int argno)
+static uint64_t hexagon_semi_arg(const CPUState *cs, int argno)
 {
-    CPUHexagonState *env = cpu_env(cs);
+    const CPUHexagonState *env = cpu_env(cs);
     return env->gpr[HEX_REG_R00 + argno];
 }
 
-void common_semi_set_ret(CPUState *cs, uint64_t ret)
+static void hexagon_semi_set_ret(CPUState *cs, uint64_t ret)
 {
     CPUHexagonState *env = cpu_env(cs);
     env->gpr[HEX_REG_R00] = ret;
 }
 
-void common_semi_set_err(CPUState *cs, int err)
+static void hexagon_semi_set_err(CPUState *cs, int err)
 {
     CPUHexagonState *env = cpu_env(cs);
     env->gpr[HEX_REG_R01] = err;
 }
 
-bool common_semi_sys_exit_is_extended(CPUState *cs)
+static bool hexagon_semi_is_64bit(const CPUState *cs)
 {
     return false;
 }
 
+static bool hexagon_semi_sys_exit_is_extended(const CPUState *cs)
+{
+    return false;
+}
+
+static uint64_t hexagon_semi_stack_bottom(const CPUState *cs)
+{
+    const CPUHexagonState *env = cpu_env(cs);
+    return env->gpr[HEX_REG_SP];
+}
+
+static bool hexagon_semi_has_synccache(const CPUState *cs)
+{
+    return false;
+}
+
+const SemihostingCPUOps hexagon_semihosting_ops = {
+    .arg = hexagon_semi_arg,
+    .set_ret = hexagon_semi_set_ret,
+    .set_err = hexagon_semi_set_err,
+    .is_64bit = hexagon_semi_is_64bit,
+    .sys_exit_is_extended = hexagon_semi_sys_exit_is_extended,
+    .stack_bottom = hexagon_semi_stack_bottom,
+    .has_synccache = hexagon_semi_has_synccache,
+};
+
+uint64_t common_semi_arg(CPUState *cs, int argno)
+{
+    return hexagon_semi_arg(cs, argno);
+}
+
+void common_semi_set_ret(CPUState *cs, uint64_t ret)
+{
+    hexagon_semi_set_ret(cs, ret);
+}
+
+void common_semi_set_err(CPUState *cs, int err)
+{
+    hexagon_semi_set_err(cs, err);
+}
+
 bool is_64bit_semihosting(CPUArchState *env)
 {
-    return false;
+    return hexagon_semi_is_64bit(env_cpu(env));
+}
+
+bool common_semi_sys_exit_is_extended(CPUState *cs)
+{
+    return hexagon_semi_sys_exit_is_extended(cs);
 }
 
 uint64_t common_semi_stack_bottom(CPUState *cs)
 {
-    CPUHexagonState *env = cpu_env(cs);
-    return env->gpr[HEX_REG_SP];
+    return hexagon_semi_stack_bottom(cs);
 }
 
 bool common_semi_has_synccache(CPUArchState *env)
 {
-    return false;
+    return hexagon_semi_has_synccache(env_cpu(env));
 }
target/hexagon/cpu.c +2 -0
index 6550e7fa800..8bbd4647968 100644
@@ -851,6 +851,8 @@ static void hexagon_cpu_class_init(ObjectClass *c, const void *data)
 #ifndef CONFIG_USER_ONLY
     cc->sysemu_ops = &hexagon_sysemu_ops;
     dc->vmsd = &vmstate_hexagon_cpu;
+    /* semihosting is only supported in system mode for Hexagon */
+    cc->semi_ops = &hexagon_semihosting_ops;
 #endif
 #ifdef CONFIG_TCG
     cc->tcg_ops = &hexagon_tcg_ops;
target/hexagon/internal.h +2 -0
index 3ed83904eb7..073de10284e 100644
@@ -34,6 +34,8 @@ void hexagon_debug_qreg(CPUHexagonState *env, int regnum);
 void hexagon_debug(CPUHexagonState *env);
 void hexagon_dump(CPUHexagonState *env, FILE *f, int flags);
 
+extern const struct SemihostingCPUOps hexagon_semihosting_ops;
+
 extern const char * const hexagon_regnames[TOTAL_PER_THREAD_REGS];
 #ifndef CONFIG_USER_ONLY
 extern const char * const hexagon_sregnames[];
Signature · 1 line
2.43.0
#7 lore raw

[PULL 03/20] hw/hexagon/virt: make machine available for hexagon target only

In reply to Pierrick Bouvier
---
 hw/hexagon/virt.c | 2 ++
 1 file changed, 2 insertions(+)
hw/hexagon/virt.c +2 -0
index 64d8366d27d..b601cd77a92 100644
@@ -20,6 +20,7 @@
 #include "hw/core/register.h"
 #include "qemu/error-report.h"
 #include "qemu/guest-random.h"
+#include "qemu/target-info.h"
 #include "qemu/units.h"
 #include "machine_cfg_v68n_1024.h.inc"
 #include "system/address-spaces.h"
@@ -379,6 +380,7 @@ static const TypeInfo virt_machine_types[] = { {
     .parent = TYPE_HEXAGON_COMMON_MACHINE,
     .instance_size = sizeof(HexagonVirtMachineState),
     .class_init = virt_class_init,
+    .is_available = target_hexagon,
 } };
 
 DEFINE_TYPES(virt_machine_types)
Signature · 1 line
2.43.0
#8 lore raw

[PULL 02/20] target-info: add target_hexagon

In reply to Pierrick Bouvier
---
 include/qemu/target-info.h | 7 +++++++
 target-info.c              | 5 +++++
 2 files changed, 12 insertions(+)
include/qemu/target-info.h +7 -0
index adda363ac39..862097c6c63 100644
@@ -70,6 +70,13 @@ bool target_aarch64(void);
  */
 bool target_m68k(void);
 
+/**
+ * target_hexagon:
+ *
+ * Returns whether the target architecture is Hexagon.
+ */
+bool target_hexagon(void);
+
 /**
  * target_or1k:
  *
target-info.c +5 -0
index 6b365113955..254530d8ea5 100644
@@ -68,6 +68,11 @@ bool target_m68k(void)
     return target_arch() == SYS_EMU_TARGET_M68K;
 }
 
+bool target_hexagon(void)
+{
+    return target_arch() == SYS_EMU_TARGET_HEXAGON;
+}
+
 bool target_or1k(void)
 {
     return target_arch() == SYS_EMU_TARGET_OR1K;
Signature · 1 line
2.43.0
#9 lore raw

[PULL 13/20] target/arm: rename qmp_query_cpu_definitions to qmp_query_arm_cpu_definitions

In reply to Pierrick Bouvier

In a future commit, a single target-agnostic qmp_query_cpu_definitions() will dispatch call to the per-architecture implementations based on target_arch(). Introduce the header holding those declarations and rename the arm implementation.

We keep the existing qmp_query_cpu_definitions() function to not break the build.

---
 include/system/qmp-cpu.h  | 14 ++++++++++++++
 target/arm/arm-qmp-cmds.c |  8 +++++++-
 2 files changed, 21 insertions(+), 1 deletion(-)
 create mode 100644 include/system/qmp-cpu.h
include/system/qmp-cpu.h new file +14 -0
new file mode 100644
index 00000000000..e969aec667a
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Per-architecture implementations of CPU-related QMP commands.
+ */
+
+#ifndef SYSTEM_QMP_CPU_H
+#define SYSTEM_QMP_CPU_H
+
+#include "qapi/error.h"
+#include "qapi/qapi-types-machine.h"
+
+CpuDefinitionInfoList *qmp_query_arm_cpu_definitions(Error **errp);
+
+#endif
target/arm/arm-qmp-cmds.c +7 -1
index 83ec95c290f..d227a06e2c6 100644
@@ -28,6 +28,7 @@
 #include "qapi/visitor.h"
 #include "qapi/qobject-input-visitor.h"
 #include "qapi/qapi-commands-machine.h"
+#include "system/qmp-cpu.h"
 #include "qapi/qapi-commands-misc-arm.h"
 #include "qobject/qdict.h"
 #include "qom/qom-qobject.h"
@@ -216,7 +217,7 @@ static void arm_cpu_add_definition(gpointer data, gpointer user_data)
     QAPI_LIST_PREPEND(*cpu_list, info);
 }
 
-CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
+CpuDefinitionInfoList *qmp_query_arm_cpu_definitions(Error **errp)
 {
     CpuDefinitionInfoList *cpu_list = NULL;
     GSList *list;
@@ -227,3 +228,8 @@ CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
 
     return cpu_list;
 }
+
+CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
+{
+    return qmp_query_arm_cpu_definitions(errp);
+}
Signature · 1 line
2.43.0
#10 lore raw

[PULL 20/20] qmp: reimplement qmp_query_cpu_definitions as a dispatcher function

In reply to Pierrick Bouvier

Now that we have per target implementations of this function, we simply dispatch the call to relevant implementation.
This eliminates duplication of qmp_query_cpu_definitions symbol.

We need to define individual stubs for targets function since each existing binary only has one variant defined. Stub mechanism works per compilation unit, thus we need one file per symbol.

---
 hw/core/machine-qmp-cmds.c            | 32 +++++++++++++++++++++++++++
 stubs/meson.build                     |  6 +++++
 stubs/qmp-cpu-arm.c                   |  9 ++++++++
 stubs/qmp-cpu-i386.c                  |  9 ++++++++
 stubs/qmp-cpu-loongarch.c             |  9 ++++++++
 stubs/qmp-cpu-mips.c                  |  9 ++++++++
 stubs/qmp-cpu-ppc.c                   |  9 ++++++++
 stubs/qmp-cpu-riscv.c                 |  9 ++++++++
 stubs/qmp-cpu-s390x.c                 |  6 +++++
 stubs/qmp-cpu.c                       |  7 ------
 target/arm/arm-qmp-cmds.c             |  5 -----
 target/i386/cpu.c                     |  5 -----
 target/loongarch/loongarch-qmp-cmds.c |  5 -----
 target/mips/system/mips-qmp-cmds.c    |  5 -----
 target/ppc/ppc-qmp-cmds.c             |  5 -----
 target/riscv/riscv-qmp-cmds.c         |  5 -----
 target/s390x/cpu_models_system.c      |  5 -----
 17 files changed, 98 insertions(+), 42 deletions(-)
 create mode 100644 stubs/qmp-cpu-arm.c
 create mode 100644 stubs/qmp-cpu-i386.c
 create mode 100644 stubs/qmp-cpu-loongarch.c
 create mode 100644 stubs/qmp-cpu-mips.c
 create mode 100644 stubs/qmp-cpu-ppc.c
 create mode 100644 stubs/qmp-cpu-riscv.c
hw/core/machine-qmp-cmds.c +32 -0
index 9c08b17510a..3fee45d568d 100644
@@ -27,6 +27,7 @@
 #include "system/hostmem.h"
 #include "system/hw_accel.h"
 #include "system/numa.h"
+#include "system/qmp-cpu.h"
 #include "system/ramlist.h"
 #include "system/runstate.h"
 #include "system/system.h"
@@ -93,6 +94,37 @@ CpuInfoFastList *qmp_query_cpus_fast(Error **errp)
     return head;
 }
 
+CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
+{
+    switch (target_arch()) {
+    case SYS_EMU_TARGET_AARCH64:
+    case SYS_EMU_TARGET_ARM:
+        return qmp_query_arm_cpu_definitions(errp);
+    case SYS_EMU_TARGET_I386:
+    case SYS_EMU_TARGET_X86_64:
+        return qmp_query_i386_cpu_definitions(errp);
+    case SYS_EMU_TARGET_LOONGARCH64:
+        return qmp_query_loongarch_cpu_definitions(errp);
+    case SYS_EMU_TARGET_MIPS:
+    case SYS_EMU_TARGET_MIPS64:
+    case SYS_EMU_TARGET_MIPS64EL:
+    case SYS_EMU_TARGET_MIPSEL:
+        return qmp_query_mips_cpu_definitions(errp);
+    case SYS_EMU_TARGET_PPC:
+    case SYS_EMU_TARGET_PPC64:
+        return qmp_query_ppc_cpu_definitions(errp);
+    case SYS_EMU_TARGET_RISCV32:
+    case SYS_EMU_TARGET_RISCV64:
+        return qmp_query_riscv_cpu_definitions(errp);
+    case SYS_EMU_TARGET_S390X:
+        return qmp_query_s390x_cpu_definitions(errp);
+    default:
+        error_setg(errp,
+                   "CPU model definitions are not supported on this target");
+        return NULL;
+    }
+}
+
 MachineInfoList *qmp_query_machines(bool has_compat_props, bool compat_props,
                                     Error **errp)
 {
stubs/meson.build +6 -0
index 29b6644b254..dcb67ce5295 100644
@@ -86,6 +86,12 @@ if have_system
   stub_ss.add(files('qmp-i386-sgx.c'))
   stub_ss.add(files('qmp-i386-xen.c'))
   stub_ss.add(files('qmp-cpu.c'))
+  stub_ss.add(files('qmp-cpu-arm.c'))
+  stub_ss.add(files('qmp-cpu-i386.c'))
+  stub_ss.add(files('qmp-cpu-loongarch.c'))
+  stub_ss.add(files('qmp-cpu-mips.c'))
+  stub_ss.add(files('qmp-cpu-ppc.c'))
+  stub_ss.add(files('qmp-cpu-riscv.c'))
   stub_ss.add(files('qmp-cpu-s390x.c'))
   stub_ss.add(files('qmp-cpu-s390x-kvm.c'))
   if have_hmp
stubs/qmp-cpu-arm.c new file +9 -0
new file mode 100644
index 00000000000..6249d7bde8d
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include "qemu/osdep.h"
+#include "system/qmp-cpu.h"
+
+CpuDefinitionInfoList *qmp_query_arm_cpu_definitions(Error **errp)
+{
+    g_assert_not_reached();
+}
stubs/qmp-cpu-i386.c new file +9 -0
new file mode 100644
index 00000000000..4858951f8c2
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include "qemu/osdep.h"
+#include "system/qmp-cpu.h"
+
+CpuDefinitionInfoList *qmp_query_i386_cpu_definitions(Error **errp)
+{
+    g_assert_not_reached();
+}
stubs/qmp-cpu-loongarch.c new file +9 -0
new file mode 100644
index 00000000000..695b6558d7e
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include "qemu/osdep.h"
+#include "system/qmp-cpu.h"
+
+CpuDefinitionInfoList *qmp_query_loongarch_cpu_definitions(Error **errp)
+{
+    g_assert_not_reached();
+}
stubs/qmp-cpu-mips.c new file +9 -0
new file mode 100644
index 00000000000..4d251d5f078
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include "qemu/osdep.h"
+#include "system/qmp-cpu.h"
+
+CpuDefinitionInfoList *qmp_query_mips_cpu_definitions(Error **errp)
+{
+    g_assert_not_reached();
+}
stubs/qmp-cpu-ppc.c new file +9 -0
new file mode 100644
index 00000000000..315461c7db7
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include "qemu/osdep.h"
+#include "system/qmp-cpu.h"
+
+CpuDefinitionInfoList *qmp_query_ppc_cpu_definitions(Error **errp)
+{
+    g_assert_not_reached();
+}
stubs/qmp-cpu-riscv.c new file +9 -0
new file mode 100644
index 00000000000..ce500ffa3f3
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include "qemu/osdep.h"
+#include "system/qmp-cpu.h"
+
+CpuDefinitionInfoList *qmp_query_riscv_cpu_definitions(Error **errp)
+{
+    g_assert_not_reached();
+}
stubs/qmp-cpu-s390x.c +6 -0
index 71e794482b5..4556072a226 100644
@@ -3,6 +3,12 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "qapi/qapi-commands-machine.h"
+#include "system/qmp-cpu.h"
+
+CpuDefinitionInfoList *qmp_query_s390x_cpu_definitions(Error **errp)
+{
+    g_assert_not_reached();
+}
 
 CpuModelCompareInfo *
 qmp_query_cpu_model_comparison(CpuModelInfo *infoa,
stubs/qmp-cpu.c +0 -7
index a8c7ee89b9d..ac185f09f2d 100644
@@ -12,10 +12,3 @@ qmp_query_cpu_model_expansion(CpuModelExpansionType type,
     error_setg(errp, "CPU model expansion is not supported on this target");
     return NULL;
 }
-
-CpuDefinitionInfoList *
-qmp_query_cpu_definitions(Error **errp)
-{
-    error_setg(errp, "CPU model definitions are not supported on this target");
-    return NULL;
-}
target/arm/arm-qmp-cmds.c +0 -5
index d227a06e2c6..cef0c27db65 100644
@@ -228,8 +228,3 @@ CpuDefinitionInfoList *qmp_query_arm_cpu_definitions(Error **errp)
 
     return cpu_list;
 }
-
-CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
-{
-    return qmp_query_arm_cpu_definitions(errp);
-}
target/i386/cpu.c +0 -5
index dc762b802e1..5da80ade70e 100644
@@ -8201,11 +8201,6 @@ CpuDefinitionInfoList *qmp_query_i386_cpu_definitions(Error **errp)
     return cpu_list;
 }
 
-CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
-{
-    return qmp_query_i386_cpu_definitions(errp);
-}
-
 #endif /* !CONFIG_USER_ONLY */
 
 static uint8_t x86_cpu_get_host_avx10_version(void)
target/loongarch/loongarch-qmp-cmds.c +0 -5
index dadf5de889d..351b6aed7c8 100644
@@ -41,11 +41,6 @@ CpuDefinitionInfoList *qmp_query_loongarch_cpu_definitions(Error **errp)
     return cpu_list;
 }
 
-CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
-{
-    return qmp_query_loongarch_cpu_definitions(errp);
-}
-
 static const char *cpu_model_advertised_features[] = {
     "lsx", "lasx", "lbt", "pmu", "kvm-pv-ipi", "kvm-steal-time", "msgint",
     "ptw", NULL
target/mips/system/mips-qmp-cmds.c +0 -5
index 560c7915365..ccbdbf8877a 100644
@@ -48,8 +48,3 @@ CpuDefinitionInfoList *qmp_query_mips_cpu_definitions(Error **errp)
 
     return cpu_list;
 }
-
-CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
-{
-    return qmp_query_mips_cpu_definitions(errp);
-}
target/ppc/ppc-qmp-cmds.c +0 -5
index fe35ae1ac04..1338233ee63 100644
@@ -83,8 +83,3 @@ CpuDefinitionInfoList *qmp_query_ppc_cpu_definitions(Error **errp)
 
     return cpu_list;
 }
-
-CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
-{
-    return qmp_query_ppc_cpu_definitions(errp);
-}
target/riscv/riscv-qmp-cmds.c +0 -5
index ccd6ae1d5cf..b70975affed 100644
@@ -66,11 +66,6 @@ CpuDefinitionInfoList *qmp_query_riscv_cpu_definitions(Error **errp)
     return cpu_list;
 }
 
-CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
-{
-    return qmp_query_riscv_cpu_definitions(errp);
-}
-
 static void riscv_check_if_cpu_available(RISCVCPU *cpu, Error **errp)
 {
     if (!riscv_cpu_accelerator_compatible(cpu)) {
target/s390x/cpu_models_system.c +0 -5
index f963ca5248a..f82b693b0cd 100644
@@ -97,11 +97,6 @@ CpuDefinitionInfoList *qmp_query_s390x_cpu_definitions(Error **errp)
     return list_data.list;
 }
 
-CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
-{
-    return qmp_query_s390x_cpu_definitions(errp);
-}
-
 static void cpu_model_from_info(S390CPUModel *model, const CpuModelInfo *info,
                                 const char *info_arg_name, Error **errp)
 {
Signature · 1 line
2.43.0
#11 lore raw

[PULL 15/20] target/loongarch: rename to qmp_query_loongarch_cpu_definitions

In reply to Pierrick Bouvier
---
 include/system/qmp-cpu.h              | 1 +
 target/loongarch/loongarch-qmp-cmds.c | 8 +++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)
include/system/qmp-cpu.h +1 -0
index 84b78c3a097..dbca230ac6f 100644
@@ -11,5 +11,6 @@
 
 CpuDefinitionInfoList *qmp_query_arm_cpu_definitions(Error **errp);
 CpuDefinitionInfoList *qmp_query_i386_cpu_definitions(Error **errp);
+CpuDefinitionInfoList *qmp_query_loongarch_cpu_definitions(Error **errp);
 
 #endif
target/loongarch/loongarch-qmp-cmds.c +7 -1
index f053f22bb8c..dadf5de889d 100644
@@ -10,6 +10,7 @@
 #include "qemu/target-info.h"
 #include "qapi/error.h"
 #include "qapi/qapi-commands-machine.h"
+#include "system/qmp-cpu.h"
 #include "cpu.h"
 #include "qobject/qdict.h"
 #include "qapi/qobject-input-visitor.h"
@@ -28,7 +29,7 @@ static void loongarch_cpu_add_definition(gpointer data, gpointer user_data)
     QAPI_LIST_PREPEND(*cpu_list, info);
 }
 
-CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
+CpuDefinitionInfoList *qmp_query_loongarch_cpu_definitions(Error **errp)
 {
     CpuDefinitionInfoList *cpu_list = NULL;
     GSList *list;
@@ -40,6 +41,11 @@ CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
     return cpu_list;
 }
 
+CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
+{
+    return qmp_query_loongarch_cpu_definitions(errp);
+}
+
 static const char *cpu_model_advertised_features[] = {
     "lsx", "lasx", "lbt", "pmu", "kvm-pv-ipi", "kvm-steal-time", "msgint",
     "ptw", NULL
Signature · 1 line
2.43.0
#12 lore raw

[PULL 17/20] target/ppc: rename qmp_query_cpu_definitions to qmp_query_ppc_cpu_definitions

In reply to Pierrick Bouvier
---
 include/system/qmp-cpu.h  | 1 +
 target/ppc/ppc-qmp-cmds.c | 8 +++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)
include/system/qmp-cpu.h +1 -0
index 4267adfdc03..fba0e11d5e2 100644
@@ -13,5 +13,6 @@ CpuDefinitionInfoList *qmp_query_arm_cpu_definitions(Error **errp);
 CpuDefinitionInfoList *qmp_query_i386_cpu_definitions(Error **errp);
 CpuDefinitionInfoList *qmp_query_loongarch_cpu_definitions(Error **errp);
 CpuDefinitionInfoList *qmp_query_mips_cpu_definitions(Error **errp);
+CpuDefinitionInfoList *qmp_query_ppc_cpu_definitions(Error **errp);
 
 #endif
target/ppc/ppc-qmp-cmds.c +7 -1
index 96228919966..fe35ae1ac04 100644
@@ -27,6 +27,7 @@
 #include "qemu/ctype.h"
 #include "qapi/error.h"
 #include "qapi/qapi-commands-machine.h"
+#include "system/qmp-cpu.h"
 #include "cpu-models.h"
 #include "cpu-qom.h"
 
@@ -53,7 +54,7 @@ static void ppc_cpu_defs_entry(gpointer data, gpointer user_data)
     QAPI_LIST_PREPEND(*first, info);
 }
 
-CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
+CpuDefinitionInfoList *qmp_query_ppc_cpu_definitions(Error **errp)
 {
     CpuDefinitionInfoList *cpu_list = NULL;
     GSList *list;
@@ -82,3 +83,8 @@ CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
 
     return cpu_list;
 }
+
+CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
+{
+    return qmp_query_ppc_cpu_definitions(errp);
+}
Signature · 1 line
2.43.0
#13 lore raw

[PULL 07/20] target/riscv: declare semihosting ops

In reply to Pierrick Bouvier

For now, we keep the global common_* symbols defined.

---
 target/riscv/common-semi-target.c | 66 ++++++++++++++++++++++++++-----
 target/riscv/cpu.c                |  4 ++
 target/riscv/internals.h          |  2 +
 3 files changed, 62 insertions(+), 10 deletions(-)
target/riscv/common-semi-target.c +56 -10
index 38a00e160c3..f0f9e29dc4c 100644
@@ -11,43 +11,89 @@
 #include "qemu/osdep.h"
 #include "cpu.h"
 #include "semihosting/common-semi.h"
+#include "internals.h"
 
-uint64_t common_semi_arg(CPUState *cs, int argno)
+static uint64_t riscv_semi_arg(const CPUState *cs, int argno)
 {
-    RISCVCPU *cpu = RISCV_CPU(cs);
-    CPURISCVState *env = &cpu->env;
+    const RISCVCPU *cpu = RISCV_CPU(cs);
+    const CPURISCVState *env = &cpu->env;
     return env->gpr[xA0 + argno];
 }
 
-void common_semi_set_ret(CPUState *cs, uint64_t ret)
+static void riscv_semi_set_ret(CPUState *cs, uint64_t ret)
 {
     RISCVCPU *cpu = RISCV_CPU(cs);
     CPURISCVState *env = &cpu->env;
     env->gpr[xA0] = ret;
 }
 
+static void riscv_semi_set_err(CPUState *cs, int err)
+{
+}
+
+static bool riscv_semi_is_64bit(const CPUState *cs)
+{
+    return riscv_cpu_mxl(cpu_env(cs)) != MXL_RV32;
+}
+
+static bool riscv_semi_sys_exit_is_extended(const CPUState *cs)
+{
+    return riscv_semi_is_64bit(cs);
+}
+
+static uint64_t riscv_semi_stack_bottom(const CPUState *cs)
+{
+    const RISCVCPU *cpu = RISCV_CPU(cs);
+    const CPURISCVState *env = &cpu->env;
+    return env->gpr[xSP];
+}
+
+static bool riscv_semi_has_synccache(const CPUState *cs)
+{
+    return true;
+}
+
+const SemihostingCPUOps riscv_semihosting_ops = {
+    .arg = riscv_semi_arg,
+    .set_ret = riscv_semi_set_ret,
+    .set_err = riscv_semi_set_err,
+    .is_64bit = riscv_semi_is_64bit,
+    .sys_exit_is_extended = riscv_semi_sys_exit_is_extended,
+    .stack_bottom = riscv_semi_stack_bottom,
+    .has_synccache = riscv_semi_has_synccache,
+};
+
+uint64_t common_semi_arg(CPUState *cs, int argno)
+{
+    return riscv_semi_arg(cs, argno);
+}
+
+void common_semi_set_ret(CPUState *cs, uint64_t ret)
+{
+    riscv_semi_set_ret(cs, ret);
+}
+
 void common_semi_set_err(CPUState *cs, int err)
 {
+    riscv_semi_set_err(cs, err);
 }
 
 bool is_64bit_semihosting(CPUArchState *env)
 {
-    return riscv_cpu_mxl(env) != MXL_RV32;
+    return riscv_semi_is_64bit(env_cpu(env));
 }
 
 bool common_semi_sys_exit_is_extended(CPUState *cs)
 {
-    return is_64bit_semihosting(cpu_env(cs));
+    return riscv_semi_sys_exit_is_extended(cs);
 }
 
 uint64_t common_semi_stack_bottom(CPUState *cs)
 {
-    RISCVCPU *cpu = RISCV_CPU(cs);
-    CPURISCVState *env = &cpu->env;
-    return env->gpr[xSP];
+    return riscv_semi_stack_bottom(cs);
 }
 
 bool common_semi_has_synccache(CPUArchState *env)
 {
-    return true;
+    return riscv_semi_has_synccache(env_cpu(env));
 }
target/riscv/cpu.c +4 -0
index da4c1a090b9..63c709ac738 100644
@@ -3053,6 +3053,10 @@ static void riscv_cpu_common_class_init(ObjectClass *c, const void *data)
     cc->gdb_arch_name = riscv_gdb_arch_name;
 #ifdef CONFIG_TCG
     cc->tcg_ops = &riscv_tcg_ops;
+#if !defined(CONFIG_USER_ONLY) || defined(CONFIG_LINUX)
+    /* semihosting is not supported for bsd-user */
+    cc->semi_ops = &riscv_semihosting_ops;
+#endif
 #endif /* CONFIG_TCG */
 
     device_class_set_props(dc, riscv_cpu_properties);
target/riscv/internals.h +2 -0
index 5d84e4de960..f17d011d22f 100644
@@ -206,6 +206,8 @@ static inline target_ulong get_xepc_mask(CPURISCVState *env)
 bool riscv_cpu_has_work(CPUState *cs);
 #endif
 
+extern const struct SemihostingCPUOps riscv_semihosting_ops;
+
 /* Zjpm addr masking routine */
 static inline target_ulong adjust_addr_body(CPURISCVState *env,
                                             target_ulong addr,
Signature · 1 line
2.43.0
#14 lore raw

[PULL 19/20] target/s390x: rename qmp_query_cpu_definitions to qmp_query_s390x_cpu_definitions

In reply to Pierrick Bouvier
---
 include/system/qmp-cpu.h         | 1 +
 target/s390x/cpu_models_system.c | 8 +++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)
include/system/qmp-cpu.h +1 -0
index c1bfdd679e2..f0e0d427e3b 100644
@@ -15,5 +15,6 @@ CpuDefinitionInfoList *qmp_query_loongarch_cpu_definitions(Error **errp);
 CpuDefinitionInfoList *qmp_query_mips_cpu_definitions(Error **errp);
 CpuDefinitionInfoList *qmp_query_ppc_cpu_definitions(Error **errp);
 CpuDefinitionInfoList *qmp_query_riscv_cpu_definitions(Error **errp);
+CpuDefinitionInfoList *qmp_query_s390x_cpu_definitions(Error **errp);
 
 #endif
target/s390x/cpu_models_system.c +7 -1
index 5b846048675..f963ca5248a 100644
@@ -20,6 +20,7 @@
 #include "qapi/qobject-input-visitor.h"
 #include "qobject/qdict.h"
 #include "qapi/qapi-commands-machine.h"
+#include "system/qmp-cpu.h"
 
 static void list_add_feat(const char *name, void *opaque);
 
@@ -82,7 +83,7 @@ static void create_cpu_model_list(ObjectClass *klass, void *opaque)
     QAPI_LIST_PREPEND(*cpu_list, info);
 }
 
-CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
+CpuDefinitionInfoList *qmp_query_s390x_cpu_definitions(Error **errp)
 {
     struct CpuDefinitionInfoListData list_data = {
         .list = NULL,
@@ -96,6 +97,11 @@ CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
     return list_data.list;
 }
 
+CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
+{
+    return qmp_query_s390x_cpu_definitions(errp);
+}
+
 static void cpu_model_from_info(S390CPUModel *model, const CpuModelInfo *info,
                                 const char *info_arg_name, Error **errp)
 {
Signature · 1 line
2.43.0
#15 lore raw

[PULL 05/20] semihosting: declare semihosting cpu ops

In reply to Pierrick Bouvier

This allows a specific target to declare its implementation of semihosting.

---
 include/hw/core/cpu.h             |  6 ++++++
 include/semihosting/common-semi.h | 17 +++++++++++++++++
 2 files changed, 23 insertions(+)
include/hw/core/cpu.h +6 -0
index 76801444a16..456154df6f6 100644
@@ -98,6 +98,9 @@ struct AccelCPUClass;
 /* see sysemu-cpu-ops.h */
 struct SysemuCPUOps;
 
+/* see semihosting/common-semi.h */
+struct SemihostingCPUOps;
+
 /**
  * CPUClass:
  * @class_by_name: Callback to map -cpu command line model name to an
@@ -186,6 +189,9 @@ struct CPUClass {
 #ifdef CONFIG_TCG
     /* when TCG is not available, this pointer is NULL */
     const TCGCPUOps *tcg_ops;
+
+    /* when target does not implement semihosting, this pointer is NULL */
+    const struct SemihostingCPUOps *semi_ops;
 #endif
 
     /*
include/semihosting/common-semi.h +17 -0
index 1e7699d7bbd..f0f8185d8e6 100644
@@ -34,6 +34,23 @@
 #ifndef COMMON_SEMI_H
 #define COMMON_SEMI_H
 
+typedef struct SemihostingCPUOps {
+    /* Return argument @argno */
+    uint64_t (*arg)(const CPUState *cs, int argno);
+    /* Set return value for semihosting call */
+    void (*set_ret)(CPUState *cs, uint64_t ret);
+    /* Set an error for a semihosting call */
+    void (*set_err)(CPUState *cs, int err);
+    /* True if the guest is using the 64-bit semihosting ABI */
+    bool (*is_64bit)(const CPUState *cs);
+    /* True if SYS_EXIT takes an extended parameter block */
+    bool (*sys_exit_is_extended)(const CPUState *cs);
+    /* Return lowest address until which stack can grow */
+    uint64_t (*stack_bottom)(const CPUState *cs);
+    /* True if SYS_SYNCCACHE is implemented */
+    bool (*has_synccache)(const CPUState *cs);
+} SemihostingCPUOps;
+
 void common_semi_cb(CPUState *cs, uint64_t ret, int err);
 void do_common_semihosting(CPUState *cs);
 uint64_t common_semi_arg(CPUState *cs, int argno);
Signature · 1 line
2.43.0
#16 lore raw

[PULL 11/20] semihosting: remove common_* functions

In reply to Pierrick Bouvier

Now that both targets and semihosting implementation both use the semihosting ops interface, we can remove all common_* functions. This allows us to link together the three targets concerned: arm, hexagon and riscv.

---
 include/semihosting/common-semi.h   |  7 ------
 target/arm/common-semi-target.c     | 35 -----------------------------
 target/hexagon/common-semi-target.c | 35 -----------------------------
 target/riscv/common-semi-target.c   | 35 -----------------------------
 4 files changed, 112 deletions(-)
include/semihosting/common-semi.h +0 -7
index f0f8185d8e6..085192e0c86 100644
@@ -53,12 +53,5 @@ typedef struct SemihostingCPUOps {
 
 void common_semi_cb(CPUState *cs, uint64_t ret, int err);
 void do_common_semihosting(CPUState *cs);
-uint64_t common_semi_arg(CPUState *cs, int argno);
-void common_semi_set_ret(CPUState *cs, uint64_t ret);
-void common_semi_set_err(CPUState *cs, int err);
-bool is_64bit_semihosting(CPUArchState *env);
-bool common_semi_sys_exit_is_extended(CPUState *cs);
-uint64_t common_semi_stack_bottom(CPUState *cs);
-bool common_semi_has_synccache(CPUArchState *env);
 
 #endif /* COMMON_SEMI_H */
target/arm/common-semi-target.c +0 -35
index dc5f277a59e..ab37730f3ef 100644
@@ -71,38 +71,3 @@ const SemihostingCPUOps arm_semihosting_ops = {
     .stack_bottom = arm_semi_stack_bottom,
     .has_synccache = arm_semi_has_synccache,
 };
-
-uint64_t common_semi_arg(CPUState *cs, int argno)
-{
-    return arm_semi_arg(cs, argno);
-}
-
-void common_semi_set_ret(CPUState *cs, uint64_t ret)
-{
-    arm_semi_set_ret(cs, ret);
-}
-
-void common_semi_set_err(CPUState *cs, int err)
-{
-    arm_semi_set_err(cs, err);
-}
-
-bool is_64bit_semihosting(CPUArchState *env)
-{
-    return arm_semi_is_64bit(env_cpu(env));
-}
-
-bool common_semi_sys_exit_is_extended(CPUState *cs)
-{
-    return arm_semi_sys_exit_is_extended(cs);
-}
-
-uint64_t common_semi_stack_bottom(CPUState *cs)
-{
-    return arm_semi_stack_bottom(cs);
-}
-
-bool common_semi_has_synccache(CPUArchState *env)
-{
-    return arm_semi_has_synccache(env_cpu(env));
-}
target/hexagon/common-semi-target.c +0 -35
index da92ff298a2..a4c346eff2f 100644
@@ -59,38 +59,3 @@ const SemihostingCPUOps hexagon_semihosting_ops = {
     .stack_bottom = hexagon_semi_stack_bottom,
     .has_synccache = hexagon_semi_has_synccache,
 };
-
-uint64_t common_semi_arg(CPUState *cs, int argno)
-{
-    return hexagon_semi_arg(cs, argno);
-}
-
-void common_semi_set_ret(CPUState *cs, uint64_t ret)
-{
-    hexagon_semi_set_ret(cs, ret);
-}
-
-void common_semi_set_err(CPUState *cs, int err)
-{
-    hexagon_semi_set_err(cs, err);
-}
-
-bool is_64bit_semihosting(CPUArchState *env)
-{
-    return hexagon_semi_is_64bit(env_cpu(env));
-}
-
-bool common_semi_sys_exit_is_extended(CPUState *cs)
-{
-    return hexagon_semi_sys_exit_is_extended(cs);
-}
-
-uint64_t common_semi_stack_bottom(CPUState *cs)
-{
-    return hexagon_semi_stack_bottom(cs);
-}
-
-bool common_semi_has_synccache(CPUArchState *env)
-{
-    return hexagon_semi_has_synccache(env_cpu(env));
-}
target/riscv/common-semi-target.c +0 -35
index f0f9e29dc4c..44f29a82982 100644
@@ -62,38 +62,3 @@ const SemihostingCPUOps riscv_semihosting_ops = {
     .stack_bottom = riscv_semi_stack_bottom,
     .has_synccache = riscv_semi_has_synccache,
 };
-
-uint64_t common_semi_arg(CPUState *cs, int argno)
-{
-    return riscv_semi_arg(cs, argno);
-}
-
-void common_semi_set_ret(CPUState *cs, uint64_t ret)
-{
-    riscv_semi_set_ret(cs, ret);
-}
-
-void common_semi_set_err(CPUState *cs, int err)
-{
-    riscv_semi_set_err(cs, err);
-}
-
-bool is_64bit_semihosting(CPUArchState *env)
-{
-    return riscv_semi_is_64bit(env_cpu(env));
-}
-
-bool common_semi_sys_exit_is_extended(CPUState *cs)
-{
-    return riscv_semi_sys_exit_is_extended(cs);
-}
-
-uint64_t common_semi_stack_bottom(CPUState *cs)
-{
-    return riscv_semi_stack_bottom(cs);
-}
-
-bool common_semi_has_synccache(CPUArchState *env)
-{
-    return riscv_semi_has_synccache(env_cpu(env));
-}
Signature · 1 line
2.43.0
#17 lore raw

[PULL 16/20] target/mips: rename qmp_query_cpu_definitions to qmp_query_mips_cpu_definitions

In reply to Pierrick Bouvier
---
 include/system/qmp-cpu.h           | 1 +
 target/mips/system/mips-qmp-cmds.c | 8 +++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)
include/system/qmp-cpu.h +1 -0
index dbca230ac6f..4267adfdc03 100644
@@ -12,5 +12,6 @@
 CpuDefinitionInfoList *qmp_query_arm_cpu_definitions(Error **errp);
 CpuDefinitionInfoList *qmp_query_i386_cpu_definitions(Error **errp);
 CpuDefinitionInfoList *qmp_query_loongarch_cpu_definitions(Error **errp);
+CpuDefinitionInfoList *qmp_query_mips_cpu_definitions(Error **errp);
 
 #endif
target/mips/system/mips-qmp-cmds.c +7 -1
index b6a2874f2dd..560c7915365 100644
@@ -10,6 +10,7 @@
 #include "qemu/target-info.h"
 #include "qapi/error.h"
 #include "qapi/qapi-commands-machine.h"
+#include "system/qmp-cpu.h"
 #include "cpu.h"
 
 CpuModelExpansionInfo *
@@ -36,7 +37,7 @@ static void mips_cpu_add_definition(gpointer data, gpointer user_data)
     QAPI_LIST_PREPEND(*cpu_list, info);
 }
 
-CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
+CpuDefinitionInfoList *qmp_query_mips_cpu_definitions(Error **errp)
 {
     CpuDefinitionInfoList *cpu_list = NULL;
     GSList *list;
@@ -47,3 +48,8 @@ CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
 
     return cpu_list;
 }
+
+CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
+{
+    return qmp_query_mips_cpu_definitions(errp);
+}
Signature · 1 line
2.43.0
#18 lore raw

[PULL 18/20] target/riscv: rename to qmp_query_cpu_definitions to qmp_query_riscv_cpu_definitions

In reply to Pierrick Bouvier
---
 include/system/qmp-cpu.h      | 1 +
 target/riscv/riscv-qmp-cmds.c | 8 +++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)
include/system/qmp-cpu.h +1 -0
index fba0e11d5e2..c1bfdd679e2 100644
@@ -14,5 +14,6 @@ CpuDefinitionInfoList *qmp_query_i386_cpu_definitions(Error **errp);
 CpuDefinitionInfoList *qmp_query_loongarch_cpu_definitions(Error **errp);
 CpuDefinitionInfoList *qmp_query_mips_cpu_definitions(Error **errp);
 CpuDefinitionInfoList *qmp_query_ppc_cpu_definitions(Error **errp);
+CpuDefinitionInfoList *qmp_query_riscv_cpu_definitions(Error **errp);
 
 #endif
target/riscv/riscv-qmp-cmds.c +7 -1
index 2647deef916..ccd6ae1d5cf 100644
@@ -26,6 +26,7 @@
 
 #include "qapi/error.h"
 #include "qapi/qapi-commands-machine.h"
+#include "system/qmp-cpu.h"
 #include "qobject/qbool.h"
 #include "qobject/qdict.h"
 #include "qapi/qobject-input-visitor.h"
@@ -54,7 +55,7 @@ static void riscv_cpu_add_definition(gpointer data, gpointer user_data)
     QAPI_LIST_PREPEND(*cpu_list, info);
 }
 
-CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
+CpuDefinitionInfoList *qmp_query_riscv_cpu_definitions(Error **errp)
 {
     CpuDefinitionInfoList *cpu_list = NULL;
     GSList *list = object_class_get_list(TYPE_RISCV_CPU, false);
@@ -65,6 +66,11 @@ CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
     return cpu_list;
 }
 
+CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
+{
+    return qmp_query_riscv_cpu_definitions(errp);
+}
+
 static void riscv_check_if_cpu_available(RISCVCPU *cpu, Error **errp)
 {
     if (!riscv_cpu_accelerator_compatible(cpu)) {
Signature · 1 line
2.43.0
#19 lore raw

[PULL 06/20] target/riscv/cpu: constify cpu parameter for riscv_cpu_mxl

In reply to Pierrick Bouvier
---
 target/riscv/cpu.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target/riscv/cpu.h +1 -1
index 8c8ffe94cd8..00650a66dcb 100644
@@ -755,7 +755,7 @@ FIELD(EXT_TB_FLAGS, BIG_ENDIAN, 33, 1)
 #ifdef TARGET_RISCV32
 #define riscv_cpu_mxl(env)  ((void)(env), MXL_RV32)
 #else
-static inline RISCVMXL riscv_cpu_mxl(CPURISCVState *env)
+static inline RISCVMXL riscv_cpu_mxl(const CPURISCVState *env)
 {
     return env->misa_mxl;
 }
Signature · 1 line
2.43.0
#20 lore raw

[PULL 12/20] meson.build: add hexagon-softmmu to multi-target

In reply to Pierrick Bouvier

Now that semihosting is solved, hexagon can join the list of target compatible with others.

---
 meson.build | 1 +
 1 file changed, 1 insertion(+)
meson.build +1 -0
index 432a333f56f..b67a97ab458 100644
@@ -4274,6 +4274,7 @@ multi_target_supported_targets = [
   'alpha-softmmu',
   'arm-softmmu',
   'avr-softmmu',
+  'hexagon-softmmu',
   'hppa-softmmu',
   'm68k-softmmu',
   'microblaze-softmmu',
Signature · 1 line
2.43.0
#21 lore raw
In reply to Pierrick Bouvier
Quoted 12 lines · Pierrick Bouvier

The following changes since commit 7e8d3c7fc460fe7cd28a3e423d7466fa292bc269:

   Merge tag 'pull-aspeed-20261015' ofhttps://github.com/legoater/qemu into staging (2026-10-15 14:58:28 +0200)

are available in the Git repository at:

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

for you to fetch changes up to 269cab810cd7ee2f6955be2048979b206a711817:

qmp: reimplement qmp_query_cpu_definitions as a dispatcher function (2026-10-15 19:30:24 +0000)

Quoted 8 lines

----------------------------------------------------------------
Changes:
- [PATCH v3 00/12] multi-target: add hexagon (Pierrick Bouvier<[email protected]>)

[email protected]
- [PATCH 0/8] multi-target: remove qmp_query_cpu_definitions duplication (Pierrick Bouvier<[email protected]>)

[email protected]

Applied, thanks.

r~