[libvirt] patch for pci passthrough

Daniel P. Berrange berrange at redhat.com
Fri Dec 19 14:09:46 UTC 2008


On Fri, Dec 19, 2008 at 02:04:43PM +0000, Mark McLoughlin wrote:
> 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.

Unloading isn't correct because that impact alls devices associated
with the device. You just want to unbind te specific device using
the 'unbind' file in sysfs. I dont think we should do this automatically
though - you wouldn't want to accidentally, automatically remotely
 unbind your network. 

I think the node device driver APIs could report what driver is
associated with each device they know, and provide an API to bind
and unbind the device to/from the driver. Its easy enough for a mgmt
app to automatically / seemlessly invoke such an API, after validating
that the PCI device isn't asociated with the ethernet device its talking
to libvirt over ..

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list