aufbau

meine config

#!/bin/bash

configfile=/etc/vfio-pci1.cfg

vfiobind() {
    dev="$1"
        vendor=$(cat /sys/bus/pci/devices/$dev/vendor)
        device=$(cat /sys/bus/pci/devices/$dev/device)
        if [ -e /sys/bus/pci/devices/$dev/driver ]; then
                echo $dev > /sys/bus/pci/devices/$dev/driver/unbind
        fi
        echo $vendor $device > /sys/bus/pci/drivers/vfio-pci/new_id
   
}

modprobe vfio-pci

cat $configfile | while read line;do
    echo $line | grep ^# >/dev/null 2>&1 && continue
        vfiobind $line
done

sudo qemu-system-x86_64 -enable-kvm \
-m 8192 \
-M q35 \
-cpu host,kvm=off \
-smp 4,sockets=1,cores=4,threads=1 \
-vga none \
-vnc none \
-device ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1 \
-device vfio-pci,host=04:00.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on \
-device vfio-pci,host=04:00.1,bus=root.1,addr=00.1 \
-drive file=/home/joachim/en_windows_7_professional_x64_dvd_X15-65805.iso,id=isocd -device ide-cd,bus=ide.1,drive=isocd \
-drive file=/var/lib/libvirt/images/win7.qcow2,format=qcow2,id=hdd -device ide-hd,bus=ide.0,drive=hdd \
-bios /usr/share/seabios/bios.bin \
-soundhw ac97 
#-boot d

#-vnc none \
#-device vfio-pci,host=04:00.0,x-vga=on \
#-device vfio-pci,host=04:00.1 \

#-vga none \
#-rtc base=localtime \
#-device pci-assign,host=04:00.0 \
#-device pci-assign,host=01:00.1 \

#menu=on 
#-smp 2,sockets=1,cores=2,threads=1 \
#-device vfio-pci,host=04:00.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on \
#-device vfio-pci,host=04:00.0,bus=root.1,addr=00.0,x-vga=on \
#-device vfio-pci,host=04:00.0,bus=root.1,addr=00.0,x-vga=on \
#-device vfio-pci,host=04:00.1,bus=root.1,addr=00.1 \
#-bios  /usr/share/seabios/bios.bin -vga none \

exit 0

bug

[  960.145002] vgaarb: device changed decodes: PCI:0000:00:02.0,olddecodes=none,decodes=io+mem:owns=none
[  966.574858] pci 0000:04:00.0: [10de:1183] type 00 class 0x030000
[  966.574892] pci 0000:04:00.0: reg 0x10: [mem 0x00000000-0x00ffffff]
[  966.574921] pci 0000:04:00.0: reg 0x14: [mem 0x00000000-0x07ffffff 64bit pref]
[  966.574950] pci 0000:04:00.0: reg 0x1c: [mem 0x00000000-0x01ffffff 64bit pref]
[  966.574963] pci 0000:04:00.0: reg 0x24: [io  0x0000-0x007f]
[  966.574974] pci 0000:04:00.0: reg 0x30: [mem 0x00000000-0x0007ffff pref]
[  966.575224] vgaarb: device added: PCI:0000:04:00.0,decodes=io+mem,owns=none,locks=none
[  966.575227] vgaarb: device changed decodes: PCI:0000:00:02.0,olddecodes=io+mem,decodes=none:owns=none
[  966.575327] pci 0000:04:00.1: [10de:0e0a] type 00 class 0x040300
[  966.575356] pci 0000:04:00.1: reg 0x10: [mem 0x00000000-0x00003fff]
[  966.998345] pci 0000:04:00.0: BAR 1: no space for [mem size 0x08000000 64bit pref]
[  966.998350] pci 0000:04:00.0: BAR 1: failed to assign [mem size 0x08000000 64bit pref]
[  966.998353] pci 0000:04:00.0: BAR 3: no space for [mem size 0x02000000 64bit pref]
[  966.998355] pci 0000:04:00.0: BAR 3: failed to assign [mem size 0x02000000 64bit pref]
[  966.998357] pci 0000:04:00.0: BAR 0: no space for [mem size 0x01000000]
[  966.998358] pci 0000:04:00.0: BAR 0: failed to assign [mem size 0x01000000]
[  966.998360] pci 0000:04:00.0: BAR 6: assigned [mem 0xf1400000-0xf147ffff pref]
[  966.998363] pci 0000:04:00.1: BAR 0: assigned [mem 0xf1480000-0xf1483fff]
[  966.998369] pci 0000:04:00.1: BAR 0: error updating (0xf1480000 != 0xffffffff)
[  966.998373] pci 0000:04:00.0: BAR 5: assigned [io  0x3000-0x307f]
[  966.998379] pci 0000:04:00.0: BAR 5: error updating (0x003001 != 0xffffffff)
[  966.998392] pcieport 0000:00:1c.2: Max Payload Size set to  128/ 128 (was  128), Max Read Rq  128
[  966.998403] pci 0000:04:00.0: Max Payload Size set to 16384/ 256 (was 16384), Max Read Rq 16384
[  966.998414] pci 0000:04:00.1: Max Payload Size set to 16384/ 256 (was 16384), Max Read Rq 16384
[  966.998472] pci-stub 0000:04:00.0: claimed by stub
[  966.998495] pci-stub 0000:04:00.1: claimed by stub
[  967.099040] pcieport 0000:00:1c.2: Max Payload Size set to  128/ 128 (was  128), Max Read Rq  128
[  967.099059] pci-stub 0000:04:00.0: Max Payload Size set to  128/ 256 (was  128), Max Read Rq  512
[  967.099075] pci-stub 0000:04:00.1: Max Payload Size set to  128/ 256 (was  128), Max Read Rq  512
[ 2148.246011] systemd-logind[1025]: New session c3 of user lightdm.
[ 6056.285984] systemd-logind[1025]: New session c4 of user lightdm.
[ 7735.938854] vgaarb: device changed decodes: PCI:0000:00:02.0,olddecodes=none,decodes=io+mem:owns=none

from linux-pci@vger.kernel.org i got this feedback:

Yes.  If we can't assign resources to the BARs, we can't enable the
device.  If you boot with "pci=realloc", Linux will try harder to
assign space (including moving other devices to make space if
necessary).

> i've seen that the
> laptop will hang on boot if the eGPU is powered on system startup.

It's possible the BIOS is hanging because it tried to assign space for
the eGPU but failed.

> i can
> see the adapter after hotplugging it using lspci and i never see an
> image on the external display.

The device will appear in lspci even if we can't assign space for it.
In that case the device would not work, even though it appears in
lspci.

So please try "pci=realloc".  Also, please collect a complete dmesg
log and "lspci -vv" output (with eGPU attached).  That will contain
the information needed to see whether it's possible even in principle
to make this work.


debugging using pci=realloc (without pci=pcie_bus_safe)

cat /proc/cmdline BOOT_IMAGE=/boot/vmlinuz-3.18.0-031800-generic root=UUID=57de6450-f543-4e05-9660-e51c59844ce6 ro intel_iommu=on vfio_iommu_type1.allow_unsafe_interrupts=1 pciehp.pciehp_debug=1 pci_hotplug.debug_acpi=1 pci=realloc


POWERING THE DEVICE
[  111.609152] pci 0000:04:00.0: [10de:1183] type 00 class 0x030000
[  111.609184] pci 0000:04:00.0: reg 0x10: [mem 0x00000000-0x00ffffff]
[  111.609204] pci 0000:04:00.0: reg 0x14: [mem 0x00000000-0x07ffffff 64bit pref]
[  111.609232] pci 0000:04:00.0: reg 0x1c: [mem 0x00000000-0x01ffffff 64bit pref]
[  111.609248] pci 0000:04:00.0: reg 0x24: [io  0x0000-0x007f]
[  111.609265] pci 0000:04:00.0: reg 0x30: [mem 0x00000000-0x0007ffff pref]
[  111.609523] vgaarb: device added: PCI:0000:04:00.0,decodes=io+mem,owns=none,locks=none
[  111.609525] vgaarb: device changed decodes: PCI:0000:00:02.0,olddecodes=io+mem,decodes=none:owns=io+mem
[  111.609633] pci 0000:04:00.1: [10de:0e0a] type 00 class 0x040300
[  111.609665] pci 0000:04:00.1: reg 0x10: [mem 0x00000000-0x00003fff]
[  112.031787] pci 0000:04:00.0: BAR 1: no space for [mem size 0x08000000 64bit pref]
[  112.031795] pci 0000:04:00.0: BAR 1: failed to assign [mem size 0x08000000 64bit pref]
[  112.031798] pci 0000:04:00.0: BAR 3: no space for [mem size 0x02000000 64bit pref]
[  112.031800] pci 0000:04:00.0: BAR 3: failed to assign [mem size 0x02000000 64bit pref]
[  112.031803] pci 0000:04:00.0: BAR 0: no space for [mem size 0x01000000]
[  112.031805] pci 0000:04:00.0: BAR 0: failed to assign [mem size 0x01000000]
[  112.031807] pci 0000:04:00.0: BAR 6: assigned [mem 0xf1400000-0xf147ffff pref]
[  112.031810] pci 0000:04:00.1: BAR 0: assigned [mem 0xf1480000-0xf1483fff]
[  112.031819] pci 0000:04:00.1: BAR 0: error updating (0xf1480000 != 0xffffffff)
[  112.031822] pci 0000:04:00.0: BAR 5: assigned [io  0x3000-0x307f]
[  112.031828] pci 0000:04:00.0: BAR 5: error updating (0x003001 != 0xffffffff)
[  112.031835] pci 0000:04:00.0: Max Payload Size 16384, but upstream 0000:00:1c.2 set to 128; if necessary, use "pci=pcie_bus_safe" and report a bug
[  112.031840] pci 0000:04:00.1: Max Payload Size 16384, but upstream 0000:00:1c.2 set to 128; if necessary, use "pci=pcie_bus_safe" and report a bug
[  112.031906] pci-stub 0000:04:00.0: claimed by stub
[  112.031931] pci-stub 0000:04:00.1: claimed by stub
[  145.452343] vfio-pci 0000:04:00.0: enabling device (0000 -> 0001)
[  145.452803] vfio_ecap_init: 0000:04:00.0 hiding ecap 0x19@0x900
[  145.456616] vfio-pci 0000:04:00.1: enabling device (0000 -> 0002)

dmesg

debugging using pci=realloc (with pci=pcie_bus_safe)



[  125.848153] pci 0000:04:00.0: [10de:1183] type 00 class 0x030000
[  125.848190] pci 0000:04:00.0: reg 0x10: [mem 0x00000000-0x00ffffff]
[  125.848208] pci 0000:04:00.0: reg 0x14: [mem 0x00000000-0x07ffffff 64bit pref]
[  125.848230] pci 0000:04:00.0: reg 0x1c: [mem 0x00000000-0x01ffffff 64bit pref]
[  125.848241] pci 0000:04:00.0: reg 0x24: [io  0x0000-0x007f]
[  125.848258] pci 0000:04:00.0: reg 0x30: [mem 0x00000000-0x0007ffff pref]
[  125.848511] vgaarb: device added: PCI:0000:04:00.0,decodes=io+mem,owns=none,locks=none
[  125.848514] vgaarb: device changed decodes: PCI:0000:00:02.0,olddecodes=io+mem,decodes=none:owns=io+mem
[  125.848610] pci 0000:04:00.1: [10de:0e0a] type 00 class 0x040300
[  125.848647] pci 0000:04:00.1: reg 0x10: [mem 0x00000000-0x00003fff]
[  126.270547] pci 0000:04:00.0: BAR 1: no space for [mem size 0x08000000 64bit pref]
[  126.270552] pci 0000:04:00.0: BAR 1: failed to assign [mem size 0x08000000 64bit pref]
[  126.270555] pci 0000:04:00.0: BAR 3: no space for [mem size 0x02000000 64bit pref]
[  126.270557] pci 0000:04:00.0: BAR 3: failed to assign [mem size 0x02000000 64bit pref]
[  126.270559] pci 0000:04:00.0: BAR 0: no space for [mem size 0x01000000]
[  126.270561] pci 0000:04:00.0: BAR 0: failed to assign [mem size 0x01000000]
[  126.270563] pci 0000:04:00.0: BAR 6: assigned [mem 0xf1400000-0xf147ffff pref]
[  126.270566] pci 0000:04:00.1: BAR 0: assigned [mem 0xf1480000-0xf1483fff]
[  126.270572] pci 0000:04:00.1: BAR 0: error updating (0xf1480000 != 0xffffffff)
[  126.270575] pci 0000:04:00.0: BAR 5: assigned [io  0x3000-0x307f]
[  126.270583] pci 0000:04:00.0: BAR 5: error updating (0x003001 != 0xffffffff)
[  126.270596] pcieport 0000:00:1c.2: Max Payload Size set to  128/ 128 (was  128), Max Read Rq  128
[  126.270606] pci 0000:04:00.0: Max Payload Size set to 16384/ 256 (was 16384), Max Read Rq 16384
[  126.270616] pci 0000:04:00.1: Max Payload Size set to 16384/ 256 (was 16384), Max Read Rq 16384
[  126.270678] pci-stub 0000:04:00.0: claimed by stub
[  126.270713] pci-stub 0000:04:00.1: claimed by stub
[  126.372215] pcieport 0000:00:1c.2: Max Payload Size set to  128/ 128 (was  128), Max Read Rq  128
[  126.372234] pci-stub 0000:04:00.0: Max Payload Size set to  128/ 256 (was  128), Max Read Rq  512
[  126.372246] pci-stub 0000:04:00.1: Max Payload Size set to  128/ 256 (was  128), Max Read Rq  512


dmesg

lspci -vv

lspci -xx

Powered by MediaWiki