diff mbox series

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

Message ID 20221013171817.1447562-1-peter.maydell@linaro.org
State Superseded
Headers show
Series hw/hyperv/hyperv.c: Use device_cold_reset() instead of device_legacy_reset() | expand

Commit Message

Peter Maydell Oct. 13, 2022, 5:18 p.m. UTC
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.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
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(-)

Comments

Maciej S. Szmigiero Oct. 13, 2022, 7:39 p.m. UTC | #1
On 13.10.2022 19:18, Peter Maydell wrote:
> 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.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> 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
Maciej S. Szmigiero Oct. 17, 2022, 2:03 p.m. UTC | #2
On 13.10.2022 21:39, Maciej S. Szmigiero wrote:
> On 13.10.2022 19:18, Peter Maydell wrote:
>> 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.
>>
>> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
>> ---
>> 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:
Reviewed-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>

Thanks,
Maciej

[1]: https://lore.kernel.org/qemu-devel/cb57cee2e29b20d06f81dce054cbcea8b5d497e8.1664552976.git.maciej.szmigiero@oracle.com/
Peter Maydell Oct. 25, 2022, 11:55 a.m. UTC | #3
On Mon, 17 Oct 2022 at 15:03, Maciej S. Szmigiero
<mail@maciej.szmigiero.name> wrote:
>
> On 13.10.2022 21:39, Maciej S. Szmigiero wrote:
> > On 13.10.2022 19:18, Peter Maydell wrote:
> >> 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.
> >>
> >> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> >> ---
> >> 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:
> Reviewed-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>

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

-- PMM
diff mbox series

Patch

diff --git a/hw/hyperv/hyperv.c b/hw/hyperv/hyperv.c
index 4a1b59cb9db..57b402b9561 100644
--- a/hw/hyperv/hyperv.c
+++ b/hw/hyperv/hyperv.c
@@ -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));
     }
 }