mic_virtio has a big hack to set up a custom ring, like this: /* * To reassign the used ring here we are directly accessing * struct vring_virtqueue which is a private data structure * in virtio_ring.c. At the minimum, a BUILD_BUG_ON() in * vring_new_virtqueue() would ensure that * (&vq->vring == (struct vring *) (&vq->vq + 1)); */ vr = (struct vring *)(vq + 1); vr->used = used;\
I added a more flexible API __vring_new_virtqueue that you might be able to use to clean this up in: commit 2a2d1382fe9dccfce6f9c60a9c9fd2f0fe5bcf2b Author: Andy Lutomirski <l...@kernel.org> Date: Tue Feb 2 21:46:37 2016 -0800 virtio: Add improved queue allocation API Please consider either using it or trying to use vring_create_virtqueue and updating it to fit your needs if appropriate. I didn't btry to do it myself because I don't have the hardware. Thanks, Andy