From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38090) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWoeD-0005ae-7G for qemu-devel@nongnu.org; Fri, 19 Feb 2016 12:15:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aWoe8-00047c-QE for qemu-devel@nongnu.org; Fri, 19 Feb 2016 12:15:16 -0500 Received: from mx2.suse.de ([195.135.220.15]:49699) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWoe8-00046m-JZ for qemu-devel@nongnu.org; Fri, 19 Feb 2016 12:15:12 -0500 References: <4744c26fdfd911c44b58a9b6e1d0effc6cb39594.1455739133.git.alistair.francis@xilinx.com> <87lh6ijqa2.fsf@blackfin.pond.sub.org> From: =?UTF-8?Q?Andreas_F=c3=a4rber?= Message-ID: <56C74D9E.3060400@suse.de> Date: Fri, 19 Feb 2016 18:15:10 +0100 MIME-Version: 1.0 In-Reply-To: <87lh6ijqa2.fsf@blackfin.pond.sub.org> Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v1 1/2] qdev-monitor.c: Register reset function if the device has one List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster , Alistair Francis Cc: peter.maydell@linaro.org, qemu-devel@nongnu.org, crosthwaitepeter@gmail.com, cov@codeaurora.org, pbonzini@redhat.com, lig.fnst@cn.fujitsu.com Am 18.02.2016 um 10:56 schrieb Markus Armbruster: > Alistair Francis writes: >=20 >> If the device being added when running qdev_device_add() has >> a reset function, register it so that it can be called. >> >> Signed-off-by: Alistair Francis >> --- >> >> qdev-monitor.c | 2 ++ >> 1 file changed, 2 insertions(+) >> >> diff --git a/qdev-monitor.c b/qdev-monitor.c >> index 81e3ff3..0a99d01 100644 >> --- a/qdev-monitor.c >> +++ b/qdev-monitor.c >> @@ -561,6 +561,8 @@ DeviceState *qdev_device_add(QemuOpts *opts, Error= **errp) >> =20 >> if (bus) { >> qdev_set_parent_bus(dev, bus); >> + } else if (dc->reset) { >> + qemu_register_reset((void (*)(void *))dc->reset, dev); >> } >> =20 >> id =3D qemu_opts_id(opts); >=20 > This looks wrong to me. >=20 > You stuff all the device reset methods into the global reset_handlers > list, where they get called in some semi-random order. This breaks whe= n > there are reset order dependencies between devices, e.g. between a > device and the bus it plugs into. >=20 > Propagating the reset signal to all the devices is a qdev problem. > Copying Andreas for further insight. We had a similar discussion for s390x, and I had started a big reset refactoring, but we agreed to go for a stop-gap solution for 2.5. The recently posted hw/core/bus.c refactoring originated from that branch. The overall idea was that for buses reset propagates along buses (so yes, NACK to this patch), but where no bus exists it shall propagate to QOM children, too. So Alistair, if you have a device that needs a reset while not sitting on a bus, please register the register hook in your device's realize hook for now. Regards, Andreas --=20 SUSE Linux GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Felix Imend=F6rffer, Jane Smithard, Graham Norton; HRB 21284 (AG N=FC= rnberg)