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>
Subject: Re: [PATCH v3 33/49] monitor: add monitor_cur_hmp() helper
Date: Mon, 17 Aug 2026 00:49:16 +0000	[thread overview]
Message-ID: <aoJajGaO3uOQ7OmA@gallifrey> (raw)
In-Reply-To: <20260816-qemu-no-hmp-v3-33-e53fc35bc550@redhat.com>

* Marc-André Lureau (marcandre.lureau@redhat.com) wrote:
> This will help to simplify the code in the following changes.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>

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

> ---
>  include/monitor/hmp.h |  2 ++
>  monitor/hmp.c         | 10 ++++++++++
>  stubs/meson.build     |  1 +
>  stubs/monitor-hmp.c   |  9 +++++++++
>  4 files changed, 22 insertions(+)
> 
> diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h
> index 827a56144824..6aa562ddbaa2 100644
> --- a/include/monitor/hmp.h
> +++ b/include/monitor/hmp.h
> @@ -36,6 +36,8 @@ struct MonitorDef {
>  void monitor_new_hmp(const char *id, const char *chardev_id,
>                       bool use_readline, Error **errp);
>  
> +MonitorHMP *monitor_cur_hmp(void);
> +
>  int monitor_vprintf(Monitor *mon, const char *fmt, va_list ap)
>      G_GNUC_PRINTF(2, 0);
>  int monitor_printf(Monitor *mon, const char *fmt, ...) G_GNUC_PRINTF(2, 3);
> diff --git a/monitor/hmp.c b/monitor/hmp.c
> index 57c4127641ac..47fb7cef6de2 100644
> --- a/monitor/hmp.c
> +++ b/monitor/hmp.c
> @@ -47,6 +47,16 @@
>  
>  OBJECT_DEFINE_TYPE(MonitorHMP, monitor_hmp, MONITOR_HMP, MONITOR);
>  
> +MonitorHMP *monitor_cur_hmp(void)
> +{
> +    Monitor *mon = monitor_cur();
> +    if (mon) {
> +        return (MonitorHMP *)object_dynamic_cast(OBJECT(mon),
> +                                                 TYPE_MONITOR_HMP);
> +    }
> +    return NULL;
> +}
> +
>  static void monitor_hmp_finalize(Object *obj)
>  {
>      MonitorHMP *hmp = MONITOR_HMP(obj);
> diff --git a/stubs/meson.build b/stubs/meson.build
> index 3b2f2680b193..7e15687a62b7 100644
> --- a/stubs/meson.build
> +++ b/stubs/meson.build
> @@ -7,6 +7,7 @@ stub_ss.add(files('fdset.c'))
>  stub_ss.add(files('iothread-lock.c'))
>  stub_ss.add(files('is-daemonized.c'))
>  stub_ss.add(files('monitor-core.c'))
> +stub_ss.add(files('monitor-hmp.c'))
>  stub_ss.add(files('replay-mode.c'))
>  stub_ss.add(files('trace-control.c'))
>  
> diff --git a/stubs/monitor-hmp.c b/stubs/monitor-hmp.c
> new file mode 100644
> index 000000000000..9452a3f0c2c8
> --- /dev/null
> +++ b/stubs/monitor-hmp.c
> @@ -0,0 +1,9 @@
> +/* SPDX-License-Identifier: GPL-2.0-or-later */
> +
> +#include "qemu/osdep.h"
> +#include "monitor/hmp.h"
> +
> +MonitorHMP *monitor_cur_hmp(void)
> +{
> +    return NULL;
> +}
> 
> -- 
> 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-17  0:49 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 [this message]
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
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=aoJajGaO3uOQ7OmA@gallifrey \
    --to=dave@treblig.org \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@mailo.com \
    --cc=qemu-devel@nongnu.org \
    /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.