From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NZUXI-0001zE-Rs for qemu-devel@nongnu.org; Mon, 25 Jan 2010 14:23:44 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NZUXG-0001vb-TH for qemu-devel@nongnu.org; Mon, 25 Jan 2010 14:23:43 -0500 Received: from [199.232.76.173] (port=56692 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NZUXF-0001v9-Sa for qemu-devel@nongnu.org; Mon, 25 Jan 2010 14:23:41 -0500 Received: from fg-out-1718.google.com ([72.14.220.158]:40062) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NZUXF-0008Nt-B8 for qemu-devel@nongnu.org; Mon, 25 Jan 2010 14:23:41 -0500 Received: by fg-out-1718.google.com with SMTP id 19so30839fgg.10 for ; Mon, 25 Jan 2010 11:23:40 -0800 (PST) Message-ID: <4B5DEFB7.4020107@codemonkey.ws> Date: Mon, 25 Jan 2010 13:23:35 -0600 From: Anthony Liguori MIME-Version: 1.0 References: <20100111171649.GB11936@redhat.com> <4B4CF88C.3050903@codemonkey.ws> <20100125191024.GC11998@redhat.com> In-Reply-To: <20100125191024.GC11998@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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: "Michael S. Tsirkin" Cc: qemu-devel@nongnu.org On 01/25/2010 01:10 PM, Michael S. Tsirkin wrote: > 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; > You need num and the physical address of the ring. The location of desc/available/used are all fixed offsets rom the start of the ring (by spec). > uint16_t vector; > VirtIODevice *vdev; > EventNotifier guest_notifier; > EventNotifier host_notifier; > guest_notifier and host_notifier appear to be new. I don't see them in your previous patchset. I can't see why you need vdev. The backlink is there only for handle_output because handle_output is passed a VirtQueue. I also don't see you using vector in this patch series. So at least from what you posted in the RFC, you just need to know the ring pa and num which would be totally reasonable to have an accessor for. Regards, Anthony Liguori