]> git.proxmox.com Git - mirror_qemu.git/commit
hw/core: create Resettable QOM interface
authorDamien Hedde <damien.hedde@greensocs.com>
Thu, 30 Jan 2020 16:02:03 +0000 (16:02 +0000)
committerPeter Maydell <peter.maydell@linaro.org>
Thu, 30 Jan 2020 16:02:03 +0000 (16:02 +0000)
commitbc5a39bf2688130bae86351a6c6b005cf9566a3c
treef5fb0d4814925cd973865c52e7cc0b7151634a44
parent70804c83f2914acaca74c1789a6b869bd5d1ea67
hw/core: create Resettable QOM interface

This commit defines an interface allowing multi-phase reset. This aims
to solve a problem of the actual single-phase reset (built in
DeviceClass and BusClass): reset behavior is dependent on the order
in which reset handlers are called. In particular doing external
side-effect (like setting an qemu_irq) is problematic because receiving
object may not be reset yet.

The Resettable interface divides the reset in 3 well defined phases.
To reset an object tree, all 1st phases are executed then all 2nd then
all 3rd. See the comments in include/hw/resettable.h for a more complete
description. The interface defines 3 phases to let the future
possibility of holding an object into reset for some time.

The qdev/qbus reset in DeviceClass and BusClass will be modified in
following commits to use this interface. A mechanism is provided
to allow executing a transitional reset handler in place of the 2nd
phase which is executed in children-then-parent order inside a tree.
This will allow to transition devices and buses smoothly while
keeping the exact current qdev/qbus reset behavior for now.

Documentation will be added in a following commit.

Signed-off-by: Damien Hedde <damien.hedde@greensocs.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 20200123132823.1117486-4-damien.hedde@greensocs.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
hw/core/Makefile.objs
hw/core/resettable.c [new file with mode: 0644]
hw/core/trace-events
include/hw/resettable.h [new file with mode: 0644]