diff options
author | Alexey Kardashevskiy <aik@ozlabs.ru> | 2019-11-07 17:47:13 +1100 |
---|---|---|
committer | Alexey Kardashevskiy <aik@ozlabs.ru> | 2019-12-05 14:41:07 +1100 |
commit | 300384f3dc68588a051f5737aee3b5eab4dd19e4 (patch) | |
tree | 5b96c2de68d164ffd4c385ed8255449e596f0f89 /lib/libvirtio/virtio-internal.h | |
parent | ac4c07a9a416f72cd0df0af1778693a5a5060523 (diff) | |
download | SLOF-300384f3dc68588a051f5737aee3b5eab4dd19e4.zip SLOF-300384f3dc68588a051f5737aee3b5eab4dd19e4.tar.gz SLOF-300384f3dc68588a051f5737aee3b5eab4dd19e4.tar.bz2 |
virtio: Store queue descriptors in virtio_device
At the moment desc/avail/used pointers are read from the device every
time we need them. This works for now unless iommu_platform=on is used,
desc/avail/used stored in the config space are bus addresses while
SLOF should keep using the guest physical addresses.
virtio-net stores queue descriptors already, virtio-serial does it in
global statics, move them into virtio_device.
The next patch will use this to allow IOMMU.
While at this, move repeating avail->flags/idx setup into
virtio_queue_init_vq() except virtio-serial which vq_rx->avail->idx is
setup differently.
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
Changes:
v4:
* removed vqs::id as it is not really used
* replaced vq_size with vq->size in virtio-serial.c
Diffstat (limited to 'lib/libvirtio/virtio-internal.h')
-rw-r--r-- | lib/libvirtio/virtio-internal.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/libvirtio/virtio-internal.h b/lib/libvirtio/virtio-internal.h index 08662ea..fe59c6b 100644 --- a/lib/libvirtio/virtio-internal.h +++ b/lib/libvirtio/virtio-internal.h @@ -17,32 +17,32 @@ static inline uint16_t virtio_cpu_to_modern16(struct virtio_device *dev, uint16_t val) { - return dev->is_modern ? cpu_to_le16(val) : val; + return (dev->features & VIRTIO_F_VERSION_1) ? cpu_to_le16(val) : val; } static inline uint32_t virtio_cpu_to_modern32(struct virtio_device *dev, uint32_t val) { - return dev->is_modern ? cpu_to_le32(val) : val; + return (dev->features & VIRTIO_F_VERSION_1) ? cpu_to_le32(val) : val; } static inline uint64_t virtio_cpu_to_modern64(struct virtio_device *dev, uint64_t val) { - return dev->is_modern ? cpu_to_le64(val) : val; + return (dev->features & VIRTIO_F_VERSION_1) ? cpu_to_le64(val) : val; } static inline uint16_t virtio_modern16_to_cpu(struct virtio_device *dev, uint16_t val) { - return dev->is_modern ? le16_to_cpu(val) : val; + return (dev->features & VIRTIO_F_VERSION_1) ? le16_to_cpu(val) : val; } static inline uint32_t virtio_modern32_to_cpu(struct virtio_device *dev, uint32_t val) { - return dev->is_modern ? le32_to_cpu(val) : val; + return (dev->features & VIRTIO_F_VERSION_1) ? le32_to_cpu(val) : val; } static inline uint64_t virtio_modern64_to_cpu(struct virtio_device *dev, uint64_t val) { - return dev->is_modern ? le64_to_cpu(val) : val; + return (dev->features & VIRTIO_F_VERSION_1) ? le64_to_cpu(val) : val; } #endif /* _LIBVIRTIO_INTERNAL_H */ |