virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Avi Kivity <avi@qumranet.com>
Cc: virtualization@lists.linux-foundation.org
Subject: Re: [RFC 1/4] New virtio bus driver
Date: Sun, 8 Jul 2007 17:29:57 +0200	[thread overview]
Message-ID: <200707081729.58461.arnd@arndb.de> (raw)
In-Reply-To: <4690B59C.10201@qumranet.com>

On Sunday 08 July 2007, Avi Kivity wrote:
> arnd@arndb.de wrote:

> > +struct virtio_device_id {
> > +	const char *device_type;
> > +	unsigned long driver_data;
> > +};
> >   
> 
> Carrying a string through a hypervisor interface can be unpleasant.  How 
> about a constant instead?

I chose a string because I found it to work rather well on
open firmware and on the platform bus. It probably has
to be a fixed length string which will be sent down from
the hypervisor along with all the device specific data.

> > +struct virtio_config {
> > +	const char host[128];
> > +	const char driver[128];
> > +};
> >   
> 
> There needs to be a way for the driver to tell the device that 
> configuration has changed (promiscuous mode, MAC address) and vice versa 
> (media detect).
> 
> Maybe have a configuration virtqueue for that.

I was hoping that we can live without dynamic configuration data
in the common case. For a simple point-to-point ethernet device,
that should work fine, and more complicated devices might need their
own interface, e.g. by embedding a command number in every
chunk of data that is sent down the one virtqueue, or by having
a separate virtqueue for all out-of-band data.

Alternatively, we could have a mechanism separate from the
virtqueue concept, like a synchronous get_config_data/set_config_data
callback into the host driver.

> What I'm missing here is the lego approach, where you can mix and match:
> 
>   virtnet.ko: basic net driver atop virtio, not linked to any implementation
>   virtio-lguest.ko, virtio-kvm.ko, virtio-xen.ko:  virtio transports
>   virtbus-pci.ko, virtbus-vio.ko, virtbus-xen.ko: virtual configuration 
> space handlers; responsible for creating queues
> 
>   vnet-kvm-pci.ko, vnet-kvm-virtbus.ko: stub drivers that glue the 
> components together
> 
> So we'd have one 10-line driver for every combination.

The whole point of the bus abstraction is that the device driver (virtnet
in this case) does not care about the underlying transport at all,
while the host driver does not care about the device.

So in your example, you get

virtnet.ko (, virtblock.ko, hwrng-virtio.ko, ...): host-independent
  device driver
virtbus-lguest.ko, virtbus-kvm.ko, virtbus-pci.ko, virtbus-xen.ko:
  device independent host drivers

In cases where some of the code can be shared, e.g. virtbus-lguest
and virtbus-kvm, you can have multiple host drivers sharing part
of their code by using symbols from a library module, but my basic
idea is that each host driver has a single module that handles
the transport and the device probing.

	Arnd <><

  reply	other threads:[~2007-07-08 15:29 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-06 12:42 [RFC 0/4] Using a generic bus_type for virtio arnd
2007-07-06 12:42 ` [RFC 1/4] New virtio bus driver arnd
2007-07-08  9:59   ` Avi Kivity
2007-07-08 15:29     ` Arnd Bergmann [this message]
2007-07-08 15:48       ` Avi Kivity
2007-07-08 20:29         ` Arnd Bergmann
2007-07-08 23:42           ` Rusty Russell
2007-07-09  6:49           ` Avi Kivity
2007-07-09 11:18             ` Arnd Bergmann
2007-07-09 11:41               ` Avi Kivity
2007-07-09 11:38                 ` Arnd Bergmann
2007-07-09 12:09                   ` Avi Kivity
2007-07-09 14:24                     ` Arnd Bergmann
2007-07-09 14:56                       ` Avi Kivity
2007-07-09 16:33                         ` Arnd Bergmann
2007-07-10  1:53                     ` Rusty Russell
2007-07-10  7:56                       ` Avi Kivity
2007-07-10  1:17             ` Rusty Russell
2007-07-10  6:06               ` Avi Kivity
2007-07-06 12:42 ` [RFC 2/4] Convert virtio_net to new virtio bus arnd
2007-07-06 12:42 ` [RFC 3/4] Convert virtio_blk " arnd
2007-07-06 12:42 ` [RFC 4/4] Example virtio host implementation, using chardev arnd
2007-07-08  2:15 ` [RFC 0/4] Using a generic bus_type for virtio Rusty Russell
2007-07-08  9:45   ` Avi Kivity
2007-07-08 15:55   ` Arnd Bergmann
2007-07-08  9:42 ` Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200707081729.58461.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=avi@qumranet.com \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).