Hi all, Here's the 4th version of the multi-phase reset proposal patches. Previous version can be found here: https://lists.gnu.org/archive/html/qemu-devel/2019-07/msg06365.html
The purpose of this series is to split the current reset procedure into multiple phases. This will help to solve some ordering difficulties we have during reset. Please see patch 4 which adds documentation for more details. Compared to previous version, I've reduced the scope of the series to multi-phase basics. In particular, I've removed migration-related features which can be added and discussed later when we've settled the api. I've also not included the change to the new api for the ~20 impacted files because it highly depends on whether we handle cold vs warm reset difference or not. I'll handle them when we'll advance on this point. I've isolated in patch 2 to 4, the multi-phase base mechanism handling only cold reset as suggested by David. Patches 5 and 6 do trivial modifications related to the registration of reset handler in the main system reset. Patch 7 handles the hotplug device reset case. These first 7 patches form a multi-phase basics independent subset; the first 6 do not modify the behavior. I'd really like to move forward on them as we have things depending on the basic multi-phase capability only (in particular the clock-tree support). Nevertheless I've kept in this series the addition of warm reset (in patches 8 to 10) so we can continue the discussion. Even if we don't introduce warm reset, it allows discussion about multiple reset type support. Maybe I should have put these 3 patches in their own (rfc ?) series, since there was lot of questioning about the warm reset and talking about handling other resets like bus specific ones. I've tested that the actual reset order was not modified by these patches by tracing calls to individual reset method after and before applying the series. Changes v3 -> v4 general: + various comments and typos patch 1: add device_legacy_reset function to prepare for reset api change + squash of 2 patches from v3 (asked by Peter and David) patch 2: Create Resettable QOM interface + ResetType enum (only cold for now) (David and Philippe's remark) + ResetState to factorize most of the code (to address David's concern) + all phases order is now children-to-parent (Peter's remark) + assert/deassert removed to isolate migration related features patch 3: add Resettable interface in Bus and Device classes + squash of 2 patches (make Device and Bus Resettable & switch to resettable api) since patch 2 has reduced their size. + adaptation to patch 2 changes (warm reset, state and methods) + isolate hotplug reset change into patch 7 (Peter's remark) + fix qdev/qbus_reset_not doing a cold reset (Peter's remark) + call helper device_reset_cold instead of device_reset (David's remark) patch 4: docs/devel/reset.txt: create doc about Resettable interface + various improvements + in this patch, doc is reduced to cold multi-phase reset with no "in reset" state (other parts are kept for following commits) patch 5: vl.c: replace deprecated qbus_reset_all registration + suggested comment improvement from Peter patch 6: hw/s390x/ipl.c: replace deprecated qbus_reset_all registration + suggested comment improvement from Peter Thanks for your feedback, Damien Damien Hedde (10): add device_legacy_reset function to prepare for reset api change hw/core: create Resettable QOM interface hw/core: add Resettable interface in Bus and Device classes docs/devel/reset.txt: create doc about Resettable interface vl.c: replace deprecated qbus_reset_all registration hw/s390x/ipl.c: replace deprecated qbus_reset_all registration hw/core/qdev: replace deprecated device_legacy_reset when hotplugging device hw/core/resettable: add support for warm reset hw/core/: add warm reset helpers for devices and buses docs/devel/reset.txt: add documentation about warm reset Makefile.objs | 1 + docs/devel/reset.txt | 284 +++++++++++++++++++++++++++++++++++++++ hw/audio/intel-hda.c | 2 +- hw/core/Makefile.objs | 1 + hw/core/bus.c | 64 +++++++++ hw/core/qdev.c | 86 +++++++++--- hw/core/resettable.c | 199 +++++++++++++++++++++++++++ hw/core/trace-events | 36 +++++ hw/hyperv/hyperv.c | 2 +- hw/i386/pc.c | 2 +- hw/ide/microdrive.c | 8 +- hw/intc/spapr_xive.c | 2 +- hw/ppc/pnv_psi.c | 2 +- hw/ppc/spapr_pci.c | 2 +- hw/ppc/spapr_vio.c | 2 +- hw/s390x/ipl.c | 10 +- hw/s390x/s390-pci-inst.c | 2 +- hw/scsi/vmw_pvscsi.c | 2 +- hw/sd/omap_mmc.c | 2 +- hw/sd/pl181.c | 2 +- include/hw/qdev-core.h | 100 +++++++++++++- include/hw/resettable.h | 171 +++++++++++++++++++++++ tests/Makefile.include | 1 + vl.c | 10 +- 24 files changed, 949 insertions(+), 44 deletions(-) create mode 100644 docs/devel/reset.txt create mode 100644 hw/core/resettable.c create mode 100644 hw/core/trace-events create mode 100644 include/hw/resettable.h -- 2.22.0