From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH RFC 1/3] virtio infrastructure Date: Sat, 02 Jun 2007 09:30:37 +0300 Message-ID: <46610E8D.10706@qumranet.com> References: <1180613947.11133.58.camel@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: Jimi Xenidis , Stephen Rothwell , Xen Mailing List , "jmk-zzFmDc4TPjtKvsKVC3L/VUEOCMrvLtNR@public.gmane.org" , Herbert Xu , kvm-devel , virtualization , Christian Borntraeger , Suzanne McIntosh , Martin Schwidefsky To: Rusty Russell Return-path: In-Reply-To: <1180613947.11133.58.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org Rusty Russell wrote: > This attempts to implement a "virtual I/O" layer which should allow > common drivers to be efficiently used across most virtual I/O > mechanisms. It will no-doubt need further enhancement. > > The details of probing the device are left to hypervisor-specific > code: it simple constructs the "struct virtio_device" and hands it to > the probe function (eg. virtnet_probe() or virtblk_probe()). > > The virtio drivers add and detach input and output buffers; as the > buffers are used up their associated "used" pointers are filled in. > > Good stuff. > +/** > + * virtio_ops - virtio abstraction layer > + * @add_outbuf: prepare to send data to the other end: > + * vdev: the virtio_device > + * sg: the description of the buffer(s). > + * num: the size of the sg array. > + * used: the length sent (set once sending is done). > + * Returns an identifier or an error. > + * @add_inbuf: prepare to receive data from the other end: > + * vdev: the virtio_device > + * sg: the description of the buffer(s). > + * num: the size of the sg array. > + * used: the length sent (set once data received). > + * Returns an identifier or an error (eg. -ENOSPC). > Instead of 'used', how about a completion callback (with associated data pointer)? A new helper, virtio_complete(), would call the callback for all completed requests. It would eliminate all the tedious scanning used to match the identifier. It would also be nice to support a bit of non-buffer data, like a set of bitflags. -- Do not meddle in the internals of kernels, for they are subtle and quick to panic. ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/