From: "Andreas Färber" <afaerber@suse.de>
To: Markus Armbruster <armbru@redhat.com>,
Alistair Francis <alistair.francis@xilinx.com>
Cc: peter.maydell@linaro.org, qemu-devel@nongnu.org,
crosthwaitepeter@gmail.com, cov@codeaurora.org,
pbonzini@redhat.com, lig.fnst@cn.fujitsu.com
Subject: Re: [Qemu-devel] [PATCH v1 1/2] qdev-monitor.c: Register reset function if the device has one
Date: Fri, 19 Feb 2016 18:15:10 +0100 [thread overview]
Message-ID: <56C74D9E.3060400@suse.de> (raw)
In-Reply-To: <87lh6ijqa2.fsf@blackfin.pond.sub.org>
Am 18.02.2016 um 10:56 schrieb Markus Armbruster:
> Alistair Francis <alistair.francis@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.francis@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.
Regards,
Andreas
--
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton; HRB 21284 (AG Nürnberg)
next prev parent reply other threads:[~2016-02-19 17:15 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-17 21:04 [Qemu-devel] [PATCH v1 0/2] Add a generic loader Alistair Francis
2016-02-17 21:04 ` [Qemu-devel] [PATCH v1 1/2] qdev-monitor.c: Register reset function if the device has one Alistair Francis
2016-02-18 9:56 ` Markus Armbruster
2016-02-18 18:47 ` Alistair Francis
2016-02-18 21:47 ` Paolo Bonzini
2016-02-18 23:07 ` Peter Crosthwaite
2016-02-19 0:02 ` Alistair Francis
2016-02-19 9:33 ` Paolo Bonzini
2016-02-19 10:55 ` Peter Maydell
2016-02-19 17:17 ` Paolo Bonzini
2016-02-19 9:58 ` Markus Armbruster
2016-02-19 17:15 ` Andreas Färber [this message]
2016-02-19 18:53 ` Alistair Francis
2016-02-17 21:04 ` [Qemu-devel] [PATCH v1 2/2] generic-loader: Add a generic loader Alistair Francis
2016-02-17 21:41 ` Eric Blake
2016-02-18 0:03 ` Alistair Francis
2016-02-18 0:11 ` Eric Blake
2016-02-18 0:17 ` Alistair Francis
2016-02-18 18:23 ` Hollis Blanchard
2016-02-18 18:49 ` Alistair Francis
2016-02-18 18:58 ` Hollis Blanchard
2016-02-18 19:34 ` Alistair Francis
2016-02-18 18:27 ` [Qemu-devel] [PATCH v1 0/2] " Hollis Blanchard
2016-02-18 19:02 ` Alistair Francis
2016-02-18 20:01 ` Peter Maydell
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=56C74D9E.3060400@suse.de \
--to=afaerber@suse.de \
--cc=alistair.francis@xilinx.com \
--cc=armbru@redhat.com \
--cc=cov@codeaurora.org \
--cc=crosthwaitepeter@gmail.com \
--cc=lig.fnst@cn.fujitsu.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).