[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 04/36] Replace use of qdev_reset_all() with device_cold_reset()
From: |
Peter Maydell |
Subject: |
[PULL 04/36] Replace use of qdev_reset_all() with device_cold_reset() |
Date: |
Fri, 16 Dec 2022 21:42:12 +0000 |
The legacy function qdev_reset_all() performs a recursive reset,
starting from a qdev. However, it does not permit any of the devices
in the tree to use three-phase reset, because device reset goes
through the device_legacy_reset() function that only calls the single
DeviceClass::reset method.
Switch to using the device_cold_reset() function instead. This also
performs a recursive reset, where first the children are reset and
then finally the parent, but it uses the new (...in 2020...)
Resettable mechanism, which supports both the old style single-reset
method and also the new 3-phase reset handling.
This commit changes the five remaining uses of this function.
Commit created with:
sed -i -e 's/qdev_reset_all/device_cold_reset/g' hw/i386/xen/xen_platform.c
hw/input/adb.c hw/remote/vfio-user-obj.c hw/s390x/s390-virtio-ccw.c
hw/usb/dev-uas.c
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
hw/i386/xen/xen_platform.c | 2 +-
hw/input/adb.c | 2 +-
hw/remote/vfio-user-obj.c | 2 +-
hw/s390x/s390-virtio-ccw.c | 2 +-
hw/usb/dev-uas.c | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/hw/i386/xen/xen_platform.c b/hw/i386/xen/xen_platform.c
index a64265cca07..7db0d94ec28 100644
--- a/hw/i386/xen/xen_platform.c
+++ b/hw/i386/xen/xen_platform.c
@@ -177,7 +177,7 @@ static void pci_xen_ide_unplug(DeviceState *dev, bool aux)
blk_unref(blk);
}
}
- qdev_reset_all(dev);
+ device_cold_reset(dev);
}
static void unplug_disks(PCIBus *b, PCIDevice *d, void *opaque)
diff --git a/hw/input/adb.c b/hw/input/adb.c
index 84331b9fce6..214ae6f42b3 100644
--- a/hw/input/adb.c
+++ b/hw/input/adb.c
@@ -43,7 +43,7 @@ static const char *adb_commands[] = {
static void adb_device_reset(ADBDevice *d)
{
- qdev_reset_all(DEVICE(d));
+ device_cold_reset(DEVICE(d));
}
static int do_adb_request(ADBBusState *s, uint8_t *obuf, const uint8_t *buf,
diff --git a/hw/remote/vfio-user-obj.c b/hw/remote/vfio-user-obj.c
index 6d0310cec97..fe1fdfb5f70 100644
--- a/hw/remote/vfio-user-obj.c
+++ b/hw/remote/vfio-user-obj.c
@@ -678,7 +678,7 @@ static int vfu_object_device_reset(vfu_ctx_t *vfu_ctx,
vfu_reset_type_t type)
return 0;
}
- qdev_reset_all(DEVICE(o->pci_dev));
+ device_cold_reset(DEVICE(o->pci_dev));
return 0;
}
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index 2e64ffab45e..fab79045dd0 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -118,7 +118,7 @@ static void subsystem_reset(void)
for (i = 0; i < ARRAY_SIZE(reset_dev_types); i++) {
dev = DEVICE(object_resolve_path_type("", reset_dev_types[i], NULL));
if (dev) {
- qdev_reset_all(dev);
+ device_cold_reset(dev);
}
}
}
diff --git a/hw/usb/dev-uas.c b/hw/usb/dev-uas.c
index 5192b062d6f..88f99c05d53 100644
--- a/hw/usb/dev-uas.c
+++ b/hw/usb/dev-uas.c
@@ -791,7 +791,7 @@ static void usb_uas_task(UASDevice *uas, uas_iu *iu)
case UAS_TMF_LOGICAL_UNIT_RESET:
trace_usb_uas_tmf_logical_unit_reset(uas->dev.addr, tag, lun);
- qdev_reset_all(&dev->qdev);
+ device_cold_reset(&dev->qdev);
usb_uas_queue_response(uas, tag, UAS_RC_TMF_COMPLETE);
break;
--
2.25.1
- [PULL 01/36] hw/s390x/s390-pci-inst.c: Use device_cold_reset() to reset PCI devices, (continued)
- [PULL 01/36] hw/s390x/s390-pci-inst.c: Use device_cold_reset() to reset PCI devices, Peter Maydell, 2022/12/16
- [PULL 02/36] pci: Use device_cold_reset() and bus_cold_reset(), Peter Maydell, 2022/12/16
- [PULL 03/36] hw/hyperv/vmbus: Use device_cold_reset() and bus_cold_reset(), Peter Maydell, 2022/12/16
- [PULL 13/36] target/avr: Convert to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 20/36] target/mips: Convert to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 19/36] target/microblaze: Convert to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 22/36] target/openrisc: Convert to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 09/36] hw/misc/mos6522: Convert TYPE_MOS6522 to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 07/36] hw/input/ps2: Convert TYPE_PS2_DEVICE to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 12/36] target/arm: Convert to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 04/36] Replace use of qdev_reset_all() with device_cold_reset(),
Peter Maydell <=
- [PULL 05/36] qdev: Remove qdev_reset_all() and qbus_reset_all(), Peter Maydell, 2022/12/16
- [PULL 06/36] hw: Remove device_legacy_reset(), Peter Maydell, 2022/12/16
- [PULL 14/36] target/cris: Convert to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 08/36] hw/input/ps2.c: Convert TYPE_PS2_{KBD, MOUSE}_DEVICE to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 10/36] hw/misc: Convert TYPE_MOS6522 subclasses to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 11/36] hw/core/cpu-common: Convert TYPE_CPU class to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 15/36] target/hexagon: Convert to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 16/36] target/i386: Convert to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 17/36] target/loongarch: Convert to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 18/36] target/m68k: Convert to 3-phase reset, Peter Maydell, 2022/12/16