hw/riscv/virt.c: move create_fw_cfg() back to virt_machine_init()
authorDaniel Henrique Barboza <dbarboza@ventanamicro.com>
Tue, 17 Jan 2023 13:27:51 +0000 (10:27 -0300)
committerAlistair Francis <alistair.francis@wdc.com>
Fri, 20 Jan 2023 00:14:14 +0000 (10:14 +1000)
commitb748352c555b42d497fe8ee00ee2e44eb8627660
tree1f3bf8b2e85c63f31169a49c507f5fbc405a458a
parentf251c01a623e0c998a2127f8648d4d02cd04e702
hw/riscv/virt.c: move create_fw_cfg() back to virt_machine_init()

Commit 1c20d3ff6004 ("hw/riscv: virt: Add a machine done notifier")
moved the initialization of fw_cfg to the virt_machine_done() callback.

Problem is that the validation of fw_cfg by devices such as ramfb is
done before the machine done notifier is called. Moving create_fw_cfg()
to machine_done() results in QEMU failing to boot when using a ramfb
device:

./qemu-system-riscv64 -machine virt -device ramfb -serial stdio
qemu-system-riscv64: -device ramfb: ramfb device requires fw_cfg with DMA

The fix is simple: move create_fw_cfg() config back to
virt_machine_init(). This happens to be the same way the ARM 'virt'
machine deals with fw_cfg (see machvirt_init() and virt_machine_done()
in hw/arm/virt.c), so we're keeping consistency with how other machines
handle this device.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1343
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20230117132751.229738-2-dbarboza@ventanamicro.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
hw/riscv/virt.c