[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v1 1/2] qdev-monitor.c: Register reset function
From: |
Markus Armbruster |
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 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Paolo Bonzini <address@hidden> writes:
> On 18/02/2016 10:56, Markus Armbruster wrote:
>> Alistair Francis <address@hidden> 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 <address@hidden>
>>> ---
>>>
>>> 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.
[...]
- Re: [Qemu-devel] [PATCH v1 2/2] generic-loader: Add a generic loader, (continued)
- [Qemu-devel] [PATCH v1 1/2] qdev-monitor.c: Register reset function if the device has one, Alistair Francis, 2016/02/17
- Re: [Qemu-devel] [PATCH v1 1/2] qdev-monitor.c: Register reset function if the device has one, Markus Armbruster, 2016/02/18
- Re: [Qemu-devel] [PATCH v1 1/2] qdev-monitor.c: Register reset function if the device has one, Alistair Francis, 2016/02/18
- Re: [Qemu-devel] [PATCH v1 1/2] qdev-monitor.c: Register reset function if the device has one, Paolo Bonzini, 2016/02/18
- Re: [Qemu-devel] [PATCH v1 1/2] qdev-monitor.c: Register reset function if the device has one, Peter Crosthwaite, 2016/02/18
- Re: [Qemu-devel] [PATCH v1 1/2] qdev-monitor.c: Register reset function if the device has one, Alistair Francis, 2016/02/18
- Re: [Qemu-devel] [PATCH v1 1/2] qdev-monitor.c: Register reset function if the device has one, Paolo Bonzini, 2016/02/19
- Re: [Qemu-devel] [PATCH v1 1/2] qdev-monitor.c: Register reset function if the device has one, Peter Maydell, 2016/02/19
- Re: [Qemu-devel] [PATCH v1 1/2] qdev-monitor.c: Register reset function if the device has one, Paolo Bonzini, 2016/02/19
- Re: [Qemu-devel] [PATCH v1 1/2] qdev-monitor.c: Register reset function if the device has one,
Markus Armbruster <=
- Re: [Qemu-devel] [PATCH v1 1/2] qdev-monitor.c: Register reset function if the device has one, Andreas Färber, 2016/02/19
- Re: [Qemu-devel] [PATCH v1 1/2] qdev-monitor.c: Register reset function if the device has one, Alistair Francis, 2016/02/19
Re: [Qemu-devel] [PATCH v1 0/2] Add a generic loader, Hollis Blanchard, 2016/02/18