Peter Maydell <peter.mayd...@linaro.org> writes:

> On 5 April 2013 17:47, Anthony Liguori <anth...@codemonkey.ws> wrote:
>> Kevin Wolf <kw...@redhat.com> writes:
>>
>>> From: KONRAD Frederic <fred.kon...@greensocs.com>
>>>
>>> The virtio-blk-x configuration is not in sync with virtio-blk configuration.
>>> So this patch remove the virtio-blk-x configuration field, and use 
>>> virtio-blk
>>> one for setting the properties.
>>>
>>> This also remove a useless configuration copy in virtio_blk_device_init.
>>>
>>> Signed-off-by: KONRAD Frederic <fred.kon...@greensocs.com>
>>> Tested-by: Cornelia Huck <cornelia.h...@de.ibm.com>
>>> Signed-off-by: Kevin Wolf <kw...@redhat.com>
>>
>> This breaks -M pc-1.0 as it breaks global properties.
>
> The first level analysis of why this happens:
>
>  (1) global values are set as part of DeviceState's instance_init function
>      [and we set the config_wce field to 0 here]
>  (2) virtio_blk_pci_instance_init is a subclass instance_init so runs second
>  (3) it calls object_initialize on its embedded virtio-blk object
>  (4) the DeviceState instance_init for that child object sets the
>      properties to their init values [thus resetting config_wce to 1]
>
> The effect is that at the moment you can't have a property on
> a parent object whose value is stored in the child object
> (unless you do something hacky like read the default before
> calling object_initialize and restore it afterwards].
>
> It seems to me that the underlying problem here is that we
> set global values too early -- they should be set after a
> device is completely instance_init'd, not halfway through init.

Here is an in-progress series that forwards properties from the
virtio-blk-pci to virtio-blk.

I think it's the best solution.  The approach needs some polishing but I
wanted to share early.

https://github.com/aliguori/qemu/commits/qom-forward.1

Regards,

Anthony Liguori

>
> -- PMM

Reply via email to