dom0: automatically bind PCI devices to pciback at VM start (#252)

This commit is contained in:
Marek Marczykowski 2011-07-05 22:10:09 +02:00
parent 5f10e408e0
commit 0de378dafc
3 changed files with 10 additions and 1 deletions

View File

@ -27,6 +27,11 @@ if [ x$BDF = x ] ; then
fi
BDF=0000:$BDF
#echo -n "Binding device $BDF to xen-pciback..."
if [ -e /sys/bus/pci/drivers/pciback/$BDF ]; then
# Already bound to pciback
exit 0
fi
if [ -e /sys/bus/pci/devices/$BDF/driver/unbind ] ; then
echo -n $BDF > /sys/bus/pci/devices/$BDF/driver/unbind || exit 1
fi

View File

@ -41,7 +41,6 @@ start()
else
echo -n $"Starting default NetVM:"
/usr/lib/qubes/unbind_all_network_devices || exit 1
qvm-start -q --no-guid $NETVM || exit 1
fi

View File

@ -88,6 +88,7 @@ dom0_vm = None
qubes_appmenu_create_cmd = "/usr/lib/qubes/create_apps_for_appvm.sh"
qubes_appmenu_remove_cmd = "/usr/lib/qubes/remove_appvm_appmenus.sh"
qubes_pciback_cmd = '/usr/lib/qubes/unbind_pci_device.sh'
class QubesException (Exception) : pass
@ -926,6 +927,10 @@ class QubesVm(object):
qmemman_client.close()
raise MemoryError ("ERROR: insufficient memory to start this VM")
# Bind pci devices to pciback driver
for pci in self.pcidevs:
subprocess.check_call('sudo', qubes_pciback_cmd, pci)
xl_cmdline = ['sudo', '/usr/sbin/xl', 'create', self.conf_file, '-p']
try: