mbox series

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

Message ID 20230918101736.23905-1-philmd@linaro.org
Headers show
Series qdev: Ensure devices are fully realized when calling DeviceReset handler | expand

Message

Philippe Mathieu-Daudé Sept. 18, 2023, 10:17 a.m. UTC
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(-)