Received: from eggs.gnu.org ([2001:4830:134:3::10]:49352) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZCTlp-00072d-2z for qemu-devel@nongnu.org; Tue, 07 Jul 2015 10:22:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZCTll-0001FN-Eu for qemu-devel@nongnu.org; Tue, 07 Jul 2015 10:22:48 -0400 Received: from e06smtp13.uk.ibm.com ([195.75.94.109]:40072) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZCTlk-0001F3-VH for qemu-devel@nongnu.org; Tue, 07 Jul 2015 10:22:45 -0400 Received: from /spool/local by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 7 Jul 2015 15:22:44 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id EDBD72190056 for ; Tue, 7 Jul 2015 15:22:18 +0100 (BST) Received: from d06av05.portsmouth.uk.ibm.com (d06av05.portsmouth.uk.ibm.com [9.149.37.229]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t67EMfjN31064246 for ; Tue, 7 Jul 2015 14:22:41 GMT Received: from d06av05.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av05.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t67EMegP012858 for ; Tue, 7 Jul 2015 08:22:40 -0600 Date: Tue, 7 Jul 2015 16:22:36 +0200 From: Cornelia Huck Message-ID: <20150707162236.62675a83.cornelia.huck@de.ibm.com> In-Reply-To: References: <1436259202-20509-1-git-send-email-cornelia.huck@de.ibm.com> <1436259202-20509-2-git-send-email-cornelia.huck@de.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH for-2.4] watchdog/diag288: correctly register for system reset requests List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Crosthwaite Cc: "Christian Borntraeger (s390x)" , jfrei@linux.vnet.ibm.com, Xu Wang , "qemu-devel@nongnu.org Developers" , Alexander Graf On Tue, 7 Jul 2015 03:51:59 -0700 Peter Crosthwaite wrote: > On Tue, Jul 7, 2015 at 1:53 AM, Cornelia Huck wrote: > > From: Xu Wang > > > > The diag288 watchdog is no sysbus device, therefore it doesn't get > > triggered on resets automatically using dc->reset. > > > > Let's register the reset handler manually, so we get correctly notified > > again when a system reset was requested. Also reset the watchdog on > > subsystem resets that don't trigger a full system reset. > > > > Signed-off-by: Xu Wang > > Reviewed-by: David Hildenbrand > > Signed-off-by: Cornelia Huck > > --- > > hw/s390x/s390-virtio-ccw.c | 6 +++++- > > hw/watchdog/wdt_diag288.c | 8 ++++++++ > > 2 files changed, 13 insertions(+), 1 deletion(-) > > > > diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c > > index 3d20d6a..4c51d1a 100644 > > --- a/hw/s390x/s390-virtio-ccw.c > > +++ b/hw/s390x/s390-virtio-ccw.c > > @@ -36,7 +36,7 @@ typedef struct S390CcwMachineState { > > > > void io_subsystem_reset(void) > > { > > - DeviceState *css, *sclp, *flic; > > + DeviceState *css, *sclp, *flic, *diag288; > > > > css = DEVICE(object_resolve_path_type("", "virtual-css-bridge", NULL)); > > if (css) { > > @@ -51,6 +51,10 @@ void io_subsystem_reset(void) > > if (flic) { > > qdev_reset_all(flic); > > } > > + diag288 = DEVICE(object_resolve_path_type("", "diag288", NULL)); > > + if (diag288) { > > + qdev_reset_all(diag288); > > + } > > } > > > > static int virtio_ccw_hcall_notify(const uint64_t *args) > > diff --git a/hw/watchdog/wdt_diag288.c b/hw/watchdog/wdt_diag288.c > > index 1185e06..2a885a4 100644 > > --- a/hw/watchdog/wdt_diag288.c > > +++ b/hw/watchdog/wdt_diag288.c > > @@ -40,6 +40,13 @@ static void wdt_diag288_reset(DeviceState *dev) > > timer_del(diag288->timer); > > } > > > > +static void diag288_reset(void *opaque) > > +{ > > + DeviceState *diag288 = opaque; > > + > > + wdt_diag288_reset(diag288); > > +} > > + > > static void diag288_timer_expired(void *dev) > > { > > qemu_log_mask(CPU_LOG_RESET, "Watchdog timer expired.\n"); > > @@ -80,6 +87,7 @@ static void wdt_diag288_realize(DeviceState *dev, Error **errp) > > { > > DIAG288State *diag288 = DIAG288(dev); > > > > + qemu_register_reset(diag288_reset, diag288); > > Doesn't seem right. Even if it is not a SBD it should still sit in the > QOM tree in a place where the reset is reached. Where is this device > in the QOM tree? It will show up as /machine/peripheral-anon/device[]. But is just showing up really enough? For the sysbus, qbus_reset_all_fn is registered as a reset handler, and that called our reset handler when diag288 was still a sysbus device in a previous patch version.