[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Re: [PATCH 19/41] virtio: use the right types for VirtQueue
From: |
Juan Quintela |
Subject: |
[Qemu-devel] Re: [PATCH 19/41] virtio: use the right types for VirtQueue elements |
Date: |
Wed, 02 Dec 2009 19:24:12 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) |
"Michael S. Tsirkin" <address@hidden> wrote:
> On Wed, Dec 02, 2009 at 01:04:17PM +0100, Juan Quintela wrote:
>>
>> Signed-off-by: Juan Quintela <address@hidden>
>> ---
>> hw/virtio.c | 8 ++++----
>> 1 files changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/hw/virtio.c b/hw/virtio.c
>> index fd617ff..2b36cad 100644
>> --- a/hw/virtio.c
>> +++ b/hw/virtio.c
>> @@ -646,8 +646,8 @@ void virtio_save(VirtIODevice *vdev, QEMUFile *f)
>> qemu_put_sbe32s(f, &vdev->num_pci_queues);
>>
>> for (i = 0; i < vdev->num_pci_queues; i++) {
>> - qemu_put_be32(f, vdev->vq[i].vring.num);
>> - qemu_put_be64(f, vdev->vq[i].pa);
>> + qemu_put_be32s(f, &vdev->vq[i].vring.num);
>> + qemu_put_be64s(f, &vdev->vq[i].pa);
>> qemu_put_be16s(f, &vdev->vq[i].last_avail_idx);
>> if (vdev->type == VIRTIO_PCI &&
>> virtio_pci_msix_present(vdev->binding_opaque)) {
>> @@ -703,8 +703,8 @@ int virtio_load(VirtIODevice *vdev, QEMUFile *f)
>> qemu_get_sbe32s(f, &vdev->num_pci_queues);
>>
>> for (i = 0; i < vdev->num_pci_queues; i++) {
>> - vdev->vq[i].vring.num = qemu_get_be32(f);
>> - vdev->vq[i].pa = qemu_get_be64(f);
>> + qemu_get_be32s(f, &vdev->vq[i].vring.num);
>> + qemu_get_be64s(f, &vdev->vq[i].pa);
>> qemu_get_be16s(f, &vdev->vq[i].last_avail_idx);
>>
>> if (vdev->type == VIRTIO_PCI &&
>
> Why are these the right types?
> I see:
> static inline void qemu_put_be64s(QEMUFile *f, const uint64_t *pv)
> {
> qemu_put_be64(f, *pv);
> }
>
> so passing a pointer to qemu_get_be64s seems exactly equivalent to
> qemu_put_be64 on value.
>
> What am I missing?
While I was porting this to vmstate, it was difficult. vmstate always
use the pointer functions (the other ones shouldn't have been defined at
all, but that is another war).
It just made the change to vmstate obvious. I had to redo it several
times until it worked :(
Later, Juan.
- [Qemu-devel] Re: [PATCH 15/41] virtio: remove save/load_queue for virtio, (continued)
[Qemu-devel] [PATCH 16/41] virtio: Add num_pci_queues field, Juan Quintela, 2009/12/02
[Qemu-devel] [PATCH 17/41] virtio: split virtio_post_load() from virtio_load(), Juan Quintela, 2009/12/02
[Qemu-devel] [PATCH 18/41] virtio: change config_len type to int32_t, Juan Quintela, 2009/12/02
[Qemu-devel] [PATCH 21/41] virtio: port to vmstate, Juan Quintela, 2009/12/02
[Qemu-devel] [PATCH 19/41] virtio: use the right types for VirtQueue elements, Juan Quintela, 2009/12/02
[Qemu-devel] [PATCH 20/41] virtio: abstract test for save/load values, Juan Quintela, 2009/12/02
[Qemu-devel] [PATCH 22/41] virtio-net: change tx_timer_active to uint32_t, Juan Quintela, 2009/12/02
[Qemu-devel] [PATCH 23/41] virtio-net: change mergeable_rx_bufs to uint32_t, Juan Quintela, 2009/12/02
[Qemu-devel] [PATCH 24/41] virtio-net: use type checking version of qemu_put/get-*, Juan Quintela, 2009/12/02
[Qemu-devel] [PATCH 25/41] virtio-net: MAC_TABLE_ENTRIES has never been bigger, Juan Quintela, 2009/12/02
[Qemu-devel] [PATCH 26/41] virtio-net: we know vlans size at compile time, make it static, Juan Quintela, 2009/12/02
[Qemu-devel] [PATCH 27/41] virtio-net: abstract vlans operations, Juan Quintela, 2009/12/02