[libvirt] patch for pci passthrough

Mark McLoughlin markmc at redhat.com
Fri Dec 19 14:04:43 UTC 2008


Hi Jason,

On Tue, 2008-12-16 at 03:02 +0100, Jason Krieg wrote:
> Hi,
> 
> This patch adds support for the -pcidevice host=bus:dev.func
> added in kvm-79
> 
> I used the structure as already defined in src/domain_conf.h
> 
> so analog to usb one now can add pci devices
> 
> as example:
> 
> lspci:  06:02.0 Network controller: Eicon Networks Corporation Diva 
> Server 2FX (rev 01)
> 
> 
> <hostdev mode='subsystem' type='pci'>
>     <source>
>         <address bus="0x06" slot="0x02" function="0x0"/>
>     </source>
> </hostdev>
> 
> 
> values are hex so for bus: 0 to ff, slot: 0 to 1f and function: 0 to 7
> 
> Hope this patch is useful it applies to libvirt-0.5.1 and cvs checkout
> from today (with some hunks)

The patch looks good to me and makes perfect sense; good stuff.

One thing that might be worth thinking about is whether we can
automatically unload host drivers for a device when assigning; e.g. if
you didn't do "rmmod e1000e" before assigning a NIC to a guest, then the
guest would just fail to start.

Another thing to think about for PCI device assignment is how we can
allow a management tool to filter the devices returned from the device
enumeration API to only those devices that could successfully be
assigned to a guest.

This gets quite tricky - if you don't have e.g. VT-d or its a
conventional PCI device (in some cases) or if the device is in use or if
its a graphics card (currently), then it's just not going to work.

We clearly don't want to have a heap of logic in libvirt about what kind
of devices can be assigned - and anyway, that logic would be ever
changing - so, we perhaps want a ioctl to query KVM as to whether a
device is assignable.

Cheers,
Mark.




More information about the libvir-list mailing list