[libvirt] PATCH: PCI device passthrough in Xen driver

Daniel P. Berrange berrange at redhat.com
Tue Mar 17 16:19:39 UTC 2009

On Tue, Mar 17, 2009 at 12:10:47PM -0400, Cole Robinson wrote:
> Daniel P. Berrange wrote:
> > This patch provides initial support for PCI device passthrough in
> > Xen, at time of boot. It does not (yet) implement device hotplug
> > for PCI, since it works in an annoyingly different way to device
> > hotplug of disks & nics. The patch has several aspects
> > 
> >  - Refactors the pci.c file to make it easier to support both
> >    Xen's pci-back.ko and upstream's pcistub.ko, which are almost
> >    identical
> >  - Add code to pci.c register the PCI device with 'new_slot' before
> >    invoking 'bind', since pci-back.ko wants this extra step
> >  - In xen_unified.c, add implmentations of APIs to dettach, reattach
> >    and reset PCI devices - this just calls into shared pci.c code that
> >    QEMU/KVM uses.
> >  - In xend_internal.c implement SEXPR conversion.
> >  - In xm_internal.c implement parsing of 'pci' config parameter
> >  - Add lots of test cases
> > 
> > XenD only supports 'unmanaged' PCI devices - ie mgmt app is responsible
> > for detaching/reattaching PCI devices from/to  host device drivers.
> > XenD itself won't automatically do this for us, though perhaps someone
> > might like to implement this as an optional feature for XenD, since it
> > is more convenient in some cases.
> > 
> So for 'unmanaged', virt-manager (and virsh?) would need to detach +
> reset on guest start, and reattach on guest shutdown? Or should we just
> assume that if someone is using PCI passthrough for xen, then they have
> taken necessary steps in /etc/modprobe or whatever for it all to just work.

I'd recommend assuming that its been blocked by modprobe.conf.

> Is there any reason why libvirt can't handle the 'managed' case, and
> take the same steps as it does in the qemu driver before asking xen to
> start the guest?

We can't assume that libvirt is responsible for it. eg the user starts the
guest using 'xm create', or migrates the guest to another host where libvirt
is not  in the loop.

These are annoying restrictions, which is why i'd like to try and get XenD
to be able to support the 'managed' setup natively.

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