From: Markus Armbruster <armbru@redhat.com>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: qemu-devel@nongnu.org, "Yanan Wang" <wangyanan55@huawei.com>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Dr. David Alan Gilbert" <dave@treblig.org>,
"Eric Blake" <eblake@redhat.com>,
"Zhao Liu" <zhao1.liu@intel.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Laurent Vivier" <lvivier@redhat.com>,
"Fabiano Rosas" <farosas@suse.de>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Eduardo Habkost" <eduardo@habkost.net>
Subject: Re: [PATCH v5 2/3] hw/uefi: add 'info firmware-log' hmp monitor command.
Date: Wed, 15 Oct 2025 16:05:42 +0200 [thread overview]
Message-ID: <87cy6ob6q1.fsf@pond.sub.org> (raw)
In-Reply-To: <20251015120637.1736402-3-kraxel@redhat.com> (Gerd Hoffmann's message of "Wed, 15 Oct 2025 14:06:36 +0200")
Gerd Hoffmann <kraxel@redhat.com> writes:
> This adds the hmp variant of the query-firmware-log qmp command.
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
> hw/uefi/ovmf-log.c | 27 +++++++++++++++++++++++++++
> hmp-commands-info.hx | 13 +++++++++++++
> 2 files changed, 40 insertions(+)
>
> diff --git a/hw/uefi/ovmf-log.c b/hw/uefi/ovmf-log.c
> index 85dda15ab6ad..e281a980a101 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);
QAPI ensures this, so I wouldn't bother myself. Up to you.
> +
> + 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 eaaa880c1b30..f0aef419923c 100644
> --- a/hmp-commands-info.hx
> +++ b/hmp-commands-info.hx
> @@ -990,3 +990,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
With the update of monitor/hmp.h moved here from PATCH 1
Reviewed-by: Markus Armbruster <armbru@redhat.com>
next prev parent reply other threads:[~2025-10-15 14:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-15 12:06 [PATCH v5 0/3] hw/uefi: add support for receiving the firmware log via monitor Gerd Hoffmann
2025-10-15 12:06 ` [PATCH v5 1/3] hw/uefi: add query-firmware-log monitor command Gerd Hoffmann
2025-10-15 14:01 ` Markus Armbruster
2025-10-15 14:34 ` Markus Armbruster
2025-10-15 12:06 ` [PATCH v5 2/3] hw/uefi: add 'info firmware-log' hmp " Gerd Hoffmann
2025-10-15 14:05 ` Markus Armbruster [this message]
2025-10-15 12:06 ` [PATCH v5 3/3] hw/uefi/ovmf-log: add maxsize parameter Gerd Hoffmann
2025-10-15 14:40 ` Markus Armbruster
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=87cy6ob6q1.fsf@pond.sub.org \
--to=armbru@redhat.com \
--cc=dave@treblig.org \
--cc=eblake@redhat.com \
--cc=eduardo@habkost.net \
--cc=farosas@suse.de \
--cc=kraxel@redhat.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.