Xen PCI Passthrough

From Alpine Linux
Revision as of 16:04, 6 August 2021 by Bt129 (talk | contribs)

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

First, use lspci to find the the PCI-Address of the Device you want to Passthrough:

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 this example, I want to passthrough the SAS Controller. So the Address is 01:00.0 Currently there is a bug #3609in Alpine that prevents using default Kernelparameters.

Edit /etc/modules and reboot the server:

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

After rebooting, you should be able to verify the pci-device is using the pciback Kernelmodule and that it's 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

Add the following line to your DomU's Config:

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.
You'll need to blacklist the mpt2sas module in /etc/modprobe.d/blacklist.conf and rebuild your initramfs.

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