From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hollis Blanchard Subject: Re: [PATCH] Remove TARGET_PAGE_SIZE from virtio interface Date: Wed, 26 Nov 2008 12:29:50 -0600 Message-ID: <1227724190.6562.9.camel@localhost.localdomain> References: <1227650239-14162-1-git-send-email-aliguori@us.ibm.com> <1227723726-15662-1-git-send-email-hollisb@us.ibm.com> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Cc: qemu-devel@nongnu.org, Avi Kivity , kvm@vger.kernel.org To: Anthony Liguori Return-path: Received: from e34.co.us.ibm.com ([32.97.110.152]:53389 "EHLO e34.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752295AbYKZS3w (ORCPT ); Wed, 26 Nov 2008 13:29:52 -0500 Received: from d03relay02.boulder.ibm.com (d03relay02.boulder.ibm.com [9.17.195.227]) by e34.co.us.ibm.com (8.13.1/8.13.1) with ESMTP id mAQITFRh011751 for ; Wed, 26 Nov 2008 11:29:15 -0700 Received: from d03av03.boulder.ibm.com (d03av03.boulder.ibm.com [9.17.195.169]) by d03relay02.boulder.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id mAQITpee149660 for ; Wed, 26 Nov 2008 11:29:51 -0700 Received: from d03av03.boulder.ibm.com (loopback [127.0.0.1]) by d03av03.boulder.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id mAQITpaX010745 for ; Wed, 26 Nov 2008 11:29:51 -0700 In-Reply-To: <1227723726-15662-1-git-send-email-hollisb@us.ibm.com> Sender: kvm-owner@vger.kernel.org List-ID: 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