qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hw/i386: Use device_cold_reset() to reset the APIC
@ 2022-10-13 17:19 Peter Maydell
  2022-10-13 17:33 ` Michael S. Tsirkin
  2022-10-13 20:43 ` Paolo Bonzini
  0 siblings, 2 replies; 3+ messages in thread
From: Peter Maydell @ 2022-10-13 17:19 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Sergio Lopez, Michael S. Tsirkin, Marcel Apfelbaum

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.

The pc_machine_reset() and microvm_machine_reset() functions use
device_legacy_reset() to reset the APIC; this is an APICCommonState
and does not have any 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'

 hw/i386/microvm.c | 2 +-
 hw/i386/pc.c      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c
index 7fe8cce03e9..0b08010bf0a 100644
--- a/hw/i386/microvm.c
+++ b/hw/i386/microvm.c
@@ -486,7 +486,7 @@ static void microvm_machine_reset(MachineState *machine)
         cpu = X86_CPU(cs);
 
         if (cpu->apic_state) {
-            device_legacy_reset(cpu->apic_state);
+            device_cold_reset(cpu->apic_state);
         }
     }
 }
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 566accf7e60..2b2d0bc2b33 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1860,7 +1860,7 @@ static void pc_machine_reset(MachineState *machine)
         cpu = X86_CPU(cs);
 
         if (cpu->apic_state) {
-            device_legacy_reset(cpu->apic_state);
+            device_cold_reset(cpu->apic_state);
         }
     }
 }
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] hw/i386: Use device_cold_reset() to reset the APIC
  2022-10-13 17:19 [PATCH] hw/i386: Use device_cold_reset() to reset the APIC Peter Maydell
@ 2022-10-13 17:33 ` Michael S. Tsirkin
  2022-10-13 20:43 ` Paolo Bonzini
  1 sibling, 0 replies; 3+ messages in thread
From: Michael S. Tsirkin @ 2022-10-13 17:33 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-devel, Paolo Bonzini, Sergio Lopez, Marcel Apfelbaum

On Thu, Oct 13, 2022 at 06:19:26PM +0100, 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.
> 
> The pc_machine_reset() and microvm_machine_reset() functions use
> device_legacy_reset() to reset the APIC; this is an APICCommonState
> and does not have any 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>


Acked-by: Michael S. Tsirkin <mst@redhat.com>

> ---
> NB: tested only with 'make check' and 'make check-avocado'
> 
>  hw/i386/microvm.c | 2 +-
>  hw/i386/pc.c      | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c
> index 7fe8cce03e9..0b08010bf0a 100644
> --- a/hw/i386/microvm.c
> +++ b/hw/i386/microvm.c
> @@ -486,7 +486,7 @@ static void microvm_machine_reset(MachineState *machine)
>          cpu = X86_CPU(cs);
>  
>          if (cpu->apic_state) {
> -            device_legacy_reset(cpu->apic_state);
> +            device_cold_reset(cpu->apic_state);
>          }
>      }
>  }
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index 566accf7e60..2b2d0bc2b33 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -1860,7 +1860,7 @@ static void pc_machine_reset(MachineState *machine)
>          cpu = X86_CPU(cs);
>  
>          if (cpu->apic_state) {
> -            device_legacy_reset(cpu->apic_state);
> +            device_cold_reset(cpu->apic_state);
>          }
>      }
>  }
> -- 
> 2.25.1



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] hw/i386: Use device_cold_reset() to reset the APIC
  2022-10-13 17:19 [PATCH] hw/i386: Use device_cold_reset() to reset the APIC Peter Maydell
  2022-10-13 17:33 ` Michael S. Tsirkin
@ 2022-10-13 20:43 ` Paolo Bonzini
  1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2022-10-13 20:43 UTC (permalink / raw)
  To: Peter Maydell
  Cc: qemu-devel, Sergio Lopez, Michael S . Tsirkin, Marcel Apfelbaum

This conflicts with "hyperv: fix SynIC SINT assertion failure on
guest reset", but the resolution is simply to do the change in a new
function x86_cpu_after_reset(); adjusted and queued, thanks.

Paolo



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-10-13 20:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-13 17:19 [PATCH] hw/i386: Use device_cold_reset() to reset the APIC Peter Maydell
2022-10-13 17:33 ` Michael S. Tsirkin
2022-10-13 20:43 ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).