diff mbox series

[RFC,03/11] vl: Hardcode a QMP monitor on stdio for now

Message ID 20211202070450.264743-4-armbru@redhat.com (mailing list archive)
State New, archived
Headers show
Series vl: Explore redesign of startup | expand

Commit Message

Markus Armbruster Dec. 2, 2021, 7:04 a.m. UTC
We bootstrap QMP with the CLI, but the CLI is (temporarily) gone.
Hardcode a QMP monitor on stdio until we get it back.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 softmmu/vl.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
diff mbox series

Patch

diff --git a/softmmu/vl.c b/softmmu/vl.c
index 39c67b91c4..b14db0f47f 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -129,6 +129,9 @@ 
 
 #include "config-host.h"
 
+#include "qapi/qapi-commands-char.h"
+#include "qapi/qapi-types-control.h"
+
 static const char *incoming;
 static const char *accelerators;
 static ram_addr_t maxram_size;
@@ -617,6 +620,14 @@  static void qemu_create_early_backends(void)
     /* spice must initialize before audio as it changes the default auiodev */
     /* spice must initialize before chardevs (for spicevmc and spiceport) */
     qemu_spice.init();
+
+    /* HACK: hardcoded monitor chardev */
+    qmp_chardev_add("compat_monitor0", &(ChardevBackend){
+            .type = CHARDEV_BACKEND_KIND_STDIO,
+            .u.stdio = {
+                .data = &(ChardevStdio){},
+            },
+        }, &error_abort);
 }
 
 
@@ -628,6 +639,11 @@  static void qemu_create_late_backends(void)
         exit(1);
     }
 
+    /* HACK: hardcoded monitor */
+    monitor_init(&(MonitorOptions){
+            .chardev = (char *)"compat_monitor0",
+        }, false, &error_abort);
+
     /* now chardevs have been created we may have semihosting to connect */
     qemu_semihosting_connect_chardevs();
     qemu_semihosting_console_init();