[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 16/26] hw/core: deprecate old reset functions and introduce new on
From: |
Peter Maydell |
Subject: |
[PULL 16/26] hw/core: deprecate old reset functions and introduce new ones |
Date: |
Thu, 30 Jan 2020 16:15:23 +0000 |
From: Damien Hedde <address@hidden>
Deprecate device_legacy_reset(), qdev_reset_all() and
qbus_reset_all() to be replaced by new functions
device_cold_reset() and bus_cold_reset() which uses resettable API.
Also introduce resettable_cold_reset_fn() which may be used as a
replacement for qdev_reset_all_fn and qbus_reset_all_fn().
Following patches will be needed to look at legacy reset call sites
and switch to resettable api. The legacy functions will be removed
when unused.
Signed-off-by: Damien Hedde <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Reviewed-by: Peter Maydell <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
Tested-by: Philippe Mathieu-Daudé <address@hidden>
Message-id: address@hidden
Signed-off-by: Peter Maydell <address@hidden>
---
include/hw/qdev-core.h | 27 +++++++++++++++++++++++++++
include/hw/resettable.h | 9 +++++++++
hw/core/bus.c | 5 +++++
hw/core/qdev.c | 5 +++++
hw/core/resettable.c | 5 +++++
5 files changed, 51 insertions(+)
diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index 09b7a441eb6..1405b8a990a 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -411,6 +411,13 @@ int qdev_walk_children(DeviceState *dev,
qdev_walkerfn *post_devfn, qbus_walkerfn *post_busfn,
void *opaque);
+/**
+ * @qdev_reset_all:
+ * Reset @dev. See @qbus_reset_all() for more details.
+ *
+ * Note: This function is deprecated and will be removed when it becomes
unused.
+ * Please use device_cold_reset() now.
+ */
void qdev_reset_all(DeviceState *dev);
void qdev_reset_all_fn(void *opaque);
@@ -423,10 +430,28 @@ void qdev_reset_all_fn(void *opaque);
* hard reset means that qbus_reset_all will reset all state of the device.
* For PCI devices, for example, this will include the base address registers
* or configuration space.
+ *
+ * Note: This function is deprecated and will be removed when it becomes
unused.
+ * Please use bus_cold_reset() now.
*/
void qbus_reset_all(BusState *bus);
void qbus_reset_all_fn(void *opaque);
+/**
+ * device_cold_reset:
+ * Reset device @dev and perform a recursive processing using the resettable
+ * interface. It triggers a RESET_TYPE_COLD.
+ */
+void device_cold_reset(DeviceState *dev);
+
+/**
+ * bus_cold_reset:
+ *
+ * Reset bus @bus and perform a recursive processing using the resettable
+ * interface. It triggers a RESET_TYPE_COLD.
+ */
+void bus_cold_reset(BusState *bus);
+
/**
* device_is_in_reset:
* Return true if the device @dev is currently being reset.
@@ -457,6 +482,8 @@ void qdev_machine_init(void);
* device_legacy_reset:
*
* Reset a single device (by calling the reset method).
+ * Note: This function is deprecated and will be removed when it becomes
unused.
+ * Please use device_cold_reset() now.
*/
void device_legacy_reset(DeviceState *dev);
diff --git a/include/hw/resettable.h b/include/hw/resettable.h
index 5e215d94e42..f4c4bab0eff 100644
--- a/include/hw/resettable.h
+++ b/include/hw/resettable.h
@@ -221,6 +221,15 @@ bool resettable_is_in_reset(Object *obj);
*/
void resettable_change_parent(Object *obj, Object *newp, Object *oldp);
+/**
+ * resettable_cold_reset_fn:
+ * Helper to call resettable_reset((Object *) opaque, RESET_TYPE_COLD).
+ *
+ * This function is typically useful to register a reset handler with
+ * qemu_register_reset.
+ */
+void resettable_cold_reset_fn(void *opaque);
+
/**
* resettable_class_set_parent_phases:
*
diff --git a/hw/core/bus.c b/hw/core/bus.c
index 2698f715bd7..3dc0a825f09 100644
--- a/hw/core/bus.c
+++ b/hw/core/bus.c
@@ -68,6 +68,11 @@ int qbus_walk_children(BusState *bus,
return 0;
}
+void bus_cold_reset(BusState *bus)
+{
+ resettable_reset(OBJECT(bus), RESET_TYPE_COLD);
+}
+
bool bus_is_in_reset(BusState *bus)
{
return resettable_is_in_reset(OBJECT(bus));
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 7697f033b19..3937d1eb1a5 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -361,6 +361,11 @@ void qbus_reset_all_fn(void *opaque)
qbus_reset_all(bus);
}
+void device_cold_reset(DeviceState *dev)
+{
+ resettable_reset(OBJECT(dev), RESET_TYPE_COLD);
+}
+
bool device_is_in_reset(DeviceState *dev)
{
return resettable_is_in_reset(OBJECT(dev));
diff --git a/hw/core/resettable.c b/hw/core/resettable.c
index 6e0b0f492f1..96a99ce39ea 100644
--- a/hw/core/resettable.c
+++ b/hw/core/resettable.c
@@ -264,6 +264,11 @@ void resettable_change_parent(Object *obj, Object *newp,
Object *oldp)
}
}
+void resettable_cold_reset_fn(void *opaque)
+{
+ resettable_reset((Object *) opaque, RESET_TYPE_COLD);
+}
+
void resettable_class_set_parent_phases(ResettableClass *rc,
ResettableEnterPhase enter,
ResettableHoldPhase hold,
--
2.20.1
- [PULL 03/26] hw/sd: Configure number of slots exposed by the ASPEED SDHCI model, (continued)
- [PULL 03/26] hw/sd: Configure number of slots exposed by the ASPEED SDHCI model, Peter Maydell, 2020/01/30
- [PULL 05/26] ftgmac100: check RX and TX buffer alignment, Peter Maydell, 2020/01/30
- [PULL 06/26] hw/arm/aspeed: add a 'execute-in-place' property to boot directly from CE0, Peter Maydell, 2020/01/30
- [PULL 07/26] misc/pca9552: Add qom set and get, Peter Maydell, 2020/01/30
- [PULL 09/26] add device_legacy_reset function to prepare for reset api change, Peter Maydell, 2020/01/30
- [PULL 08/26] hw/arm/raspi: Remove obsolete use of -smp to set the soc 'enabled-cpus', Peter Maydell, 2020/01/30
- [PULL 10/26] hw/core/qdev: add trace events to help with resettable transition, Peter Maydell, 2020/01/30
- [PULL 12/26] hw/core: add Resettable support to BusClass and DeviceClass, Peter Maydell, 2020/01/30
- [PULL 14/26] hw/core/qdev: handle parent bus change regarding resettable, Peter Maydell, 2020/01/30
- [PULL 13/26] hw/core/resettable: add support for changing parent, Peter Maydell, 2020/01/30
- [PULL 16/26] hw/core: deprecate old reset functions and introduce new ones,
Peter Maydell <=
- [PULL 19/26] hw/s390x/ipl: replace deprecated qdev_reset_all registration, Peter Maydell, 2020/01/30
- [PULL 22/26] hw/arm/virt: Add missing 5.0 options call to 4.2 options, Peter Maydell, 2020/01/30
- [PULL 11/26] hw/core: create Resettable QOM interface, Peter Maydell, 2020/01/30
- [PULL 15/26] hw/core/qdev: update hotplug reset regarding resettable, Peter Maydell, 2020/01/30
- [PULL 21/26] target/arm/kvm: trivial: Clean up header documentation, Peter Maydell, 2020/01/30
- [PULL 25/26] target/arm/kvm: Implement virtual time adjustment, Peter Maydell, 2020/01/30
- [PULL 20/26] hw/intc/arm_gicv3_kvm: Stop wrongly programming GICR_PENDBASER.PTZ bit, Peter Maydell, 2020/01/30
- [PULL 18/26] vl: replace deprecated qbus_reset_all registration, Peter Maydell, 2020/01/30
- [PULL 17/26] docs/devel/reset.rst: add doc about Resettable interface, Peter Maydell, 2020/01/30
- [PULL 23/26] target/arm/kvm64: kvm64 cpus have timer registers, Peter Maydell, 2020/01/30