Re: [PATCH] Remove TARGET_PAGE_SIZE from virtio interface

Hollis Blanchard
2008-11-26T18:29:52Z

On Wed, 2008-11-26 at 12:22 -0600, Hollis Blanchard wrote:
>
> diff --git a/hw/virtio.h b/hw/virtio.h
> index 1df8f83..c23f38c 100644
> --- a/hw/virtio.h
> +++ b/hw/virtio.h
> @@ -47,6 +47,11 @@
> /* This means don't interrupt guest when buffer consumed. */
> #define VRING_AVAIL_F_NO_INTERRUPT 1
>
> +static inline vring_align(unsigned long addr, unsigned long align)
> +{
> + return (addr + align - 1) & ~(align - 1);
> +}
> +
> typedef struct VirtQueue VirtQueue;
> typedef struct VirtIODevice VirtIODevice;

OK, obviously this doesn't need to be named "vring_align". I was going
to just build VIRTIO_PCI_VRING_ALIGN into this function, but in the
future we'll need to accommodate KVM_S390_VIRTIO_RING_ALIGN, so we would
need to pass in a parameter from virtqueue_init(). Of course, I'm not
sure how the S390 code will fit here anyways, since virtio.c is both
virtio ring and virtio PCI.

I haven't found an existing "align" function in qemu though...

--
Hollis Blanchard
IBM Linux Technology Center