[libvirt] [PATCH]: Make Xen VT-d PCI attach/detach work

Daniel Veillard veillard at redhat.com
Mon Dec 21 15:30:33 UTC 2009

On Fri, Dec 11, 2009 at 05:33:15PM +0100, Chris Lalancette wrote:
> All,
>      The Xen code for making HVM VT-d PCI passthrough attach and detach is
> currently not properly working.  There are 2 problems:
> 1)  In xenDaemonAttachDevice(), we were always trying to reconfigure
> a PCI passthrough device, even the first time we added it.  This was
> because the code in virDomainXMLDevID() was not checking xenstore for
> the existence of the device, and always returning 0 (meaning that
> the device already existed).
> 2)  In xenDaemonDetachDevice(), we were trying to use "device_destroy"
> to detach a PCI device.  While you would think that is the right
> method to call, it's actually wrong for PCI devices.  In particular,
> in upstream Xen (and soon in RHEL-5 Xen), device_configure is actually
> used to destroy a PCI device.
> The attached patch fixes both of these problems.  To fix the attach
> problem I add a lookup into xenstore to see if the device we are
> trying to attach already exists.  To fix the detach problem I change
> it so that for PCI detach (only), we use device_configure with the
> appropriate sxpr to do the detachment.
> Tested by me on RHEL-5 on a VT-d capable machine, and, in combination
> with the RHEL-5 xen patch, fixes the problem for me in testing.
> (note: this solves https://bugzilla.redhat.com/show_bug.cgi?id=546671)
> Signed-off-by: Chris Lalancette <clalance at redhat.com>

  Okay, not trivial to debug and test, looks fine to me, ACK, pushed,


Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

More information about the libvir-list mailing list