* [PATCH 1/4] hmp*hx: Move info docs
2026-05-04 17:49 [PATCH 0/4] HMP roll up dave
@ 2026-05-04 17:49 ` dave
2026-05-04 17:49 ` [PATCH 2/4] hxtool: Split srst/erst add checks dave
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: dave @ 2026-05-04 17:49 UTC (permalink / raw)
To: qemu-devel, armbru
Cc: AlanoSong, Dr. David Alan Gilbert, Marc-André Lureau
From: "Dr. David Alan Gilbert" <dave@treblig.org>
Move the docs for the info subcommand from the separate hx
into the top level file next to the 'info' command itself.
That makes every command in the top level file have a RST section.
Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
---
hmp-commands-info.hx | 9 +--------
hmp-commands.hx | 27 +++++++++++++++++----------
2 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
index 74c741f80e..964eed004c 100644
--- a/hmp-commands-info.hx
+++ b/hmp-commands-info.hx
@@ -8,14 +8,7 @@ HXCOMM
HXCOMM In this file, generally SRST fragments should have two extra
HXCOMM spaces of indent, so that the documentation list item for "info foo"
HXCOMM appears inside the documentation list item for the top level
-HXCOMM "info" documentation entry. The exception is the first SRST
-HXCOMM fragment that defines that top level entry.
-
-SRST
-``info`` *subcommand*
- Show various information about the system state.
-
-ERST
+HXCOMM "info" documentation entry.
{
.name = "version",
diff --git a/hmp-commands.hx b/hmp-commands.hx
index 5cc4788f12..f4a6eeda93 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -1814,16 +1814,6 @@ SRST
command.
ERST
- {
- .name = "info",
- .args_type = "item:s?",
- .params = "[subcommand]",
- .help = "show various information about the system state",
- .cmd = hmp_info_help,
- .sub_table = hmp_info_cmds,
- .flags = "p",
- },
-
#if defined(CONFIG_FDT)
{
.name = "dumpdtb",
@@ -1867,3 +1857,20 @@ SRST
List event channels in the guest
ERST
#endif
+
+HXCOMM *** MUST BE LAST ENTRY **
+ {
+ .name = "info",
+ .args_type = "item:s?",
+ .params = "[subcommand]",
+ .help = "show various information about the system state",
+ .cmd = hmp_info_help,
+ .sub_table = hmp_info_cmds,
+ .flags = "p",
+ },
+
+SRST
+``info`` *subcommand*
+ Show various information about the system state.
+ERST
+HXCOMM *** MUST BE LAST ENTRY **
--
2.54.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 2/4] hxtool: Split srst/erst add checks
2026-05-04 17:49 [PATCH 0/4] HMP roll up dave
2026-05-04 17:49 ` [PATCH 1/4] hmp*hx: Move info docs dave
@ 2026-05-04 17:49 ` dave
2026-05-04 17:49 ` [PATCH 3/4] hxtool: Error on missing docs dave
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: dave @ 2026-05-04 17:49 UTC (permalink / raw)
To: qemu-devel, armbru; +Cc: AlanoSong, Dr. David Alan Gilbert, Thomas Huth
From: "Dr. David Alan Gilbert" <dave@treblig.org>
Split the SRST/ERST case and add some checks.
This is mainly to make it easier to add some checks in following
patches.
Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
---
scripts/hxtool | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/scripts/hxtool b/scripts/hxtool
index 80516b9437..51dc841479 100755
--- a/scripts/hxtool
+++ b/scripts/hxtool
@@ -2,15 +2,29 @@
hxtoh()
{
- flag=1
+ in_rst=0
while read -r str; do
case $str in
HXCOMM*)
;;
- SRST*|ERST*) flag=$(($flag^1))
+ SRST*)
+ if [ $in_rst -eq 1 ]
+ then
+ echo "Error: SRST inside another RST" >&2
+ exit 1
+ fi
+ in_rst=1
+ ;;
+ ERST*)
+ if [ $in_rst -eq 0 ]
+ then
+ echo "Error: ERST already outside RST" >&2
+ exit 1
+ fi
+ in_rst=0
;;
*)
- test $flag -eq 1 && printf "%s\n" "$str"
+ test $in_rst -eq 0 && printf "%s\n" "$str"
;;
esac
done
--
2.54.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 3/4] hxtool: Error on missing docs
2026-05-04 17:49 [PATCH 0/4] HMP roll up dave
2026-05-04 17:49 ` [PATCH 1/4] hmp*hx: Move info docs dave
2026-05-04 17:49 ` [PATCH 2/4] hxtool: Split srst/erst add checks dave
@ 2026-05-04 17:49 ` dave
2026-05-04 17:49 ` [PATCH 4/4] monitor: Add `clear` command dave
2026-05-05 14:13 ` [PATCH 0/4] HMP roll up Markus Armbruster
4 siblings, 0 replies; 7+ messages in thread
From: dave @ 2026-05-04 17:49 UTC (permalink / raw)
To: qemu-devel, armbru; +Cc: AlanoSong, Dr. David Alan Gilbert
From: "Dr. David Alan Gilbert" <dave@treblig.org>
Error if a '.name' is seen after another '.name' without an intervening
SRST, this normally indicates missing or misplaced docs.
We can't check DEF (as used in command line options) because those
often have multiple DEF per doc.
Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
With the two minor tidy ups from Thomas's review
---
scripts/hxtool | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/scripts/hxtool b/scripts/hxtool
index 51dc841479..617a694eaf 100755
--- a/scripts/hxtool
+++ b/scripts/hxtool
@@ -1,8 +1,15 @@
#!/bin/sh
+print_if_not_rst()
+{
+ test $in_rst -eq 0 && printf "%s\n" "$str"
+}
+
hxtoh()
{
in_rst=0
+ # .name for HMP
+ seen_name=0
while read -r str; do
case $str in
HXCOMM*)
@@ -13,6 +20,8 @@ hxtoh()
echo "Error: SRST inside another RST" >&2
exit 1
fi
+ # consume the name
+ seen_name=0
in_rst=1
;;
ERST*)
@@ -23,8 +32,18 @@ hxtoh()
fi
in_rst=0
;;
+ # Note the space at the start - we need to exclude something.name
+ ( .name*)
+ if [ $seen_name -eq 1 ]
+ then
+ echo "Error: Seen another .name, maybe missing docs?" >&2
+ exit 1
+ fi
+ seen_name=1
+ print_if_not_rst
+ ;;
*)
- test $in_rst -eq 0 && printf "%s\n" "$str"
+ print_if_not_rst
;;
esac
done
--
2.54.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 4/4] monitor: Add `clear` command
2026-05-04 17:49 [PATCH 0/4] HMP roll up dave
` (2 preceding siblings ...)
2026-05-04 17:49 ` [PATCH 3/4] hxtool: Error on missing docs dave
@ 2026-05-04 17:49 ` dave
2026-05-05 14:13 ` [PATCH 0/4] HMP roll up Markus Armbruster
4 siblings, 0 replies; 7+ messages in thread
From: dave @ 2026-05-04 17:49 UTC (permalink / raw)
To: qemu-devel, armbru; +Cc: AlanoSong, Dr. David Alan Gilbert
From: "AlanoSong@163.com" <AlanoSong@163.com>
The monitor screen can be cluttered after executing commands
like `info qtree`. It is useful to have a command to clear
current screen, just like linux `clear` command do.
This patch has been tested under monitors using stdio, vc,
tcp socket, unix socket and serial interfaces.
Signed-off-by: Alano Song <AlanoSong@163.com>
Reviewed-by: Dr. David Alan Gilbert <dave@treblig.org>
Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
---
hmp-commands.hx | 14 ++++++++++++++
include/monitor/hmp.h | 1 +
monitor/hmp-cmds.c | 11 +++++++++++
3 files changed, 26 insertions(+)
diff --git a/hmp-commands.hx b/hmp-commands.hx
index f4a6eeda93..b806ec5635 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -20,6 +20,20 @@ SRST
Show the help for all commands or just for command *cmd*.
ERST
+ {
+ .name = "clear",
+ .args_type = "",
+ .params = "",
+ .help = "clear the monitor screen",
+ .cmd = hmp_clear,
+ .flags = "p",
+ },
+
+SRST
+``clear``
+ Clear the monitor screen.
+ERST
+
{
.name = "commit",
.args_type = "device:B",
diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h
index e222bea60c..9b66458d21 100644
--- a/include/monitor/hmp.h
+++ b/include/monitor/hmp.h
@@ -165,6 +165,7 @@ void hmp_trace_event(Monitor *mon, const QDict *qdict);
void hmp_trace_file(Monitor *mon, const QDict *qdict);
void hmp_info_trace_events(Monitor *mon, const QDict *qdict);
void hmp_help(Monitor *mon, const QDict *qdict);
+void hmp_clear(Monitor *mon, const QDict *qdict);
void hmp_info_help(Monitor *mon, const QDict *qdict);
void hmp_info_sync_profile(Monitor *mon, const QDict *qdict);
void hmp_info_history(Monitor *mon, const QDict *qdict);
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
index afa7b709a6..1b44d07c18 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
@@ -219,6 +219,17 @@ void hmp_help(Monitor *mon, const QDict *qdict)
hmp_help_cmd(mon, qdict_get_try_str(qdict, "name"));
}
+void hmp_clear(Monitor *mon, const QDict *qdict)
+{
+ /*
+ * Send an ANSI escape sequence:
+ * "\x1b[H" - move cursor to top-left
+ * "\x1b[2J" - clear visible screen
+ * "\x1b[3J" - clear scrollback
+ */
+ monitor_printf(mon, "\x1b[H\x1b[2J\x1b[3J");
+}
+
void hmp_info_help(Monitor *mon, const QDict *qdict)
{
hmp_help_cmd(mon, "info");
--
2.54.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH 0/4] HMP roll up
2026-05-04 17:49 [PATCH 0/4] HMP roll up dave
` (3 preceding siblings ...)
2026-05-04 17:49 ` [PATCH 4/4] monitor: Add `clear` command dave
@ 2026-05-05 14:13 ` Markus Armbruster
2026-05-05 17:49 ` Dr. David Alan Gilbert
4 siblings, 1 reply; 7+ messages in thread
From: Markus Armbruster @ 2026-05-05 14:13 UTC (permalink / raw)
To: dave; +Cc: qemu-devel, AlanoSong
dave@treblig.org writes:
> From: "Dr. David Alan Gilbert" <dave@treblig.org>
>
> Hi Markus,
> Can you merge this little set through your monitor set?
Sure! PR sent: "[PULL 0/4] Monitor patches for 2026-05-05".
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH 0/4] HMP roll up
2026-05-05 14:13 ` [PATCH 0/4] HMP roll up Markus Armbruster
@ 2026-05-05 17:49 ` Dr. David Alan Gilbert
0 siblings, 0 replies; 7+ messages in thread
From: Dr. David Alan Gilbert @ 2026-05-05 17:49 UTC (permalink / raw)
To: Markus Armbruster; +Cc: qemu-devel, AlanoSong
* Markus Armbruster (armbru@redhat.com) wrote:
> dave@treblig.org writes:
>
> > From: "Dr. David Alan Gilbert" <dave@treblig.org>
> >
> > Hi Markus,
> > Can you merge this little set through your monitor set?
>
> Sure! PR sent: "[PULL 0/4] Monitor patches for 2026-05-05".
Thanks!
Dave
--
-----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] 7+ messages in thread