On Fri, Feb 19, 2016 at 9:15 AM, Andreas Färber <afaer...@suse.de> wrote: > Am 18.02.2016 um 10:56 schrieb Markus Armbruster: >> Alistair Francis <alistair.fran...@xilinx.com> writes: >> >>> 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 <alistair.fran...@xilinx.com> >>> --- >>> >>> 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) >>> >>> if (bus) { >>> qdev_set_parent_bus(dev, bus); >>> + } else if (dc->reset) { >>> + qemu_register_reset((void (*)(void *))dc->reset, dev); >>> } >>> >>> id = qemu_opts_id(opts); >> >> This looks wrong to me. >> >> You stuff all the device reset methods into the global reset_handlers >> list, where they get called in some semi-random order. This breaks when >> there are reset order dependencies between devices, e.g. between a >> device and the bus it plugs into. >> >> 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.
Ok, that is fair. I have moved the reset register/unregister to the realise/unrealise functions in V2. Thanks, Alistair > > Regards, > Andreas > > -- > SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany > GF: Felix Imendörffer, Jane Smithard, Graham Norton; HRB 21284 (AG Nürnberg) >