qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] xics: add unrealize handler
@ 2017-05-24 17:40 Greg Kurz
  2017-05-25  0:32 ` David Gibson
  0 siblings, 1 reply; 2+ messages in thread
From: Greg Kurz @ 2017-05-24 17:40 UTC (permalink / raw)
  To: qemu-devel; +Cc: David Gibson, qemu-ppc, Cedric Le Goater, Bharata B Rao

Now that ICPState objects get finalized on CPU unplug, we should unregister
reset handlers as well to avoid a QEMU crash at machine reset time.

Signed-off-by: Greg Kurz <groug@kaod.org>
---
 hw/intc/xics.c     |    5 +++++
 hw/intc/xics_kvm.c |    6 ++++++
 2 files changed, 11 insertions(+)

diff --git a/hw/intc/xics.c b/hw/intc/xics.c
index 292fffecd376..ea3516794af7 100644
--- a/hw/intc/xics.c
+++ b/hw/intc/xics.c
@@ -357,6 +357,10 @@ static void icp_realize(DeviceState *dev, Error **errp)
     qemu_register_reset(icp_reset, dev);
 }
 
+static void icp_unrealize(DeviceState *dev, Error **errp)
+{
+    qemu_unregister_reset(icp_reset, dev);
+}
 
 static void icp_class_init(ObjectClass *klass, void *data)
 {
@@ -364,6 +368,7 @@ static void icp_class_init(ObjectClass *klass, void *data)
 
     dc->vmsd = &vmstate_icp_server;
     dc->realize = icp_realize;
+    dc->unrealize = icp_unrealize;
 }
 
 static const TypeInfo icp_info = {
diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c
index dd7f29846235..14b8f6f6e478 100644
--- a/hw/intc/xics_kvm.c
+++ b/hw/intc/xics_kvm.c
@@ -164,12 +164,18 @@ static void icp_kvm_realize(DeviceState *dev, Error **errp)
     qemu_register_reset(icp_kvm_reset, dev);
 }
 
+static void icp_kvm_unrealize(DeviceState *dev, Error **errp)
+{
+    qemu_unregister_reset(icp_kvm_reset, dev);
+}
+
 static void icp_kvm_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
     ICPStateClass *icpc = ICP_CLASS(klass);
 
     dc->realize = icp_kvm_realize;
+    dc->unrealize = icp_kvm_unrealize;
     icpc->pre_save = icp_get_kvm_state;
     icpc->post_load = icp_set_kvm_state;
     icpc->cpu_setup = icp_kvm_cpu_setup;

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

* Re: [Qemu-devel] [PATCH] xics: add unrealize handler
  2017-05-24 17:40 [Qemu-devel] [PATCH] xics: add unrealize handler Greg Kurz
@ 2017-05-25  0:32 ` David Gibson
  0 siblings, 0 replies; 2+ messages in thread
From: David Gibson @ 2017-05-25  0:32 UTC (permalink / raw)
  To: Greg Kurz; +Cc: qemu-devel, qemu-ppc, Cedric Le Goater, Bharata B Rao

[-- Attachment #1: Type: text/plain, Size: 2155 bytes --]

On Wed, May 24, 2017 at 07:40:43PM +0200, Greg Kurz wrote:
> Now that ICPState objects get finalized on CPU unplug, we should unregister
> reset handlers as well to avoid a QEMU crash at machine reset time.
> 
> Signed-off-by: Greg Kurz <groug@kaod.org>

Applied to ppc-for-2.10.

> ---
>  hw/intc/xics.c     |    5 +++++
>  hw/intc/xics_kvm.c |    6 ++++++
>  2 files changed, 11 insertions(+)
> 
> diff --git a/hw/intc/xics.c b/hw/intc/xics.c
> index 292fffecd376..ea3516794af7 100644
> --- a/hw/intc/xics.c
> +++ b/hw/intc/xics.c
> @@ -357,6 +357,10 @@ static void icp_realize(DeviceState *dev, Error **errp)
>      qemu_register_reset(icp_reset, dev);
>  }
>  
> +static void icp_unrealize(DeviceState *dev, Error **errp)
> +{
> +    qemu_unregister_reset(icp_reset, dev);
> +}
>  
>  static void icp_class_init(ObjectClass *klass, void *data)
>  {
> @@ -364,6 +368,7 @@ static void icp_class_init(ObjectClass *klass, void *data)
>  
>      dc->vmsd = &vmstate_icp_server;
>      dc->realize = icp_realize;
> +    dc->unrealize = icp_unrealize;
>  }
>  
>  static const TypeInfo icp_info = {
> diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c
> index dd7f29846235..14b8f6f6e478 100644
> --- a/hw/intc/xics_kvm.c
> +++ b/hw/intc/xics_kvm.c
> @@ -164,12 +164,18 @@ static void icp_kvm_realize(DeviceState *dev, Error **errp)
>      qemu_register_reset(icp_kvm_reset, dev);
>  }
>  
> +static void icp_kvm_unrealize(DeviceState *dev, Error **errp)
> +{
> +    qemu_unregister_reset(icp_kvm_reset, dev);
> +}
> +
>  static void icp_kvm_class_init(ObjectClass *klass, void *data)
>  {
>      DeviceClass *dc = DEVICE_CLASS(klass);
>      ICPStateClass *icpc = ICP_CLASS(klass);
>  
>      dc->realize = icp_kvm_realize;
> +    dc->unrealize = icp_kvm_unrealize;
>      icpc->pre_save = icp_get_kvm_state;
>      icpc->post_load = icp_set_kvm_state;
>      icpc->cpu_setup = icp_kvm_cpu_setup;
> 

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

end of thread, other threads:[~2017-05-25  0:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-24 17:40 [Qemu-devel] [PATCH] xics: add unrealize handler Greg Kurz
2017-05-25  0:32 ` David Gibson

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).