PCI Delegation in Xen (Xen Pci Passthrough)

#!/bin/bash
 
# get pci id (for example avm isdn card)
lspci | grep AVM | cut -d " " -f1
 
# hide deivce in Dom0 (Debinan 6.0)
sed -i 's|GRUB_CMDLINE_LINUX_DEFAULT="quiet"|GRUB_CMDLINE_LINUX_DEFAULT="xen-pciback.hide=(00:09.0)(01:02.0) quiet"|g' /etc/default/grub
# xen-pciback.permissive pci=resource_alignment=00:09.0;01:02.0
#echo "GRUB_CMDLINE_XEN_DEFAULT=\"iommu=1\"" >> /etc/default/grub
update-grub
 
sed -i 's|#(pci-passthrough-strict-check yes)|(pci-passthrough-strict-check no)|g' /etc/xen/xend-config.sxp
 
 
 
reboot
 
# view hidden devices
xm pci-list-assignable-devices
 
# add device to DomU
cat <<EOF>> /etc/xen/${DOMAIN_NAME}
pci = ['00:09.0','01:02.0']
extra = 'iommu=soft swiotlb=force'
EOF
 
# OPTIONAL: configure second nic in domU
mount /dev/vg1/${DOMAIN_NAME}-disk /mnt/
cat <<EOF>> /mnt/etc/network/interfaces
auto eth1
iface eth1 inet dhcp
# post-up ethtool -K eth0 tx off
EOF
umount /mnt
 
 
# hide device in Dom0 (Debian 5.0)
vi /boot/grub/menu.lst
pciback.permissive pciback.hide=(05:00.0)(01:07.0)
 
 
# USB
# to delegate USB devices you need to delegate the PCI USB controller to the DomU
 
# LINKS
http://wiki.xen.org/xenwiki/XenPCIpassthrough
http://lubl.de/blog/2009/09/creating-a-squeeze-amd64-domu/
http://wiki.xen.org/xenwiki/VTdHowTo
http://wiki.xen.org/xenwiki/XenPCIpassthrough
http://www.neobiker.de/wiki/index.php?title=USB_in_DomU

Do you like this page? Then support it. Please click the AD below and visit the sponsor. Thank you!