Changes between Version 21 and Version 22 of xen


Ignore:
Timestamp:
Feb 23, 2008, 6:13:34 PM (10 years ago)
Author:
jrollins
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • xen

    v21 v22  
    8888If you're on the dom0, and you've attached to the virtual console of a domU with `xm console domUname` , you can detach from the console just as if you were detaching from an old-school telnet session.  Use `Ctrl+]`
    8989
     90=== passing pci devices to a domU ===
     91
     92Debian xen has built in support for passing pci devices to domU using the "pciback" module.  The following xen kernel config options are enabled by default:
     93{{{
     94CONFIG_XEN_PCIDEV_FRONTEND=y (for DomU kernels)
     95CONFIG_XEN_PCIDEV_BACKEND=y (for Dom0 kernels)
     96}}}
     97
     98You have to first find the pci device id of the devices you want to pass to the domU.  This is most easily done with '''lspci'''.  The id is given in the first column, usually of form "bus:slot.func" (eg. "00:0a.0"), refered to as "PCIDEV?" below.  Sometimes the device needs to be referred to by it's full address form "domain:bus:slot.func" (eg. "0000:00:0a.0"), referred to as "DPCIDEV?" below.
     99
     100Before passing a pci device to a domU, it must first be hidden from dom0.  You can remove the pci devices manually from the dom0 kernel:
     101{{{
     102# remove the device from the kernel module controlling it
     103DRIVER=$(dirname $(find /sys/bus/pci/drivers -iname "$PCIDEV"))
     104echo -n $DPCIDEV > "$DRIVER"/unbind
     105}}}
     106and then add the devices to to the pciback list:
     107{{{
     108echo -n $DPCIDEV > /sys/bus/pci/drivers/pciback/new_slot
     109echo -n $DPCIDEV > /sys/bus/pci/drivers/pciback/bind
     110}}}
     111To have this happen automatially at boot, first tell the dom0 initramfs to include the "pciback" module.  On Debian, this is easily done by adding "pciback" to /etc/initramfs-tools/modules and then updating the initramfs:
     112{{{
     113echo pciback >> /etc/initramfs-tools/modules
     114update-initramfs -u -k $(uname -r)
     115}}}
     116There are pciback kernel parameters that tell the kernel which pci devices to ignore.  With GRUB, this is best done by adding the needed parameters to the "xenkopt" config line in the grub menu.lst:
     117{{{
     118## Xen Linux kernel options to use with the default Xen boot option               
     119# xenkopt=pciback.permissive pciback.hide=(PCIDEV0 PCIDEV1 ...) pciback.verbose_request=1
     120}}}
     121Don't forget to run '''update-grub'''.  Reboot the machine and make sure the changes take effect. 
     122
     123Now add the pci devices to the domU config with a "pci=[...]" line:
     124{{{
     125pci=['PCIDEV0', 'PCIDEV1', ...]
     126}}}
     127After creating the domU, lspci should show the passed through devices.
     128
     129references:
     130 * [http://www.wlug.org.nz/XenPciPassthrough]
     131 * [http://www.novell.com/communities/node/2880/assign-dedicated-network-card-or-pci-device-xen-virtual-machine]
     132
    90133== upgrading kernels on Xen instances ==
    91134