* [PATCH v2 1/8] target/i386: Include missing 'svm.h' header in 'sev.h'
2026-01-17 16:29 [PATCH v2 0/8] monitor/hmp: Reduce target-specific definitions Philippe Mathieu-Daudé
@ 2026-01-17 16:29 ` Philippe Mathieu-Daudé
2026-01-19 5:37 ` Zhao Liu
2026-01-17 16:29 ` [PATCH v2 2/8] monitor: Add hmp_cmds_for_target() helper Philippe Mathieu-Daudé
` (6 subsequent siblings)
7 siblings, 1 reply; 16+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-01-17 16:29 UTC (permalink / raw)
To: qemu-devel
Cc: Richard Henderson, Paolo Bonzini, Pierrick Bouvier,
Dr. David Alan Gilbert, Markus Armbruster,
Philippe Mathieu-Daudé, Zhao Liu, Marcelo Tosatti, kvm
otarget/i386/cpu.h:2820:#include "svm.h"
target/i386/sev.h:17:#include "target/i386/svm.h"
"target/i386/sev.h" uses the vmcb_seg structure type, which
is defined in "target/i386/svm.h". Current builds succeed
because the files including "target/i386/sev.h" also include
"monitor/hmp-target.h", itself including "cpu.h" and finally
"target/i386/svm.h".
Include the latter, otherwise removing "cpu.h" from
"monitor/hmp-target.h" triggers:
../target/i386/sev.h:62:21: error: field has incomplete type 'struct vmcb_seg'
62 | struct vmcb_seg es;
| ^
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/i386/sev.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/target/i386/sev.h b/target/i386/sev.h
index 9db1a802f6b..4358df40e48 100644
--- a/target/i386/sev.h
+++ b/target/i386/sev.h
@@ -14,6 +14,8 @@
#ifndef I386_SEV_H
#define I386_SEV_H
+#include "target/i386/svm.h"
+
#ifndef CONFIG_USER_ONLY
#include CONFIG_DEVICES /* CONFIG_SEV */
#endif
--
2.52.0
^ permalink raw reply related [flat|nested] 16+ messages in thread* Re: [PATCH v2 1/8] target/i386: Include missing 'svm.h' header in 'sev.h'
2026-01-17 16:29 ` [PATCH v2 1/8] target/i386: Include missing 'svm.h' header in 'sev.h' Philippe Mathieu-Daudé
@ 2026-01-19 5:37 ` Zhao Liu
0 siblings, 0 replies; 16+ messages in thread
From: Zhao Liu @ 2026-01-19 5:37 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: qemu-devel, Richard Henderson, Paolo Bonzini, Pierrick Bouvier,
Dr. David Alan Gilbert, Markus Armbruster, Marcelo Tosatti, kvm
On Sat, Jan 17, 2026 at 05:29:19PM +0100, Philippe Mathieu-Daudé wrote:
> Date: Sat, 17 Jan 2026 17:29:19 +0100
> From: Philippe Mathieu-Daudé <philmd@linaro.org>
> Subject: [PATCH v2 1/8] target/i386: Include missing 'svm.h' header in
> 'sev.h'
> X-Mailer: git-send-email 2.52.0
>
> otarget/i386/cpu.h:2820:#include "svm.h"
> target/i386/sev.h:17:#include "target/i386/svm.h"
>
> "target/i386/sev.h" uses the vmcb_seg structure type, which
> is defined in "target/i386/svm.h". Current builds succeed
> because the files including "target/i386/sev.h" also include
> "monitor/hmp-target.h", itself including "cpu.h" and finally
> "target/i386/svm.h".
>
> Include the latter, otherwise removing "cpu.h" from
> "monitor/hmp-target.h" triggers:
>
> ../target/i386/sev.h:62:21: error: field has incomplete type 'struct vmcb_seg'
> 62 | struct vmcb_seg es;
> | ^
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> target/i386/sev.h | 2 ++
> 1 file changed, 2 insertions(+)
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v2 2/8] monitor: Add hmp_cmds_for_target() helper
2026-01-17 16:29 [PATCH v2 0/8] monitor/hmp: Reduce target-specific definitions Philippe Mathieu-Daudé
2026-01-17 16:29 ` [PATCH v2 1/8] target/i386: Include missing 'svm.h' header in 'sev.h' Philippe Mathieu-Daudé
@ 2026-01-17 16:29 ` Philippe Mathieu-Daudé
2026-01-19 2:04 ` Dr. David Alan Gilbert
2026-01-17 16:29 ` [PATCH v2 3/8] monitor: Reduce target-specific methods Philippe Mathieu-Daudé
` (5 subsequent siblings)
7 siblings, 1 reply; 16+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-01-17 16:29 UTC (permalink / raw)
To: qemu-devel
Cc: Richard Henderson, Paolo Bonzini, Pierrick Bouvier,
Dr. David Alan Gilbert, Markus Armbruster,
Philippe Mathieu-Daudé
HMPCommand arrays are filled with target-specific
commands, so defined in a target-specific unit.
Introduce the hmp_cmds_for_target() to allow
target-agnostic code to access the arrays.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
monitor/monitor-internal.h | 9 +++++++--
monitor/hmp-target.c | 13 ++++++++-----
monitor/hmp.c | 8 +++++---
3 files changed, 20 insertions(+), 10 deletions(-)
diff --git a/monitor/monitor-internal.h b/monitor/monitor-internal.h
index 7735c731083..feca111ae31 100644
--- a/monitor/monitor-internal.h
+++ b/monitor/monitor-internal.h
@@ -169,8 +169,6 @@ extern QmpCommandList qmp_commands, qmp_cap_negotiation_commands;
extern QemuMutex monitor_lock;
extern MonitorList mon_list;
-extern HMPCommand hmp_cmds[];
-
void monitor_data_init(Monitor *mon, bool is_qmp, bool skip_flush,
bool use_io_thread);
void monitor_data_destroy(Monitor *mon);
@@ -187,4 +185,11 @@ int get_monitor_def(Monitor *mon, int64_t *pval, const char *name);
void handle_hmp_command(MonitorHMP *mon, const char *cmdline);
int hmp_compare_cmd(const char *name, const char *list);
+/*
+ * hmp_cmds_for_target: Return array of HMPCommand entries
+ *
+ * If @info_command is true, return the particular 'info foo' commands array.
+ */
+HMPCommand *hmp_cmds_for_target(bool info_command);
+
#endif
diff --git a/monitor/hmp-target.c b/monitor/hmp-target.c
index 37dfd7fd4c6..59c60d13b52 100644
--- a/monitor/hmp-target.c
+++ b/monitor/hmp-target.c
@@ -44,8 +44,6 @@
/* Make devices configuration available for use in hmp-commands*.hx templates */
#include CONFIG_DEVICES
-static HMPCommand hmp_info_cmds[];
-
/**
* Is @name in the '|' separated list of names @list?
*/
@@ -76,11 +74,16 @@ static HMPCommand hmp_info_cmds[] = {
};
/* hmp_cmds and hmp_info_cmds would be sorted at runtime */
-HMPCommand hmp_cmds[] = {
+static HMPCommand hmp_cmds[] = {
#include "hmp-commands.h"
{ NULL, NULL, },
};
+HMPCommand *hmp_cmds_for_target(bool info_command)
+{
+ return info_command ? hmp_info_cmds : hmp_cmds;
+}
+
/*
* Set @pval to the value in the register identified by @name.
* return 0 if OK, -1 if not found
@@ -148,7 +151,7 @@ static void __attribute__((__constructor__)) sortcmdlist(void)
void monitor_register_hmp(const char *name, bool info,
void (*cmd)(Monitor *mon, const QDict *qdict))
{
- HMPCommand *table = info ? hmp_info_cmds : hmp_cmds;
+ HMPCommand *table = hmp_cmds_for_target(info);
while (table->name != NULL) {
if (strcmp(table->name, name) == 0) {
@@ -164,7 +167,7 @@ void monitor_register_hmp(const char *name, bool info,
void monitor_register_hmp_info_hrt(const char *name,
HumanReadableText *(*handler)(Error **errp))
{
- HMPCommand *table = hmp_info_cmds;
+ HMPCommand *table = hmp_cmds_for_target(true);
while (table->name != NULL) {
if (strcmp(table->name, name) == 0) {
diff --git a/monitor/hmp.c b/monitor/hmp.c
index 4caafbc7146..17e5756986f 100644
--- a/monitor/hmp.c
+++ b/monitor/hmp.c
@@ -301,7 +301,7 @@ void hmp_help_cmd(Monitor *mon, const char *name)
}
/* 2. dump the contents according to parsed args */
- help_cmd_dump(mon, hmp_cmds, args, nb_args, 0);
+ help_cmd_dump(mon, hmp_cmds_for_target(false), args, nb_args, 0);
free_cmdline_args(args, nb_args);
}
@@ -1131,7 +1131,8 @@ void handle_hmp_command(MonitorHMP *mon, const char *cmdline)
trace_handle_hmp_command(mon, cmdline);
- cmd = monitor_parse_command(mon, cmdline, &cmdline, hmp_cmds);
+ cmd = monitor_parse_command(mon, cmdline, &cmdline,
+ hmp_cmds_for_target(false));
if (!cmd) {
return;
}
@@ -1375,7 +1376,8 @@ static void monitor_find_completion(void *opaque,
}
/* 2. auto complete according to args */
- monitor_find_completion_by_table(mon, hmp_cmds, args, nb_args);
+ monitor_find_completion_by_table(mon, hmp_cmds_for_target(false),
+ args, nb_args);
cleanup:
free_cmdline_args(args, nb_args);
--
2.52.0
^ permalink raw reply related [flat|nested] 16+ messages in thread* Re: [PATCH v2 2/8] monitor: Add hmp_cmds_for_target() helper
2026-01-17 16:29 ` [PATCH v2 2/8] monitor: Add hmp_cmds_for_target() helper Philippe Mathieu-Daudé
@ 2026-01-19 2:04 ` Dr. David Alan Gilbert
0 siblings, 0 replies; 16+ messages in thread
From: Dr. David Alan Gilbert @ 2026-01-19 2:04 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: qemu-devel, Richard Henderson, Paolo Bonzini, Pierrick Bouvier,
Markus Armbruster
* Philippe Mathieu-Daudé (philmd@linaro.org) wrote:
> HMPCommand arrays are filled with target-specific
> commands, so defined in a target-specific unit.
> Introduce the hmp_cmds_for_target() to allow
> target-agnostic code to access the arrays.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Dr. David Alan Gilbert <dave@treblig.org>
> ---
> monitor/monitor-internal.h | 9 +++++++--
> monitor/hmp-target.c | 13 ++++++++-----
> monitor/hmp.c | 8 +++++---
> 3 files changed, 20 insertions(+), 10 deletions(-)
>
> diff --git a/monitor/monitor-internal.h b/monitor/monitor-internal.h
> index 7735c731083..feca111ae31 100644
> --- a/monitor/monitor-internal.h
> +++ b/monitor/monitor-internal.h
> @@ -169,8 +169,6 @@ extern QmpCommandList qmp_commands, qmp_cap_negotiation_commands;
> extern QemuMutex monitor_lock;
> extern MonitorList mon_list;
>
> -extern HMPCommand hmp_cmds[];
> -
> void monitor_data_init(Monitor *mon, bool is_qmp, bool skip_flush,
> bool use_io_thread);
> void monitor_data_destroy(Monitor *mon);
> @@ -187,4 +185,11 @@ int get_monitor_def(Monitor *mon, int64_t *pval, const char *name);
> void handle_hmp_command(MonitorHMP *mon, const char *cmdline);
> int hmp_compare_cmd(const char *name, const char *list);
>
> +/*
> + * hmp_cmds_for_target: Return array of HMPCommand entries
> + *
> + * If @info_command is true, return the particular 'info foo' commands array.
> + */
> +HMPCommand *hmp_cmds_for_target(bool info_command);
> +
> #endif
> diff --git a/monitor/hmp-target.c b/monitor/hmp-target.c
> index 37dfd7fd4c6..59c60d13b52 100644
> --- a/monitor/hmp-target.c
> +++ b/monitor/hmp-target.c
> @@ -44,8 +44,6 @@
> /* Make devices configuration available for use in hmp-commands*.hx templates */
> #include CONFIG_DEVICES
>
> -static HMPCommand hmp_info_cmds[];
> -
> /**
> * Is @name in the '|' separated list of names @list?
> */
> @@ -76,11 +74,16 @@ static HMPCommand hmp_info_cmds[] = {
> };
>
> /* hmp_cmds and hmp_info_cmds would be sorted at runtime */
> -HMPCommand hmp_cmds[] = {
> +static HMPCommand hmp_cmds[] = {
> #include "hmp-commands.h"
> { NULL, NULL, },
> };
>
> +HMPCommand *hmp_cmds_for_target(bool info_command)
> +{
> + return info_command ? hmp_info_cmds : hmp_cmds;
> +}
> +
> /*
> * Set @pval to the value in the register identified by @name.
> * return 0 if OK, -1 if not found
> @@ -148,7 +151,7 @@ static void __attribute__((__constructor__)) sortcmdlist(void)
> void monitor_register_hmp(const char *name, bool info,
> void (*cmd)(Monitor *mon, const QDict *qdict))
> {
> - HMPCommand *table = info ? hmp_info_cmds : hmp_cmds;
> + HMPCommand *table = hmp_cmds_for_target(info);
>
> while (table->name != NULL) {
> if (strcmp(table->name, name) == 0) {
> @@ -164,7 +167,7 @@ void monitor_register_hmp(const char *name, bool info,
> void monitor_register_hmp_info_hrt(const char *name,
> HumanReadableText *(*handler)(Error **errp))
> {
> - HMPCommand *table = hmp_info_cmds;
> + HMPCommand *table = hmp_cmds_for_target(true);
>
> while (table->name != NULL) {
> if (strcmp(table->name, name) == 0) {
> diff --git a/monitor/hmp.c b/monitor/hmp.c
> index 4caafbc7146..17e5756986f 100644
> --- a/monitor/hmp.c
> +++ b/monitor/hmp.c
> @@ -301,7 +301,7 @@ void hmp_help_cmd(Monitor *mon, const char *name)
> }
>
> /* 2. dump the contents according to parsed args */
> - help_cmd_dump(mon, hmp_cmds, args, nb_args, 0);
> + help_cmd_dump(mon, hmp_cmds_for_target(false), args, nb_args, 0);
>
> free_cmdline_args(args, nb_args);
> }
> @@ -1131,7 +1131,8 @@ void handle_hmp_command(MonitorHMP *mon, const char *cmdline)
>
> trace_handle_hmp_command(mon, cmdline);
>
> - cmd = monitor_parse_command(mon, cmdline, &cmdline, hmp_cmds);
> + cmd = monitor_parse_command(mon, cmdline, &cmdline,
> + hmp_cmds_for_target(false));
> if (!cmd) {
> return;
> }
> @@ -1375,7 +1376,8 @@ static void monitor_find_completion(void *opaque,
> }
>
> /* 2. auto complete according to args */
> - monitor_find_completion_by_table(mon, hmp_cmds, args, nb_args);
> + monitor_find_completion_by_table(mon, hmp_cmds_for_target(false),
> + args, nb_args);
>
> cleanup:
> free_cmdline_args(args, nb_args);
> --
> 2.52.0
>
--
-----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 |_______/
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v2 3/8] monitor: Reduce target-specific methods
2026-01-17 16:29 [PATCH v2 0/8] monitor/hmp: Reduce target-specific definitions Philippe Mathieu-Daudé
2026-01-17 16:29 ` [PATCH v2 1/8] target/i386: Include missing 'svm.h' header in 'sev.h' Philippe Mathieu-Daudé
2026-01-17 16:29 ` [PATCH v2 2/8] monitor: Add hmp_cmds_for_target() helper Philippe Mathieu-Daudé
@ 2026-01-17 16:29 ` Philippe Mathieu-Daudé
2026-01-19 0:50 ` Dr. David Alan Gilbert
2026-01-17 16:29 ` [PATCH v2 4/8] monitor: Have MonitorDef::get_value() return an unsigned type Philippe Mathieu-Daudé
` (4 subsequent siblings)
7 siblings, 1 reply; 16+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-01-17 16:29 UTC (permalink / raw)
To: qemu-devel
Cc: Richard Henderson, Paolo Bonzini, Pierrick Bouvier,
Dr. David Alan Gilbert, Markus Armbruster,
Philippe Mathieu-Daudé
The following methods don't use target-specific code anymore:
- hmp_compare_cmd()
- monitor_register_hmp()
- monitor_register_hmp_info_hrt()
Move them to hmp.c which is target-agnostic, being built once.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
monitor/hmp-target.c | 57 --------------------------------------------
monitor/hmp.c | 55 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 55 insertions(+), 57 deletions(-)
diff --git a/monitor/hmp-target.c b/monitor/hmp-target.c
index 59c60d13b52..420969bd6eb 100644
--- a/monitor/hmp-target.c
+++ b/monitor/hmp-target.c
@@ -33,8 +33,6 @@
#include "qapi/qapi-commands-control.h"
#include "qapi/qapi-commands-misc.h"
#include "qapi/qapi-commands-machine.h"
-#include "qapi/error.h"
-#include "qemu/cutils.h"
#if defined(TARGET_S390X)
#include "hw/s390x/storage-keys.h"
@@ -44,29 +42,6 @@
/* Make devices configuration available for use in hmp-commands*.hx templates */
#include CONFIG_DEVICES
-/**
- * Is @name in the '|' separated list of names @list?
- */
-int hmp_compare_cmd(const char *name, const char *list)
-{
- const char *p, *pstart;
- int len;
- len = strlen(name);
- p = list;
- for (;;) {
- pstart = p;
- p = qemu_strchrnul(p, '|');
- if ((p - pstart) == len && !memcmp(pstart, name, len)) {
- return 1;
- }
- if (*p == '\0') {
- break;
- }
- p++;
- }
- return 0;
-}
-
/* Please update hmp-commands.hx when adding or changing commands */
static HMPCommand hmp_info_cmds[] = {
#include "hmp-commands-info.h"
@@ -147,35 +122,3 @@ static void __attribute__((__constructor__)) sortcmdlist(void)
sizeof(*hmp_info_cmds),
compare_mon_cmd);
}
-
-void monitor_register_hmp(const char *name, bool info,
- void (*cmd)(Monitor *mon, const QDict *qdict))
-{
- HMPCommand *table = hmp_cmds_for_target(info);
-
- while (table->name != NULL) {
- if (strcmp(table->name, name) == 0) {
- g_assert(table->cmd == NULL && table->cmd_info_hrt == NULL);
- table->cmd = cmd;
- return;
- }
- table++;
- }
- g_assert_not_reached();
-}
-
-void monitor_register_hmp_info_hrt(const char *name,
- HumanReadableText *(*handler)(Error **errp))
-{
- HMPCommand *table = hmp_cmds_for_target(true);
-
- while (table->name != NULL) {
- if (strcmp(table->name, name) == 0) {
- g_assert(table->cmd == NULL && table->cmd_info_hrt == NULL);
- table->cmd_info_hrt = handler;
- return;
- }
- table++;
- }
- g_assert_not_reached();
-}
diff --git a/monitor/hmp.c b/monitor/hmp.c
index 17e5756986f..0a5bbf82197 100644
--- a/monitor/hmp.c
+++ b/monitor/hmp.c
@@ -1497,3 +1497,58 @@ void monitor_init_hmp(Chardev *chr, bool use_readline, Error **errp)
monitor_event, NULL, &mon->common, NULL, true);
monitor_list_append(&mon->common);
}
+
+/**
+ * Is @name in the '|' separated list of names @list?
+ */
+int hmp_compare_cmd(const char *name, const char *list)
+{
+ const char *p, *pstart;
+ int len;
+ len = strlen(name);
+ p = list;
+ for (;;) {
+ pstart = p;
+ p = qemu_strchrnul(p, '|');
+ if ((p - pstart) == len && !memcmp(pstart, name, len)) {
+ return 1;
+ }
+ if (*p == '\0') {
+ break;
+ }
+ p++;
+ }
+ return 0;
+}
+
+void monitor_register_hmp(const char *name, bool info,
+ void (*cmd)(Monitor *mon, const QDict *qdict))
+{
+ HMPCommand *table = hmp_cmds_for_target(info);
+
+ while (table->name != NULL) {
+ if (strcmp(table->name, name) == 0) {
+ g_assert(table->cmd == NULL && table->cmd_info_hrt == NULL);
+ table->cmd = cmd;
+ return;
+ }
+ table++;
+ }
+ g_assert_not_reached();
+}
+
+void monitor_register_hmp_info_hrt(const char *name,
+ HumanReadableText *(*handler)(Error **errp))
+{
+ HMPCommand *table = hmp_cmds_for_target(true);
+
+ while (table->name != NULL) {
+ if (strcmp(table->name, name) == 0) {
+ g_assert(table->cmd == NULL && table->cmd_info_hrt == NULL);
+ table->cmd_info_hrt = handler;
+ return;
+ }
+ table++;
+ }
+ g_assert_not_reached();
+}
--
2.52.0
^ permalink raw reply related [flat|nested] 16+ messages in thread* Re: [PATCH v2 3/8] monitor: Reduce target-specific methods
2026-01-17 16:29 ` [PATCH v2 3/8] monitor: Reduce target-specific methods Philippe Mathieu-Daudé
@ 2026-01-19 0:50 ` Dr. David Alan Gilbert
0 siblings, 0 replies; 16+ messages in thread
From: Dr. David Alan Gilbert @ 2026-01-19 0:50 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: qemu-devel, Richard Henderson, Paolo Bonzini, Pierrick Bouvier,
Markus Armbruster
* Philippe Mathieu-Daudé (philmd@linaro.org) wrote:
> The following methods don't use target-specific code anymore:
> - hmp_compare_cmd()
> - monitor_register_hmp()
> - monitor_register_hmp_info_hrt()
> Move them to hmp.c which is target-agnostic, being built once.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Dr. David Alan Gilbert <dave@treblig.org>
> ---
> monitor/hmp-target.c | 57 --------------------------------------------
> monitor/hmp.c | 55 ++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 55 insertions(+), 57 deletions(-)
>
> diff --git a/monitor/hmp-target.c b/monitor/hmp-target.c
> index 59c60d13b52..420969bd6eb 100644
> --- a/monitor/hmp-target.c
> +++ b/monitor/hmp-target.c
> @@ -33,8 +33,6 @@
> #include "qapi/qapi-commands-control.h"
> #include "qapi/qapi-commands-misc.h"
> #include "qapi/qapi-commands-machine.h"
> -#include "qapi/error.h"
> -#include "qemu/cutils.h"
>
> #if defined(TARGET_S390X)
> #include "hw/s390x/storage-keys.h"
> @@ -44,29 +42,6 @@
> /* Make devices configuration available for use in hmp-commands*.hx templates */
> #include CONFIG_DEVICES
>
> -/**
> - * Is @name in the '|' separated list of names @list?
> - */
> -int hmp_compare_cmd(const char *name, const char *list)
> -{
> - const char *p, *pstart;
> - int len;
> - len = strlen(name);
> - p = list;
> - for (;;) {
> - pstart = p;
> - p = qemu_strchrnul(p, '|');
> - if ((p - pstart) == len && !memcmp(pstart, name, len)) {
> - return 1;
> - }
> - if (*p == '\0') {
> - break;
> - }
> - p++;
> - }
> - return 0;
> -}
> -
> /* Please update hmp-commands.hx when adding or changing commands */
> static HMPCommand hmp_info_cmds[] = {
> #include "hmp-commands-info.h"
> @@ -147,35 +122,3 @@ static void __attribute__((__constructor__)) sortcmdlist(void)
> sizeof(*hmp_info_cmds),
> compare_mon_cmd);
> }
> -
> -void monitor_register_hmp(const char *name, bool info,
> - void (*cmd)(Monitor *mon, const QDict *qdict))
> -{
> - HMPCommand *table = hmp_cmds_for_target(info);
> -
> - while (table->name != NULL) {
> - if (strcmp(table->name, name) == 0) {
> - g_assert(table->cmd == NULL && table->cmd_info_hrt == NULL);
> - table->cmd = cmd;
> - return;
> - }
> - table++;
> - }
> - g_assert_not_reached();
> -}
> -
> -void monitor_register_hmp_info_hrt(const char *name,
> - HumanReadableText *(*handler)(Error **errp))
> -{
> - HMPCommand *table = hmp_cmds_for_target(true);
> -
> - while (table->name != NULL) {
> - if (strcmp(table->name, name) == 0) {
> - g_assert(table->cmd == NULL && table->cmd_info_hrt == NULL);
> - table->cmd_info_hrt = handler;
> - return;
> - }
> - table++;
> - }
> - g_assert_not_reached();
> -}
> diff --git a/monitor/hmp.c b/monitor/hmp.c
> index 17e5756986f..0a5bbf82197 100644
> --- a/monitor/hmp.c
> +++ b/monitor/hmp.c
> @@ -1497,3 +1497,58 @@ void monitor_init_hmp(Chardev *chr, bool use_readline, Error **errp)
> monitor_event, NULL, &mon->common, NULL, true);
> monitor_list_append(&mon->common);
> }
> +
> +/**
> + * Is @name in the '|' separated list of names @list?
> + */
> +int hmp_compare_cmd(const char *name, const char *list)
> +{
> + const char *p, *pstart;
> + int len;
> + len = strlen(name);
> + p = list;
> + for (;;) {
> + pstart = p;
> + p = qemu_strchrnul(p, '|');
> + if ((p - pstart) == len && !memcmp(pstart, name, len)) {
> + return 1;
> + }
> + if (*p == '\0') {
> + break;
> + }
> + p++;
> + }
> + return 0;
> +}
> +
> +void monitor_register_hmp(const char *name, bool info,
> + void (*cmd)(Monitor *mon, const QDict *qdict))
> +{
> + HMPCommand *table = hmp_cmds_for_target(info);
> +
> + while (table->name != NULL) {
> + if (strcmp(table->name, name) == 0) {
> + g_assert(table->cmd == NULL && table->cmd_info_hrt == NULL);
> + table->cmd = cmd;
> + return;
> + }
> + table++;
> + }
> + g_assert_not_reached();
> +}
> +
> +void monitor_register_hmp_info_hrt(const char *name,
> + HumanReadableText *(*handler)(Error **errp))
> +{
> + HMPCommand *table = hmp_cmds_for_target(true);
> +
> + while (table->name != NULL) {
> + if (strcmp(table->name, name) == 0) {
> + g_assert(table->cmd == NULL && table->cmd_info_hrt == NULL);
> + table->cmd_info_hrt = handler;
> + return;
> + }
> + table++;
> + }
> + g_assert_not_reached();
> +}
> --
> 2.52.0
>
--
-----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 |_______/
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v2 4/8] monitor: Have MonitorDef::get_value() return an unsigned type
2026-01-17 16:29 [PATCH v2 0/8] monitor/hmp: Reduce target-specific definitions Philippe Mathieu-Daudé
` (2 preceding siblings ...)
2026-01-17 16:29 ` [PATCH v2 3/8] monitor: Reduce target-specific methods Philippe Mathieu-Daudé
@ 2026-01-17 16:29 ` Philippe Mathieu-Daudé
2026-01-19 0:59 ` Dr. David Alan Gilbert
2026-01-17 16:29 ` [PATCH v2 5/8] monitor: Have *get_monitor_def() fill an unsigned value Philippe Mathieu-Daudé
` (3 subsequent siblings)
7 siblings, 1 reply; 16+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-01-17 16:29 UTC (permalink / raw)
To: qemu-devel
Cc: Richard Henderson, Paolo Bonzini, Pierrick Bouvier,
Dr. David Alan Gilbert, Markus Armbruster,
Philippe Mathieu-Daudé, Zhao Liu, Nicholas Piggin,
Chinmay Rath, Mark Cave-Ayland, Artyom Tarasenko, qemu-ppc
All implementations of the get_value() handler return an
unsigned type:
- target/i386/monitor.c
monitor_get_pc() -> target_ulong eip;
- target/ppc/ppc-qmp-cmds.c
monitor_get_ccr() -> uint64_t ppc_get_cr(const CPUPPCState *env);
monitor_get_xer() -> target_ulong cpu_read_xer(const CPUPPCState *env);
monitor_get_decr() -> target_ulong cpu_ppc_load_decr(CPUPPCState *env);
monitor_get_tbu() -> uint32_t cpu_ppc_load_tbu(CPUPPCState *env);
monitor_get_tbl() -> uint64_t cpu_ppc_load_tbl(CPUPPCState *env);
- target/sparc/monitor.c
monitor_get_psr() -> target_ulong cpu_get_psr(CPUSPARCState *env1);
monitor_get_reg() -> target_ulong *regwptr;
Convert the MonitorDef::get_value() handler to return unsigned.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/monitor/hmp-target.h | 3 +--
monitor/hmp-target.c | 8 ++++----
target/i386/monitor.c | 4 ++--
target/ppc/ppc-qmp-cmds.c | 25 +++++++++++--------------
target/sparc/monitor.c | 8 ++++----
5 files changed, 22 insertions(+), 26 deletions(-)
diff --git a/include/monitor/hmp-target.h b/include/monitor/hmp-target.h
index b679aaebbff..bd9baeaa3ad 100644
--- a/include/monitor/hmp-target.h
+++ b/include/monitor/hmp-target.h
@@ -32,8 +32,7 @@ typedef struct MonitorDef MonitorDef;
struct MonitorDef {
const char *name;
int offset;
- target_long (*get_value)(Monitor *mon, const struct MonitorDef *md,
- int val);
+ uint64_t (*get_value)(Monitor *mon, const struct MonitorDef *md, int val);
int type;
};
#endif
diff --git a/monitor/hmp-target.c b/monitor/hmp-target.c
index 420969bd6eb..3fb4fb12508 100644
--- a/monitor/hmp-target.c
+++ b/monitor/hmp-target.c
@@ -67,7 +67,6 @@ int get_monitor_def(Monitor *mon, int64_t *pval, const char *name)
{
const MonitorDef *md = target_monitor_defs();
CPUState *cs = mon_get_cpu(mon);
- void *ptr;
uint64_t tmp = 0;
int ret;
@@ -81,13 +80,14 @@ int get_monitor_def(Monitor *mon, int64_t *pval, const char *name)
*pval = md->get_value(mon, md, md->offset);
} else {
CPUArchState *env = mon_get_cpu_env(mon);
- ptr = (uint8_t *)env + md->offset;
+ void *ptr = (uint8_t *)env + md->offset;
+
switch(md->type) {
case MD_I32:
- *pval = *(int32_t *)ptr;
+ *pval = *(uint32_t *)ptr;
break;
case MD_TLONG:
- *pval = *(target_long *)ptr;
+ *pval = *(target_ulong *)ptr;
break;
default:
*pval = 0;
diff --git a/target/i386/monitor.c b/target/i386/monitor.c
index 99b32cb7b0f..cce23f987ef 100644
--- a/target/i386/monitor.c
+++ b/target/i386/monitor.c
@@ -593,8 +593,8 @@ void hmp_mce(Monitor *mon, const QDict *qdict)
}
}
-static target_long monitor_get_pc(Monitor *mon, const struct MonitorDef *md,
- int val)
+static uint64_t monitor_get_pc(Monitor *mon, const struct MonitorDef *md,
+ int val)
{
CPUArchState *env = mon_get_cpu_env(mon);
return env->eip + env->segs[R_CS].base;
diff --git a/target/ppc/ppc-qmp-cmds.c b/target/ppc/ppc-qmp-cmds.c
index 7022564604f..07938abb15f 100644
--- a/target/ppc/ppc-qmp-cmds.c
+++ b/target/ppc/ppc-qmp-cmds.c
@@ -33,26 +33,23 @@
#include "cpu-models.h"
#include "cpu-qom.h"
-static target_long monitor_get_ccr(Monitor *mon, const struct MonitorDef *md,
- int val)
+static uint64_t monitor_get_ccr(Monitor *mon, const struct MonitorDef *md,
+ int val)
{
CPUArchState *env = mon_get_cpu_env(mon);
- unsigned int u;
- u = ppc_get_cr(env);
-
- return u;
+ return ppc_get_cr(env);
}
-static target_long monitor_get_xer(Monitor *mon, const struct MonitorDef *md,
- int val)
+static uint64_t monitor_get_xer(Monitor *mon, const struct MonitorDef *md,
+ int val)
{
CPUArchState *env = mon_get_cpu_env(mon);
return cpu_read_xer(env);
}
-static target_long monitor_get_decr(Monitor *mon, const struct MonitorDef *md,
- int val)
+static uint64_t monitor_get_decr(Monitor *mon, const struct MonitorDef *md,
+ int val)
{
CPUArchState *env = mon_get_cpu_env(mon);
if (!env->tb_env) {
@@ -61,8 +58,8 @@ static target_long monitor_get_decr(Monitor *mon, const struct MonitorDef *md,
return cpu_ppc_load_decr(env);
}
-static target_long monitor_get_tbu(Monitor *mon, const struct MonitorDef *md,
- int val)
+static uint64_t monitor_get_tbu(Monitor *mon, const struct MonitorDef *md,
+ int val)
{
CPUArchState *env = mon_get_cpu_env(mon);
if (!env->tb_env) {
@@ -71,8 +68,8 @@ static target_long monitor_get_tbu(Monitor *mon, const struct MonitorDef *md,
return cpu_ppc_load_tbu(env);
}
-static target_long monitor_get_tbl(Monitor *mon, const struct MonitorDef *md,
- int val)
+static uint64_t monitor_get_tbl(Monitor *mon, const struct MonitorDef *md,
+ int val)
{
CPUArchState *env = mon_get_cpu_env(mon);
if (!env->tb_env) {
diff --git a/target/sparc/monitor.c b/target/sparc/monitor.c
index 73f15aa272d..3e1f4dd5c9c 100644
--- a/target/sparc/monitor.c
+++ b/target/sparc/monitor.c
@@ -40,8 +40,8 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict)
}
#ifndef TARGET_SPARC64
-static target_long monitor_get_psr(Monitor *mon, const struct MonitorDef *md,
- int val)
+static uint64_t monitor_get_psr(Monitor *mon, const struct MonitorDef *md,
+ int val)
{
CPUArchState *env = mon_get_cpu_env(mon);
@@ -49,8 +49,8 @@ static target_long monitor_get_psr(Monitor *mon, const struct MonitorDef *md,
}
#endif
-static target_long monitor_get_reg(Monitor *mon, const struct MonitorDef *md,
- int val)
+static uint64_t monitor_get_reg(Monitor *mon, const struct MonitorDef *md,
+ int val)
{
CPUArchState *env = mon_get_cpu_env(mon);
return env->regwptr[val];
--
2.52.0
^ permalink raw reply related [flat|nested] 16+ messages in thread* Re: [PATCH v2 4/8] monitor: Have MonitorDef::get_value() return an unsigned type
2026-01-17 16:29 ` [PATCH v2 4/8] monitor: Have MonitorDef::get_value() return an unsigned type Philippe Mathieu-Daudé
@ 2026-01-19 0:59 ` Dr. David Alan Gilbert
0 siblings, 0 replies; 16+ messages in thread
From: Dr. David Alan Gilbert @ 2026-01-19 0:59 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: qemu-devel, Richard Henderson, Paolo Bonzini, Pierrick Bouvier,
Markus Armbruster, Zhao Liu, Nicholas Piggin, Chinmay Rath,
Mark Cave-Ayland, Artyom Tarasenko, qemu-ppc
* Philippe Mathieu-Daudé (philmd@linaro.org) wrote:
> All implementations of the get_value() handler return an
> unsigned type:
>
> - target/i386/monitor.c
>
> monitor_get_pc() -> target_ulong eip;
>
> - target/ppc/ppc-qmp-cmds.c
>
> monitor_get_ccr() -> uint64_t ppc_get_cr(const CPUPPCState *env);
>
> monitor_get_xer() -> target_ulong cpu_read_xer(const CPUPPCState *env);
>
> monitor_get_decr() -> target_ulong cpu_ppc_load_decr(CPUPPCState *env);
>
> monitor_get_tbu() -> uint32_t cpu_ppc_load_tbu(CPUPPCState *env);
>
> monitor_get_tbl() -> uint64_t cpu_ppc_load_tbl(CPUPPCState *env);
>
> - target/sparc/monitor.c
>
> monitor_get_psr() -> target_ulong cpu_get_psr(CPUSPARCState *env1);
>
> monitor_get_reg() -> target_ulong *regwptr;
>
> Convert the MonitorDef::get_value() handler to return unsigned.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> include/monitor/hmp-target.h | 3 +--
> monitor/hmp-target.c | 8 ++++----
> target/i386/monitor.c | 4 ++--
> target/ppc/ppc-qmp-cmds.c | 25 +++++++++++--------------
> target/sparc/monitor.c | 8 ++++----
> 5 files changed, 22 insertions(+), 26 deletions(-)
>
> diff --git a/include/monitor/hmp-target.h b/include/monitor/hmp-target.h
> index b679aaebbff..bd9baeaa3ad 100644
> --- a/include/monitor/hmp-target.h
> +++ b/include/monitor/hmp-target.h
> @@ -32,8 +32,7 @@ typedef struct MonitorDef MonitorDef;
> struct MonitorDef {
> const char *name;
> int offset;
> - target_long (*get_value)(Monitor *mon, const struct MonitorDef *md,
> - int val);
> + uint64_t (*get_value)(Monitor *mon, const struct MonitorDef *md, int val);
> int type;
> };
> #endif
> diff --git a/monitor/hmp-target.c b/monitor/hmp-target.c
> index 420969bd6eb..3fb4fb12508 100644
> --- a/monitor/hmp-target.c
> +++ b/monitor/hmp-target.c
> @@ -67,7 +67,6 @@ int get_monitor_def(Monitor *mon, int64_t *pval, const char *name)
> {
> const MonitorDef *md = target_monitor_defs();
> CPUState *cs = mon_get_cpu(mon);
> - void *ptr;
> uint64_t tmp = 0;
> int ret;
>
> @@ -81,13 +80,14 @@ int get_monitor_def(Monitor *mon, int64_t *pval, const char *name)
> *pval = md->get_value(mon, md, md->offset);
> } else {
> CPUArchState *env = mon_get_cpu_env(mon);
> - ptr = (uint8_t *)env + md->offset;
> + void *ptr = (uint8_t *)env + md->offset;
> +
> switch(md->type) {
> case MD_I32:
> - *pval = *(int32_t *)ptr;
> + *pval = *(uint32_t *)ptr;
> break;
> case MD_TLONG:
> - *pval = *(target_long *)ptr;
> + *pval = *(target_ulong *)ptr;
> break;
So I think this patch does make sense, but it does feel a bit hideous
to have 'MD_I32' and 'MD_TLONG' as names for unsigneds.
Reviewed-by: Dr. David Alan Gilbert <dave@treblig.org>
> default:
> *pval = 0;
> diff --git a/target/i386/monitor.c b/target/i386/monitor.c
> index 99b32cb7b0f..cce23f987ef 100644
> --- a/target/i386/monitor.c
> +++ b/target/i386/monitor.c
> @@ -593,8 +593,8 @@ void hmp_mce(Monitor *mon, const QDict *qdict)
> }
> }
>
> -static target_long monitor_get_pc(Monitor *mon, const struct MonitorDef *md,
> - int val)
> +static uint64_t monitor_get_pc(Monitor *mon, const struct MonitorDef *md,
> + int val)
> {
> CPUArchState *env = mon_get_cpu_env(mon);
> return env->eip + env->segs[R_CS].base;
> diff --git a/target/ppc/ppc-qmp-cmds.c b/target/ppc/ppc-qmp-cmds.c
> index 7022564604f..07938abb15f 100644
> --- a/target/ppc/ppc-qmp-cmds.c
> +++ b/target/ppc/ppc-qmp-cmds.c
> @@ -33,26 +33,23 @@
> #include "cpu-models.h"
> #include "cpu-qom.h"
>
> -static target_long monitor_get_ccr(Monitor *mon, const struct MonitorDef *md,
> - int val)
> +static uint64_t monitor_get_ccr(Monitor *mon, const struct MonitorDef *md,
> + int val)
> {
> CPUArchState *env = mon_get_cpu_env(mon);
> - unsigned int u;
>
> - u = ppc_get_cr(env);
> -
> - return u;
> + return ppc_get_cr(env);
> }
>
> -static target_long monitor_get_xer(Monitor *mon, const struct MonitorDef *md,
> - int val)
> +static uint64_t monitor_get_xer(Monitor *mon, const struct MonitorDef *md,
> + int val)
> {
> CPUArchState *env = mon_get_cpu_env(mon);
> return cpu_read_xer(env);
> }
>
> -static target_long monitor_get_decr(Monitor *mon, const struct MonitorDef *md,
> - int val)
> +static uint64_t monitor_get_decr(Monitor *mon, const struct MonitorDef *md,
> + int val)
> {
> CPUArchState *env = mon_get_cpu_env(mon);
> if (!env->tb_env) {
> @@ -61,8 +58,8 @@ static target_long monitor_get_decr(Monitor *mon, const struct MonitorDef *md,
> return cpu_ppc_load_decr(env);
> }
>
> -static target_long monitor_get_tbu(Monitor *mon, const struct MonitorDef *md,
> - int val)
> +static uint64_t monitor_get_tbu(Monitor *mon, const struct MonitorDef *md,
> + int val)
> {
> CPUArchState *env = mon_get_cpu_env(mon);
> if (!env->tb_env) {
> @@ -71,8 +68,8 @@ static target_long monitor_get_tbu(Monitor *mon, const struct MonitorDef *md,
> return cpu_ppc_load_tbu(env);
> }
>
> -static target_long monitor_get_tbl(Monitor *mon, const struct MonitorDef *md,
> - int val)
> +static uint64_t monitor_get_tbl(Monitor *mon, const struct MonitorDef *md,
> + int val)
> {
> CPUArchState *env = mon_get_cpu_env(mon);
> if (!env->tb_env) {
> diff --git a/target/sparc/monitor.c b/target/sparc/monitor.c
> index 73f15aa272d..3e1f4dd5c9c 100644
> --- a/target/sparc/monitor.c
> +++ b/target/sparc/monitor.c
> @@ -40,8 +40,8 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict)
> }
>
> #ifndef TARGET_SPARC64
> -static target_long monitor_get_psr(Monitor *mon, const struct MonitorDef *md,
> - int val)
> +static uint64_t monitor_get_psr(Monitor *mon, const struct MonitorDef *md,
> + int val)
> {
> CPUArchState *env = mon_get_cpu_env(mon);
>
> @@ -49,8 +49,8 @@ static target_long monitor_get_psr(Monitor *mon, const struct MonitorDef *md,
> }
> #endif
>
> -static target_long monitor_get_reg(Monitor *mon, const struct MonitorDef *md,
> - int val)
> +static uint64_t monitor_get_reg(Monitor *mon, const struct MonitorDef *md,
> + int val)
> {
> CPUArchState *env = mon_get_cpu_env(mon);
> return env->regwptr[val];
> --
> 2.52.0
>
--
-----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 |_______/
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v2 5/8] monitor: Have *get_monitor_def() fill an unsigned value
2026-01-17 16:29 [PATCH v2 0/8] monitor/hmp: Reduce target-specific definitions Philippe Mathieu-Daudé
` (3 preceding siblings ...)
2026-01-17 16:29 ` [PATCH v2 4/8] monitor: Have MonitorDef::get_value() return an unsigned type Philippe Mathieu-Daudé
@ 2026-01-17 16:29 ` Philippe Mathieu-Daudé
2026-01-19 1:12 ` Dr. David Alan Gilbert
2026-01-17 16:29 ` [PATCH v2 6/8] monitor: Truncate target register using ldn_he_p() API Philippe Mathieu-Daudé
` (2 subsequent siblings)
7 siblings, 1 reply; 16+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-01-17 16:29 UTC (permalink / raw)
To: qemu-devel
Cc: Richard Henderson, Paolo Bonzini, Pierrick Bouvier,
Dr. David Alan Gilbert, Markus Armbruster,
Philippe Mathieu-Daudé
target_get_monitor_def() fills an unsigned value.
Have get_monitor_def() fill an unsigned value too.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
monitor/monitor-internal.h | 2 +-
monitor/hmp-target.c | 4 ++--
monitor/hmp.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/monitor/monitor-internal.h b/monitor/monitor-internal.h
index feca111ae31..8dc88963630 100644
--- a/monitor/monitor-internal.h
+++ b/monitor/monitor-internal.h
@@ -181,7 +181,7 @@ void monitor_data_destroy_qmp(MonitorQMP *mon);
void coroutine_fn monitor_qmp_dispatcher_co(void *data);
void qmp_dispatcher_co_wake(void);
-int get_monitor_def(Monitor *mon, int64_t *pval, const char *name);
+int get_monitor_def(Monitor *mon, uint64_t *pval, const char *name);
void handle_hmp_command(MonitorHMP *mon, const char *cmdline);
int hmp_compare_cmd(const char *name, const char *list);
diff --git a/monitor/hmp-target.c b/monitor/hmp-target.c
index 3fb4fb12508..ead195f5616 100644
--- a/monitor/hmp-target.c
+++ b/monitor/hmp-target.c
@@ -63,7 +63,7 @@ HMPCommand *hmp_cmds_for_target(bool info_command)
* Set @pval to the value in the register identified by @name.
* return 0 if OK, -1 if not found
*/
-int get_monitor_def(Monitor *mon, int64_t *pval, const char *name)
+int get_monitor_def(Monitor *mon, uint64_t *pval, const char *name)
{
const MonitorDef *md = target_monitor_defs();
CPUState *cs = mon_get_cpu(mon);
@@ -100,7 +100,7 @@ int get_monitor_def(Monitor *mon, int64_t *pval, const char *name)
ret = target_get_monitor_def(cs, name, &tmp);
if (!ret) {
- *pval = (target_long) tmp;
+ *pval = (target_ulong)tmp;
}
return ret;
diff --git a/monitor/hmp.c b/monitor/hmp.c
index 0a5bbf82197..eee8b7e964e 100644
--- a/monitor/hmp.c
+++ b/monitor/hmp.c
@@ -376,7 +376,7 @@ static int64_t expr_unary(Monitor *mon)
case '$':
{
char buf[128], *q;
- int64_t reg = 0;
+ uint64_t reg = 0;
pch++;
q = buf;
--
2.52.0
^ permalink raw reply related [flat|nested] 16+ messages in thread* Re: [PATCH v2 5/8] monitor: Have *get_monitor_def() fill an unsigned value
2026-01-17 16:29 ` [PATCH v2 5/8] monitor: Have *get_monitor_def() fill an unsigned value Philippe Mathieu-Daudé
@ 2026-01-19 1:12 ` Dr. David Alan Gilbert
0 siblings, 0 replies; 16+ messages in thread
From: Dr. David Alan Gilbert @ 2026-01-19 1:12 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: qemu-devel, Richard Henderson, Paolo Bonzini, Pierrick Bouvier,
Markus Armbruster
* Philippe Mathieu-Daudé (philmd@linaro.org) wrote:
> target_get_monitor_def() fills an unsigned value.
> Have get_monitor_def() fill an unsigned value too.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> monitor/monitor-internal.h | 2 +-
> monitor/hmp-target.c | 4 ++--
> monitor/hmp.c | 2 +-
> 3 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/monitor/monitor-internal.h b/monitor/monitor-internal.h
> index feca111ae31..8dc88963630 100644
> --- a/monitor/monitor-internal.h
> +++ b/monitor/monitor-internal.h
> @@ -181,7 +181,7 @@ void monitor_data_destroy_qmp(MonitorQMP *mon);
> void coroutine_fn monitor_qmp_dispatcher_co(void *data);
> void qmp_dispatcher_co_wake(void);
>
> -int get_monitor_def(Monitor *mon, int64_t *pval, const char *name);
> +int get_monitor_def(Monitor *mon, uint64_t *pval, const char *name);
> void handle_hmp_command(MonitorHMP *mon, const char *cmdline);
> int hmp_compare_cmd(const char *name, const char *list);
>
> diff --git a/monitor/hmp-target.c b/monitor/hmp-target.c
> index 3fb4fb12508..ead195f5616 100644
> --- a/monitor/hmp-target.c
> +++ b/monitor/hmp-target.c
> @@ -63,7 +63,7 @@ HMPCommand *hmp_cmds_for_target(bool info_command)
> * Set @pval to the value in the register identified by @name.
> * return 0 if OK, -1 if not found
> */
> -int get_monitor_def(Monitor *mon, int64_t *pval, const char *name)
> +int get_monitor_def(Monitor *mon, uint64_t *pval, const char *name)
> {
> const MonitorDef *md = target_monitor_defs();
> CPUState *cs = mon_get_cpu(mon);
> @@ -100,7 +100,7 @@ int get_monitor_def(Monitor *mon, int64_t *pval, const char *name)
>
> ret = target_get_monitor_def(cs, name, &tmp);
> if (!ret) {
> - *pval = (target_long) tmp;
> + *pval = (target_ulong)tmp;
> }
>
> return ret;
> diff --git a/monitor/hmp.c b/monitor/hmp.c
> index 0a5bbf82197..eee8b7e964e 100644
> --- a/monitor/hmp.c
> +++ b/monitor/hmp.c
> @@ -376,7 +376,7 @@ static int64_t expr_unary(Monitor *mon)
> case '$':
> {
> char buf[128], *q;
> - int64_t reg = 0;
> + uint64_t reg = 0;
I'm a bit surprised the 'n = reg' where n is an int64_t doesn't
generate a warning. Mind you, the 'n = strtoull(..)' has
been there for ages.
But, if it doesn't, then I'm hmm, ok, as you say above all the
data started out unsigned anyway.
Reviewed-by: Dr. David Alan Gilbert <dave@treblig.org>
> pch++;
> q = buf;
> --
> 2.52.0
>
--
-----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 |_______/
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v2 6/8] monitor: Truncate target register using ldn_he_p() API
2026-01-17 16:29 [PATCH v2 0/8] monitor/hmp: Reduce target-specific definitions Philippe Mathieu-Daudé
` (4 preceding siblings ...)
2026-01-17 16:29 ` [PATCH v2 5/8] monitor: Have *get_monitor_def() fill an unsigned value Philippe Mathieu-Daudé
@ 2026-01-17 16:29 ` Philippe Mathieu-Daudé
2026-01-17 16:29 ` [PATCH v2 7/8] monitor: Reduce target-specific methods further Philippe Mathieu-Daudé
2026-01-17 16:29 ` [PATCH v2 8/8] monitor: Remove 'monitor/hmp-target.h' header Philippe Mathieu-Daudé
7 siblings, 0 replies; 16+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-01-17 16:29 UTC (permalink / raw)
To: qemu-devel
Cc: Richard Henderson, Paolo Bonzini, Pierrick Bouvier,
Dr. David Alan Gilbert, Markus Armbruster,
Philippe Mathieu-Daudé
Rather than truncating with a target_long cast, use the
unaligned load/store API.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/monitor/hmp-target.h | 3 ---
monitor/hmp-target.c | 6 ++++--
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/include/monitor/hmp-target.h b/include/monitor/hmp-target.h
index bd9baeaa3ad..713936c4523 100644
--- a/include/monitor/hmp-target.h
+++ b/include/monitor/hmp-target.h
@@ -27,15 +27,12 @@
typedef struct MonitorDef MonitorDef;
-#ifdef COMPILING_PER_TARGET
-#include "cpu.h"
struct MonitorDef {
const char *name;
int offset;
uint64_t (*get_value)(Monitor *mon, const struct MonitorDef *md, int val);
int type;
};
-#endif
#define MD_TLONG 0
#define MD_I32 1
diff --git a/monitor/hmp-target.c b/monitor/hmp-target.c
index ead195f5616..01be0a0b426 100644
--- a/monitor/hmp-target.c
+++ b/monitor/hmp-target.c
@@ -23,6 +23,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/bswap.h"
#include "monitor-internal.h"
#include "monitor/qdev.h"
#include "net/slirp.h"
@@ -65,6 +66,7 @@ HMPCommand *hmp_cmds_for_target(bool info_command)
*/
int get_monitor_def(Monitor *mon, uint64_t *pval, const char *name)
{
+ const unsigned length = target_long_bits() / 8;
const MonitorDef *md = target_monitor_defs();
CPUState *cs = mon_get_cpu(mon);
uint64_t tmp = 0;
@@ -87,7 +89,7 @@ int get_monitor_def(Monitor *mon, uint64_t *pval, const char *name)
*pval = *(uint32_t *)ptr;
break;
case MD_TLONG:
- *pval = *(target_ulong *)ptr;
+ *pval = ldn_he_p(ptr, length);
break;
default:
*pval = 0;
@@ -100,7 +102,7 @@ int get_monitor_def(Monitor *mon, uint64_t *pval, const char *name)
ret = target_get_monitor_def(cs, name, &tmp);
if (!ret) {
- *pval = (target_ulong)tmp;
+ *pval = ldn_he_p(&tmp, length);
}
return ret;
--
2.52.0
^ permalink raw reply related [flat|nested] 16+ messages in thread* [PATCH v2 7/8] monitor: Reduce target-specific methods further
2026-01-17 16:29 [PATCH v2 0/8] monitor/hmp: Reduce target-specific definitions Philippe Mathieu-Daudé
` (5 preceding siblings ...)
2026-01-17 16:29 ` [PATCH v2 6/8] monitor: Truncate target register using ldn_he_p() API Philippe Mathieu-Daudé
@ 2026-01-17 16:29 ` Philippe Mathieu-Daudé
2026-01-19 2:01 ` Dr. David Alan Gilbert
2026-01-17 16:29 ` [PATCH v2 8/8] monitor: Remove 'monitor/hmp-target.h' header Philippe Mathieu-Daudé
7 siblings, 1 reply; 16+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-01-17 16:29 UTC (permalink / raw)
To: qemu-devel
Cc: Richard Henderson, Paolo Bonzini, Pierrick Bouvier,
Dr. David Alan Gilbert, Markus Armbruster,
Philippe Mathieu-Daudé
get_monitor_def() doesn't use any target-specific declaration
anymore, move it to hmp.c to compile it once.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
monitor/monitor-internal.h | 1 -
monitor/hmp-target.c | 49 -----------------------------------
monitor/hmp.c | 52 ++++++++++++++++++++++++++++++++++++++
3 files changed, 52 insertions(+), 50 deletions(-)
diff --git a/monitor/monitor-internal.h b/monitor/monitor-internal.h
index 8dc88963630..3ecd394ecf6 100644
--- a/monitor/monitor-internal.h
+++ b/monitor/monitor-internal.h
@@ -181,7 +181,6 @@ void monitor_data_destroy_qmp(MonitorQMP *mon);
void coroutine_fn monitor_qmp_dispatcher_co(void *data);
void qmp_dispatcher_co_wake(void);
-int get_monitor_def(Monitor *mon, uint64_t *pval, const char *name);
void handle_hmp_command(MonitorHMP *mon, const char *cmdline);
int hmp_compare_cmd(const char *name, const char *list);
diff --git a/monitor/hmp-target.c b/monitor/hmp-target.c
index 01be0a0b426..a3306b69c93 100644
--- a/monitor/hmp-target.c
+++ b/monitor/hmp-target.c
@@ -23,7 +23,6 @@
*/
#include "qemu/osdep.h"
-#include "qemu/bswap.h"
#include "monitor-internal.h"
#include "monitor/qdev.h"
#include "net/slirp.h"
@@ -60,54 +59,6 @@ HMPCommand *hmp_cmds_for_target(bool info_command)
return info_command ? hmp_info_cmds : hmp_cmds;
}
-/*
- * Set @pval to the value in the register identified by @name.
- * return 0 if OK, -1 if not found
- */
-int get_monitor_def(Monitor *mon, uint64_t *pval, const char *name)
-{
- const unsigned length = target_long_bits() / 8;
- const MonitorDef *md = target_monitor_defs();
- CPUState *cs = mon_get_cpu(mon);
- uint64_t tmp = 0;
- int ret;
-
- if (cs == NULL || md == NULL) {
- return -1;
- }
-
- for(; md->name != NULL; md++) {
- if (hmp_compare_cmd(name, md->name)) {
- if (md->get_value) {
- *pval = md->get_value(mon, md, md->offset);
- } else {
- CPUArchState *env = mon_get_cpu_env(mon);
- void *ptr = (uint8_t *)env + md->offset;
-
- switch(md->type) {
- case MD_I32:
- *pval = *(uint32_t *)ptr;
- break;
- case MD_TLONG:
- *pval = ldn_he_p(ptr, length);
- break;
- default:
- *pval = 0;
- break;
- }
- }
- return 0;
- }
- }
-
- ret = target_get_monitor_def(cs, name, &tmp);
- if (!ret) {
- *pval = ldn_he_p(&tmp, length);
- }
-
- return ret;
-}
-
static int
compare_mon_cmd(const void *a, const void *b)
{
diff --git a/monitor/hmp.c b/monitor/hmp.c
index eee8b7e964e..82d2bbdf77d 100644
--- a/monitor/hmp.c
+++ b/monitor/hmp.c
@@ -27,8 +27,10 @@
#include "hw/core/qdev.h"
#include "monitor-internal.h"
#include "monitor/hmp.h"
+#include "monitor/hmp-target.h"
#include "qobject/qdict.h"
#include "qobject/qnum.h"
+#include "qemu/bswap.h"
#include "qemu/config-file.h"
#include "qemu/ctype.h"
#include "qemu/cutils.h"
@@ -311,6 +313,8 @@ void hmp_help_cmd(Monitor *mon, const char *name)
static const char *pch;
static sigjmp_buf expr_env;
+static int get_monitor_def(Monitor *mon, uint64_t *pval, const char *name);
+
static G_NORETURN G_GNUC_PRINTF(2, 3)
void expr_error(Monitor *mon, const char *fmt, ...)
{
@@ -1552,3 +1556,51 @@ void monitor_register_hmp_info_hrt(const char *name,
}
g_assert_not_reached();
}
+
+/*
+ * 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, uint64_t *pval, const char *name)
+{
+ const unsigned length = target_long_bits() / 8;
+ const MonitorDef *md = target_monitor_defs();
+ CPUState *cs = mon_get_cpu(mon);
+ uint64_t tmp = 0;
+ int ret;
+
+ if (cs == NULL || md == NULL) {
+ return -1;
+ }
+
+ for(; md->name != NULL; md++) {
+ if (hmp_compare_cmd(name, md->name)) {
+ if (md->get_value) {
+ *pval = md->get_value(mon, md, md->offset);
+ } else {
+ CPUArchState *env = mon_get_cpu_env(mon);
+ void *ptr = (uint8_t *)env + md->offset;
+
+ switch(md->type) {
+ case MD_I32:
+ *pval = *(uint32_t *)ptr;
+ break;
+ case MD_TLONG:
+ *pval = ldn_he_p(ptr, length);
+ break;
+ default:
+ *pval = 0;
+ break;
+ }
+ }
+ return 0;
+ }
+ }
+
+ ret = target_get_monitor_def(cs, name, &tmp);
+ if (!ret) {
+ *pval = ldn_he_p(&tmp, length);
+ }
+
+ return ret;
+}
--
2.52.0
^ permalink raw reply related [flat|nested] 16+ messages in thread* Re: [PATCH v2 7/8] monitor: Reduce target-specific methods further
2026-01-17 16:29 ` [PATCH v2 7/8] monitor: Reduce target-specific methods further Philippe Mathieu-Daudé
@ 2026-01-19 2:01 ` Dr. David Alan Gilbert
0 siblings, 0 replies; 16+ messages in thread
From: Dr. David Alan Gilbert @ 2026-01-19 2:01 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: qemu-devel, Richard Henderson, Paolo Bonzini, Pierrick Bouvier,
Markus Armbruster
* Philippe Mathieu-Daudé (philmd@linaro.org) wrote:
> get_monitor_def() doesn't use any target-specific declaration
> anymore, move it to hmp.c to compile it once.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Dr. David Alan Gilbert <dave@treblig.org>
> ---
> monitor/monitor-internal.h | 1 -
> monitor/hmp-target.c | 49 -----------------------------------
> monitor/hmp.c | 52 ++++++++++++++++++++++++++++++++++++++
> 3 files changed, 52 insertions(+), 50 deletions(-)
>
> diff --git a/monitor/monitor-internal.h b/monitor/monitor-internal.h
> index 8dc88963630..3ecd394ecf6 100644
> --- a/monitor/monitor-internal.h
> +++ b/monitor/monitor-internal.h
> @@ -181,7 +181,6 @@ void monitor_data_destroy_qmp(MonitorQMP *mon);
> void coroutine_fn monitor_qmp_dispatcher_co(void *data);
> void qmp_dispatcher_co_wake(void);
>
> -int get_monitor_def(Monitor *mon, uint64_t *pval, const char *name);
> void handle_hmp_command(MonitorHMP *mon, const char *cmdline);
> int hmp_compare_cmd(const char *name, const char *list);
>
> diff --git a/monitor/hmp-target.c b/monitor/hmp-target.c
> index 01be0a0b426..a3306b69c93 100644
> --- a/monitor/hmp-target.c
> +++ b/monitor/hmp-target.c
> @@ -23,7 +23,6 @@
> */
>
> #include "qemu/osdep.h"
> -#include "qemu/bswap.h"
> #include "monitor-internal.h"
> #include "monitor/qdev.h"
> #include "net/slirp.h"
> @@ -60,54 +59,6 @@ HMPCommand *hmp_cmds_for_target(bool info_command)
> return info_command ? hmp_info_cmds : hmp_cmds;
> }
>
> -/*
> - * Set @pval to the value in the register identified by @name.
> - * return 0 if OK, -1 if not found
> - */
> -int get_monitor_def(Monitor *mon, uint64_t *pval, const char *name)
> -{
> - const unsigned length = target_long_bits() / 8;
> - const MonitorDef *md = target_monitor_defs();
> - CPUState *cs = mon_get_cpu(mon);
> - uint64_t tmp = 0;
> - int ret;
> -
> - if (cs == NULL || md == NULL) {
> - return -1;
> - }
> -
> - for(; md->name != NULL; md++) {
> - if (hmp_compare_cmd(name, md->name)) {
> - if (md->get_value) {
> - *pval = md->get_value(mon, md, md->offset);
> - } else {
> - CPUArchState *env = mon_get_cpu_env(mon);
> - void *ptr = (uint8_t *)env + md->offset;
> -
> - switch(md->type) {
> - case MD_I32:
> - *pval = *(uint32_t *)ptr;
> - break;
> - case MD_TLONG:
> - *pval = ldn_he_p(ptr, length);
> - break;
> - default:
> - *pval = 0;
> - break;
> - }
> - }
> - return 0;
> - }
> - }
> -
> - ret = target_get_monitor_def(cs, name, &tmp);
> - if (!ret) {
> - *pval = ldn_he_p(&tmp, length);
> - }
> -
> - return ret;
> -}
> -
> static int
> compare_mon_cmd(const void *a, const void *b)
> {
> diff --git a/monitor/hmp.c b/monitor/hmp.c
> index eee8b7e964e..82d2bbdf77d 100644
> --- a/monitor/hmp.c
> +++ b/monitor/hmp.c
> @@ -27,8 +27,10 @@
> #include "hw/core/qdev.h"
> #include "monitor-internal.h"
> #include "monitor/hmp.h"
> +#include "monitor/hmp-target.h"
> #include "qobject/qdict.h"
> #include "qobject/qnum.h"
> +#include "qemu/bswap.h"
> #include "qemu/config-file.h"
> #include "qemu/ctype.h"
> #include "qemu/cutils.h"
> @@ -311,6 +313,8 @@ void hmp_help_cmd(Monitor *mon, const char *name)
> static const char *pch;
> static sigjmp_buf expr_env;
>
> +static int get_monitor_def(Monitor *mon, uint64_t *pval, const char *name);
> +
> static G_NORETURN G_GNUC_PRINTF(2, 3)
> void expr_error(Monitor *mon, const char *fmt, ...)
> {
> @@ -1552,3 +1556,51 @@ void monitor_register_hmp_info_hrt(const char *name,
> }
> g_assert_not_reached();
> }
> +
> +/*
> + * 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, uint64_t *pval, const char *name)
> +{
> + const unsigned length = target_long_bits() / 8;
> + const MonitorDef *md = target_monitor_defs();
> + CPUState *cs = mon_get_cpu(mon);
> + uint64_t tmp = 0;
> + int ret;
> +
> + if (cs == NULL || md == NULL) {
> + return -1;
> + }
> +
> + for(; md->name != NULL; md++) {
> + if (hmp_compare_cmd(name, md->name)) {
> + if (md->get_value) {
> + *pval = md->get_value(mon, md, md->offset);
> + } else {
> + CPUArchState *env = mon_get_cpu_env(mon);
> + void *ptr = (uint8_t *)env + md->offset;
> +
> + switch(md->type) {
> + case MD_I32:
> + *pval = *(uint32_t *)ptr;
> + break;
> + case MD_TLONG:
> + *pval = ldn_he_p(ptr, length);
> + break;
> + default:
> + *pval = 0;
> + break;
> + }
> + }
> + return 0;
> + }
> + }
> +
> + ret = target_get_monitor_def(cs, name, &tmp);
> + if (!ret) {
> + *pval = ldn_he_p(&tmp, length);
> + }
> +
> + return ret;
> +}
> --
> 2.52.0
>
--
-----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 |_______/
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v2 8/8] monitor: Remove 'monitor/hmp-target.h' header
2026-01-17 16:29 [PATCH v2 0/8] monitor/hmp: Reduce target-specific definitions Philippe Mathieu-Daudé
` (6 preceding siblings ...)
2026-01-17 16:29 ` [PATCH v2 7/8] monitor: Reduce target-specific methods further Philippe Mathieu-Daudé
@ 2026-01-17 16:29 ` Philippe Mathieu-Daudé
2026-01-19 2:03 ` Dr. David Alan Gilbert
7 siblings, 1 reply; 16+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-01-17 16:29 UTC (permalink / raw)
To: qemu-devel
Cc: Richard Henderson, Paolo Bonzini, Pierrick Bouvier,
Dr. David Alan Gilbert, Markus Armbruster,
Philippe Mathieu-Daudé, Eduardo Habkost, Michael S. Tsirkin,
Marcel Apfelbaum, Zhao Liu, Marcelo Tosatti, Laurent Vivier,
Nicholas Piggin, Chinmay Rath, Palmer Dabbelt, Alistair Francis,
Weiwei Li, Daniel Henrique Barboza, Liu Zhiwei, Yoshinori Sato,
Mark Cave-Ayland, Artyom Tarasenko, Max Filippov, kvm, qemu-ppc,
qemu-riscv
The "monitor/hmp-target.h" header doesn't contain any
target-specific declarations anymore. Merge it with
"monitor/hmp.h", its target-agnostic counterpart.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
MAINTAINERS | 2 +-
include/monitor/hmp-target.h | 60 -----------------------------------
include/monitor/hmp.h | 31 ++++++++++++++++++
hw/i386/sgx-stub.c | 2 +-
hw/i386/sgx.c | 1 -
monitor/hmp-cmds.c | 1 -
monitor/hmp-target.c | 1 -
monitor/hmp.c | 1 -
stubs/target-monitor-defs.c | 2 +-
target/i386/cpu-apic.c | 2 +-
target/i386/monitor.c | 1 -
target/i386/sev-system-stub.c | 2 +-
target/i386/sev.c | 1 -
target/m68k/monitor.c | 2 +-
target/ppc/ppc-qmp-cmds.c | 1 -
target/riscv/monitor.c | 2 +-
target/riscv/riscv-qmp-cmds.c | 1 -
target/sh4/monitor.c | 1 -
target/sparc/monitor.c | 1 -
target/xtensa/monitor.c | 1 -
20 files changed, 38 insertions(+), 78 deletions(-)
delete mode 100644 include/monitor/hmp-target.h
diff --git a/MAINTAINERS b/MAINTAINERS
index de8246c3ffd..1e0d71c7bb8 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3377,7 +3377,7 @@ F: monitor/monitor.c
F: monitor/hmp*
F: hmp.h
F: hmp-commands*.hx
-F: include/monitor/hmp-target.h
+F: include/monitor/hmp.h
F: tests/qtest/test-hmp.c
F: include/qemu/qemu-print.h
F: util/qemu-print.c
diff --git a/include/monitor/hmp-target.h b/include/monitor/hmp-target.h
deleted file mode 100644
index 713936c4523..00000000000
--- a/include/monitor/hmp-target.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * QEMU monitor
- *
- * Copyright (c) 2003-2004 Fabrice Bellard
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#ifndef MONITOR_HMP_TARGET_H
-#define MONITOR_HMP_TARGET_H
-
-typedef struct MonitorDef MonitorDef;
-
-struct MonitorDef {
- const char *name;
- int offset;
- uint64_t (*get_value)(Monitor *mon, const struct MonitorDef *md, int val);
- int type;
-};
-
-#define MD_TLONG 0
-#define MD_I32 1
-
-const MonitorDef *target_monitor_defs(void);
-int target_get_monitor_def(CPUState *cs, const char *name, uint64_t *pval);
-
-CPUArchState *mon_get_cpu_env(Monitor *mon);
-CPUState *mon_get_cpu(Monitor *mon);
-
-void hmp_info_mem(Monitor *mon, const QDict *qdict);
-void hmp_info_tlb(Monitor *mon, const QDict *qdict);
-void hmp_mce(Monitor *mon, const QDict *qdict);
-void hmp_info_local_apic(Monitor *mon, const QDict *qdict);
-void hmp_info_sev(Monitor *mon, const QDict *qdict);
-void hmp_info_sgx(Monitor *mon, const QDict *qdict);
-void hmp_info_via(Monitor *mon, const QDict *qdict);
-void hmp_memory_dump(Monitor *mon, const QDict *qdict);
-void hmp_physical_memory_dump(Monitor *mon, const QDict *qdict);
-void hmp_info_registers(Monitor *mon, const QDict *qdict);
-void hmp_gva2gpa(Monitor *mon, const QDict *qdict);
-void hmp_gpa2hva(Monitor *mon, const QDict *qdict);
-void hmp_gpa2hpa(Monitor *mon, const QDict *qdict);
-
-#endif /* MONITOR_HMP_TARGET_H */
diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h
index 83721b5ffc6..fb678786101 100644
--- a/include/monitor/hmp.h
+++ b/include/monitor/hmp.h
@@ -17,6 +17,37 @@
#include "qemu/readline.h"
#include "qapi/qapi-types-common.h"
+typedef struct MonitorDef {
+ const char *name;
+ int offset;
+ uint64_t (*get_value)(Monitor *mon, const struct MonitorDef *md, int val);
+ int type;
+} MonitorDef;
+
+#define MD_TLONG 0
+#define MD_I32 1
+
+const MonitorDef *target_monitor_defs(void);
+
+int target_get_monitor_def(CPUState *cs, const char *name, uint64_t *pval);
+
+CPUArchState *mon_get_cpu_env(Monitor *mon);
+CPUState *mon_get_cpu(Monitor *mon);
+
+void hmp_info_mem(Monitor *mon, const QDict *qdict);
+void hmp_info_tlb(Monitor *mon, const QDict *qdict);
+void hmp_mce(Monitor *mon, const QDict *qdict);
+void hmp_info_local_apic(Monitor *mon, const QDict *qdict);
+void hmp_info_sev(Monitor *mon, const QDict *qdict);
+void hmp_info_sgx(Monitor *mon, const QDict *qdict);
+void hmp_info_via(Monitor *mon, const QDict *qdict);
+void hmp_memory_dump(Monitor *mon, const QDict *qdict);
+void hmp_physical_memory_dump(Monitor *mon, const QDict *qdict);
+void hmp_info_registers(Monitor *mon, const QDict *qdict);
+void hmp_gva2gpa(Monitor *mon, const QDict *qdict);
+void hmp_gpa2hva(Monitor *mon, const QDict *qdict);
+void hmp_gpa2hpa(Monitor *mon, const QDict *qdict);
+
bool hmp_handle_error(Monitor *mon, Error *err);
void hmp_help_cmd(Monitor *mon, const char *name);
strList *hmp_split_at_comma(const char *str);
diff --git a/hw/i386/sgx-stub.c b/hw/i386/sgx-stub.c
index d295e54d239..6e82773a86d 100644
--- a/hw/i386/sgx-stub.c
+++ b/hw/i386/sgx-stub.c
@@ -1,6 +1,6 @@
#include "qemu/osdep.h"
#include "monitor/monitor.h"
-#include "monitor/hmp-target.h"
+#include "monitor/hmp.h"
#include "hw/i386/pc.h"
#include "hw/i386/sgx-epc.h"
#include "qapi/qapi-commands-misc-i386.h"
diff --git a/hw/i386/sgx.c b/hw/i386/sgx.c
index e2801546ad6..54d2cae36d8 100644
--- a/hw/i386/sgx.c
+++ b/hw/i386/sgx.c
@@ -16,7 +16,6 @@
#include "hw/mem/memory-device.h"
#include "monitor/qdev.h"
#include "monitor/monitor.h"
-#include "monitor/hmp-target.h"
#include "qapi/error.h"
#include "qemu/error-report.h"
#include "qapi/qapi-commands-misc-i386.h"
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
index 5a673cddb2a..7c2b69dfa5b 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
@@ -21,7 +21,6 @@
#include "gdbstub/enums.h"
#include "monitor/hmp.h"
#include "qemu/help_option.h"
-#include "monitor/hmp-target.h"
#include "monitor/monitor-internal.h"
#include "qapi/error.h"
#include "qapi/qapi-commands-control.h"
diff --git a/monitor/hmp-target.c b/monitor/hmp-target.c
index a3306b69c93..2574c5d8b4b 100644
--- a/monitor/hmp-target.c
+++ b/monitor/hmp-target.c
@@ -27,7 +27,6 @@
#include "monitor/qdev.h"
#include "net/slirp.h"
#include "system/device_tree.h"
-#include "monitor/hmp-target.h"
#include "monitor/hmp.h"
#include "block/block-hmp-cmds.h"
#include "qapi/qapi-commands-control.h"
diff --git a/monitor/hmp.c b/monitor/hmp.c
index 82d2bbdf77d..4dc8c5f9364 100644
--- a/monitor/hmp.c
+++ b/monitor/hmp.c
@@ -27,7 +27,6 @@
#include "hw/core/qdev.h"
#include "monitor-internal.h"
#include "monitor/hmp.h"
-#include "monitor/hmp-target.h"
#include "qobject/qdict.h"
#include "qobject/qnum.h"
#include "qemu/bswap.h"
diff --git a/stubs/target-monitor-defs.c b/stubs/target-monitor-defs.c
index 35a0a342772..0dd4cdb34f6 100644
--- a/stubs/target-monitor-defs.c
+++ b/stubs/target-monitor-defs.c
@@ -1,5 +1,5 @@
#include "qemu/osdep.h"
-#include "monitor/hmp-target.h"
+#include "monitor/hmp.h"
const MonitorDef *target_monitor_defs(void)
{
diff --git a/target/i386/cpu-apic.c b/target/i386/cpu-apic.c
index eeee62b52a2..3b73a04597f 100644
--- a/target/i386/cpu-apic.c
+++ b/target/i386/cpu-apic.c
@@ -10,7 +10,7 @@
#include "qobject/qdict.h"
#include "qapi/error.h"
#include "monitor/monitor.h"
-#include "monitor/hmp-target.h"
+#include "monitor/hmp.h"
#include "system/hw_accel.h"
#include "system/kvm.h"
#include "system/xen.h"
diff --git a/target/i386/monitor.c b/target/i386/monitor.c
index cce23f987ef..1c16b003371 100644
--- a/target/i386/monitor.c
+++ b/target/i386/monitor.c
@@ -25,7 +25,6 @@
#include "qemu/osdep.h"
#include "cpu.h"
#include "monitor/monitor.h"
-#include "monitor/hmp-target.h"
#include "monitor/hmp.h"
#include "qobject/qdict.h"
#include "qapi/error.h"
diff --git a/target/i386/sev-system-stub.c b/target/i386/sev-system-stub.c
index 7c5c02a5657..f799a338d60 100644
--- a/target/i386/sev-system-stub.c
+++ b/target/i386/sev-system-stub.c
@@ -13,7 +13,7 @@
#include "qemu/osdep.h"
#include "monitor/monitor.h"
-#include "monitor/hmp-target.h"
+#include "monitor/hmp.h"
#include "qapi/error.h"
#include "sev.h"
diff --git a/target/i386/sev.c b/target/i386/sev.c
index 1d70f96ec1f..31dbabe4b51 100644
--- a/target/i386/sev.c
+++ b/target/i386/sev.c
@@ -36,7 +36,6 @@
#include "migration/blocker.h"
#include "qom/object.h"
#include "monitor/monitor.h"
-#include "monitor/hmp-target.h"
#include "qapi/qapi-commands-misc-i386.h"
#include "confidential-guest.h"
#include "hw/i386/pc.h"
diff --git a/target/m68k/monitor.c b/target/m68k/monitor.c
index 161f41853ec..05d05440f42 100644
--- a/target/m68k/monitor.c
+++ b/target/m68k/monitor.c
@@ -7,7 +7,7 @@
#include "qemu/osdep.h"
#include "cpu.h"
-#include "monitor/hmp-target.h"
+#include "monitor/hmp.h"
#include "monitor/monitor.h"
void hmp_info_tlb(Monitor *mon, const QDict *qdict)
diff --git a/target/ppc/ppc-qmp-cmds.c b/target/ppc/ppc-qmp-cmds.c
index 07938abb15f..08314e3c1cd 100644
--- a/target/ppc/ppc-qmp-cmds.c
+++ b/target/ppc/ppc-qmp-cmds.c
@@ -26,7 +26,6 @@
#include "cpu.h"
#include "monitor/monitor.h"
#include "qemu/ctype.h"
-#include "monitor/hmp-target.h"
#include "monitor/hmp.h"
#include "qapi/error.h"
#include "qapi/qapi-commands-machine.h"
diff --git a/target/riscv/monitor.c b/target/riscv/monitor.c
index 8a77476db93..bc176dd8771 100644
--- a/target/riscv/monitor.c
+++ b/target/riscv/monitor.c
@@ -22,7 +22,7 @@
#include "cpu.h"
#include "cpu_bits.h"
#include "monitor/monitor.h"
-#include "monitor/hmp-target.h"
+#include "monitor/hmp.h"
#include "system/memory.h"
#ifdef TARGET_RISCV64
diff --git a/target/riscv/riscv-qmp-cmds.c b/target/riscv/riscv-qmp-cmds.c
index d5e9bec0f86..79232d34005 100644
--- a/target/riscv/riscv-qmp-cmds.c
+++ b/target/riscv/riscv-qmp-cmds.c
@@ -34,7 +34,6 @@
#include "qemu/ctype.h"
#include "qemu/qemu-print.h"
#include "monitor/hmp.h"
-#include "monitor/hmp-target.h"
#include "system/kvm.h"
#include "system/tcg.h"
#include "cpu-qom.h"
diff --git a/target/sh4/monitor.c b/target/sh4/monitor.c
index 2da6a5426eb..50324d3600c 100644
--- a/target/sh4/monitor.c
+++ b/target/sh4/monitor.c
@@ -24,7 +24,6 @@
#include "qemu/osdep.h"
#include "cpu.h"
#include "monitor/monitor.h"
-#include "monitor/hmp-target.h"
#include "monitor/hmp.h"
static void print_tlb(Monitor *mon, int idx, tlb_t *tlb)
diff --git a/target/sparc/monitor.c b/target/sparc/monitor.c
index 3e1f4dd5c9c..79f564c551a 100644
--- a/target/sparc/monitor.c
+++ b/target/sparc/monitor.c
@@ -24,7 +24,6 @@
#include "qemu/osdep.h"
#include "cpu.h"
#include "monitor/monitor.h"
-#include "monitor/hmp-target.h"
#include "monitor/hmp.h"
diff --git a/target/xtensa/monitor.c b/target/xtensa/monitor.c
index fbf60d55530..2af84934f83 100644
--- a/target/xtensa/monitor.c
+++ b/target/xtensa/monitor.c
@@ -24,7 +24,6 @@
#include "qemu/osdep.h"
#include "cpu.h"
#include "monitor/monitor.h"
-#include "monitor/hmp-target.h"
#include "monitor/hmp.h"
void hmp_info_tlb(Monitor *mon, const QDict *qdict)
--
2.52.0
^ permalink raw reply related [flat|nested] 16+ messages in thread* Re: [PATCH v2 8/8] monitor: Remove 'monitor/hmp-target.h' header
2026-01-17 16:29 ` [PATCH v2 8/8] monitor: Remove 'monitor/hmp-target.h' header Philippe Mathieu-Daudé
@ 2026-01-19 2:03 ` Dr. David Alan Gilbert
0 siblings, 0 replies; 16+ messages in thread
From: Dr. David Alan Gilbert @ 2026-01-19 2:03 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: qemu-devel, Richard Henderson, Paolo Bonzini, Pierrick Bouvier,
Markus Armbruster, Eduardo Habkost, Michael S. Tsirkin,
Marcel Apfelbaum, Zhao Liu, Marcelo Tosatti, Laurent Vivier,
Nicholas Piggin, Chinmay Rath, Palmer Dabbelt, Alistair Francis,
Weiwei Li, Daniel Henrique Barboza, Liu Zhiwei, Yoshinori Sato,
Mark Cave-Ayland, Artyom Tarasenko, Max Filippov, kvm, qemu-ppc,
qemu-riscv
* Philippe Mathieu-Daudé (philmd@linaro.org) wrote:
> The "monitor/hmp-target.h" header doesn't contain any
> target-specific declarations anymore. Merge it with
> "monitor/hmp.h", its target-agnostic counterpart.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Dr. David Alan Gilbert <dave@treblig.org>
> ---
> MAINTAINERS | 2 +-
> include/monitor/hmp-target.h | 60 -----------------------------------
> include/monitor/hmp.h | 31 ++++++++++++++++++
> hw/i386/sgx-stub.c | 2 +-
> hw/i386/sgx.c | 1 -
> monitor/hmp-cmds.c | 1 -
> monitor/hmp-target.c | 1 -
> monitor/hmp.c | 1 -
> stubs/target-monitor-defs.c | 2 +-
> target/i386/cpu-apic.c | 2 +-
> target/i386/monitor.c | 1 -
> target/i386/sev-system-stub.c | 2 +-
> target/i386/sev.c | 1 -
> target/m68k/monitor.c | 2 +-
> target/ppc/ppc-qmp-cmds.c | 1 -
> target/riscv/monitor.c | 2 +-
> target/riscv/riscv-qmp-cmds.c | 1 -
> target/sh4/monitor.c | 1 -
> target/sparc/monitor.c | 1 -
> target/xtensa/monitor.c | 1 -
> 20 files changed, 38 insertions(+), 78 deletions(-)
> delete mode 100644 include/monitor/hmp-target.h
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index de8246c3ffd..1e0d71c7bb8 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -3377,7 +3377,7 @@ F: monitor/monitor.c
> F: monitor/hmp*
> F: hmp.h
> F: hmp-commands*.hx
> -F: include/monitor/hmp-target.h
> +F: include/monitor/hmp.h
> F: tests/qtest/test-hmp.c
> F: include/qemu/qemu-print.h
> F: util/qemu-print.c
> diff --git a/include/monitor/hmp-target.h b/include/monitor/hmp-target.h
> deleted file mode 100644
> index 713936c4523..00000000000
> --- a/include/monitor/hmp-target.h
> +++ /dev/null
> @@ -1,60 +0,0 @@
> -/*
> - * QEMU monitor
> - *
> - * Copyright (c) 2003-2004 Fabrice Bellard
> - *
> - * Permission is hereby granted, free of charge, to any person obtaining a copy
> - * of this software and associated documentation files (the "Software"), to deal
> - * in the Software without restriction, including without limitation the rights
> - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> - * copies of the Software, and to permit persons to whom the Software is
> - * furnished to do so, subject to the following conditions:
> - *
> - * The above copyright notice and this permission notice shall be included in
> - * all copies or substantial portions of the Software.
> - *
> - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
> - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> - * THE SOFTWARE.
> - */
> -
> -#ifndef MONITOR_HMP_TARGET_H
> -#define MONITOR_HMP_TARGET_H
> -
> -typedef struct MonitorDef MonitorDef;
> -
> -struct MonitorDef {
> - const char *name;
> - int offset;
> - uint64_t (*get_value)(Monitor *mon, const struct MonitorDef *md, int val);
> - int type;
> -};
> -
> -#define MD_TLONG 0
> -#define MD_I32 1
> -
> -const MonitorDef *target_monitor_defs(void);
> -int target_get_monitor_def(CPUState *cs, const char *name, uint64_t *pval);
> -
> -CPUArchState *mon_get_cpu_env(Monitor *mon);
> -CPUState *mon_get_cpu(Monitor *mon);
> -
> -void hmp_info_mem(Monitor *mon, const QDict *qdict);
> -void hmp_info_tlb(Monitor *mon, const QDict *qdict);
> -void hmp_mce(Monitor *mon, const QDict *qdict);
> -void hmp_info_local_apic(Monitor *mon, const QDict *qdict);
> -void hmp_info_sev(Monitor *mon, const QDict *qdict);
> -void hmp_info_sgx(Monitor *mon, const QDict *qdict);
> -void hmp_info_via(Monitor *mon, const QDict *qdict);
> -void hmp_memory_dump(Monitor *mon, const QDict *qdict);
> -void hmp_physical_memory_dump(Monitor *mon, const QDict *qdict);
> -void hmp_info_registers(Monitor *mon, const QDict *qdict);
> -void hmp_gva2gpa(Monitor *mon, const QDict *qdict);
> -void hmp_gpa2hva(Monitor *mon, const QDict *qdict);
> -void hmp_gpa2hpa(Monitor *mon, const QDict *qdict);
> -
> -#endif /* MONITOR_HMP_TARGET_H */
> diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h
> index 83721b5ffc6..fb678786101 100644
> --- a/include/monitor/hmp.h
> +++ b/include/monitor/hmp.h
> @@ -17,6 +17,37 @@
> #include "qemu/readline.h"
> #include "qapi/qapi-types-common.h"
>
> +typedef struct MonitorDef {
> + const char *name;
> + int offset;
> + uint64_t (*get_value)(Monitor *mon, const struct MonitorDef *md, int val);
> + int type;
> +} MonitorDef;
> +
> +#define MD_TLONG 0
> +#define MD_I32 1
> +
> +const MonitorDef *target_monitor_defs(void);
> +
> +int target_get_monitor_def(CPUState *cs, const char *name, uint64_t *pval);
> +
> +CPUArchState *mon_get_cpu_env(Monitor *mon);
> +CPUState *mon_get_cpu(Monitor *mon);
> +
> +void hmp_info_mem(Monitor *mon, const QDict *qdict);
> +void hmp_info_tlb(Monitor *mon, const QDict *qdict);
> +void hmp_mce(Monitor *mon, const QDict *qdict);
> +void hmp_info_local_apic(Monitor *mon, const QDict *qdict);
> +void hmp_info_sev(Monitor *mon, const QDict *qdict);
> +void hmp_info_sgx(Monitor *mon, const QDict *qdict);
> +void hmp_info_via(Monitor *mon, const QDict *qdict);
> +void hmp_memory_dump(Monitor *mon, const QDict *qdict);
> +void hmp_physical_memory_dump(Monitor *mon, const QDict *qdict);
> +void hmp_info_registers(Monitor *mon, const QDict *qdict);
> +void hmp_gva2gpa(Monitor *mon, const QDict *qdict);
> +void hmp_gpa2hva(Monitor *mon, const QDict *qdict);
> +void hmp_gpa2hpa(Monitor *mon, const QDict *qdict);
> +
> bool hmp_handle_error(Monitor *mon, Error *err);
> void hmp_help_cmd(Monitor *mon, const char *name);
> strList *hmp_split_at_comma(const char *str);
> diff --git a/hw/i386/sgx-stub.c b/hw/i386/sgx-stub.c
> index d295e54d239..6e82773a86d 100644
> --- a/hw/i386/sgx-stub.c
> +++ b/hw/i386/sgx-stub.c
> @@ -1,6 +1,6 @@
> #include "qemu/osdep.h"
> #include "monitor/monitor.h"
> -#include "monitor/hmp-target.h"
> +#include "monitor/hmp.h"
> #include "hw/i386/pc.h"
> #include "hw/i386/sgx-epc.h"
> #include "qapi/qapi-commands-misc-i386.h"
> diff --git a/hw/i386/sgx.c b/hw/i386/sgx.c
> index e2801546ad6..54d2cae36d8 100644
> --- a/hw/i386/sgx.c
> +++ b/hw/i386/sgx.c
> @@ -16,7 +16,6 @@
> #include "hw/mem/memory-device.h"
> #include "monitor/qdev.h"
> #include "monitor/monitor.h"
> -#include "monitor/hmp-target.h"
> #include "qapi/error.h"
> #include "qemu/error-report.h"
> #include "qapi/qapi-commands-misc-i386.h"
> diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
> index 5a673cddb2a..7c2b69dfa5b 100644
> --- a/monitor/hmp-cmds.c
> +++ b/monitor/hmp-cmds.c
> @@ -21,7 +21,6 @@
> #include "gdbstub/enums.h"
> #include "monitor/hmp.h"
> #include "qemu/help_option.h"
> -#include "monitor/hmp-target.h"
> #include "monitor/monitor-internal.h"
> #include "qapi/error.h"
> #include "qapi/qapi-commands-control.h"
> diff --git a/monitor/hmp-target.c b/monitor/hmp-target.c
> index a3306b69c93..2574c5d8b4b 100644
> --- a/monitor/hmp-target.c
> +++ b/monitor/hmp-target.c
> @@ -27,7 +27,6 @@
> #include "monitor/qdev.h"
> #include "net/slirp.h"
> #include "system/device_tree.h"
> -#include "monitor/hmp-target.h"
> #include "monitor/hmp.h"
> #include "block/block-hmp-cmds.h"
> #include "qapi/qapi-commands-control.h"
> diff --git a/monitor/hmp.c b/monitor/hmp.c
> index 82d2bbdf77d..4dc8c5f9364 100644
> --- a/monitor/hmp.c
> +++ b/monitor/hmp.c
> @@ -27,7 +27,6 @@
> #include "hw/core/qdev.h"
> #include "monitor-internal.h"
> #include "monitor/hmp.h"
> -#include "monitor/hmp-target.h"
> #include "qobject/qdict.h"
> #include "qobject/qnum.h"
> #include "qemu/bswap.h"
> diff --git a/stubs/target-monitor-defs.c b/stubs/target-monitor-defs.c
> index 35a0a342772..0dd4cdb34f6 100644
> --- a/stubs/target-monitor-defs.c
> +++ b/stubs/target-monitor-defs.c
> @@ -1,5 +1,5 @@
> #include "qemu/osdep.h"
> -#include "monitor/hmp-target.h"
> +#include "monitor/hmp.h"
>
> const MonitorDef *target_monitor_defs(void)
> {
> diff --git a/target/i386/cpu-apic.c b/target/i386/cpu-apic.c
> index eeee62b52a2..3b73a04597f 100644
> --- a/target/i386/cpu-apic.c
> +++ b/target/i386/cpu-apic.c
> @@ -10,7 +10,7 @@
> #include "qobject/qdict.h"
> #include "qapi/error.h"
> #include "monitor/monitor.h"
> -#include "monitor/hmp-target.h"
> +#include "monitor/hmp.h"
> #include "system/hw_accel.h"
> #include "system/kvm.h"
> #include "system/xen.h"
> diff --git a/target/i386/monitor.c b/target/i386/monitor.c
> index cce23f987ef..1c16b003371 100644
> --- a/target/i386/monitor.c
> +++ b/target/i386/monitor.c
> @@ -25,7 +25,6 @@
> #include "qemu/osdep.h"
> #include "cpu.h"
> #include "monitor/monitor.h"
> -#include "monitor/hmp-target.h"
> #include "monitor/hmp.h"
> #include "qobject/qdict.h"
> #include "qapi/error.h"
> diff --git a/target/i386/sev-system-stub.c b/target/i386/sev-system-stub.c
> index 7c5c02a5657..f799a338d60 100644
> --- a/target/i386/sev-system-stub.c
> +++ b/target/i386/sev-system-stub.c
> @@ -13,7 +13,7 @@
>
> #include "qemu/osdep.h"
> #include "monitor/monitor.h"
> -#include "monitor/hmp-target.h"
> +#include "monitor/hmp.h"
> #include "qapi/error.h"
> #include "sev.h"
>
> diff --git a/target/i386/sev.c b/target/i386/sev.c
> index 1d70f96ec1f..31dbabe4b51 100644
> --- a/target/i386/sev.c
> +++ b/target/i386/sev.c
> @@ -36,7 +36,6 @@
> #include "migration/blocker.h"
> #include "qom/object.h"
> #include "monitor/monitor.h"
> -#include "monitor/hmp-target.h"
> #include "qapi/qapi-commands-misc-i386.h"
> #include "confidential-guest.h"
> #include "hw/i386/pc.h"
> diff --git a/target/m68k/monitor.c b/target/m68k/monitor.c
> index 161f41853ec..05d05440f42 100644
> --- a/target/m68k/monitor.c
> +++ b/target/m68k/monitor.c
> @@ -7,7 +7,7 @@
>
> #include "qemu/osdep.h"
> #include "cpu.h"
> -#include "monitor/hmp-target.h"
> +#include "monitor/hmp.h"
> #include "monitor/monitor.h"
>
> void hmp_info_tlb(Monitor *mon, const QDict *qdict)
> diff --git a/target/ppc/ppc-qmp-cmds.c b/target/ppc/ppc-qmp-cmds.c
> index 07938abb15f..08314e3c1cd 100644
> --- a/target/ppc/ppc-qmp-cmds.c
> +++ b/target/ppc/ppc-qmp-cmds.c
> @@ -26,7 +26,6 @@
> #include "cpu.h"
> #include "monitor/monitor.h"
> #include "qemu/ctype.h"
> -#include "monitor/hmp-target.h"
> #include "monitor/hmp.h"
> #include "qapi/error.h"
> #include "qapi/qapi-commands-machine.h"
> diff --git a/target/riscv/monitor.c b/target/riscv/monitor.c
> index 8a77476db93..bc176dd8771 100644
> --- a/target/riscv/monitor.c
> +++ b/target/riscv/monitor.c
> @@ -22,7 +22,7 @@
> #include "cpu.h"
> #include "cpu_bits.h"
> #include "monitor/monitor.h"
> -#include "monitor/hmp-target.h"
> +#include "monitor/hmp.h"
> #include "system/memory.h"
>
> #ifdef TARGET_RISCV64
> diff --git a/target/riscv/riscv-qmp-cmds.c b/target/riscv/riscv-qmp-cmds.c
> index d5e9bec0f86..79232d34005 100644
> --- a/target/riscv/riscv-qmp-cmds.c
> +++ b/target/riscv/riscv-qmp-cmds.c
> @@ -34,7 +34,6 @@
> #include "qemu/ctype.h"
> #include "qemu/qemu-print.h"
> #include "monitor/hmp.h"
> -#include "monitor/hmp-target.h"
> #include "system/kvm.h"
> #include "system/tcg.h"
> #include "cpu-qom.h"
> diff --git a/target/sh4/monitor.c b/target/sh4/monitor.c
> index 2da6a5426eb..50324d3600c 100644
> --- a/target/sh4/monitor.c
> +++ b/target/sh4/monitor.c
> @@ -24,7 +24,6 @@
> #include "qemu/osdep.h"
> #include "cpu.h"
> #include "monitor/monitor.h"
> -#include "monitor/hmp-target.h"
> #include "monitor/hmp.h"
>
> static void print_tlb(Monitor *mon, int idx, tlb_t *tlb)
> diff --git a/target/sparc/monitor.c b/target/sparc/monitor.c
> index 3e1f4dd5c9c..79f564c551a 100644
> --- a/target/sparc/monitor.c
> +++ b/target/sparc/monitor.c
> @@ -24,7 +24,6 @@
> #include "qemu/osdep.h"
> #include "cpu.h"
> #include "monitor/monitor.h"
> -#include "monitor/hmp-target.h"
> #include "monitor/hmp.h"
>
>
> diff --git a/target/xtensa/monitor.c b/target/xtensa/monitor.c
> index fbf60d55530..2af84934f83 100644
> --- a/target/xtensa/monitor.c
> +++ b/target/xtensa/monitor.c
> @@ -24,7 +24,6 @@
> #include "qemu/osdep.h"
> #include "cpu.h"
> #include "monitor/monitor.h"
> -#include "monitor/hmp-target.h"
> #include "monitor/hmp.h"
>
> void hmp_info_tlb(Monitor *mon, const QDict *qdict)
> --
> 2.52.0
>
--
-----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 |_______/
^ permalink raw reply [flat|nested] 16+ messages in thread