Skip to content

Commit

Permalink
Refactor VRING macros for AMP VIRTIO
Browse files Browse the repository at this point in the history
Renamed AMP VIRTIO macros to avoid conflicts.

Signed-off-by: Dan Milea <[email protected]>
  • Loading branch information
Dan Milea committed Oct 2, 2023
1 parent f2162a6 commit b68885b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/include/openamp/virtio.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ struct virtio_device_id {
#define VIRTIO_ASSERT(_exp, _msg) metal_assert(_exp)
#endif /* VIRTIO_DEBUG */

#define VRING_ALIGNMENT 4096
#define VIRTIO_AMP_VRING_ALIGNMENT 4096

#define VIRTIO_RING_SIZE(n, align) \
(( \
Expand All @@ -152,7 +152,7 @@ struct virtio_device_id {
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 char __vrbuf_##name[VIRTIO_RING_SIZE(n, align)] __aligned(VIRTIO_AMP_VRING_ALIGNMENT); \
static struct vring __vring_##name = { \
.desc = (void *)__vrbuf_##name, \
.avail = (void *)((unsigned long)__vrbuf_##name + n * sizeof(struct vring_desc)), \
Expand Down
2 changes: 1 addition & 1 deletion lib/virtio_mmio/virtio_mmio_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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_AMP_VRING_ALIGNMENT;

/* Check if vrings are already configured */
if (vq->vq_nentries != 0 && vq->vq_nentries == vq->vq_free_cnt &&
Expand Down

0 comments on commit b68885b

Please sign in to comment.