next up previous contents
Next: PCI Backend Configuration - Up: PCI Previous: PCI Backend Configuration -   Contents

PCI Backend Configuration - Late Binding

PCI devices can also be bound to the PCI Backend after boot through the manual binding/unbinding facilities provided by the Linux kernel in sysfs (allowing for a Xen user to give PCI devices to driver domains that were not specified on the kernel command-line). There are several attributes with the PCI Backend's sysfs directory (/sys/bus/pci/drivers/pciback) that can be used to bind/unbind devices:

slots
lists all of the PCI slots that the PCI Backend will try to seize (or "hide" from Domain 0). A PCI slot must appear in this list before it can be bound to the PCI Backend through the bind attribute.
new_slot
write the name of a slot here (in 0000:00:00.0 format) to have the PCI Backend seize the device in this slot.
remove_slot
write the name of a slot here (same format as new_slot) to have the PCI Backend no longer try to seize devices in this slot. Note that this does not unbind the driver from a device it has already seized.
bind
write the name of a slot here (in 0000:00:00.0 format) to have the Linux kernel attempt to bind the device in that slot to the PCI Backend driver.
unbind
write the name of a skit here (same format as bind) to have the Linux kernel unbind the device from the PCI Backend. DO NOT unbind a device while it is currently given to a PCI driver domain!

Some examples:

Bind a device to the PCI Backend which is not bound to any other driver.

# # Add a new slot to the PCI Backend's list
# echo -n 0000:01:04.d > /sys/bus/pci/drivers/pciback/new_slot
# # Now that the backend is watching for the slot, bind to it
# echo -n 0000:01:04.d > /sys/bus/pci/drivers/pciback/bind

Unbind a device from its driver and bind to the PCI Backend.

# # Unbind a PCI network card from its network driver
# echo -n 0000:05:02.0 > /sys/bus/pci/drivers/3c905/unbind
# # And now bind it to the PCI Backend
# echo -n 0000:05:02.0 > /sys/bus/pci/drivers/pciback/new_slot
# echo -n 0000:05:02.0 > /sys/bus/pci/drivers/pciback/bind

Note that the "-n" option in the example is important as it causes echo to not output a new-line.


next up previous contents
Next: PCI Backend Configuration - Up: PCI Previous: PCI Backend Configuration -   Contents
root 2006-12-15