You are not logged in.

#1 2020-03-24 10:10:01

Utini
Member
Registered: 2015-09-28
Posts: 452
Website

Thinkpad X1E: GPU Passthrough - Win10 NVIDIA Adapter shows Code 31

Hello everyone,

I am currently trying to get a GPU passthrough with QEMU/KVM/Libvirt/Virt-Manager to work on my Thinkpad X1 Extreme with also bumblebee installed on the host.
The Windows 10 installation is the 2nd NVME SSD in my laptop which I used as dual booting so far.

So far I can:
- Boot Arch with a normal bumblebee setup
- Isolate the nvidia gpu on the fly without rebooting
- Pass it through to the VM
- Boot VM and use VM
- Shutdown the VM
- Remove the isolation / unbind the nvidia gpu on the fly without rebooting
- Use bumblebee again on my host

How ever, inside my Windows 10 VM I get a "Microsoft Basic Display Adapter" which shows "Code 31".
The programm "Speccy" on Windows 10 lists my NVIDIA adapter as graphic adapter named as "Microsoft Basic Display Adapter".
Meaning my NVIDIA card isn't detected as NVIDIA by Windows 10.

Here are all the information I could think off that would help. Let me know if I should provide more:

Host: Thinkpad X1 Extreme, Kernel: x86_64 Linux 5.5.11.a-1-hardened
Guest: Windows 10 Home (2nd SSD, used for dual booting as well)
Host CPU: i7-8850H
Host GPU: iGPU + NVIDIA GTX1050Ti Max-Q
Host RAM: 32GB
Host SSD: 1TB Samsung 970 Pro
Guest SSD: Intel NVME SSD (passed through)

Display Adapters - Microsoft Basic Display Adapter -> Code 31
Other devices -> SCSI Controller -> Code 28 (update: fixed that one by selecting VirtIO Model in Virt-manager)
Other devices -> Unknown device -> Code 28
System decides -> High Definition Audio Controller -> Code 10
... there is a 2nd working "High Definition Audio Controller" though.
Screenshot: http://files.bestmail.ws/device-manager.JPG

My XML in virt-manager:

<domain type="kvm">
  <name>win10</name>
  <uuid>e31f67e9-5929-46e0-a0a9-2789168a5855</uuid>
  <metadata>
    <libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
      <libosinfo:os id="http://microsoft.com/win/10"/>
    </libosinfo:libosinfo>
  </metadata>
  <memory unit="KiB">16778240</memory>
  <currentMemory unit="KiB">16777216</currentMemory>
  <vcpu placement="static">10</vcpu>
  <cputune>
    <vcpupin vcpu="0" cpuset="1"/>
    <vcpupin vcpu="1" cpuset="2"/>
    <vcpupin vcpu="2" cpuset="3"/>
    <vcpupin vcpu="3" cpuset="4"/>
    <vcpupin vcpu="4" cpuset="5"/>
    <vcpupin vcpu="5" cpuset="7"/>
    <vcpupin vcpu="6" cpuset="8"/>
    <vcpupin vcpu="7" cpuset="9"/>
    <vcpupin vcpu="8" cpuset="10"/>
    <vcpupin vcpu="9" cpuset="11"/>
  </cputune>
  <os>
    <type arch="x86_64" machine="pc-q35-4.2">hvm</type>
    <loader readonly="yes" type="pflash">/usr/share/ovmf/x64/OVMF_CODE.fd</loader>
    <nvram template="/usr/share/ovmf/x64/OVMF_VARS.fd">/var/lib/libvirt/qemu/nvram/win10_VARS.fd</nvram>
    <bootmenu enable="no"/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <hyperv>
      <relaxed state="on"/>
      <vapic state="on"/>
      <spinlocks state="on" retries="8191"/>
      <vendor_id state="on" value="1298dr7"/>
    </hyperv>
    <kvm>
      <hidden state="on"/>
    </kvm>
    <vmport state="off"/>
  </features>
  <cpu mode="host-passthrough" check="none">
    <topology sockets="1" cores="5" threads="2"/>
    <cache mode="passthrough"/>
    <feature policy="require" name="topoext"/>
  </cpu>
  <clock offset="localtime">
    <timer name="rtc" tickpolicy="catchup"/>
    <timer name="pit" tickpolicy="delay"/>
    <timer name="hpet" present="no"/>
    <timer name="hypervclock" present="yes"/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <pm>
    <suspend-to-mem enabled="no"/>
    <suspend-to-disk enabled="no"/>
  </pm>
  <devices>
    <emulator>/usr/bin/qemu-system-x86_64</emulator>
    <controller type="usb" index="0" model="qemu-xhci" ports="15">
      <address type="pci" domain="0x0000" bus="0x02" slot="0x00" function="0x0"/>
    </controller>
    <controller type="sata" index="0">
      <address type="pci" domain="0x0000" bus="0x00" slot="0x1f" function="0x2"/>
    </controller>
    <controller type="pci" index="0" model="pcie-root"/>
    <controller type="pci" index="1" model="pcie-root-port">
      <model name="pcie-root-port"/>
      <target chassis="1" port="0x10"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x0" multifunction="on"/>
    </controller>
    <controller type="pci" index="2" model="pcie-root-port">
      <model name="pcie-root-port"/>
      <target chassis="2" port="0x11"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x1"/>
    </controller>
    <controller type="pci" index="3" model="pcie-root-port">
      <model name="pcie-root-port"/>
      <target chassis="3" port="0x12"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x2"/>
    </controller>
    <controller type="pci" index="4" model="pcie-root-port">
      <model name="pcie-root-port"/>
      <target chassis="4" port="0x13"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x3"/>
    </controller>
    <controller type="pci" index="5" model="pcie-root-port">
      <model name="pcie-root-port"/>
      <target chassis="5" port="0x14"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x4"/>
    </controller>
    <controller type="pci" index="6" model="pcie-root-port">
      <model name="pcie-root-port"/>
      <target chassis="6" port="0x15"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x5"/>
    </controller>
    <controller type="pci" index="7" model="pcie-to-pci-bridge">
      <model name="pcie-pci-bridge"/>
      <address type="pci" domain="0x0000" bus="0x05" slot="0x00" function="0x0"/>
    </controller>
    <controller type="pci" index="8" model="pcie-root-port">
      <model name="pcie-root-port"/>
      <target chassis="8" port="0x16"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x6"/>
    </controller>
    <controller type="pci" index="9" model="pcie-root-port">
      <model name="pcie-root-port"/>
      <target chassis="9" port="0x17"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x7"/>
    </controller>
    <controller type="virtio-serial" index="0">
      <address type="pci" domain="0x0000" bus="0x03" slot="0x00" function="0x0"/>
    </controller>
    <controller type="scsi" index="0" model="lsilogic">
      <address type="pci" domain="0x0000" bus="0x07" slot="0x01" function="0x0"/>
    </controller>
    <interface type="network">
      <mac address="52:54:00:13:9c:94"/>
      <source network="default"/>
      <model type="virtio"/>
      <link state="up"/>
      <address type="pci" domain="0x0000" bus="0x01" slot="0x00" function="0x0"/>
    </interface>
    <serial type="pty">
      <target type="isa-serial" port="0">
        <model name="isa-serial"/>
      </target>
    </serial>
    <console type="pty">
      <target type="serial" port="0"/>
    </console>
    <channel type="spicevmc">
      <target type="virtio" name="com.redhat.spice.0"/>
      <address type="virtio-serial" controller="0" bus="0" port="1"/>
    </channel>
    <input type="tablet" bus="usb">
      <address type="usb" bus="0" port="1"/>
    </input>
    <input type="mouse" bus="ps2"/>
    <input type="keyboard" bus="ps2"/>
    <graphics type="spice" autoport="yes">
      <listen type="address"/>
      <image compression="off"/>
      <gl enable="no"/>
    </graphics>
    <sound model="ich9">
      <address type="pci" domain="0x0000" bus="0x00" slot="0x1b" function="0x0"/>
    </sound>
    <video>
      <model type="qxl" ram="65536" vram="65536" vgamem="16384" heads="1" primary="yes"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x01" function="0x0"/>
    </video>
    <hostdev mode="subsystem" type="pci" managed="yes">
      <source>
        <address domain="0x0000" bus="0x02" slot="0x00" function="0x0"/>
      </source>
      <boot order="1"/>
      <address type="pci" domain="0x0000" bus="0x06" slot="0x00" function="0x0"/>
    </hostdev>
    <hostdev mode="subsystem" type="pci" managed="yes">
      <source>
        <address domain="0x0000" bus="0x01" slot="0x00" function="0x0"/>
      </source>
      <address type="pci" domain="0x0000" bus="0x08" slot="0x00" function="0x0"/>
    </hostdev>
    <hostdev mode="subsystem" type="pci" managed="yes">
      <source>
        <address domain="0x0000" bus="0x01" slot="0x00" function="0x1"/>
      </source>
      <address type="pci" domain="0x0000" bus="0x09" slot="0x00" function="0x0"/>
    </hostdev>
    <redirdev bus="usb" type="spicevmc">
      <address type="usb" bus="0" port="2"/>
    </redirdev>
    <redirdev bus="usb" type="spicevmc">
      <address type="usb" bus="0" port="3"/>
    </redirdev>
    <memballoon model="virtio">
      <address type="pci" domain="0x0000" bus="0x04" slot="0x00" function="0x0"/>
    </memballoon>
    <shmem name="looking-glass">
      <model type="ivshmem-plain"/>
      <size unit="M">32</size>
      <address type="pci" domain="0x0000" bus="0x07" slot="0x02" function="0x0"/>
    </shmem>
  </devices>
</domain>

VFIO related kernel parameters:

intel_iommu=on,igfx_off iommu=pt kvm.ignore_msrs=1

IOMMU groups:

IOMMU Group 0:
        00:00.0 Host bridge [0600]: Intel Corporation 8th Gen Core Processor Host Bridge/DRAM Registers [8086:3ec4] (rev 07)
IOMMU Group 1:
        00:01.0 PCI bridge [0604]: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor PCIe Controller (x16) [8086:1901] (rev 07)
        01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GP107M [GeForce GTX 1050 Ti Mobile] [10de:1c8c] (rev ff)
        01:00.1 Audio device [0403]: NVIDIA Corporation GP107GL High Definition Audio Controller [10de:0fb9] (rev ff)
IOMMU Group 10:
        00:1d.0 PCI bridge [0604]: Intel Corporation Cannon Lake PCH PCI Express Root Port #9 [8086:a330] (rev f0)
IOMMU Group 11:
        00:1e.0 Communication controller [0780]: Intel Corporation Cannon Lake PCH Serial IO UART Host Controller [8086:a328] (rev 10)
IOMMU Group 12:
        00:1f.0 ISA bridge [0601]: Intel Corporation Device [8086:a30e] (rev 10)
        00:1f.3 Audio device [0403]: Intel Corporation Cannon Lake PCH cAVS [8086:a348] (rev 10)
        00:1f.4 SMBus [0c05]: Intel Corporation Cannon Lake PCH SMBus Controller [8086:a323] (rev 10)
        00:1f.5 Serial bus controller [0c80]: Intel Corporation Cannon Lake PCH SPI Controller [8086:a324] (rev 10)
        00:1f.6 Ethernet controller [0200]: Intel Corporation Ethernet Connection (7) I219-LM [8086:15bb] (rev 10)
IOMMU Group 13:
        02:00.0 Non-Volatile memory controller [0108]: Intel Corporation SSD Pro 7600p/760p/E 6100p Series [8086:f1a6] (rev 03)
IOMMU Group 14:
        04:00.0 PCI bridge [0604]: Intel Corporation JHL7540 Thunderbolt 3 Bridge [Titan Ridge 4C 2018] [8086:15ea] (rev 06)
IOMMU Group 15:
        05:00.0 PCI bridge [0604]: Intel Corporation JHL7540 Thunderbolt 3 Bridge [Titan Ridge 4C 2018] [8086:15ea] (rev 06)
IOMMU Group 16:
        05:01.0 PCI bridge [0604]: Intel Corporation JHL7540 Thunderbolt 3 Bridge [Titan Ridge 4C 2018] [8086:15ea] (rev 06)
IOMMU Group 17:
        05:02.0 PCI bridge [0604]: Intel Corporation JHL7540 Thunderbolt 3 Bridge [Titan Ridge 4C 2018] [8086:15ea] (rev 06)
IOMMU Group 18:
        05:04.0 PCI bridge [0604]: Intel Corporation JHL7540 Thunderbolt 3 Bridge [Titan Ridge 4C 2018] [8086:15ea] (rev 06)
IOMMU Group 19:
        06:00.0 System peripheral [0880]: Intel Corporation JHL7540 Thunderbolt 3 NHI [Titan Ridge 4C 2018] [8086:15eb] (rev 06)
IOMMU Group 2:
        00:04.0 Signal processing controller [1180]: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Thermal Subsystem [8086:1903] (rev 07)
IOMMU Group 20:
        3a:00.0 USB controller [0c03]: Intel Corporation JHL7540 Thunderbolt 3 USB Controller [Titan Ridge 4C 2018] [8086:15ec] (rev 06)
IOMMU Group 21:
        71:00.0 Non-Volatile memory controller [0108]: Samsung Electronics Co Ltd NVMe SSD Controller SM981/PM981/PM983 [144d:a808]
IOMMU Group 3:
        00:08.0 System peripheral [0880]: Intel Corporation Xeon E3-1200 v5/v6 / E3-1500 v5 / 6th/7th/8th Gen Core Processor Gaussian Mixture Model [8086:1911]
IOMMU Group 4:
        00:12.0 Signal processing controller [1180]: Intel Corporation Cannon Lake PCH Thermal Controller [8086:a379] (rev 10)
IOMMU Group 5:
        00:14.0 USB controller [0c03]: Intel Corporation Cannon Lake PCH USB 3.1 xHCI Host Controller [8086:a36d] (rev 10)
        00:14.2 RAM memory [0500]: Intel Corporation Cannon Lake PCH Shared SRAM [8086:a36f] (rev 10)
        00:14.3 Network controller [0280]: Intel Corporation Wireless-AC 9560 [Jefferson Peak] [8086:a370] (rev 10)
IOMMU Group 6:
        00:15.0 Serial bus controller [0c80]: Intel Corporation Cannon Lake PCH Serial IO I2C Controller #0 [8086:a368] (rev 10)
IOMMU Group 7:
        00:16.0 Communication controller [0780]: Intel Corporation Cannon Lake PCH HECI Controller [8086:a360] (rev 10)
IOMMU Group 8:
        00:1b.0 PCI bridge [0604]: Intel Corporation Cannon Lake PCH PCI Express Root Port #17 [8086:a340] (rev f0)
IOMMU Group 9:
        00:1b.4 PCI bridge [0604]: Intel Corporation Cannon Lake PCH PCI Express Root Port #21 [8086:a32c] (rev f0)

/etc/mkinitcpio.conf:

MODULES=(ext4 i915 atkbd vfio vfio_iommu_type1 vfio_pci vfio_virqfd vhost-net)
HOOKS=(base udev autodetect keyboard keymap modconf block encrypt lvm2 filesystems fsck)

After booting my host, this is how I isolate/bind the nvidia on the fly:

sudo bash -c "echo '10de 1c8c' > '/sys/bus/pci/drivers/vfio-pci/new_id'"

Verification:

lspci -nnk -d 10de:1c8c
01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GP107M [GeForce GTX 1050 Ti Mobile] [10de:1c8c] (rev a1)
        Subsystem: Lenovo GP107M [GeForce GTX 1050 Ti Mobile] [17aa:2267]
        Kernel driver in use: vfio-pci
        Kernel modules: nouveau, nvidia_drm, nvidia

This is the procedure to unbind and use the nvidia in my bumblebee setup on my host again:

sudo bash -c "echo '0000:01:00.0' > '/sys/bus/pci/drivers/vfio-pci/0000:01:00.0/driver/unbind'"
sudo bash -c "echo 'OFF' >> /proc/acpi/bbswitch"

I have also tried the whole procedure by binding/isolating the nvidia at boot up of the host via kernel parameters but the results were the same.
This is the only part where I differ from the guidance of the wiki. Just wanted to mak sure that this wasn't the troublemaker.

Any help would be very appreciated smile

Last edited by Utini (2020-03-24 11:03:18)


Setup 1: Thinkpad T14s G3, 14" FHD - R7 6850U - 32GB RAM - 2TB Solidigm P44 Pro NVME
Setup 2: Thinkpad X1E G1, 15.6" FHD - i7-8850H - 32GB RAM - NVIDIA GTX 1050Ti - 2x 1TB Samsung 970 Pro NVME
Accessories: Filco Majestouch TKL MX-Brown Mini Otaku, Benq XL2420T (144Hz), Lo(w)gitech G400, Puretrak Talent, Sennheiser HD800S + Meier Daccord FF + Meier Classic FF

Offline

#2 2020-03-24 10:32:55

ThePooN
Member
Registered: 2016-11-27
Posts: 6

Re: Thinkpad X1E: GPU Passthrough - Win10 NVIDIA Adapter shows Code 31

have you tried installing the NVIDIA drivers inside the VM, from NVIDIA's website?
as i said on reddit, your laptop GPU is recognized as VGA and not 3D, which probably means one of your laptop's display output is directly wired to the GPU. i would try plugging a monitor in that output and removing the QXL video device.

if that doesn't work, it would be interesting to see how that setup behaves in a Linux VM instead. i believe Manjaro has pretty good out-of-the-box support for NVIDIA stuff, so you don't have to go through all that trouble.

Last edited by ThePooN (2020-03-24 10:33:14)

Offline

#3 2020-03-24 10:55:49

Utini
Member
Registered: 2015-09-28
Posts: 452
Website

Re: Thinkpad X1E: GPU Passthrough - Win10 NVIDIA Adapter shows Code 31

ThePooN wrote:

have you tried installing the NVIDIA drivers inside the VM, from NVIDIA's website?
as i said on reddit, your laptop GPU is recognized as VGA and not 3D, which probably means one of your laptop's display output is directly wired to the GPU. i would try plugging a monitor in that output and removing the QXL video device.

if that doesn't work, it would be interesting to see how that setup behaves in a Linux VM instead. i believe Manjaro has pretty good out-of-the-box support for NVIDIA stuff, so you don't have to go through all that trouble.

Oh I forgot to mention:
The Windows 10 installation is on a 2nd NVME SSD inside my laptop.
So far I used that to dual boot Windows 10.
This means that the NVIDIA driver is already installed on that Windows 10 system.
I still tried to download the latest NVIDIA driver and install it. The setup says that the driver can't install because no NVIDIA compatible hardware was found.

Instead of an external monitor, shouldn't looking glass work like that as well?
The outputs on my laptop are HDMI and mini-displayport. I believe those two are wires to my NVIDIA GPU according to this Archwiki page of my laptop: https://wiki.archlinux.org/index.php/Le … #Bumblebee


Setup 1: Thinkpad T14s G3, 14" FHD - R7 6850U - 32GB RAM - 2TB Solidigm P44 Pro NVME
Setup 2: Thinkpad X1E G1, 15.6" FHD - i7-8850H - 32GB RAM - NVIDIA GTX 1050Ti - 2x 1TB Samsung 970 Pro NVME
Accessories: Filco Majestouch TKL MX-Brown Mini Otaku, Benq XL2420T (144Hz), Lo(w)gitech G400, Puretrak Talent, Sennheiser HD800S + Meier Daccord FF + Meier Classic FF

Offline

#4 2020-03-24 11:02:41

ThePooN
Member
Registered: 2016-11-27
Posts: 6

Re: Thinkpad X1E: GPU Passthrough - Win10 NVIDIA Adapter shows Code 31

Looking Glass cannot create a monitor, only mirror an exisiting one.

there's another area of GPU-passthrough that differs from desktops: the GPU BIOS is often stored in the laptop's BIOS instead of the GPU, so they may be altered to some degree.
you may wanna grab a vBIOS for your GPU on TechPowerUp, and pass it to QEMU, see: https://wiki.archlinux.org/index.php/PC … y_in_VBIOS (ignore all the blabla about UEFI, this is a different scenario. the only relevant stuff here is how to use another vBIOS. and don't worry, you won't flash your GPU at all unless you're using nvflash)

Last edited by ThePooN (2020-03-24 11:03:30)

Offline

#5 2020-03-24 11:16:10

Utini
Member
Registered: 2015-09-28
Posts: 452
Website

Re: Thinkpad X1E: GPU Passthrough - Win10 NVIDIA Adapter shows Code 31

ThePooN wrote:

Looking Glass cannot create a monitor, only mirror an exisiting one.

there's another area of GPU-passthrough that differs from desktops: the GPU BIOS is often stored in the laptop's BIOS instead of the GPU, so they may be altered to some degree.
you may wanna grab a vBIOS for your GPU on TechPowerUp, and pass it to QEMU, see: https://wiki.archlinux.org/index.php/PC … y_in_VBIOS (ignore all the blabla about UEFI, this is a different scenario. the only relevant stuff here is how to use another vBIOS. and don't worry, you won't flash your GPU at all unless you're using nvflash)

I belive techpower doesn't have a vbios file that is similiar to my GPU. The device ID and "board" always seems to be different to mine?

I also wanted to try and dump my GPU VBIOS but ran into some errors:

sudo bash -c "echo 'ON' >> /proc/acpi/bbswitch"
sudo bash -c "echo 1 > /sys/bus/pci/devices/0000:01:00.0/rom"           
sudo bash -c "cat /sys/bus/pci/devices/0000:01:00.0/rom > /tmp/image.rom"
cat: '/sys/bus/pci/devices/0000:01:00.0/rom': Input/output error
sudo bash -c "echo 0 > /sys/bus/pci/devices/0000:01:00.0/rom"           
./rom-parser /tmp/image.rom
Error, zero sized ROM file

Update:
I also did this hackmack now but it didn't help: https://old.reddit.com/r/VFIO/comments/ … qemu_ovmf/

Basically I converted the text below here to a file: https://base64.guru/converter/decode/file

U1NEVKEAAAAB9EJPQ0hTAEJYUENTU0RUAQAAAElOVEwYEBkgoA8AFVwuX1NCX1BDSTAGABBMBi5f
U0JfUENJMFuCTwVCQVQwCF9ISUQMQdAMCghfVUlEABQJX1NUQQCkCh8UK19CSUYApBIjDQELcBcL
cBcBC9A5C1gCCywBCjwKPA0ADQANTElPTgANABQSX0JTVACkEgoEAAALcBcL0Dk=

Renamed the file and saved it to:

sudo cp /home/myusername/Downloads/SSDT1.dat /var/lib/libvirt/qemu/acpi/SSDT1.dat

And added this to my virt-lib XML:

    <acpi>
      <table type="slic">/var/lib/libvirt/qemu/acpi/SSDT1.dat</table>
    </acpi>

Last edited by Utini (2020-03-24 11:38:14)


Setup 1: Thinkpad T14s G3, 14" FHD - R7 6850U - 32GB RAM - 2TB Solidigm P44 Pro NVME
Setup 2: Thinkpad X1E G1, 15.6" FHD - i7-8850H - 32GB RAM - NVIDIA GTX 1050Ti - 2x 1TB Samsung 970 Pro NVME
Accessories: Filco Majestouch TKL MX-Brown Mini Otaku, Benq XL2420T (144Hz), Lo(w)gitech G400, Puretrak Talent, Sennheiser HD800S + Meier Daccord FF + Meier Classic FF

Offline

#6 2020-03-24 12:39:52

Utini
Member
Registered: 2015-09-28
Posts: 452
Website

Re: Thinkpad X1E: GPU Passthrough - Win10 NVIDIA Adapter shows Code 31

Okay I now also extraced my vbios in Windows (dual booted) and applied it to virtlib. I hope I did everything correct, but it doesn't fix my issue.

This is what I did:

I followed this guide to extract the vbios and save it as .rom file: https://forums.laptopvideo2go.com/topic … y-nvflash/
I also verified it by running a "BIOS Tweaker" and opening the file. It looked like everything was done correctly.

rom-parser output:

./rom-parser nvidia.rom
Valid ROM signature found @0h, PCIR offset 170h
        PCIR: type 0 (x86 PC-AT), vendor: 10de, device: 1c8c, class: 030000
        PCIR: revision 3, vendor revision: 1
        Last image

Back on Arch is moved the .rom file:

sudo cp /home/myusername/Downloads/nvidia.rom /var/lib/libvirt/qemu/nvram/nvidia.rom

I then added it to the XML:

<hostdev mode="subsystem" type="pci" managed="yes">
  <source>
    <address domain="0x0000" bus="0x01" slot="0x00" function="0x0"/>
  </source>
  <rom file="/var/lib/libvirt/qemu/nvram/nvidia.rom"/>
  <address type="pci" domain="0x0000" bus="0x08" slot="0x00" function="0x0"/>
</hostdev>

Booting the VM still showed the same problem.
Also GPU-Z doesn't seem to report the VBIOS. See screenshot here: http://files.bestmail.ws/Capture2.JPG

It seems that since I do not have a "type 3 (EFI)" ROM I will need to use this tool: https://github.com/bitthief/ovmf-with-vbios-patch
It should patch something with my vbios.rom but I have absolutely no idea how to do this?

Last edited by Utini (2020-03-24 12:54:19)


Setup 1: Thinkpad T14s G3, 14" FHD - R7 6850U - 32GB RAM - 2TB Solidigm P44 Pro NVME
Setup 2: Thinkpad X1E G1, 15.6" FHD - i7-8850H - 32GB RAM - NVIDIA GTX 1050Ti - 2x 1TB Samsung 970 Pro NVME
Accessories: Filco Majestouch TKL MX-Brown Mini Otaku, Benq XL2420T (144Hz), Lo(w)gitech G400, Puretrak Talent, Sennheiser HD800S + Meier Daccord FF + Meier Classic FF

Offline

#7 2020-03-24 14:35:12

ThePooN
Member
Registered: 2016-11-27
Posts: 6

Re: Thinkpad X1E: GPU Passthrough - Win10 NVIDIA Adapter shows Code 31

have you tried using a VBIOS from TechPowerUp instead?
the VBIOS you're extracting from GPU-Z might be altered by your manufacturer and may not work correctly in a VM.

Offline

#8 2020-03-24 17:45:23

Utini
Member
Registered: 2015-09-28
Posts: 452
Website

Re: Thinkpad X1E: GPU Passthrough - Win10 NVIDIA Adapter shows Code 31

ThePooN wrote:

have you tried using a VBIOS from TechPowerUp instead?
the VBIOS you're extracting from GPU-Z might be altered by your manufacturer and may not work correctly in a VM.

I have now tried all 5 roms but non worked.
Also I am a little bit confused becuase the wiki tals about a .bin file while at TechPowerUp it is .rom files?
Additonally GPU-Z in Windows 10 never shows a BIOS version. So it seems like none of the BIOS even get accepted or used by the VM because there would be atleast a BIOS version then?


Setup 1: Thinkpad T14s G3, 14" FHD - R7 6850U - 32GB RAM - 2TB Solidigm P44 Pro NVME
Setup 2: Thinkpad X1E G1, 15.6" FHD - i7-8850H - 32GB RAM - NVIDIA GTX 1050Ti - 2x 1TB Samsung 970 Pro NVME
Accessories: Filco Majestouch TKL MX-Brown Mini Otaku, Benq XL2420T (144Hz), Lo(w)gitech G400, Puretrak Talent, Sennheiser HD800S + Meier Daccord FF + Meier Classic FF

Offline

#9 2020-03-24 20:42:33

ThePooN
Member
Registered: 2016-11-27
Posts: 6

Re: Thinkpad X1E: GPU Passthrough - Win10 NVIDIA Adapter shows Code 31

.rom or .bin shouldnt make a difference afaik, they're both binary ROM files in the end

i have no idea anymore sad i would give it a try on a Linux image instead of Windows, to see if how it behaves there gives any hint.

Offline

#10 2020-03-24 21:14:20

Utini
Member
Registered: 2015-09-28
Posts: 452
Website

Re: Thinkpad X1E: GPU Passthrough - Win10 NVIDIA Adapter shows Code 31

ThePooN wrote:

.rom or .bin shouldnt make a difference afaik, they're both binary ROM files in the end

i have no idea anymore sad i would give it a try on a Linux image instead of Windows, to see if how it behaves there gives any hint.

Thank you a lot for your help so far! Made me fix a lot of things on the way ;-)

I guess I need to find someone who can help me on how to use this tool:
https://github.com/bitthief/ovmf-with-vbios-patch

Update: A friendly user from reddit tried to run the patcher for me and patched with my .xml and .rom.
Still same problem after applying those patched files to my .xml hmm

Last edited by Utini (2020-03-24 23:13:09)


Setup 1: Thinkpad T14s G3, 14" FHD - R7 6850U - 32GB RAM - 2TB Solidigm P44 Pro NVME
Setup 2: Thinkpad X1E G1, 15.6" FHD - i7-8850H - 32GB RAM - NVIDIA GTX 1050Ti - 2x 1TB Samsung 970 Pro NVME
Accessories: Filco Majestouch TKL MX-Brown Mini Otaku, Benq XL2420T (144Hz), Lo(w)gitech G400, Puretrak Talent, Sennheiser HD800S + Meier Daccord FF + Meier Classic FF

Offline

#11 2020-03-27 20:12:30

Utini
Member
Registered: 2015-09-28
Posts: 452
Website

Re: Thinkpad X1E: GPU Passthrough - Win10 NVIDIA Adapter shows Code 31

No mighty pci passthrough guy who can help me? sad


Setup 1: Thinkpad T14s G3, 14" FHD - R7 6850U - 32GB RAM - 2TB Solidigm P44 Pro NVME
Setup 2: Thinkpad X1E G1, 15.6" FHD - i7-8850H - 32GB RAM - NVIDIA GTX 1050Ti - 2x 1TB Samsung 970 Pro NVME
Accessories: Filco Majestouch TKL MX-Brown Mini Otaku, Benq XL2420T (144Hz), Lo(w)gitech G400, Puretrak Talent, Sennheiser HD800S + Meier Daccord FF + Meier Classic FF

Offline

#12 2020-03-27 21:44:42

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,427

Re: Thinkpad X1E: GPU Passthrough - Win10 NVIDIA Adapter shows Code 31

You might also want to try things like these on the normal kernel, the hardened kernel has by definition functionality to make things like these harder.

Offline

#13 2020-04-01 18:54:07

Utini
Member
Registered: 2015-09-28
Posts: 452
Website

Re: Thinkpad X1E: GPU Passthrough - Win10 NVIDIA Adapter shows Code 31

V1del wrote:

You might also want to try things like these on the normal kernel, the hardened kernel has by definition functionality to make things like these harder.

Nothing easier than that :-) But sadly it didn't help.

pacman -S linux linux-headers
reboot
still the same problem

Setup 1: Thinkpad T14s G3, 14" FHD - R7 6850U - 32GB RAM - 2TB Solidigm P44 Pro NVME
Setup 2: Thinkpad X1E G1, 15.6" FHD - i7-8850H - 32GB RAM - NVIDIA GTX 1050Ti - 2x 1TB Samsung 970 Pro NVME
Accessories: Filco Majestouch TKL MX-Brown Mini Otaku, Benq XL2420T (144Hz), Lo(w)gitech G400, Puretrak Talent, Sennheiser HD800S + Meier Daccord FF + Meier Classic FF

Offline

#14 2020-05-23 13:20:27

pabloski
Member
Registered: 2007-03-14
Posts: 31

Re: Thinkpad X1E: GPU Passthrough - Win10 NVIDIA Adapter shows Code 31

Utini wrote:

Nothing easier than that :-) But sadly it didn't help.

Did you find a solution? I sadly have the same problem. It is a laptop with a muxed NVidia GPU, with the hdmi attached directly to the discrete GPU ( it is an Optimus machine ). What can I say? I have tried Windows 10, Linux and macOS. Funny thing, macOS works perfectly. Linux works 100% with Nouveau, doesn't work with Nvidia proprietary driver. Driver refuses to load, saying "wrong kernel version" or something like that. Total bull****. Windows 10, code 31. But older driver version, tried on an older Linux distro, works.

So Nvidia is at it again. They are blocking the driver from starting when it detects a virtual machine. Obviously I have tried all the notorious vfio/kvm tricks to "hide" the virtual machine. I have even added a fake battery, as suggest by someone on reddit ( he debugged the Nvidia driver and found that it refuses to run on a laptop with no battery onboard ). But nothing. There must be some other trick they are using. I did stop. Didn't try to go deeper, because I am using another machine with a passed through Radeon, that just works!!

Last edited by pabloski (2020-05-23 13:22:35)

Offline

#15 2021-07-27 21:42:17

zasire
Member
Registered: 2011-07-20
Posts: 11

Re: Thinkpad X1E: GPU Passthrough - Win10 NVIDIA Adapter shows Code 31

Anyone made progress with this issue? I am facing the same with my Thinkpad.

Offline

Board footer

Powered by FluxBB