diff mbox series

[for-9.2,06/10] hw/remote/message.c: Don't directly invoke DeviceClass:reset

Message ID 20240813165250.2717650-7-peter.maydell@linaro.org
State Superseded
Headers show
Series s390: Convert virtio-ccw, cpu to three-phase reset, and followup cleanup | expand

Commit Message

Peter Maydell Aug. 13, 2024, 4:52 p.m. UTC
Directly invoking the DeviceClass::reset method is a bad idea,
because if the device is using three-phase reset then it relies on
transitional reset machinery which is likely to disappear at some
point.

Reset the device in the standard way, by calling device_cold_reset().

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/remote/message.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Richard Henderson Aug. 13, 2024, 11:10 p.m. UTC | #1
On 8/14/24 02:52, Peter Maydell wrote:
> Directly invoking theDeviceClass::reset method is a bad idea,
> because if the device is using three-phase reset then it relies on
> transitional reset machinery which is likely to disappear at some
> point.
> 
> Reset the device in the standard way, by calling device_cold_reset().
> 
> Signed-off-by: Peter Maydell<peter.maydell@linaro.org>
> ---
>   hw/remote/message.c | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~
Philippe Mathieu-Daudé Aug. 14, 2024, 1:48 p.m. UTC | #2
On 13/8/24 18:52, Peter Maydell wrote:
> Directly invoking the DeviceClass::reset method is a bad idea,
> because if the device is using three-phase reset then it relies on
> transitional reset machinery which is likely to disappear at some
> point.

This seems like fix-for-9.1 material.

> Reset the device in the standard way, by calling device_cold_reset().
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>   hw/remote/message.c | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
diff mbox series

Patch

diff --git a/hw/remote/message.c b/hw/remote/message.c
index 50f6bf2d495..38ae6c75b4e 100644
--- a/hw/remote/message.c
+++ b/hw/remote/message.c
@@ -215,13 +215,10 @@  fail:
 static void process_device_reset_msg(QIOChannel *ioc, PCIDevice *dev,
                                      Error **errp)
 {
-    DeviceClass *dc = DEVICE_GET_CLASS(dev);
     DeviceState *s = DEVICE(dev);
     MPQemuMsg ret = { 0 };
 
-    if (dc->reset) {
-        dc->reset(s);
-    }
+    device_cold_reset(s);
 
     ret.cmd = MPQEMU_CMD_RET;