From: Markus Armbruster <armbru@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: peter.maydell@linaro.org, qemu-devel@nongnu.org,
"Alistair Francis" <alistair.francis@xilinx.com>,
crosthwaitepeter@gmail.com, cov@codeaurora.org,
"Andreas Färber" <afaerber@suse.de>,
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 10:58:59 +0100 [thread overview]
Message-ID: <87d1rtuil8.fsf@blackfin.pond.sub.org> (raw)
In-Reply-To: <56C63C0D.8030501@redhat.com> (Paolo Bonzini's message of "Thu, 18 Feb 2016 22:47:57 +0100")
Paolo Bonzini <pbonzini@redhat.com> writes:
> On 18/02/2016 10:56, Markus Armbruster wrote:
>> 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.
>
> There is no bus here, see the "if" above the one that's being added.
>
> However, what devices have done so far is to register/unregister the
> reset in the realize/unrealize methods, and I suggest doing the same.
Shows that our support for bus-less devices is still in its infancy.
For me, a device has a number of external connectors that need to be
wired up. A qdev bus is merely a standardized package of such
connectors. For historical reasons, buses are all qdev has, with a
special sysbus for everything that cannot be shoehorned into a single
bus. To work with individual connectors, you have to drop into C
(ignoring the weird "platform bus" sysbus thing Alex added). Support
for doing that at configuration rather than code level would be nice.
[...]
next prev parent reply other threads:[~2016-02-19 9:59 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 [this message]
2016-02-19 17:15 ` Andreas Färber
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=87d1rtuil8.fsf@blackfin.pond.sub.org \
--to=armbru@redhat.com \
--cc=afaerber@suse.de \
--cc=alistair.francis@xilinx.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.