From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NZUNW-0008U4-QP for qemu-devel@nongnu.org; Mon, 25 Jan 2010 14:13:38 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NZUNS-0008Pa-NG for qemu-devel@nongnu.org; Mon, 25 Jan 2010 14:13:38 -0500 Received: from [199.232.76.173] (port=32943 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NZUNS-0008PT-L5 for qemu-devel@nongnu.org; Mon, 25 Jan 2010 14:13:34 -0500 Received: from mx1.redhat.com ([209.132.183.28]:27064) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NZUNS-0007Bz-59 for qemu-devel@nongnu.org; Mon, 25 Jan 2010 14:13:34 -0500 Date: Mon, 25 Jan 2010 21:10:26 +0200 From: "Michael S. Tsirkin" Message-ID: <20100125191024.GC11998@redhat.com> References: <20100111171649.GB11936@redhat.com> <4B4CF88C.3050903@codemonkey.ws> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4B4CF88C.3050903@codemonkey.ws> Subject: [Qemu-devel] Re: [PATCH-RFC 01/13] virtio: export virtqueue structure List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: qemu-devel@nongnu.org On Tue, Jan 12, 2010 at 04:32:44PM -0600, Anthony Liguori wrote: > On 01/11/2010 11:16 AM, Michael S. Tsirkin wrote: >> vhost needs physical addresses for >> ring so expose that structure. >> >> Signed-off-by: Michael S. Tsirkin >> > > I think accessor functions might make more sense. > > Regards, > > Anthony Liguori Well, take a look: typedef struct VRing { unsigned int num; target_phys_addr_t desc; target_phys_addr_t avail; target_phys_addr_t used; } VRing; struct VirtQueue { VRing vring; target_phys_addr_t pa; uint16_t last_avail_idx; int inuse; uint16_t vector; void (*handle_output)(VirtIODevice *vdev, VirtQueue *vq); VirtIODevice *vdev; EventNotifier guest_notifier; EventNotifier host_notifier; } (Notifiers are added by patches I will shortly post). We need at least: unsigned int num; target_phys_addr_t desc; target_phys_addr_t avail; target_phys_addr_t used; VRing vring; target_phys_addr_t pa; uint16_t vector; VirtIODevice *vdev; EventNotifier guest_notifier; EventNotifier host_notifier; We do not need: uint16_t last_avail_idx; int inuse; void (*handle_output)(VirtIODevice *vdev, VirtQueue *vq); (last_avail_idx will be needed if we ever want to move a running guest from kernel to userspace or back). IOW, most of VirtQueue needs to be exposed. So - do we really want accessors? -- MST