WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] PCI Backend - Late Binding

To: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] PCI Backend - Late Binding
From: Ryan <hap9@xxxxxxxxxxxxxx>
Date: Wed, 22 Mar 2006 19:32:40 -0500
Delivery-date: Thu, 23 Mar 2006 00:34:13 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Attached to this e-mail are patches which provide support for late
binding of PCI devices to the PCI backend driver in dom0. This allows
you to bind devices to the backend driver *after* dom0 has booted. You
are no longer required to specify the devices to hide on the kernel
command-line. Using the bind/unbind driver attributes
(see /sys/bus/pci/drivers/pciback), you can specify which devices that
the PCI backend will seize. There are three new driver attributes in
that directory:

slots       - lists all of the PCI slots that
              the PCI backend will try to seize
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 to have
              the PCI Backend no longer try to seize a
              device in this slot

Note that writing to new_slot/remove_slot does not actually change
whether the PCI Backend is actually bound to the device in that slot or
not. Instead, it tells the PCI backend which slots it should be
interested in. The sysfs attributes "bind" and "unbind" (which are
common to all drivers, not just the PCI Backend) must be used to
actually add or remove a device from the PCI backend driver. Note that
the syntax for specifying a device to bind and unbind is very strict (do
not append a newline).

For Example:

# 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 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


Unfortunately, Linux makes it possible to remove (unbind) a PCI device
from the PCI backend while that device is attached to a driver domain.
It is also possible to unload the PCI Backend module while a PCI
Frontend is attached. DON'T DO EITHER OF THESE ACTIONS. This patch will
output warnings if you do try and do these. Be aware that while access
to the configuration space of the device has been revoked, the driver
domain can still access the I/O resources of the device as they have not
been revoked (although I *hope* to explore adding support for this
soon). Before unloading the module or unbinding a device, shutdown your
driver domain.

These patches also convert a few function and variable declarations to
static (no sense in polluting the global namespace with local function
names) and rename a few structures in drivers/xen/pciback/pci_stub.c.

device_bind.patch patches a Linux bug in the driver core in regards to
the bind sysfs driver attribute. I've submitted this to lkml, but it
should be included in Xen now for people who will use this late binding
capability.

Signed-off-by: Ryan Wilson <hap9@xxxxxxxxxxxxxx>

Attachment: device_bind.patch
Description: Text Data

Attachment: pci-late-binding.patch
Description: Text Data

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel