Xen PCI Passthrough

From Alpine Linux
Revision as of 02:15, 20 January 2015 by Tze (talk | contribs)

This guide is to show how to configure PCI Passthrough on Alpine.

First use lspci to find out what PCI-Address the Device that you want to Passthrough has:

node03:~# lspci
00:00.0 Host bridge: Intel Corporation Xeon E3-1200 Processor Family DRAM Controller (rev 09)
00:19.0 Ethernet controller: Intel Corporation 82579LM Gigabit Network Connection (rev 05)
00:1a.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #2 (rev 05)
00:1c.0 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 1 (rev b5)
00:1c.4 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 5 (rev b5)
00:1d.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #1 (rev 05)
00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev a5)
00:1f.0 ISA bridge: Intel Corporation C204 Chipset Family LPC Controller (rev 05)
00:1f.2 SATA controller: Intel Corporation 6 Series/C200 Series Chipset Family SATA AHCI Controller (rev 05)
00:1f.3 SMBus: Intel Corporation 6 Series/C200 Series Chipset Family SMBus Controller (rev 05)
01:00.0 Serial Attached SCSI controller: LSI Logic / Symbios Logic SAS2008 PCI-Express Fusion-MPT SAS-2 [Falcon] (rev 03)
02:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection
03:03.0 VGA compatible controller: Matrox Electronics Systems Ltd. MGA G200eW WPCM450 (rev 0a)

In my case i want to passthrough the SAS Controller so the Address is 01:00.0 Currently there is a bug #3609in Alpine due to which we can't use the Default way to use Kernelparameters for it.

Edit /etc/modules and reboot the server:

node03:~# grep pciback /etc/modules 
xen_pciback hide=(01:00.0)

After a reboot you should be able to see that the pci-device is using the pciback Kernelmodule and should be visible to passthrough via xl:

node03:~# lspci -k | grep -A2 '01:00.0'
01:00.0 Serial Attached SCSI controller: LSI Logic / Symbios Logic SAS2008 PCI-Express Fusion-MPT SAS-2 [Falcon] (rev 03)
        Subsystem: LSI Logic / Symbios Logic Device 3020
        Kernel driver in use: pciback
node03:~# xl pci-assignable-list
0000:01:00.0

Now just add a line to your DomU's Config and everything should be fine.

pci = [ '01:00.0' ]

Known Issue with LSI Controllers

As the Kernelmodule for LSI Controllers is built into the Alpine Initramfs, the real Module is loaded before the pciback Module can be assigned. Just blacklist the mpt2sas module in /etc/modprobe.d/blacklist.conf and rebuilt your initramfs.

node03:~# grep sas /etc/modprobe.d/blacklist.conf 
blacklist mpt2sas
node03:~# mkinitfs 
==> initramfs: creating /boot/initramfs-grsec
11538 blocks
33641 blocks