[PATCH 0/2] qdev: Ensure devices are fully realized when calling DeviceReset handler

Philippe Mathieu-Daudé posted 2 patches 1 year ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20230918101736.23905-1-philmd@linaro.org
Maintainers: Peter Maydell <peter.maydell@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>, Eduardo Habkost <eduardo@habkost.net>
include/hw/arm/omap.h |  2 +-
hw/arm/omap1.c        |  2 +-
hw/arm/omap2.c        |  2 +-
hw/core/qdev.c        |  3 +++
hw/sd/omap_mmc.c      | 21 ++++++++++++---------
5 files changed, 18 insertions(+), 12 deletions(-)
[PATCH 0/2] qdev: Ensure devices are fully realized when calling DeviceReset handler
Posted by Philippe Mathieu-Daudé 1 year ago
In the process of clarifying QOM/QDev design, we want to enforce
the QDev state machine, in particular RESET can only happens *after*
REALIZE.

Besides CPUs (which are still particular), the only case I noticed
is in a non-QDev type (OMAP MMC) accessing a QDev one (SD/MMC card).

The first patch first handle the OMAP MMC case doing minor surgery
(passing a 'realized' state to omap_mmc_reset(), the function doing
reset out of normal QDev RESET tree propagation).

The second patch add an assertion in QDev core code, in order to
avoid further devices being added out of (QDev) order.

Please review,

Phil.

Philippe Mathieu-Daudé (2):
  hw/sd/omap_mmc: Do not reset SDCard until being fully realized
  qdev: Ensure devices are fully realized when calling DeviceReset
    handler

 include/hw/arm/omap.h |  2 +-
 hw/arm/omap1.c        |  2 +-
 hw/arm/omap2.c        |  2 +-
 hw/core/qdev.c        |  3 +++
 hw/sd/omap_mmc.c      | 21 ++++++++++++---------
 5 files changed, 18 insertions(+), 12 deletions(-)

-- 
2.41.0