Re: [libvirt] patch for pci passthrough

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Dec 19, 2008 at 02:54:45PM +0000, Mark McLoughlin wrote:
> On Fri, 2008-12-19 at 14:09 +0000, Daniel P. Berrange wrote:
> > 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.
> 
> Yeah, and in 2.6.29 we have a pci-stub driver to prevent anything
> re-attaching to the device, so e.g.
> 
>   $> echo "8086 10f5" > /sys/bus/pci/drivers/pci-stub/new_id                                                                 
>   $> echo -n 0000:00:19.0 > /sys/bus/pci/drivers/e1000e/unbind                                                               
>   $> echo -n 0000:00:19.0 > /sys/bus/pci/drivers/pci-stub/bind                 
> 
> >  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 ..
> 
> The management app can do that validation when setting up the guest, but
> not always when starting the guest - e.g. thinking about autostarted
> guests ...

Hmm, which suggests we might want someway to persist the 'unbind' across 
reboots, so when libvirt does autostart at  boot, it'll replay all the 
unbinds.

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 :|

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]