Assign hardware to DomU with PCIBack as module [Update]

If the Dom0’s kernel is built with pciback as a module (grep CONFIG_XEN_PCIDEV_BACKEND /boot/config-`uname -r`), using the kernel command-line parameter pciback.hide won’t work.

There is of course more than solution how you can assign hardware to a domU, but the probably easiest one is to to pass the hide parameter to the pciback module in /etc/modprobe.conf:

 # hide (0000:05:02.0)
 options pciback hide=(0000:05:02.0)

The xensouce mailing list even tells you how to modify your initrd preloading the pciback driver before all others

# mkinitrd -f --preload=pciback /boot/initrd-$(uname -r).img $(uname -r)

Another (maybe more elegant) solution would be assigning the pci devices in a separate init script:

Update: If you want to avoid rebuilding the initial ramdisk manually every time you update your kernel, you may want to put this small script to your /etc/rc.local

/sbin/modprobe pciback
# Unbind a PCI function from its driver as necessary
[ ! -e /sys/bus/pci/devices/$BDF/driver/unbind ] || \
        echo -n $BDF > /sys/bus/pci/devices/$BDF/driver/unbind
# Add a new slot to the PCI Backend's list
echo -n $BDF > /sys/bus/pci/drivers/pciback/new_slot
# Now that the backend is watching for the slot, bind to it
echo -n $BDF > /sys/bus/pci/drivers/pciback/bind

With the preceding modprobe pciback the module doesn’t have to be preloaded in you initial ramdisk.

1 thought on “Assign hardware to DomU with PCIBack as module [Update]

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.