[Top][All Lists]
[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
- [Qemu-devel] [PATCH 09/15] qdev: allow both pre- and post-order vists in qdev walking functions, (continued)
- [Qemu-devel] [PATCH 09/15] qdev: allow both pre- and post-order vists in qdev walking functions, Paolo Bonzini, 2012/12/17
- [Qemu-devel] [PATCH 10/15] qdev: switch reset to post-order, Paolo Bonzini, 2012/12/17
- [Qemu-devel] [PATCH 11/15] qdev: remove device_reset, Paolo Bonzini, 2012/12/17
- [Qemu-devel] [PATCH 15/15] virtio-serial: do not perform bus reset by hand, Paolo Bonzini, 2012/12/17
- [Qemu-devel] [PATCH 14/15] virtio-s390: reset all qbuses too when writing to the status field, Paolo Bonzini, 2012/12/17
- [Qemu-devel] [PATCH 13/15] virtio-pci: reset all qbuses too when writing to the status field, Paolo Bonzini, 2012/12/17
[Qemu-devel] [PATCH 12/15] qdev: document reset semantics, Paolo Bonzini, 2012/12/17
Re: [Qemu-devel] [PATCH 00/15] qdev: make reset semantics more clear and consistent, reset qbuses under virtio devices, Michael S. Tsirkin, 2012/12/17