qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH-for-5.2 v4] hw/core/qdev: Increase qdev_realize() kindness


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH-for-5.2 v4] hw/core/qdev: Increase qdev_realize() kindness
Date: Wed, 29 Jul 2020 14:49:13 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0

On 7/29/20 2:32 PM, Markus Armbruster wrote:
> Philippe Mathieu-Daudé <f4bug@amsat.org> writes:
> 
>> On 7/29/20 9:39 AM, Markus Armbruster wrote:
>>> Paolo Bonzini <pbonzini@redhat.com> writes:
>>>
>>>> On 28/07/20 09:44, Markus Armbruster wrote:
>>>>>> -        assert(!DEVICE_GET_CLASS(dev)->bus_type);
>>>>>> +    } else if (DEVICE_GET_CLASS(dev)->bus_type) {
>>>>>> +        error_setg(errp, "Unexpected bus '%s' for bus-less device '%s'",
>>>>>> +                   DEVICE_GET_CLASS(dev)->bus_type,
>>>>>> +                   object_get_typename(OBJECT(dev)));
>>>>>> +        return false;
>>>>>>      }
>>>>>>  
>>>>>>      object_property_set_bool(OBJECT(dev), true, "realized", &err);
>>>>> Objection.  This turns an abort into something else unless the caller
>>>>> passes &error_abort.  The caller in your commit message's example does,
>>>>> others don't.
>>>>>
>>>>> Keep the unconditional abort, please.  Feel free to print something kind
>>>>> right before.  I doubt it's all that useful, as I believe whoever gets
>>>>> to fix the bug will have to figure out the code anyway, but I could be
>>>>> wrong.
>>>>>
>>>>
>>>> This was my request, actually.  We have an Error**, we should use it in
>>>> case this code is reached via device_add.
>>>
>>> That's not actually possible.
>>
>> I agree this condition is not possible in current mainstream.
>>
>> What I'm working on is:
>>
>> qmp command that:
>> - create a SDCard or FloppyDisk medium
>> - eventually link a block driver to it
>> - insert the medium into a slot
>>
>> then another qmp command that
>> - eject the medium
>> - unlink the block driver
>> - destroy the medium
>>
>> second step is a command that takes as argument
>> (block driver, bus endpoint) and automatically
>> creates the envelope media and insert it to the bus.
> 
> If this makes the error possible, then your code fails to establish
> qdev_realize()'s precondition, and therefore needs fixing.

Yes, because I try to create a bus-ful device without plugging it on
the bus (I want to set the block driver link before plugging it).

> 
> Could a combination of existing commands get the job done?

Maybe. I'm trying a clean design. With the current state it is hard
to figure if my design is broken or the current QEMU design [*] is
broken and unfixable.

[*] keep re-using existing media device, add blockdrv, reset media
    device internals register depending of the blockdrv properties,
    eject blockdrv/insert different one and keep adapting the device.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]