From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45308) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZEcnp-0004mK-Pn for qemu-devel@nongnu.org; Mon, 13 Jul 2015 08:25:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZEcnk-0007Ye-4V for qemu-devel@nongnu.org; Mon, 13 Jul 2015 08:25:45 -0400 Received: from e06smtp17.uk.ibm.com ([195.75.94.113]:54684) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZEcnj-0007Y1-Rd for qemu-devel@nongnu.org; Mon, 13 Jul 2015 08:25:40 -0400 Received: from /spool/local by e06smtp17.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 13 Jul 2015 13:25:35 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 854372190344 for ; Mon, 13 Jul 2015 13:21:44 +0100 (BST) Received: from d06av01.portsmouth.uk.ibm.com (d06av01.portsmouth.uk.ibm.com [9.149.37.212]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t6DCM7hI33095804 for ; Mon, 13 Jul 2015 12:22:07 GMT Received: from d06av01.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av01.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t6DCM6sU003747 for ; Mon, 13 Jul 2015 06:22:07 -0600 Message-ID: <55A3AD6D.5010303@de.ibm.com> Date: Mon, 13 Jul 2015 14:22:05 +0200 From: Christian Borntraeger MIME-Version: 1.0 References: <1436460692-5142-1-git-send-email-cornelia.huck@de.ibm.com> <1436460692-5142-2-git-send-email-cornelia.huck@de.ibm.com> In-Reply-To: <1436460692-5142-2-git-send-email-cornelia.huck@de.ibm.com> Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH for-2.4 1/2] core: reset handler for bus-less devices List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Cornelia Huck , 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 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 > Signed-off-by: Cornelia Huck reboot (from within guest) and external reset (system_reset in monitor) now work fine with the s390 watchdog. Tested-by: Christian Borntraeger > --- > 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) { >