On 20/2/24 17:06, Peter Maydell wrote:
In the i386 PC machine, we want to run the pc_cmos_init_late()
function only once the IDE and floppy drive devices have been set up.
We currently do this using qemu_register_reset(), and then have the
function call qemu_unregister_reset() on itself, so it runs exactly
once.

This was an expedient way to do it back in 2010 when we first added
this (in commit c0897e0cb94e8), but now we have a more obvious point
to do "machine initialization that has to happen after generic device
init": the machine-init-done hook.

Do the pc_cmos_init_late() work from our existing PC machine init
done hook function, so we can drop the use of qemu_register_reset()
and qemu_unregister_reset().

Because the pointers to the devices we need (the IDE buses and the
RTC) are now all in the machine state, we don't need the
pc_cmos_init_late_arg struct and can just pass the PCMachineState
pointer.

Even if we remove the IDEBus/RTC pointers from PCMachineState,
we can still QOM-resolve them from it in pc_cmos_init_late().

Reviewed-by: Philippe Mathieu-Daudé <phi...@linaro.org>

Signed-off-by: Peter Maydell <peter.mayd...@linaro.org>
---
  hw/i386/pc.c | 39 ++++++++++++++++-----------------------
  1 file changed, 16 insertions(+), 23 deletions(-)


Reply via email to