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

Chris Lalancette clalance at redhat.com
Fri Dec 11 16:33:15 UTC 2009

     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>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libvirt-xen-vtd-pci-passthrough.patch
Type: text/x-diff
Size: 8145 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20091211/5d62de77/attachment-0001.bin>

More information about the libvir-list mailing list