ia64/xen-unstable

changeset 9732:14659382edd3

This patch adds a section to the documentation on the late binding
feature for PCI devices. It provides some examples (mostly stolen from
the e-mail which accompanied the late-binding patch) of how to use the
sysfs attributes for late binding.

This patch was revised from the last documentation patch that I
submitted which included this and some documentation on the permissive
flag. I've divided the two sections up and I'd like this one considered
for acceptance now while I revise the permissive flag code.

Signed-off-by: Ryan Wilson <hap9@epoch.ncsc.mil>
author kaf24@firebug.cl.cam.ac.uk
date Sat Apr 15 11:28:55 2006 +0100 (2006-04-15)
parents 1dce0d05c763
children 4613f42db780
files docs/src/user.tex
line diff
     1.1 --- a/docs/src/user.tex	Sat Apr 15 10:16:05 2006 +0100
     1.2 +++ b/docs/src/user.tex	Sat Apr 15 11:28:55 2006 +0100
     1.3 @@ -1232,8 +1232,15 @@ customized variants for your site's pref
     1.4  \subsection{PCI}
     1.5  \label{ss:pcidd}
     1.6  
     1.7 -Individual PCI devices can be assigned to a given domain to allow that
     1.8 -domain direct access to the PCI hardware. To use this functionality, ensure
     1.9 +Individual PCI devices can be assigned to a given domain (a PCI driver domain)
    1.10 +to allow that domain direct access to the PCI hardware.
    1.11 +
    1.12 +While PCI Driver Domains can increase the stability and security of a system
    1.13 +by addressing a number of security concerns, there are some security issues
    1.14 +that remain that you can read about in Section~\ref{s:ddsecurity}.
    1.15 +
    1.16 +\subsubsection{Compile-Time Setup}
    1.17 +To use this functionality, ensure
    1.18  that the PCI Backend is compiled in to a privileged domain (e.g. domain 0)
    1.19  and that the domains which will be assigned PCI devices have the PCI Frontend
    1.20  compiled in. In XenLinux, the PCI Backend is available under the Xen
    1.21 @@ -1241,21 +1248,73 @@ configuration section while the PCI Fron
    1.22  architecture-specific "Bus Options" section. You may compile both the backend
    1.23  and the frontend into the same kernel; they will not affect each other.
    1.24  
    1.25 +\subsubsection{PCI Backend Configuration - Binding at Boot}
    1.26  The PCI devices you wish to assign to unprivileged domains must be "hidden"
    1.27  from your backend domain (usually domain 0) so that it does not load a driver
    1.28  for them. Use the \path{pciback.hide} kernel parameter which is specified on
    1.29  the kernel command-line and is configurable through GRUB (see
    1.30  Section~\ref{s:configure}). Note that devices are not really hidden from the
    1.31 -backend domain. The PCI Backend ensures that no other device driver loads
    1.32 -for those devices. PCI devices are identified by hexadecimal
    1.33 -slot/funciton numbers (on Linux, use \path{lspci} to determine slot/funciton
    1.34 -numbers of your devices) and can be specified with or without the PCI domain: \\
    1.35 +backend domain. The PCI Backend appears to the Linux kernel as a regular PCI
    1.36 +device driver. The PCI Backend ensures that no other device driver loads
    1.37 +for the devices by binding itself as the device driver for those devices.
    1.38 +PCI devices are identified by hexadecimal slot/funciton numbers (on Linux,
    1.39 +use \path{lspci} to determine slot/funciton numbers of your devices) and
    1.40 +can be specified with or without the PCI domain: \\
    1.41  \centerline{  {\tt ({\em bus}:{\em slot}.{\em func})} example {\tt (02:1d.3)}} \\
    1.42  \centerline{  {\tt ({\em domain}:{\em bus}:{\em slot}.{\em func})} example {\tt (0000:02:1d.3)}} \\
    1.43  
    1.44  An example kernel command-line which hides two PCI devices might be: \\
    1.45  \centerline{ {\tt root=/dev/sda4 ro console=tty0 pciback.hide=(02:01.f)(0000:04:1d.0) } } \\
    1.46  
    1.47 +\subsubsection{PCI Backend Configuration - Late Binding}
    1.48 +PCI devices can also be bound to the PCI Backend after boot through the manual
    1.49 +binding/unbinding facilities provided by the Linux kernel in sysfs (allowing
    1.50 +for a Xen user to give PCI devices to driver domains that were not specified
    1.51 +on the kernel command-line). There are several attributes with the PCI
    1.52 +Backend's sysfs directory (\path{/sys/bus/pci/drivers/pciback}) that can be
    1.53 +used to bind/unbind devices:
    1.54 +
    1.55 +\begin{description}
    1.56 +\item[slots] lists all of the PCI slots that the PCI Backend will try to seize
    1.57 +  (or "hide" from Domain 0). A PCI slot must appear in this list before it can
    1.58 +  be bound to the PCI Backend through the \path{bind} attribute.
    1.59 +\item[new\_slot] write the name of a slot here (in 0000:00:00.0 format) to
    1.60 +  have the PCI Backend seize the device in this slot.
    1.61 +\item[remove\_slot] write the name of a slot here (same format as
    1.62 +  \path{new\_slot}) to have the PCI Backend no longer try to seize devices in
    1.63 +  this slot. Note that this does not unbind the driver from a device it has
    1.64 +  already seized.
    1.65 +\item[bind] write the name of a slot here (in 0000:00:00.0 format) to have
    1.66 +  the Linux kernel attempt to bind the device in that slot to the PCI Backend
    1.67 +  driver.
    1.68 +\item[unbind] write the name of a skit here (same format as \path{bind}) to have
    1.69 +  the Linux kernel unbind the device from the PCI Backend. DO NOT unbind a
    1.70 +  device while it is currently given to a PCI driver domain!
    1.71 +\end{description}
    1.72 +
    1.73 +Some examples:
    1.74 +
    1.75 +Bind a device to the PCI Backend which is not bound to any other driver.
    1.76 +\begin{verbatim}
    1.77 +# # Add a new slot to the PCI Backend's list
    1.78 +# echo -n 0000:01:04.d > /sys/bus/pci/drivers/pciback/new_slot
    1.79 +# # Now that the backend is watching for the slot, bind to it
    1.80 +# echo -n 0000:01:04.d > /sys/bus/pci/drivers/pciback/bind
    1.81 +\end{verbatim}
    1.82 +
    1.83 +Unbind a device from its driver and bind to the PCI Backend.
    1.84 +\begin{verbatim}
    1.85 +# # Unbind a PCI network card from its network driver
    1.86 +# echo -n 0000:05:02.0 > /sys/bus/pci/drivers/3c905/unbind
    1.87 +# # And now bind it to the PCI Backend
    1.88 +# echo -n 0000:05:02.0 > /sys/bus/pci/drivers/pciback/new_slot
    1.89 +# echo -n 0000:05:02.0 > /sys/bus/pci/drivers/pciback/bind
    1.90 +\end{verbatim}
    1.91 +
    1.92 +Note that the "-n" option in the example is important as it causes echo to not
    1.93 +output a new-line.
    1.94 +
    1.95 +\subsubsection{PCI Frontend Configuration}
    1.96  To configure a domU to receive a PCI device:
    1.97  
    1.98  \begin{description}
    1.99 @@ -1282,9 +1341,6 @@ To configure a domU to receive a PCI dev
   1.100  }
   1.101  \end{description}
   1.102  
   1.103 -There are a number of security concerns associated with PCI Driver Domains
   1.104 -that you can read about in Section~\ref{s:ddsecurity}.
   1.105 -
   1.106  %% There are two possible types of privileges: IO privileges and
   1.107  %% administration privileges.
   1.108