qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 13/15] virtio-pci: reset all qbuses too when wri


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH 13/15] virtio-pci: reset all qbuses too when writing to the status field
Date: Mon, 17 Dec 2012 18:09:41 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0

Il 17/12/2012 18:08, Michael S. Tsirkin ha scritto:
>>> I would still prefer this logic to reside in virtio.c instead of being
>>> duplicated in each bus.
>>> My idea was to simply call qdev_reset_all on the binding from virtio.c
>>> but other ideas wellcome.
>>
>> I think you're confusing "in the common superclass of all virtio
>> transports" vs "in the common superclass of all virtio devices".
>> virtio.c only implements a common superclass of all virtio devices; in
>> fact, there is no common superclass of all virtio transports, and it is
>> not possible without multiple inheritance or stuff like traits (you're
>> already inheriting from PCIDevice for virtio-*-pci).
>>
>> Such common superclass, if it existed, would abstract stuff like "write
>> zero to the status register" and would call qdev_reset_all.  But again,
>> we don't have this concept.
> 
> There's some misunderstanding here.
> 
> This is not about classes and stuff.
> 
> Common code should be in a single place so everyone can reuse it through
> function calls, not duplicated in all transports.
> And yes we do have examples of this if you are asking for examples;
> examples are functions like virtio_reset, virtio_set_status, etc.

We shouldn't need a virtio_reset at all.  It should be invoked
automatically by virtue of having a correct, complete description of
virtio in terms of qdev buses.

In other words, qdev_reset_all _is_ the common code you're seeking.

Paolo



reply via email to

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