qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fw_cfg: Don't set callback_opaque NULL in fw_cfg_modify_bytes_read()
@ 2022-08-25 16:18 Shameer Kolothum via
  2022-08-26 11:59 ` Laszlo Ersek
  2022-09-07  8:52 ` Igor Mammedov
  0 siblings, 2 replies; 8+ messages in thread
From: Shameer Kolothum via @ 2022-08-25 16:18 UTC (permalink / raw)
  To: qemu-devel, qemu-arm
  Cc: imammedo, peter.maydell, lersek, linuxarm, chenxiang66

Hi

On arm/virt platform, Chen Xiang reported a Guest crash while
attempting the below steps,

1. Launch the Guest with nvdimm=on
2. Hot-add a NVDIMM dev
3. Reboot
4. Guest boots fine.
5. Reboot again.
6. Guest boot fails.

QEMU_EFI reports the below error:
ProcessCmdAddPointer: invalid pointer value in "etc/acpi/tables"
OnRootBridgesConnected: InstallAcpiTables: Protocol Error

Debugging shows that on first reboot(after hot-adding NVDIMM),
Qemu updates the etc/table-loader len,

qemu_ram_resize()
  fw_cfg_modify_file()
     fw_cfg_modify_bytes_read()

And in fw_cfg_modify_bytes_read() we set the "callback_opaque" for
the "key" entry to NULL. Because of this, on the second reboot,
virt_acpi_build_update() is called with a NULL "build_state" and
returns without updating the ACPI tables. This seems to be 
upsetting the firmware.

To fix this, don't change the callback_opaque in fw_cfg_modify_bytes_read().

Reported-by: chenxiang <chenxiang66@hisilicon.com>
Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
---
I am still not very convinced this is the root cause of the issue.
Though it looks like setting callback_opaque to NULL while updating
the file size is wrong, what puzzles me is that on the second reboot
we don't have any ACPI table size changes and ideally firmware should
see the updated tables from the first reboot itself.

Please take a look and let me know.

Thanks,
Shameer

---
 hw/nvram/fw_cfg.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
index d605f3f45a..dfe8404c01 100644
--- a/hw/nvram/fw_cfg.c
+++ b/hw/nvram/fw_cfg.c
@@ -728,7 +728,6 @@ static void *fw_cfg_modify_bytes_read(FWCfgState *s, uint16_t key,
     ptr = s->entries[arch][key].data;
     s->entries[arch][key].data = data;
     s->entries[arch][key].len = len;
-    s->entries[arch][key].callback_opaque = NULL;
     s->entries[arch][key].allow_write = false;
 
     return ptr;
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-09-07  9:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-25 16:18 [PATCH] fw_cfg: Don't set callback_opaque NULL in fw_cfg_modify_bytes_read() Shameer Kolothum via
2022-08-26 11:59 ` Laszlo Ersek
2022-08-26 12:06   ` Laszlo Ersek
2022-08-26 12:15     ` Shameerali Kolothum Thodi via
2022-08-30  6:43     ` Shameerali Kolothum Thodi via
2022-08-30 19:45       ` Christian A. Ehrhardt
2022-09-07  8:52 ` Igor Mammedov
2022-09-07  9:36   ` Gerd Hoffmann

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).