]> git.ipfire.org Git - thirdparty/libvirt.git/commit
Make Xen VT-d PCI attach/detach work
authorChris Lalancette <clalance@redhat.com>
Tue, 22 Dec 2009 09:53:51 +0000 (10:53 +0100)
committerDaniel Veillard <veillard@redhat.com>
Tue, 22 Dec 2009 09:53:51 +0000 (10:53 +0100)
commite9f468d3f9147349453009cdc789faaaec509d67
tree32be3a41eab1424f166a282ed48aa5c29a2fa6f7
parentc90e545f83d8536b8bf3dfb443cecb52df3339bb
Make Xen VT-d PCI attach/detach work

The Xen code for making HVM VT-d PCI passthrough attach and detach
wasn't working properly:

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.

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.

* src/xen/xend_internal.c: don't use device_destroy for PCI devices
  and fix the other issues.
* src/xen/xs_internal.c src/xen/xs_internal.h: add
  xenStoreDomainGetPCIID()
src/xen/xend_internal.c
src/xen/xs_internal.c
src/xen/xs_internal.h