All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christian Borntraeger <borntraeger@de.ibm.com>
To: Cornelia Huck <cornelia.huck@de.ibm.com>, qemu-devel@nongnu.org
Cc: peter.crosthwaite@xilinx.com, gesaint@linux.vnet.ibm.com,
	jfrei@linux.vnet.ibm.com, agraf@suse.de, afaerber@suse.de
Subject: Re: [Qemu-devel] [PATCH for-2.4 1/2] core: reset handler for bus-less devices
Date: Mon, 13 Jul 2015 14:22:05 +0200	[thread overview]
Message-ID: <55A3AD6D.5010303@de.ibm.com> (raw)
In-Reply-To: <1436460692-5142-2-git-send-email-cornelia.huck@de.ibm.com>

Am 09.07.2015 um 18:51 schrieb Cornelia Huck:
> Devices that don't live on a bus aren't caught by the normal device
> reset logic. Let's register a reset handler for those devices during
> device realization that calls the reset handler for the associated
> device class.
> 
> Suggested-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
reboot (from within guest) and external reset (system_reset in monitor)
now work fine with the s390 watchdog.

Tested-by: Christian Borntraeger <borntraeger@de.ibm.com>

> ---
>  hw/core/qdev.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/hw/core/qdev.c b/hw/core/qdev.c
> index b2f404a..5c7c27b 100644
> --- a/hw/core/qdev.c
> +++ b/hw/core/qdev.c
> @@ -1018,6 +1018,13 @@ static bool device_get_realized(Object *obj, Error **errp)
>      return dev->realized;
>  }
> 
> +static void do_device_reset(void *opaque)
> +{
> +    DeviceState *dev = opaque;
> +
> +    device_reset(dev);
> +}
> +
>  static void device_set_realized(Object *obj, bool value, Error **errp)
>  {
>      DeviceState *dev = DEVICE(obj);
> @@ -1061,6 +1068,11 @@ static void device_set_realized(Object *obj, bool value, Error **errp)
>              goto post_realize_fail;
>          }
> 
> +        if (!dev->parent_bus) {
> +            /* Make sure that reset is called for bus-less devices. */
> +            qemu_register_reset(do_device_reset, dev);
> +        }
> +
>          if (qdev_get_vmsd(dev)) {
>              vmstate_register_with_alias_id(dev, -1, qdev_get_vmsd(dev), dev,
>                                             dev->instance_id_alias,
> @@ -1094,6 +1106,9 @@ static void device_set_realized(Object *obj, bool value, Error **errp)
>          }
>          dev->pending_deleted_event = true;
>          DEVICE_LISTENER_CALL(unrealize, Reverse, dev);
> +        if (!dev->parent_bus) {
> +            qemu_unregister_reset(do_device_reset, dev);
> +        }
>      }
> 
>      if (local_err != NULL) {
> 

  parent reply	other threads:[~2015-07-13 12:25 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-09 16:51 [Qemu-devel] [PATCH for-2.4 0/2] reset for bus-less devices Cornelia Huck
2015-07-09 16:51 ` [Qemu-devel] [PATCH for-2.4 1/2] core: reset handler " Cornelia Huck
2015-07-09 16:59   ` Andreas Färber
2015-07-09 18:53     ` Peter Crosthwaite
2015-07-13 14:28       ` Paolo Bonzini
2015-07-13 12:22   ` Christian Borntraeger [this message]
2015-07-13 14:11     ` Cornelia Huck
2015-07-13 14:20       ` Andreas Färber
2015-07-13 14:30         ` Christian Borntraeger
2015-07-13 15:05           ` Andreas Färber
2015-07-13 15:38             ` Cornelia Huck
2015-07-13 15:49               ` Andreas Färber
2015-07-13 15:56               ` Peter Maydell
2015-07-13 14:37         ` Cornelia Huck
2015-07-13 16:06           ` Andreas Färber
2015-07-14  7:41             ` Cornelia Huck
2015-07-09 16:51 ` [Qemu-devel] [PATCH for-2.4 2/2] watchdog/diag288: handle subsystem resets correctly Cornelia Huck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55A3AD6D.5010303@de.ibm.com \
    --to=borntraeger@de.ibm.com \
    --cc=afaerber@suse.de \
    --cc=agraf@suse.de \
    --cc=cornelia.huck@de.ibm.com \
    --cc=gesaint@linux.vnet.ibm.com \
    --cc=jfrei@linux.vnet.ibm.com \
    --cc=peter.crosthwaite@xilinx.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.