From: Gerd Hoffmann Date: Fri, 17 Oct 2025 11:50:04 +0000 (+0200) Subject: hw/uefi: add 'info firmware-log' hmp monitor command. X-Git-Tag: v10.2.0-rc1~52^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c8aa8120313fc7770900de13b657dacb7dc77a95;p=thirdparty%2Fqemu.git hw/uefi: add 'info firmware-log' hmp monitor command. This adds the hmp variant of the query-firmware-log qmp command. Reviewed-by: Markus Armbruster Signed-off-by: Gerd Hoffmann Message-ID: <20251017115006.2696991-3-kraxel@redhat.com> --- diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx index 25b4aed51f..33cf740bbc 100644 --- a/hmp-commands-info.hx +++ b/hmp-commands-info.hx @@ -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 diff --git a/hw/uefi/ovmf-log.c b/hw/uefi/ovmf-log.c index 0d4bd503a0..fe8acbd192 100644 --- a/hw/uefi/ovmf-log.c +++ b/hw/uefi/ovmf-log.c @@ -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); +} diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h index 897dfaa2b6..83721b5ffc 100644 --- a/include/monitor/hmp.h +++ b/include/monitor/hmp.h @@ -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