All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dave@treblig.org>
To: "Marc-André Lureau" <marcandre.lureau@redhat.com>
Cc: qemu-devel@nongnu.org,
	"Philippe Mathieu-Daudé" <philmd@mailo.com>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Zhao Liu" <zhao1.liu@intel.com>,
	"Laurent Vivier" <laurent@vivier.eu>,
	"Nicholas Piggin" <npiggin@gmail.com>,
	"Chinmay Rath" <rathc@linux.ibm.com>,
	"Glenn Miles" <milesg@linux.ibm.com>,
	"Harsh Prateek Bora" <harshpb@linux.ibm.com>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"Alistair Francis" <alistair.francis@wdc.com>,
	"Weiwei Li" <liwei1518@gmail.com>,
	"Daniel Henrique Barboza" <daniel.barboza@oss.qualcomm.com>,
	"Liu Zhiwei" <zhiwei_liu@linux.alibaba.com>,
	"Chao Liu" <chao.liu@processmission.com>,
	"Yoshinori Sato" <yoshinori.sato@nifty.com>,
	"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
	"Artyom Tarasenko" <atar4qemu@gmail.com>,
	"Max Filippov" <jcmvbkbc@gmail.com>,
	qemu-ppc@nongnu.org, qemu-riscv@nongnu.org
Subject: Re: [PATCH v3 36/49] monitor: tighten monitor_set_cpu()/get_cpu()
Date: Tue, 18 Aug 2026 14:15:13 +0000	[thread overview]
Message-ID: <aoRo8UcTqAUu5lkP@gallifrey> (raw)
In-Reply-To: <20260816-qemu-no-hmp-v3-36-e53fc35bc550@redhat.com>

* Marc-André Lureau (marcandre.lureau@redhat.com) wrote:
> These functions access mon_cpu_path, which is a MonitorHMP-specific
> field. Narrowing their signatures from Monitor* to MonitorHMP* makes the
> type system enforce what was already true at runtime: every caller is in
> an HMP context. The expression parser's MONITOR_HMP() casts are safe
> because it is only reachable from handle_hmp_command(), they will be
> dropped with later patches.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>

Reviewed-by: Dr. David Alan Gilbert <dave@treblig.org>

> ---
>  hw/core/machine-hmp-cmds.c |  4 ++--
>  include/monitor/hmp.h      |  7 +++---
>  include/monitor/monitor.h  |  1 -
>  monitor/hmp-cmds.c         | 53 ++++++++++++++++++++++------------------------
>  monitor/hmp.c              | 18 ++++++++--------
>  monitor/monitor-internal.h |  2 +-
>  monitor/qmp-cmds.c         |  2 +-
>  stats/stats-hmp-cmds.c     |  2 +-
>  target/i386/cpu-apic.c     |  2 +-
>  target/i386/cpu.c          |  4 ++--
>  target/i386/monitor.c      |  4 ++--
>  target/m68k/monitor.c      |  2 +-
>  target/ppc/monitor.c       |  2 +-
>  target/riscv/monitor.c     |  2 +-
>  target/sh4/monitor.c       |  2 +-
>  target/sparc/monitor.c     |  2 +-
>  target/xtensa/monitor.c    |  2 +-
>  17 files changed, 54 insertions(+), 57 deletions(-)
> 
> diff --git a/hw/core/machine-hmp-cmds.c b/hw/core/machine-hmp-cmds.c
> index 4e2f0c212b0d..702c798ccc56 100644
> --- a/hw/core/machine-hmp-cmds.c
> +++ b/hw/core/machine-hmp-cmds.c
> @@ -36,7 +36,7 @@ void hmp_info_cpus(MonitorHMP *hmp, const QDict *qdict)
>          g_autofree char *cpu_model = cpu_model_from_type(cpu->value->qom_type);
>          int active = ' ';
>  
> -        if (cpu->value->cpu_index == monitor_get_cpu_index(mon)) {
> +        if (cpu->value->cpu_index == monitor_hmp_get_cpu_index(hmp)) {
>              active = '*';
>          }
>  
> @@ -228,7 +228,7 @@ void hmp_memsave(MonitorHMP *hmp, const QDict *qdict)
>      const char *filename = qdict_get_str(qdict, "filename");
>      uint64_t addr = qdict_get_int(qdict, "val");
>      Error *err = NULL;
> -    int cpu_index = monitor_get_cpu_index(mon);
> +    int cpu_index = monitor_hmp_get_cpu_index(hmp);
>  
>      if (cpu_index < 0) {
>          monitor_printf(mon, "No CPU available\n");
> diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h
> index 6aa562ddbaa2..3fd17048b319 100644
> --- a/include/monitor/hmp.h
> +++ b/include/monitor/hmp.h
> @@ -30,7 +30,7 @@ OBJECT_DECLARE_TYPE(MonitorHMP, MonitorHMPClass, MONITOR_HMP);
>  struct MonitorDef {
>      const char *name;
>      int offset;
> -    int64_t (*get_value)(Monitor *mon, const MonitorDef *md, int offset);
> +    int64_t (*get_value)(MonitorHMP *hmp, const MonitorDef *md, int offset);
>  };
>  
>  void monitor_new_hmp(const char *id, const char *chardev_id,
> @@ -53,8 +53,9 @@ void monitor_register_hmp_info_hrt(const char *name,
>                                     HumanReadableText *(*handler)(Error **errp));
>  
>  
> -CPUArchState *mon_get_cpu_env(Monitor *mon);
> -CPUState *mon_get_cpu(Monitor *mon);
> +CPUArchState *monitor_hmp_get_cpu_env(MonitorHMP *hmp);
> +CPUState *monitor_hmp_get_cpu(MonitorHMP *hmp);
> +int monitor_hmp_get_cpu_index(MonitorHMP *hmp);
>  
>  bool hmp_handle_error(MonitorHMP *hmp, Error *err);
>  void hmp_help_cmd(Monitor *mon, const char *name);
> diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h
> index 72a8f6ea5b4f..2a550aec023f 100644
> --- a/include/monitor/monitor.h
> +++ b/include/monitor/monitor.h
> @@ -39,7 +39,6 @@ int monitor_fd_param(Monitor *mon, const char *fdname, Error **errp);
>  
>  int monitor_puts(Monitor *mon, const char *str);
>  void monitor_flush(Monitor *mon);
> -int monitor_get_cpu_index(Monitor *mon);
>  
>  int monitor_puts_locked(Monitor *mon, const char *str);
>  void monitor_flush_locked(Monitor *mon);
> diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
> index d1e7e4de6585..89cc19c2431d 100644
> --- a/monitor/hmp-cmds.c
> +++ b/monitor/hmp-cmds.c
> @@ -182,10 +182,10 @@ void hmp_cpu(MonitorHMP *hmp, const QDict *qdict)
>      Monitor *mon = MONITOR(hmp);
>      int64_t cpu_index;
>  
> -    /* XXX: drop the monitor_set_cpu() usage when all HMP commands that
> +    /* XXX: drop the monitor_hmp_set_cpu() usage when all HMP commands that
>              use it are converted to the QAPI */
>      cpu_index = qdict_get_int(qdict, "index");
> -    if (monitor_set_cpu(mon, cpu_index) < 0) {
> +    if (monitor_hmp_set_cpu(hmp, cpu_index) < 0) {
>          monitor_printf(mon, "invalid CPU index\n");
>      }
>  }
> @@ -512,39 +512,37 @@ void hmp_dumpdtb(MonitorHMP *hmp, const QDict *qdict)
>  #endif
>  
>  /* Set the current CPU defined by the user. Callers must hold BQL. */
> -int monitor_set_cpu(Monitor *mon, int cpu_index)
> +int monitor_hmp_set_cpu(MonitorHMP *hmp, int cpu_index)
>  {
> -    MonitorHMP *hmp_mon = MONITOR_HMP(mon);
>      CPUState *cpu;
>  
>      cpu = qemu_get_cpu(cpu_index);
>      if (cpu == NULL) {
>          return -1;
>      }
> -    g_free(hmp_mon->mon_cpu_path);
> -    hmp_mon->mon_cpu_path = object_get_canonical_path(OBJECT(cpu));
> +    g_free(hmp->mon_cpu_path);
> +    hmp->mon_cpu_path = object_get_canonical_path(OBJECT(cpu));
>      return 0;
>  }
>  
>  /* Callers must hold BQL. */
> -static CPUState *mon_get_cpu_sync(Monitor *mon, bool synchronize)
> +static CPUState *monitor_hmp_get_cpu_sync(MonitorHMP *hmp, bool synchronize)
>  {
> -    MonitorHMP *hmp_mon = MONITOR_HMP(mon);
>      CPUState *cpu = NULL;
>  
> -    if (hmp_mon->mon_cpu_path) {
> -        cpu = (CPUState *) object_resolve_path_type(hmp_mon->mon_cpu_path,
> +    if (hmp->mon_cpu_path) {
> +        cpu = (CPUState *) object_resolve_path_type(hmp->mon_cpu_path,
>                                                      TYPE_CPU, NULL);
>          if (!cpu) {
> -            g_free(hmp_mon->mon_cpu_path);
> -            hmp_mon->mon_cpu_path = NULL;
> +            g_free(hmp->mon_cpu_path);
> +            hmp->mon_cpu_path = NULL;
>          }
>      }
> -    if (!hmp_mon->mon_cpu_path) {
> +    if (!hmp->mon_cpu_path) {
>          if (!first_cpu) {
>              return NULL;
>          }
> -        monitor_set_cpu(mon, first_cpu->cpu_index);
> +        monitor_hmp_set_cpu(hmp, first_cpu->cpu_index);
>          cpu = first_cpu;
>      }
>      assert(cpu != NULL);
> @@ -554,21 +552,21 @@ static CPUState *mon_get_cpu_sync(Monitor *mon, bool synchronize)
>      return cpu;
>  }
>  
> -CPUState *mon_get_cpu(Monitor *mon)
> +CPUState *monitor_hmp_get_cpu(MonitorHMP *hmp)
>  {
> -    return mon_get_cpu_sync(mon, true);
> +    return monitor_hmp_get_cpu_sync(hmp, true);
>  }
>  
> -CPUArchState *mon_get_cpu_env(Monitor *mon)
> +CPUArchState *monitor_hmp_get_cpu_env(MonitorHMP *hmp)
>  {
> -    CPUState *cs = mon_get_cpu(mon);
> +    CPUState *cs = monitor_hmp_get_cpu(hmp);
>  
>      return cs ? cpu_env(cs) : NULL;
>  }
>  
> -int monitor_get_cpu_index(Monitor *mon)
> +int monitor_hmp_get_cpu_index(MonitorHMP *hmp)
>  {
> -    CPUState *cs = mon_get_cpu_sync(mon, false);
> +    CPUState *cs = monitor_hmp_get_cpu_sync(hmp, false);
>  
>      return cs ? cs->cpu_index : UNASSIGNED_CPU_INDEX;
>  }
> @@ -586,7 +584,7 @@ void hmp_info_registers(MonitorHMP *hmp, const QDict *qdict)
>              cpu_dump_state(cs, NULL, CPU_DUMP_FPU | CPU_DUMP_VPU);
>          }
>      } else {
> -        cs = vcpu >= 0 ? qemu_get_cpu(vcpu) : mon_get_cpu(mon);
> +        cs = vcpu >= 0 ? qemu_get_cpu(vcpu) : monitor_hmp_get_cpu(hmp);
>  
>          if (!cs) {
>              if (vcpu >= 0) {
> @@ -602,13 +600,14 @@ void hmp_info_registers(MonitorHMP *hmp, const QDict *qdict)
>      }
>  }
>  
> -static void memory_dump(Monitor *mon, int count, int format, int wsize,
> +static void memory_dump(MonitorHMP *hmp, int count, int format, int wsize,
>                          uint64_t addr, bool is_physical)
>  {
> +    Monitor *mon = MONITOR(hmp);
>      int l, line_size, i, max_digits, len;
>      uint8_t buf[16];
>      uint64_t v;
> -    CPUState *cs = mon_get_cpu(mon);
> +    CPUState *cs = monitor_hmp_get_cpu(hmp);
>      const unsigned int addr_width = is_physical ? 8 : (target_long_bits() / 4);
>      const bool big_endian = target_big_endian();
>  
> @@ -712,24 +711,22 @@ static void memory_dump(Monitor *mon, int count, int format, int wsize,
>  
>  void hmp_memory_dump(MonitorHMP *hmp, const QDict *qdict)
>  {
> -    Monitor *mon = MONITOR(hmp);
>      int count = qdict_get_int(qdict, "count");
>      int format = qdict_get_int(qdict, "format");
>      int size = qdict_get_int(qdict, "size");
>      vaddr addr = qdict_get_int(qdict, "addr");
>  
> -    memory_dump(mon, count, format, size, addr, false);
> +    memory_dump(hmp, count, format, size, addr, false);
>  }
>  
>  void hmp_physical_memory_dump(MonitorHMP *hmp, const QDict *qdict)
>  {
> -    Monitor *mon = MONITOR(hmp);
>      int count = qdict_get_int(qdict, "count");
>      int format = qdict_get_int(qdict, "format");
>      int size = qdict_get_int(qdict, "size");
>      hwaddr addr = qdict_get_int(qdict, "addr");
>  
> -    memory_dump(mon, count, format, size, addr, true);
> +    memory_dump(hmp, count, format, size, addr, true);
>  }
>  
>  void hmp_gpa2hva(MonitorHMP *hmp, const QDict *qdict)
> @@ -757,7 +754,7 @@ void hmp_gva2gpa(MonitorHMP *hmp, const QDict *qdict)
>  {
>      Monitor *mon = MONITOR(hmp);
>      vaddr addr = qdict_get_int(qdict, "addr");
> -    CPUState *cs = mon_get_cpu(mon);
> +    CPUState *cs = monitor_hmp_get_cpu(hmp);
>      TranslateForDebugResult tres;
>  
>      if (!cs) {
> diff --git a/monitor/hmp.c b/monitor/hmp.c
> index 47fb7cef6de2..2484a2310dff 100644
> --- a/monitor/hmp.c
> +++ b/monitor/hmp.c
> @@ -411,10 +411,10 @@ void hmp_help_cmd(Monitor *mon, const char *name)
>   * Set @pval to the value in the register identified by @name.
>   * return %true if the register is found, %false otherwise.
>   */
> -static bool gdb_get_register(Monitor *mon, int64_t *pval, const char *name)
> +static bool gdb_get_register(MonitorHMP *hmp, int64_t *pval, const char *name)
>  {
>      g_autoptr(GArray) regs = NULL;
> -    CPUState *cs = mon_get_cpu(mon);
> +    CPUState *cs = monitor_hmp_get_cpu(hmp);
>  
>      if (cs == NULL) {
>          return false;
> @@ -452,7 +452,7 @@ static bool gdb_get_register(Monitor *mon, int64_t *pval, const char *name)
>  static const char *pch;
>  static sigjmp_buf expr_env;
>  
> -static int get_monitor_def(Monitor *mon, int64_t *pval, const char *name);
> +static int get_monitor_def(MonitorHMP *mon, int64_t *pval, const char *name);
>  
>  static G_NORETURN G_GNUC_PRINTF(2, 3)
>  void expr_error(Monitor *mon, const char *fmt, ...)
> @@ -535,8 +535,8 @@ static int64_t expr_unary(Monitor *mon)
>                  pch++;
>              }
>              *q = 0;
> -            if (!gdb_get_register(mon, &reg, buf)
> -                && get_monitor_def(mon, &reg, buf) < 0) {
> +            if (!gdb_get_register(MONITOR_HMP(mon), &reg, buf)
> +                && get_monitor_def(MONITOR_HMP(mon), &reg, buf) < 0) {
>                  expr_error(mon, "unknown register");
>              }
>              n = reg;
> @@ -1733,9 +1733,9 @@ void monitor_register_hmp_info_hrt(const char *name,
>   * Set @pval to the value in the register identified by @name.
>   * return 0 if OK, -1 if not found
>   */
> -static int get_monitor_def(Monitor *mon, int64_t *pval, const char *name)
> +static int get_monitor_def(MonitorHMP *hmp, int64_t *pval, const char *name)
>  {
> -    CPUState *cs = mon_get_cpu(mon);
> +    CPUState *cs = monitor_hmp_get_cpu(hmp);
>      const MonitorDef *md;
>      void *ptr;
>  
> @@ -1750,9 +1750,9 @@ static int get_monitor_def(Monitor *mon, int64_t *pval, const char *name)
>      for (; md->name != NULL; md++) {
>          if (hmp_compare_cmd(name, md->name)) {
>              if (md->get_value) {
> -                *pval = md->get_value(mon, md, md->offset);
> +                *pval = md->get_value(hmp, md, md->offset);
>              } else {
> -                CPUArchState *env = mon_get_cpu_env(mon);
> +                CPUArchState *env = monitor_hmp_get_cpu_env(hmp);
>                  ptr = (uint8_t *)env + md->offset;
>                  *pval = *(int32_t *)ptr;
>              }
> diff --git a/monitor/monitor-internal.h b/monitor/monitor-internal.h
> index a0fa37c887ed..afdda1386080 100644
> --- a/monitor/monitor-internal.h
> +++ b/monitor/monitor-internal.h
> @@ -215,7 +215,7 @@ int monitor_can_read(void *opaque);
>  void monitor_cancel_out_watch(Monitor *mon);
>  void monitor_list_append(Monitor *mon);
>  void monitor_fdsets_cleanup(void);
> -int monitor_set_cpu(Monitor *mon, int cpu_index);
> +int monitor_hmp_set_cpu(MonitorHMP *mon, int cpu_index);
>  
>  void qmp_send_response(MonitorQMP *mon, const QDict *rsp);
>  void monitor_data_destroy_qmp(MonitorQMP *mon);
> diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c
> index 6cb0b587fbd4..b16119f4858c 100644
> --- a/monitor/qmp-cmds.c
> +++ b/monitor/qmp-cmds.c
> @@ -169,7 +169,7 @@ char *qmp_human_monitor_command(const char *command_line, bool has_cpu_index,
>      MonitorHMP *hmp = MONITOR_HMP(object_new(TYPE_MONITOR_HMP));
>  
>      if (has_cpu_index) {
> -        int ret = monitor_set_cpu(&hmp->parent_obj, cpu_index);
> +        int ret = monitor_hmp_set_cpu(hmp, cpu_index);
>          if (ret < 0) {
>              error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cpu-index",
>                         "a CPU number");
> diff --git a/stats/stats-hmp-cmds.c b/stats/stats-hmp-cmds.c
> index f280ad8c4314..cd1f1deb58bc 100644
> --- a/stats/stats-hmp-cmds.c
> +++ b/stats/stats-hmp-cmds.c
> @@ -226,7 +226,7 @@ void hmp_info_stats(MonitorHMP *hmp, const QDict *qdict)
>          filter = stats_filter(target, names, -1, provider);
>          break;
>      case STATS_TARGET_VCPU: {}
> -        int cpu_index = monitor_get_cpu_index(mon);
> +        int cpu_index = monitor_hmp_get_cpu_index(hmp);
>          filter = stats_filter(target, names, cpu_index, provider);
>          break;
>      case STATS_TARGET_CRYPTODEV:
> diff --git a/target/i386/cpu-apic.c b/target/i386/cpu-apic.c
> index 2cb3147837d1..3ae20f004b64 100644
> --- a/target/i386/cpu-apic.c
> +++ b/target/i386/cpu-apic.c
> @@ -93,7 +93,7 @@ void hmp_info_local_apic(MonitorHMP *hmp, const QDict *qdict)
>              cpu_synchronize_state(cs);
>          }
>      } else {
> -        cs = mon_get_cpu(mon);
> +        cs = monitor_hmp_get_cpu(hmp);
>      }
>  
>  
> diff --git a/target/i386/cpu.c b/target/i386/cpu.c
> index e5ffb10d1565..f0687b5c482d 100644
> --- a/target/i386/cpu.c
> +++ b/target/i386/cpu.c
> @@ -10853,10 +10853,10 @@ static const Property x86_cpu_properties[] = {
>  
>  #ifndef CONFIG_USER_ONLY
>  
> -static int64_t monitor_get_pc(Monitor *mon, const struct MonitorDef *md,
> +static int64_t monitor_get_pc(MonitorHMP *hmp, const struct MonitorDef *md,
>                                int offset)
>  {
> -    CPUArchState *env = mon_get_cpu_env(mon);
> +    CPUArchState *env = monitor_hmp_get_cpu_env(hmp);
>      int64_t ret = env->eip + env->segs[R_CS].base;
>  
>      if (!(env->hflags & HF_CS64_MASK)) {
> diff --git a/target/i386/monitor.c b/target/i386/monitor.c
> index f68dd38ac225..72bcab131f77 100644
> --- a/target/i386/monitor.c
> +++ b/target/i386/monitor.c
> @@ -215,7 +215,7 @@ void hmp_info_tlb(MonitorHMP *hmp, const QDict *qdict)
>      CPUArchState *env;
>      AddressSpace *as;
>  
> -    env = mon_get_cpu_env(mon);
> +    env = monitor_hmp_get_cpu_env(hmp);
>      if (!env) {
>          monitor_printf(mon, "No CPU available\n");
>          return;
> @@ -542,7 +542,7 @@ void hmp_info_mem(MonitorHMP *hmp, const QDict *qdict)
>      CPUArchState *env;
>      AddressSpace *as;
>  
> -    env = mon_get_cpu_env(mon);
> +    env = monitor_hmp_get_cpu_env(hmp);
>      if (!env) {
>          monitor_printf(mon, "No CPU available\n");
>          return;
> diff --git a/target/m68k/monitor.c b/target/m68k/monitor.c
> index 0414474f2ffb..5645a5d4d4f5 100644
> --- a/target/m68k/monitor.c
> +++ b/target/m68k/monitor.c
> @@ -13,7 +13,7 @@
>  void hmp_info_tlb(MonitorHMP *hmp, const QDict *qdict)
>  {
>      Monitor *mon = MONITOR(hmp);
> -    CPUArchState *env1 = mon_get_cpu_env(mon);
> +    CPUArchState *env1 = monitor_hmp_get_cpu_env(hmp);
>  
>      if (!env1) {
>          monitor_printf(mon, "No CPU available\n");
> diff --git a/target/ppc/monitor.c b/target/ppc/monitor.c
> index 99eda7351877..5769829bdd7e 100644
> --- a/target/ppc/monitor.c
> +++ b/target/ppc/monitor.c
> @@ -14,7 +14,7 @@
>  void hmp_info_tlb(MonitorHMP *hmp, const QDict *qdict)
>  {
>      Monitor *mon = MONITOR(hmp);
> -    CPUArchState *env1 = mon_get_cpu_env(mon);
> +    CPUArchState *env1 = monitor_hmp_get_cpu_env(hmp);
>  
>      if (!env1) {
>          monitor_printf(mon, "No CPU available\n");
> diff --git a/target/riscv/monitor.c b/target/riscv/monitor.c
> index 496d519c978d..4c9c0c793b36 100644
> --- a/target/riscv/monitor.c
> +++ b/target/riscv/monitor.c
> @@ -220,7 +220,7 @@ void hmp_info_mem(MonitorHMP *hmp, const QDict *qdict)
>      Monitor *mon = MONITOR(hmp);
>      CPUArchState *env;
>  
> -    env = mon_get_cpu_env(mon);
> +    env = monitor_hmp_get_cpu_env(hmp);
>      if (!env) {
>          monitor_printf(mon, "No CPU available\n");
>          return;
> diff --git a/target/sh4/monitor.c b/target/sh4/monitor.c
> index 50da650b2e04..4e443152bf56 100644
> --- a/target/sh4/monitor.c
> +++ b/target/sh4/monitor.c
> @@ -41,7 +41,7 @@ static void print_tlb(Monitor *mon, int idx, tlb_t *tlb)
>  void hmp_info_tlb(MonitorHMP *hmp, const QDict *qdict)
>  {
>      Monitor *mon = MONITOR(hmp);
> -    CPUArchState *env = mon_get_cpu_env(mon);
> +    CPUArchState *env = monitor_hmp_get_cpu_env(hmp);
>      int i;
>  
>      if (!env) {
> diff --git a/target/sparc/monitor.c b/target/sparc/monitor.c
> index 09a15b821a1a..e826e584a918 100644
> --- a/target/sparc/monitor.c
> +++ b/target/sparc/monitor.c
> @@ -30,7 +30,7 @@
>  void hmp_info_tlb(MonitorHMP *hmp, const QDict *qdict)
>  {
>      Monitor *mon = MONITOR(hmp);
> -    CPUArchState *env1 = mon_get_cpu_env(mon);
> +    CPUArchState *env1 = monitor_hmp_get_cpu_env(hmp);
>  
>      if (!env1) {
>          monitor_printf(mon, "No CPU available\n");
> diff --git a/target/xtensa/monitor.c b/target/xtensa/monitor.c
> index a1082c44e11c..b7b7387706f3 100644
> --- a/target/xtensa/monitor.c
> +++ b/target/xtensa/monitor.c
> @@ -29,7 +29,7 @@
>  void hmp_info_tlb(MonitorHMP *hmp, const QDict *qdict)
>  {
>      Monitor *mon = MONITOR(hmp);
> -    CPUArchState *env1 = mon_get_cpu_env(mon);
> +    CPUArchState *env1 = monitor_hmp_get_cpu_env(hmp);
>  
>      if (!env1) {
>          monitor_printf(mon, "No CPU available\n");
> 
> -- 
> 2.55.0.543.g5ebe2ebe4ea8
> 
-- 
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/


  reply	other threads:[~2026-08-18 14:16 UTC|newest]

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-16 19:12 [PATCH v3 00/49] Make HMP optional (and later standalone) Marc-André Lureau
2026-08-16 19:12 ` [PATCH v3 01/49] vl: fix -monitor none prefix matching Marc-André Lureau
2026-08-16 19:12 ` [PATCH v3 02/49] hmp: remove 'vcpu' argument from trace-event help Marc-André Lureau
2026-08-16 19:12 ` [PATCH v3 03/49] hmp: fix snapshot_blkdev argument type Marc-André Lureau
2026-08-17  3:51   ` Philippe Mathieu-Daudé
2026-08-16 19:12 ` [PATCH v3 04/49] target/i386: decouple cpu_x86_inject_mce() from Monitor Marc-André Lureau
2026-08-16 19:12 ` [PATCH v3 05/49] target/i386: return an error for invalid CPU in hmp_mce() Marc-André Lureau
2026-08-16 19:12 ` [PATCH v3 06/49] system: move gpa2hva() to system memory unit Marc-André Lureau
2026-08-16 19:12 ` [PATCH v3 07/49] system: decouple qmp_inject_nmi() from Monitor Marc-André Lureau
2026-08-17  3:53   ` Philippe Mathieu-Daudé
2026-08-17  8:04     ` Marc-André Lureau
2026-08-16 19:12 ` [PATCH v3 08/49] monitor: move HMP-only fields from Monitor to MonitorHMP Marc-André Lureau
2026-08-16 19:12 ` [PATCH v3 09/49] tests/functional: use query-version QMP command instead of HMP Marc-André Lureau
2026-08-16 19:12 ` [PATCH v3 10/49] net/qapi: add x-query-usernet command Marc-André Lureau
2026-08-16 19:12 ` [PATCH v3 11/49] python, tests: switch usernet queries from HMP to QMP Marc-André Lureau
2026-08-17  7:30   ` Thomas Huth
2026-08-17  8:07     ` Marc-André Lureau
2026-08-16 19:12 ` [PATCH v3 12/49] tests/qtest/pnv: drop unnecessary -serial mon:stdio Marc-André Lureau
2026-08-16 19:12 ` [PATCH v3 13/49] tests/qtest/qmp-test: don't depend on human-monitor-command Marc-André Lureau
2026-08-17  3:55   ` Philippe Mathieu-Daudé
2026-08-17  8:11     ` Marc-André Lureau
2026-08-17  9:11       ` Philippe Mathieu-Daudé
2026-08-16 19:12 ` [PATCH v3 14/49] tests/qtest/numa-test: replace HMP "info numa" with QMP query-cpus-fast Marc-André Lureau
2026-08-16 19:12 ` [PATCH v3 15/49] tests/qtest/cdrom-test: replace HMP "info block" with QMP query-block Marc-André Lureau
2026-08-16 19:53   ` Denis V. Lunev
2026-08-16 19:12 ` [PATCH v3 16/49] tests/qtest/device-introspect-test: fix test without HMP Marc-André Lureau
2026-08-16 19:12 ` [PATCH v3 17/49] tests/qemu-iotests/205: fix race in assertExportNotFound Marc-André Lureau
2026-08-16 19:12 ` [PATCH v3 18/49] net: add x-query-network QMP command Marc-André Lureau
2026-08-16 19:12 ` [PATCH v3 19/49] tests/qtest/netdev-socket: replace HMP with x-query-network QMP Marc-André Lureau
2026-08-16 19:12 ` [PATCH v3 20/49] qemu-io: propagate errors through Error API instead of printf Marc-André Lureau
2026-08-16 19:12 ` [PATCH v3 21/49] block: add x-qemu-io QMP command Marc-André Lureau
2026-08-16 19:12 ` [PATCH v3 22/49] qtest: add qemu-io command to the qtest protocol Marc-André Lureau
2026-08-16 19:12 ` [PATCH v3 23/49] qtest/ide-test: convert to use qtest qemu-io command Marc-André Lureau
2026-08-16 19:54   ` Denis V. Lunev
2026-08-16 19:12 ` [PATCH v3 24/49] tests/qemu-iotests: add qmp_qemu_io() Marc-André Lureau
2026-08-16 19:12 ` [PATCH v3 25/49] tests/qemu-iotests: convert pause/resume_drive() to QMP Marc-André Lureau
2026-08-16 19:12 ` [PATCH v3 26/49] build-sys: add 'hmp' option Marc-André Lureau
2026-08-16 19:12 ` [PATCH v3 27/49] monitor: reject readline monitor when HMP is disabled Marc-André Lureau
2026-08-16 20:23   ` Dr. David Alan Gilbert
2026-08-16 19:12 ` [PATCH v3 28/49] system: guard HMP initialization paths with CONFIG_HMP Marc-André Lureau
2026-08-16 19:12 ` [PATCH v3 29/49] tests: skip HMP-dependent tests when HMP is disabled Marc-André Lureau
2026-08-16 19:12 ` [PATCH v3 30/49] monitor: isolate HMP declarations in hmp.h Marc-André Lureau
2026-08-16 20:21   ` Dr. David Alan Gilbert
2026-08-16 19:12 ` [PATCH v3 31/49] monitor: change HMPCommand cmd to take MonitorHMP Marc-André Lureau
2026-08-16 21:51   ` Dr. David Alan Gilbert
2026-08-17 18:08     ` Jason J. Herne
2026-08-16 19:12 ` [PATCH v3 32/49] monitor: make hmp_handle_error() " Marc-André Lureau
2026-08-17  0:36   ` Dr. David Alan Gilbert
2026-08-16 19:13 ` [PATCH v3 33/49] monitor: add monitor_cur_hmp() helper Marc-André Lureau
2026-08-17  0:49   ` Dr. David Alan Gilbert
2026-08-16 19:13 ` [PATCH v3 34/49] qemu-print: switch to use monitor_cur_hmp() Marc-André Lureau
2026-08-16 19:13 ` [PATCH v3 35/49] error-report: " Marc-André Lureau
2026-08-16 19:13 ` [PATCH v3 36/49] monitor: tighten monitor_set_cpu()/get_cpu() Marc-André Lureau
2026-08-18 14:15   ` Dr. David Alan Gilbert [this message]
2026-08-16 19:13 ` [PATCH v3 37/49] monitor: tighten monitor_printf*() Marc-André Lureau
2026-08-17 18:09   ` Jason J. Herne
2026-08-16 19:13 ` [PATCH v3 38/49] hexagon: make dump_mmu() take MonitorHMP Marc-André Lureau
2026-08-17  3:49   ` Philippe Mathieu-Daudé
2026-08-18 20:35   ` Brian Cain
2026-08-16 19:13 ` [PATCH v3 39/49] qdev-monitor: make print_dev() callback " Marc-André Lureau
2026-08-17  3:48   ` Philippe Mathieu-Daudé
2026-08-16 19:13 ` [PATCH v3 40/49] qapi: make HMP-specific schema entries conditional on CONFIG_HMP Marc-André Lureau
2026-08-16 19:13 ` [PATCH v3 41/49] Guard HMP command implementations with CONFIG_HMP Marc-André Lureau
2026-08-17 18:11   ` Jason J. Herne
2026-08-16 19:13 ` [PATCH v3 42/49] target: guard MonitorDef tables " Marc-André Lureau
2026-08-17  3:47   ` Philippe Mathieu-Daudé
2026-08-16 19:13 ` [PATCH v3 43/49] hw: guard BusClass::print_dev " Marc-André Lureau
2026-08-16 19:13 ` [PATCH v3 44/49] hexagon: condition HMP-specific code Marc-André Lureau
2026-08-17  3:46   ` Philippe Mathieu-Daudé
2026-08-18 20:34   ` Brian Cain
2026-08-16 19:13 ` [PATCH v3 45/49] build-sys: make HMP source files conditional on have_hmp Marc-André Lureau
2026-08-16 19:13 ` [PATCH v3 46/49] stubs: split monitor-core stubs into separate compilation units Marc-André Lureau
2026-08-16 19:13 ` [PATCH v3 47/49] monitor: move monitor_hmp_print*() functions to hmp.c Marc-André Lureau
2026-08-16 19:13 ` [PATCH v3 48/49] monitor: move HMP-specific to monitor-hmp-internal.h Marc-André Lureau
2026-08-16 19:13 ` [PATCH v3 49/49] gitlab: --disable-hmp in build-without-defaults Marc-André Lureau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aoRo8UcTqAUu5lkP@gallifrey \
    --to=dave@treblig.org \
    --cc=alistair.francis@wdc.com \
    --cc=armbru@redhat.com \
    --cc=atar4qemu@gmail.com \
    --cc=berrange@redhat.com \
    --cc=chao.liu@processmission.com \
    --cc=daniel.barboza@oss.qualcomm.com \
    --cc=harshpb@linux.ibm.com \
    --cc=jcmvbkbc@gmail.com \
    --cc=laurent@vivier.eu \
    --cc=liwei1518@gmail.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=milesg@linux.ibm.com \
    --cc=npiggin@gmail.com \
    --cc=palmer@dabbelt.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@mailo.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    --cc=rathc@linux.ibm.com \
    --cc=yoshinori.sato@nifty.com \
    --cc=zhao1.liu@intel.com \
    --cc=zhiwei_liu@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.