]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
hw/uefi: add 'info firmware-log' hmp monitor command.
authorGerd Hoffmann <kraxel@redhat.com>
Fri, 17 Oct 2025 11:50:04 +0000 (13:50 +0200)
committerGerd Hoffmann <kraxel@redhat.com>
Wed, 22 Oct 2025 09:32:07 +0000 (11:32 +0200)
This adds the hmp variant of the query-firmware-log qmp command.

Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-ID: <20251017115006.2696991-3-kraxel@redhat.com>

hmp-commands-info.hx
hw/uefi/ovmf-log.c
include/monitor/hmp.h

index 25b4aed51f56d6cd1a3b049021f2b5d9dcec4b89..33cf740bbc1b6777d98ad1ed9b9432c9830e89d7 100644 (file)
@@ -995,3 +995,16 @@ SRST
   ``info cryptodev``
     Show the crypto devices.
 ERST
+
+    {
+        .name       = "firmware-log",
+        .args_type  = "",
+        .params     = "",
+        .help       = "show the firmware (ovmf) debug log",
+        .cmd        = hmp_info_firmware_log,
+    },
+
+SRST
+  ``info firmware-log``
+    Show the firmware (ovmf) debug log.
+ERST
index 0d4bd503a06a8e6c37dc7250957eac5f81d261ca..fe8acbd192361663fedc65f7e226e18b8d0cd62d 100644 (file)
@@ -231,3 +231,30 @@ FirmwareLog *qmp_query_firmware_log(Error **errp)
     ret->log = g_base64_encode((const guchar *)log->str, log->len);
     return ret;
 }
+
+void hmp_info_firmware_log(Monitor *mon, const QDict *qdict)
+{
+    g_autofree gchar *log_esc = NULL;
+    g_autofree guchar *log_out = NULL;
+    Error *err = NULL;
+    FirmwareLog *log;
+    gsize log_len;
+
+    log = qmp_query_firmware_log(&err);
+    if (err)  {
+        hmp_handle_error(mon, err);
+        return;
+    }
+
+    g_assert(log != NULL);
+    g_assert(log->log != NULL);
+
+    if (log->version) {
+        g_autofree gchar *esc = g_strescape(log->version, NULL);
+        monitor_printf(mon, "[ firmware version: %s ]\n", esc);
+    }
+
+    log_out = g_base64_decode(log->log, &log_len);
+    log_esc = g_strescape((gchar *)log_out, "\r\n");
+    monitor_printf(mon, "%s\n", log_esc);
+}
index 897dfaa2b6d93d4e609bbf0474f572305a28303e..83721b5ffc6deec9f4bd382079dc6320b7638f2b 100644 (file)
@@ -179,5 +179,6 @@ void hmp_boot_set(Monitor *mon, const QDict *qdict);
 void hmp_info_mtree(Monitor *mon, const QDict *qdict);
 void hmp_info_cryptodev(Monitor *mon, const QDict *qdict);
 void hmp_dumpdtb(Monitor *mon, const QDict *qdict);
+void hmp_info_firmware_log(Monitor *mon, const QDict *qdict);
 
 #endif