You are not logged in.

#1 2019-06-03 08:41:03

7thCore
Member
Registered: 2018-06-09
Posts: 75

[SOLVED] VFIO problem (pass theough 2nd nic with same ID as 1st)

I have home server set up with a virtual machine using libvirt. Due to the motherboard having two built-in intel nics and that i have spare ports on my MikroTik router  I want to pass one to the vm. Both of the nics have the same vendor id (8086:1533) but thankfully they are in their own seperate iommu groups. After looking through the wiki i found a note stating that from kernel 4.18.16 onward vfio is compiled in and I would need a initcpio hook.

So what i came up with is this:

/etc/initcpio/install/vfio

#!/bin/bash

build() {
        add_binary /usr/bin/cat
        add_runscript
}

help() {
        cat <<HELPEOF
Configure vfio
HELPEOF
}

/etc/initcpio/hooks/vfio

                                                          
#!/usr/bin/bash

GROUP="0000:00:1c.5"
DEVS="0000:02:00.0"

run_hook() {
if [ ! -z "$(ls -A /sys/class/iommu)" ]; then
        for DEV in $DEVS; do
                echo "vfio-pci" > /sys/bus/pci/devices/$GROUP/$DEV/driver_override
        done
fi
}

And then added vfio to the hooks section of /etc/mkinitcpio.conf

HOOKS=(base udev autodetect modconf block filesystems keyboard fsck vfio) 

Later I executed:

sudo mkinitcpio -p linux

After a reboot I checked on the controller with the following command:

lspci -nnk -d 8086:1533

And i got the following:

01:00.0 Ethernet controller [0200]: Intel Corporation I210 Gigabit Network Connection [8086:1533] (rev 03)
        DeviceName:  Onboard LAN
        Subsystem: ASUSTeK Computer Inc. I210 Gigabit Network Connection [1043:8557]
        Kernel driver in use: igb
        Kernel modules: igb
02:00.0 Ethernet controller [0200]: Intel Corporation I210 Gigabit Network Connection [8086:1533] (rev 03)
        DeviceName:  Onboard 1394
        Subsystem: ASUSTeK Computer Inc. I210 Gigabit Network Connection [1043:8557]
        Kernel modules: igb

Now if I'm not mistaken, shouldn't the "kernel drive in use" section (wich is missing now) for my second nic be there and say vfio-pci? There is nothing in dmesg that stands out to vfio or the nic id. I have checked the driver_override file (using cat) and it says vfio-pci. The primary nic one says (null)

Here is also the result from the iommu script from the arch wiki:

IOMMU Group 0:
        00:00.0 Host bridge [0600]: Intel Corporation Xeon E3-1200 v6/7th Gen Core Processor Host Bridge/DRAM Registers [8086:5918] (rev 05)
IOMMU Group 1:
        00:02.0 VGA compatible controller [0300]: Intel Corporation HD Graphics P630 [8086:591d] (rev 04)
IOMMU Group 2:
        00:14.0 USB controller [0c03]: Intel Corporation 100 Series/C230 Series Chipset Family USB 3.0 xHCI Controller [8086:a12f] (rev 31)
        00:14.2 Signal processing controller [1180]: Intel Corporation 100 Series/C230 Series Chipset Family Thermal Subsystem [8086:a131] (rev 31)
IOMMU Group 3:
        00:16.0 Communication controller [0780]: Intel Corporation 100 Series/C230 Series Chipset Family MEI Controller #1 [8086:a13a] (rev 31)
IOMMU Group 4:
        00:17.0 SATA controller [0106]: Intel Corporation Q170/Q150/B150/H170/H110/Z170/CM236 Chipset SATA Controller [AHCI Mode] [8086:a102] (rev 31)
IOMMU Group 5:
        00:1c.0 PCI bridge [0604]: Intel Corporation 100 Series/C230 Series Chipset Family PCI Express Root Port #5 [8086:a114] (rev f1)
IOMMU Group 6:
        00:1c.5 PCI bridge [0604]: Intel Corporation 100 Series/C230 Series Chipset Family PCI Express Root Port #6 [8086:a115] (rev f1)
IOMMU Group 7:
        00:1f.0 ISA bridge [0601]: Intel Corporation C236 Chipset LPC/eSPI Controller [8086:a149] (rev 31)
        00:1f.2 Memory controller [0580]: Intel Corporation 100 Series/C230 Series Chipset Family Power Management Controller [8086:a121] (rev 31)
        00:1f.3 Audio device [0403]: Intel Corporation 100 Series/C230 Series Chipset Family HD Audio Controller [8086:a170] (rev 31)
        00:1f.4 SMBus [0c05]: Intel Corporation 100 Series/C230 Series Chipset Family SMBus [8086:a123] (rev 31)
IOMMU Group 8:
        01:00.0 Ethernet controller [0200]: Intel Corporation I210 Gigabit Network Connection [8086:1533] (rev 03)
IOMMU Group 9:
        02:00.0 Ethernet controller [0200]: Intel Corporation I210 Gigabit Network Connection [8086:1533] (rev 03)

Last edited by 7thCore (2019-06-03 13:36:39)


The Linux philosophy is 'Laugh in the face of danger'. Oops. Wrong One. 'Do it yourself'. Yes, that's it.

Offline

#2 2019-06-03 11:04:19

bugsmanagement
Member
Registered: 2017-04-21
Posts: 201

Re: [SOLVED] VFIO problem (pass theough 2nd nic with same ID as 1st)

Hello There!

7thCore wrote:

Now if I'm not mistaken, shouldn't the "kernel drive in use" section (wich is missing now) for my second nic be there and say vfio-pci? There is nothing in dmesg that stands out to vfio or the nic id. I have checked the driver_override file (using cat) and it says vfio-pci. The primary nic one says (null)

PCI Passthrough? It would never say 'Kernel in use'? It will disappear, if it's a properly coded driver, which is often nic devices. You gave a lot information but the guest didn't detect the nic? Dmesg of the guest? Libvirt XML?

Cheers

Offline

#3 2019-06-03 13:36:21

7thCore
Member
Registered: 2018-06-09
Posts: 75

Re: [SOLVED] VFIO problem (pass theough 2nd nic with same ID as 1st)

Well this is akward... Never thought to check the guest dmesg. I was used to the module vfio from back in the day for passing through a second gpu.

Yes it is detected and it works. Thanks and sorry for wasting your time.

Last edited by 7thCore (2019-06-03 13:37:35)


The Linux philosophy is 'Laugh in the face of danger'. Oops. Wrong One. 'Do it yourself'. Yes, that's it.

Offline

Board footer

Powered by FluxBB