* [PATCH] hw/uefi: add variable digest to vmstate
@ 2026-03-04 7:59 Gerd Hoffmann
2026-03-08 17:18 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 2+ messages in thread
From: Gerd Hoffmann @ 2026-03-04 7:59 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
Add digest to vmstate if needed. Clear digest before
loading vmstate to make sure it is initialized.
Fixes: db1ecfb473ac ("hw/uefi: add var-service-vars.c")
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/uefi/var-service-vars.c | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/hw/uefi/var-service-vars.c b/hw/uefi/var-service-vars.c
index 94f40ef23684..22f91ab2d4b5 100644
--- a/hw/uefi/var-service-vars.c
+++ b/hw/uefi/var-service-vars.c
@@ -37,8 +37,40 @@ const VMStateDescription vmstate_uefi_time = {
},
};
+static int uefi_vars_pre_load(void *opaque)
+{
+ uefi_variable *var = opaque;
+
+ /* clear digest which is optional in the live migration data stream */
+ var->digest = NULL;
+ var->digest_size = 0;
+ return 0;
+}
+
+static bool uefi_vars_digest_is_needed(void *opaque)
+{
+ uefi_variable *var = opaque;
+
+ if ((var->attributes & EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) &&
+ !uefi_vars_is_sb_any(var)) {
+ return true;
+ }
+ return false;
+}
+
+const VMStateDescription vmstate_uefi_variable_digest = {
+ .name = "uefi-variable-digest",
+ .needed = uefi_vars_digest_is_needed,
+ .fields = (VMStateField[]) {
+ VMSTATE_UINT32(digest_size, uefi_variable),
+ VMSTATE_VBUFFER_ALLOC_UINT32(digest, uefi_variable, 0, NULL, digest_size),
+ VMSTATE_END_OF_LIST()
+ },
+};
+
const VMStateDescription vmstate_uefi_variable = {
.name = "uefi-variable",
+ .pre_load = uefi_vars_pre_load,
.fields = (VMStateField[]) {
VMSTATE_UINT8_ARRAY_V(guid.data, uefi_variable, sizeof(QemuUUID), 0),
VMSTATE_UINT32(name_size, uefi_variable),
@@ -49,6 +81,10 @@ const VMStateDescription vmstate_uefi_variable = {
VMSTATE_STRUCT(time, uefi_variable, 0, vmstate_uefi_time, efi_time),
VMSTATE_END_OF_LIST()
},
+ .subsections = (const VMStateDescription * const []) {
+ &vmstate_uefi_variable_digest,
+ NULL
+ }
};
uefi_variable *uefi_vars_find_variable(uefi_vars_state *uv, QemuUUID guid,
--
2.53.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] hw/uefi: add variable digest to vmstate
2026-03-04 7:59 [PATCH] hw/uefi: add variable digest to vmstate Gerd Hoffmann
@ 2026-03-08 17:18 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 2+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-03-08 17:18 UTC (permalink / raw)
To: Gerd Hoffmann, qemu-devel
On 4/3/26 08:59, Gerd Hoffmann wrote:
> Add digest to vmstate if needed. Clear digest before
> loading vmstate to make sure it is initialized.
>
> Fixes: db1ecfb473ac ("hw/uefi: add var-service-vars.c")
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
> hw/uefi/var-service-vars.c | 36 ++++++++++++++++++++++++++++++++++++
> 1 file changed, 36 insertions(+)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
and queued via hw-misc, thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-03-08 17:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-04 7:59 [PATCH] hw/uefi: add variable digest to vmstate Gerd Hoffmann
2026-03-08 17:18 ` Philippe Mathieu-Daudé
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox