Re: [PATCH/RFC 7/9] Virtual network guest device driver

Cornelia Huck
2007-05-21T11:56:28Z

On Mon, 21 May 2007 13:28:03 +0200,
Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org> wrote:

> We've had the same discussion about PCI as virtual device abstraction
> recently when hpa made the suggestions to get a set of PCI device
> numbers registered for Linux.

(If you want to read it up, it's the thread at
http://marc.info/?t=117554525400003&r=1&w=2)

>
> IIRC, the conclusion to which we came was that it is indeed helpful
> for most architecture to have a PCI device as one way to probe for
> the functionality, but not to rely on it. s390 is the obvious
> example where you can't have PCI, but you may also want to build
> a guest kernel without PCI support because of space constraints
> in a many-guests machine.
>
> What I think would be ideal is to have a new bus type in Linux
> that does not have any dependency on PCI itself, but can be
> easily implemented as a child of a PCI device.
>
> If we only need the stuff mentioned by Anthony, the interface could
> look like
>
> struct vmchannel_device {
> struct resource virt_mem;
> struct vm_device_id id;
> int irq;
^^^^^^^^
> int (*signal)(struct vmchannel_device *);
> int (*irq_ack)(struct vmchannel_device *);
> struct device dev;
> };

IRQ numbers are evil :)

It should be more like a
void *vmchannel_device_handle;
which could be different things depending on what we want the
vmchannel_device to be a child of (it could be an IRQ number for
PCI devices, or something like subchannel_id if we wanted to
support channel devices).

>
> Such a device can easily be provided as a child of a PCI device,
> or as something that is purely virtual based on an hcall interface.

This looks like a flexible approach.