On 11/5/21 03:23, Markus Armbruster wrote:
Jonah Palmer<jonah.pal...@oracle.com>  writes:

From: Laurent Vivier<lviv...@redhat.com>

This patch implements the HMP versions of the virtio QMP commands.

Signed-off-by: Jonah Palmer<jonah.pal...@oracle.com>
---
  docs/system/monitor.rst |   2 +
  hmp-commands-virtio.hx  | 250 ++++++++++++++++++++++++++++++++++
  hmp-commands.hx         |  10 ++
  hw/virtio/virtio.c      | 355 ++++++++++++++++++++++++++++++++++++++++++++++++
  include/monitor/hmp.h   |   5 +
  meson.build             |   1 +
  monitor/misc.c          |  17 +++
  7 files changed, 640 insertions(+)
  create mode 100644 hmp-commands-virtio.hx

diff --git a/docs/system/monitor.rst b/docs/system/monitor.rst
index ff5c434..10418fc 100644
--- a/docs/system/monitor.rst
+++ b/docs/system/monitor.rst
@@ -21,6 +21,8 @@ The following commands are available:
.. hxtool-doc:: hmp-commands.hx +.. hxtool-doc:: hmp-commands-virtio.hx
+
  .. hxtool-doc:: hmp-commands-info.hx
Integer expressions
diff --git a/hmp-commands-virtio.hx b/hmp-commands-virtio.hx
new file mode 100644
index 0000000..36aab94
--- /dev/null
+++ b/hmp-commands-virtio.hx
@@ -0,0 +1,250 @@
+HXCOMM Use DEFHEADING() to define headings in both help text and rST.
+HXCOMM Text between SRST and ERST is copied to the rST version and
+HXCOMM discarded from C version.
+HXCOMM
+HXCOMM DEF(command, args, callback, arg_string, help) is used to construct
+HXCOMM monitor info commands.
+HXCOMM
+HXCOMM HXCOMM can be used for comments, discarded from both rST and C.
+HXCOMM
+HXCOMM In this file, generally SRST fragments should have two extra
+HXCOMM spaces of indent, so that the documentation list item for "virtio cmd"
+HXCOMM appears inside the documentation list item for the top level
+HXCOMM "virtio" documentation entry. The exception is the first SRST
+HXCOMM fragment that defines that top level entry.
+
+SRST
+  ``virtio`` *subcommand*
+  Show various information about virtio
+
+  Example:
+
+  List all sub-commands::
+
+  (qemu) virtio
+  virtio query  -- List all available virtio devices
I get:

     qemu/docs/../hmp-commands-virtio.hx:25:Inconsistent literal block quoting.

+  virtio status path -- Display status of a given virtio device
+  virtio queue-status path queue -- Display status of a given virtio queue
+  virtio vhost-queue-status path queue -- Display status of a given vhost queue
+  virtio queue-element path queue [index] -- Display element of a given virtio 
queue
+
+ERST
[...]

diff --git a/monitor/misc.c b/monitor/misc.c
index ffe7966..5e4cd88 100644
--- a/monitor/misc.c
+++ b/monitor/misc.c
@@ -23,6 +23,7 @@
   */
#include "qemu/osdep.h"
+#include CONFIG_DEVICES
  #include "monitor-internal.h"
  #include "monitor/qdev.h"
  #include "hw/usb.h"
@@ -219,6 +220,15 @@ static void hmp_info_help(Monitor *mon, const QDict *qdict)
      help_cmd(mon, "info");
  }
+static void hmp_virtio_help(Monitor *mon, const QDict *qdict)
+{
+#if defined(CONFIG_VIRTIO)
+    help_cmd(mon, "virtio");
Probably not your patch's fault: extra space before '--' in the line

     virtio query  -- List all available virtio devices

Huh interesting... I'll get this patched up!


+#else
+    monitor_printf(mon, "Virtio is disabled\n");
+#endif
+}
+
  static void monitor_init_qmp_commands(void)
  {
      /*
@@ -1433,6 +1443,13 @@ static HMPCommand hmp_info_cmds[] = {
      { NULL, NULL, },
  };
+static HMPCommand hmp_virtio_cmds[] = {
+#if defined(CONFIG_VIRTIO)
+#include "hmp-commands-virtio.h"
+#endif
+    { NULL, NULL, },
+};
+
  /* hmp_cmds and hmp_info_cmds would be sorted at runtime */
  HMPCommand hmp_cmds[] = {
  #include "hmp-commands.h"
Jonah

Reply via email to