Refactor VRING macros for AMP VIRTIO

Renamed AMP VIRTIO macros to avoid conflicts.

Signed-off-by: Dan Milea <dan.milea@windriver.com>
This commit is contained in:
Dan Milea
2023-10-10 16:22:53 +02:00
committed by Arnaud Pouliquen
parent 937ba1d700
commit bdf5f910c0
2 changed files with 2 additions and 24 deletions
+1 -23
View File
@@ -136,29 +136,7 @@ struct virtio_device_id {
#define VIRTIO_ASSERT(_exp, _msg) metal_assert(_exp)
#endif /* VIRTIO_DEBUG */
#define VRING_ALIGNMENT 4096
#define VIRTIO_RING_SIZE(n, align) \
(( \
( \
sizeof(struct vring_desc) * n + \
sizeof(struct vring_avail) + \
sizeof(uint16_t) * (n + 1) + \
align - 1 \
) \
& ~(align - 1) \
) + \
sizeof(struct vring_used) + \
sizeof(struct vring_used_elem) * n + sizeof(uint16_t))
#define VRING_DECLARE(name, n, align) \
static char __vrbuf_##name[VIRTIO_RING_SIZE(n, align)] __aligned(VRING_ALIGNMENT); \
static struct vring __vring_##name = { \
.desc = (void *)__vrbuf_##name, \
.avail = (void *)((unsigned long)__vrbuf_##name + n * sizeof(struct vring_desc)), \
.used = (void *)((unsigned long)__vrbuf_##name + ((n * sizeof(struct vring_desc) + \
(n + 1) * sizeof(uint16_t) + align - 1) & ~(align - 1))), \
}
#define VIRTIO_MMIO_VRING_ALIGNMENT 4096
typedef void (*virtio_dev_reset_cb)(struct virtio_device *vdev);
+1 -1
View File
@@ -286,7 +286,7 @@ struct virtqueue *virtio_mmio_setup_virtqueue(struct virtio_device *vdev,
vring_info->io = vmdev->shm_io;
vring_info->info.num_descs = virtio_mmio_get_max_elem(vdev, idx);
vring_info->info.align = VRING_ALIGNMENT;
vring_info->info.align = VIRTIO_MMIO_VRING_ALIGNMENT;
/* Check if vrings are already configured */
if (vq->vq_nentries != 0 && vq->vq_nentries == vq->vq_free_cnt &&