On Tue, Feb 20, 2024 at 04:06:14PM +0000, Peter Maydell wrote: > Date: Tue, 20 Feb 2024 16:06:14 +0000 > From: Peter Maydell <peter.mayd...@linaro.org> > Subject: [PATCH 02/10] hw/i386/pc: Do pc_cmos_init_late() from > pc_machine_done() > X-Mailer: git-send-email 2.34.1 > > 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. > > Signed-off-by: Peter Maydell <peter.mayd...@linaro.org> > --- > hw/i386/pc.c | 39 ++++++++++++++++----------------------- > 1 file changed, 16 insertions(+), 23 deletions(-)
Reviewed-by: Zhao Liu <zhao1....@intel.com>