From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Zhao Liu" <zhao1.liu@intel.com>,
"Eric Blake" <eblake@redhat.com>,
"Yanan Wang" <wangyanan55@huawei.com>,
"Eduardo Habkost" <eduardo@habkost.net>,
"Fabiano Rosas" <farosas@suse.de>,
"Dr. David Alan Gilbert" <dave@treblig.org>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Laurent Vivier" <lvivier@redhat.com>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Markus Armbruster" <armbru@redhat.com>
Subject: [PULL 2/3] hw/uefi: add 'info firmware-log' hmp monitor command.
Date: Wed, 22 Oct 2025 13:00:26 +0200 [thread overview]
Message-ID: <20251022110027.441780-3-kraxel@redhat.com> (raw)
In-Reply-To: <20251022110027.441780-1-kraxel@redhat.com>
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>
---
include/monitor/hmp.h | 1 +
hw/uefi/ovmf-log.c | 27 +++++++++++++++++++++++++++
hmp-commands-info.hx | 13 +++++++++++++
3 files changed, 41 insertions(+)
diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h
index 897dfaa2b6d9..83721b5ffc6d 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
diff --git a/hw/uefi/ovmf-log.c b/hw/uefi/ovmf-log.c
index 0d4bd503a06a..fe8acbd19236 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/hmp-commands-info.hx b/hmp-commands-info.hx
index 25b4aed51f56..33cf740bbc1b 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
--
2.51.0
next prev parent reply other threads:[~2025-10-22 11:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-22 11:00 [PULL 0/3] Uefi 20251022 patches Gerd Hoffmann
2025-10-22 11:00 ` [PULL 1/3] hw/uefi: add query-firmware-log monitor command Gerd Hoffmann
2025-10-22 11:00 ` Gerd Hoffmann [this message]
2025-10-22 11:00 ` [PULL 3/3] hw/uefi/ovmf-log: add maxsize parameter Gerd Hoffmann
2025-10-22 14:29 ` [PULL 0/3] Uefi 20251022 patches Richard Henderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251022110027.441780-3-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=armbru@redhat.com \
--cc=dave@treblig.org \
--cc=eblake@redhat.com \
--cc=eduardo@habkost.net \
--cc=farosas@suse.de \
--cc=lvivier@redhat.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=pbonzini@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=wangyanan55@huawei.com \
--cc=zhao1.liu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).