qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] scsi: Switch to bus_cold_reset() and device_cold_reset()
@ 2022-10-13 16:06 Peter Maydell
  2022-10-13 16:06 ` [PATCH 1/2] scsi: Use device_cold_reset() and bus_cold_reset() Peter Maydell
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Peter Maydell @ 2022-10-13 16:06 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Fam Zheng, Hannes Reinecke, Cédric Le Goater,
	Daniel Henrique Barboza, Greg Kurz, Michael S. Tsirkin,
	Dmitry Fleytman, qemu-block, qemu-ppc

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



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-10-13 20:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-13 16:06 [PATCH 0/2] scsi: Switch to bus_cold_reset() and device_cold_reset() Peter Maydell
2022-10-13 16:06 ` [PATCH 1/2] scsi: Use device_cold_reset() and bus_cold_reset() Peter Maydell
2022-10-13 16:06 ` [PATCH 2/2] hw/scsi/vmw_pvscsi.c: Use device_cold_reset() to reset SCSI devices Peter Maydell
2022-10-13 20:36 ` [PATCH 0/2] scsi: Switch to bus_cold_reset() and device_cold_reset() Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).