|  |  | 
  
    |  |  | 
 
  |   |  | 
  
    |  |  | 
  
    |  |  | 
  
    |   xen-devel
[Xen-devel] Re: [kvm-devel] [PATCH RFC 1/3] virtio infrastructure 
| To: | Rusty Russell <rusty@xxxxxxxxxxxxxxx> |  
| Subject: | [Xen-devel] Re: [kvm-devel] [PATCH RFC 1/3] virtio infrastructure |  
| From: | Avi Kivity <avi@xxxxxxxxxxxx> |  
| Date: | Sat, 02 Jun 2007 09:30:37 +0300 |  
| Cc: | Jimi Xenidis <jimix@xxxxxxxxxxxxxx>,	Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx>,	Xen Mailing List <xen-devel@xxxxxxxxxxxxxxxxxxx>,	"jmk@xxxxxxxxxxxxxxxxxxx" <jmk@xxxxxxxxxxxxxxxxxxx>,	Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>,	kvm-devel <kvm-devel@xxxxxxxxxxxxxxxxxxxxx>,	virtualization <virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx>,	Christian Borntraeger <cborntra@xxxxxxxxxx>,	Suzanne McIntosh <skranjac@xxxxxxxxxx>,	Martin Schwidefsky <schwidefsky@xxxxxxxxxx> |  
| Delivery-date: | Fri, 01 Jun 2007 23:28:55 -0700 |  
| Envelope-to: | www-data@xxxxxxxxxxxxxxxxxx |  
| In-reply-to: | <1180613947.11133.58.camel@xxxxxxxxxxxxxxxxxxxxx> |  
| List-help: | <mailto:xen-devel-request@lists.xensource.com?subject=help> |  
| List-id: | Xen developer discussion <xen-devel.lists.xensource.com> |  
| List-post: | <mailto:xen-devel@lists.xensource.com> |  
| List-subscribe: | <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>,	<mailto:xen-devel-request@lists.xensource.com?subject=subscribe> |  
| List-unsubscribe: | <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>,	<mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe> |  
| References: | <1180613947.11133.58.camel@xxxxxxxxxxxxxxxxxxxxx> |  
| Sender: | xen-devel-bounces@xxxxxxxxxxxxxxxxxxx |  
| User-agent: | Thunderbird 2.0.0.0 (X11/20070419) |  
| 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.
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
 | 
 
| <Prev in Thread] | Current Thread | [Next in Thread> |  | 
[Xen-devel] Re: [kvm-devel] [PATCH RFC 1/3] virtio infrastructure,
Avi Kivity <=
 |  |  | 
  
    |  |  |