Skip to contentSkip to conversation

hw/hyperv/hyperv.c: Use device_cold_reset() instead of device_legacy_reset()

PATCH In review Peter Maydell 2 participants 4 messages Oct 13, 2022 – Oct 25, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/hyperv/hyperv.c: Use device_cold_reset() instead of device_legacy_reset()

The semantic difference between the deprecated device_legacy_reset() function and the newer device_cold_reset() function is that the new function resets both the device itself and any qbuses it owns, whereas the legacy function resets just the device itself and nothing else. In hyperv_synic_reset() we reset a SynICState, which has no qbuses, so for this purpose the two functions behave identically and we can stop using the deprecated one.

---
NB: tested only with 'make check' and 'make check-avocado', which may well not exercise this.

 hw/hyperv/hyperv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/hyperv/hyperv.c +1 -1
index 4a1b59cb9db..57b402b9561 100644
@@ -157,7 +157,7 @@ void hyperv_synic_reset(CPUState *cs)
     SynICState *synic = get_synic(cs);
 
     if (synic) {
-        device_legacy_reset(DEVICE(synic));
+        device_cold_reset(DEVICE(synic));
     }
 }
 
Signature · 1 line
2.25.1
#1 lore raw
Quoted 8 lines · Peter Maydell

The semantic difference between the deprecated device_legacy_reset() function and the newer device_cold_reset() function is that the new function resets both the device itself and any qbuses it owns, whereas the legacy function resets just the device itself and nothing else. In hyperv_synic_reset() we reset a SynICState, which has no qbuses, so for this purpose the two functions behave identically and we can stop using the deprecated one.

Quoted 5 lines

---
NB: tested only with 'make check' and 'make check-avocado', which may well not exercise this.

In general the patch LGTM, but I will runtime-test it on Monday just to be sure.

Thanks,
Maciej

#2 lore raw
Quoted 9 lines · Maciej S. Szmigiero
Quoted 8 lines · Peter Maydell

The semantic difference between the deprecated device_legacy_reset() function and the newer device_cold_reset() function is that the new function resets both the device itself and any qbuses it owns, whereas the legacy function resets just the device itself and nothing else.  In hyperv_synic_reset() we reset a SynICState, which has no qbuses, so for this purpose the two functions behave identically and we can stop using the deprecated one.

Quoted 9 lines
Quoted 5 lines

---
NB: tested only with 'make check' and 'make check-avocado', which may well not exercise this.

In general the patch LGTM, but I will runtime-test it on Monday just to be sure.

Tested and works fine on QEMU with SynIC reset fix [1] applied, so:

Thanks,
Maciej

[1]: https://lore.kernel.org/qemu-devel/cb57cee2e29b20d06f81dce054cbcea8b5d497e8.1664552976.git.maciej.szmigiero@oracle.com/

#3 lore raw
Quoted 17 lines · Maciej S. Szmigiero
Quoted 15 lines · Maciej S. Szmigiero
Quoted 13 lines · Peter Maydell

The semantic difference between the deprecated device_legacy_reset() function and the newer device_cold_reset() function is that the new function resets both the device itself and any qbuses it owns, whereas the legacy function resets just the device itself and nothing else. In hyperv_synic_reset() we reset a SynICState, which has no qbuses, so for this purpose the two functions behave identically and we can stop using the deprecated one.

---
NB: tested only with 'make check' and 'make check-avocado', which may well not exercise this.

Quoted 6 lines
Quoted 3 lines

In general the patch LGTM, but I will runtime-test it on Monday just to be sure.

Tested and works fine on QEMU with SynIC reset fix [1] applied, so:

Thanks for testing; I'll take this through target-arm.next since I'm doing a pullreq anyway, unless somebody would prefer otherwise.

-- PMM