Back in 2020 we introduced a new set of reset APIs (the "3-phase reset" system, as documented in docs/devel/reset.rst), but we left a lot of the existing uses of older reset functions alone.
This patchset converts the SCSI subsystem to use the newer device_cold_reset() and bus_cold_reset() instead of the old and now-deprecated qdev_reset_all() and qbus_reset_all(). The semantics of qdev_reset_all() are that it recursively resets all the devices on the qbus tree starting from the device you pass in, resetting the child buses first and the device itself last. qbus_reset_all() is similar, except it starts with a qbus rather than a qdev. In both cases, the bus is reset by calling the BusClass::reset method, and the device by calling DeviceClass::reset. device_cold_reset() and bus_cold_reset() have identical "recursive reset, children first" semantics, except that they are three-phase-reset aware (and can handle both a newer device that implements the 3 phases, and also older devices that only implement the DeviceState::reset method). I think we should be able to change to these new functions mechanically across the whole codebase without any change in behaviour, but my experience with reset is that it's not uncommon for there to be lurking unforeseen consequences. So I've opted to start by just changing the SCSI subsystem, which has about half of the uses of these deprecated functions. Assuming this works out OK I'll proceed to the rest of the tree. Patch 1 does the qdev_reset_all() -> device_cold_reset() and qbus_reset_all() -> bus_cold_reset() change (mechanically generated using sed). Patch 2 tidies up a loose end where one SCSI controller was using device_legacy_reset() to do the "reset a device" action (harmlessly, as no SCSI devices have further child buses, so the behaviour was the same as qdev_reset_all() and device_cold_reset(). NB: tested only with 'make check' and 'make check-avocado'. thanks -- PMM Peter Maydell (2): scsi: Use device_cold_reset() and bus_cold_reset() hw/scsi/vmw_pvscsi.c: Use device_cold_reset() to reset SCSI devices hw/scsi/esp.c | 2 +- hw/scsi/lsi53c895a.c | 4 ++-- hw/scsi/megasas.c | 2 +- hw/scsi/mptsas.c | 8 ++++---- hw/scsi/spapr_vscsi.c | 2 +- hw/scsi/virtio-scsi.c | 6 +++--- hw/scsi/vmw_pvscsi.c | 6 +++--- 7 files changed, 15 insertions(+), 15 deletions(-) -- 2.25.1