Nvidis RTX 2080: Single GPU Passtrough


MarkusR

Recommended Posts

Hallo liebe Community,

 

ich habe mir mittlerweile einen zweiten Unraid-Server aufgesetzt und möchte meine GPU in eine Windows 11 VM durchreichen.

 

System:

AMD Ryzen 5800x

Asus x570 Mainboard

RTX 2080

Dual Monitore HDMI / DisplayPort-Anschluss

Unraid Version 6.11.2

 

Bei meinem ersten Unraid-System mit einer Single GPU AMD rx5500xt hat der Passtrough korrekt funktioniert. Starte ich aber im neuen System die VM, sieht man beim Monitor, der mittels HDMI angeschlossen ist, ein kurzes flackern und dann bekommt er kein Video Signal mehr.

 

Folgende Punkte habe ich bisher konfiguriert:

 

- Legacy Boot für den Unraid Stick

- IOMMU im Bios aktiviert

- In Unraid im VM-Manager PCIe ACS override auf Both und VFIO allow unsafe interrupts auf Yes gestellt

- In Unraid unter SystemInfo alles zu meiner Grafikkarte an Vfio gebunden

- Das Vbios aus meiner Grafikkarte mit einem Skript von Spaceinvader in Unraid eingefügt und das vbios erstellen lassen

- In der Windows 11 VM meine Grafikkarte, Vbios, deren Soundkarte und die zwei USB-Ports zugewiesen

 

Ich hoffe ihr könnt mir da weiterhelfen 🙂 Im Anhang habe ich noch Screenshots der VM GUI und der Vfio Bindungen beigefügt.

 

XML-File meiner VM:

 

<?xml version='1.0' encoding='UTF-8'?>
<domain type='kvm'>
  <name>Windows 11</name>
  <uuid>31f29702-0a7b-f89a-abd4-84fd69a46770</uuid>
  <metadata>
    <vmtemplate xmlns="unraid" name="Windows 11" icon="windows11.png" os="windowstpm"/>
  </metadata>
  <memory unit='KiB'>4194304</memory>
  <currentMemory unit='KiB'>4194304</currentMemory>
  <memoryBacking>
    <nosharepages/>
  </memoryBacking>
  <vcpu placement='static'>4</vcpu>
  <cputune>
    <vcpupin vcpu='0' cpuset='0'/>
    <vcpupin vcpu='1' cpuset='8'/>
    <vcpupin vcpu='2' cpuset='1'/>
    <vcpupin vcpu='3' cpuset='9'/>
  </cputune>
  <os>
    <type arch='x86_64' machine='pc-i440fx-7.1'>hvm</type>
    <loader readonly='yes' type='pflash'>/usr/share/qemu/ovmf-x64/OVMF_CODE-pure-efi-tpm.fd</loader>
    <nvram>/etc/libvirt/qemu/nvram/31f29702-0a7b-f89a-abd4-84fd69a46770_VARS-pure-efi-tpm.fd</nvram>
  </os>
  <features>
    <acpi/>
    <apic/>
  </features>
  <cpu mode='host-passthrough' check='none' migratable='on'>
    <topology sockets='1' dies='1' cores='2' 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'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/local/sbin/qemu</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='writeback'/>
      <source file='/mnt/user/domains/Windows 11/vdisk1.img'/>
      <target dev='hdc' bus='virtio'/>
      <boot order='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/mnt/user/isos/Win11_German_x64.iso'/>
      <target dev='hda' bus='ide'/>
      <readonly/>
      <boot order='2'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/mnt/user/isos/virtio-win-0.1.225-2.iso'/>
      <target dev='hdb' bus='ide'/>
      <readonly/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
    <controller type='pci' index='0' model='pci-root'/>
    <controller type='ide' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </controller>
    <controller type='usb' index='0' model='ich9-ehci1'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x2'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:46:d2:ce'/>
      <source bridge='br0'/>
      <model type='virtio-net'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' 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='unix'>
      <target type='virtio' name='org.qemu.guest_agent.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <tpm model='tpm-tis'>
      <backend type='emulator' version='2.0' persistent_state='yes'/>
    </tpm>
    <audio id='1' type='none'/>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x09' slot='0x00' function='0x0'/>
      </source>
      <rom file='/mnt/user/isos/vbios/rtx280.rom'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0' multifunction='on'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x09' slot='0x00' function='0x1'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x1'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x09' slot='0x00' function='0x2'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x1'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x09' slot='0x00' function='0x3'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x1'/>
    </hostdev>
    <hostdev mode='subsystem' type='usb' managed='no'>
      <source>
        <vendor id='0x046d'/>
        <product id='0xc08b'/>
      </source>
      <address type='usb' bus='0' port='1'/>
    </hostdev>
    <hostdev mode='subsystem' type='usb' managed='no'>
      <source>
        <vendor id='0x046d'/>
        <product id='0xc33f'/>
      </source>
      <address type='usb' bus='0' port='2'/>
    </hostdev>
    <memballoon model='none'/>
  </devices>
</domain>

 

Screenshot1.png

Screenshot2.png

Link to comment
6 hours ago, MarkusR said:

- Legacy Boot für den Unraid Stick

 

ist jetzt alles nur "Hoffnung", AMD Systeme sind (leider) nicht die erste Wahl mit GPU passthrough ...

 

so, bei einer 2080 solltest du jedoch ziemlich sicher in uefi booten, inkl. rbar, above 4g decode support etc etc ... je nachdem wie man das bei Dir im bios einstellt.

 

6 hours ago, MarkusR said:

- In Unraid im VM-Manager PCIe ACS override auf Both und VFIO allow unsafe interrupts auf Yes gestellt

 

das wäre der "letzte" Schritt, erstmal besser wieder retour, außer deine iommu groups (ACS) lassen es nicht zu, unsafe interupts wäre dann der erste Test bei "Fehlern".

 

multifunction hast du bereits eingepflegt, passt.

 

6 hours ago, MarkusR said:

- Das Vbios aus meiner Grafikkarte mit einem Skript von Spaceinvader in Unraid eingefügt und das vbios erstellen lassen

 

vbios, wenn du dir sicher bist das dieses passt, lassen, ansonsten evtl. entfernen und ohne testen.

 

6 hours ago, MarkusR said:
    <type arch='x86_64' machine='pc-i440fx-7.1'>hvm</type>

da würde ich auch umstellen auf q35 ... evtl. zum Start eher 6.0 oder 6.1,2, ... 7.x ist neu, läuft hier zwar sauber, nur um sicher zu gehen ...

 

sorry, da steckt viel trial & error bei AMD Systemen drin ...

Link to comment

@alturismo

 

vielen Dank für deine Hilfe 🙂 nur zur Sicherheit. Das System mit der AMD Grafikkarte lief gleich auf Anhieb. Nur mein neues Zweitsystem mit der Nvidia will nicht. Die von dir genannten Einstellungen im BIOS habe ich gesetzt. Auch das Booten mit uefi. Die unterschiedlichen Machine Typen in der VM hab ich auch schon durch. 
 

gibt es da noch LOGs, die wir auswerten können?

Link to comment
21 minutes ago, MarkusR said:

gibt es da noch LOGs, die wir auswerten können?

nicht wirklich für mich ;)

 

27 minutes ago, MarkusR said:

nur zur Sicherheit. Das System mit der AMD Grafikkarte lief gleich auf Anhieb. Nur mein neues Zweitsystem mit der Nvidia will nicht.

es geht primär um die AMD CPU und Mainboard ...

 

ich nutze nur Intel/Nvidia ... und das ist schon immer schmerzfrei (hier zumindest), mit AMD habe ich persönlich aufgegeben ...

 

da kann evtl. jemand anderes einspringen wenn du die logs hast, Beispiel, syslog schauen, oder evtl. hier mal schauen,

kopier es dir auf ein share um es am Desktop zu sichten (AlsPC ist mein VM Name ... "Windows 11" bei dir wenn das noch aktuell ist, Tipp, lasst die Leerzeichen weg)

 

cp /var/log/libvirt/qemu/AlsPC.log /mnt/user/was_auch_immer

 

das steht allerdings auch im laufenden Betrieb der VM  im log über die GUI

 

klick, klick

 

image.png.d130d2a634685d408cae6965b240f093.png

Link to comment

Ich behaupte, dass das mit UEFI nicht geht. Und single passthrough ist sehr hardwarespezifisch. 

 

Hast du beim Booten von Unraid auf dem alten System die Ausgabe von BIOS und Unraid gesehen oder war da die GPU Ausgabe von Anfang an schwarz?

 

Warum hast du eigentlich nicht gleich einen 5700G geholt? Dann hättest du den Stress jetzt nicht.

  • Like 1
Link to comment

@mgutt

 

beim AMD System habe ich, wie beim jetzigen System, das Bios gesehen und Teile von Unraid. Bei Unraid bleibt die Anzeige irgendwann stehen, also sieht dann aus wie eingefroren. 
 

auf dem neuen System hatte ich bisher Windows 11 nativ laufen. Da ich aber von Unraid mehr und mehr begeistert bin, wollte ich es auch auf diesem System haben. 
 

was mir beim jetzigen System auffällt, bevor die Anzeige von Unraid nicht mehr weiter geht, steht noch die Hardware ID meiner Grafikkarte und die Zeile vgaarb: changed VGA decodes: olddecodes=io+mem, decodes=io+mem:owns=io+mem.

 

ich weiß nicht, ob das etwas zu sagen hat. Muss ich in der VM eventuell mit multifunction arbeiten?

Link to comment
21 minutes ago, MarkusR said:

was mir beim jetzigen System auffällt, bevor die Anzeige von Unraid nicht mehr weiter geht, steht noch die Hardware ID meiner Grafikkarte und die Zeile vgaarb: changed VGA decodes: olddecodes=io+mem, decodes=io+mem:owns=io+mem.

 

du hast nicht zufällig das corefreq plugin installiert und laufen ?

Link to comment

Du musst auf jeden Fall die VMs immer neu erstellen. Es bringt nichts die XML zu ändern, wenn in libvirt der alte virtuelle Rechner angesprochen wird und du zwischenzeitlich beim Host zwischen Legacy und UEFI usw wechselst.

 

Also jede Änderung und jeden Test, den du machst, solltest du immer auch an eine neue Maschine koppeln.

 

Ansonsten kann dir niemand deine Fragen beantworten. Wie gesagt ist das absolut abhängig von der Hardware. Wenn du nicht gerade jemanden im Forum mit genau deinem Board findest, der auch Single GPU passthrough geschafft hast, wirst du keine weitere Hilfe dazu finden. 

Link to comment

@alturismo / @mgutt

 

ich habe es hinbekommen 🙂 

 

Falls jemand die gleichen Probleme hat folgende Vorgehensweise:

 

- Umstellung der Bootoption von UEFI auf nur legacy im Bios

- In Unraid  im Bereich Flash und dort bei Unraid OS direkt hinter append die Werte

video=efib:off,video=vesafb:off eintragen

- In Unraid unter Settings - VM Manager für die Einstellung "PCIe ACS override" both und für "

VFIO allow unsafe interrupts:" auf Yes stellen

- In Unraid unter Tools - System Devices die Grafikkarte und alles was dazugehört an Vfio binden

- Unraid restart

- Installation der Community Plugins und dort Installation der User Scripts

- Einbinden des Skripts von SpaceInvader zur Erstellung des Vbios der Grafikkarte

- Erstellung einer VM, Grafikkarte, deren Soundkarte und gegebenenfalls USB Schnittstellen auswählen

- Auswahl des erstellten Vbios

- Konfiguration der restlichen VM wie gewünscht

- Starten, sich freuen und wie ein 5 Monate alter Hundewelpe vor Freude quietschen

 

Skript von Spaceinvader:

 

#!/bin/bash
# Script to dump GPU vbios from any Unraid GPU 
# by SpaceinvaderOne

##### Read the readme for how to use this script #####

##### FILL IN THE  VARIABLES BELOW #######################################################################

###################
gpuid="0a:09.0"
###################
		
#####Name the vbios for example gtx2080ti.rom	

### Naming of the vbios is optional ....  if you do not rename it here then the script will name it based off the details found about the gpu dumped

###################
vbiosname="rtx2080neu.rom"
###################

##### Location to put vbios (change if you dont want to use below location) if location doesnt exist it will be created for you.

###################
vbioslocation="/mnt/user/isos/vbios/"
###################

##### Runs checks on device to see if it is in fact a GPU. Recommended to leave set as "yes"

###################
safety="yes"
###################

########## DO NOT CHANGE BELOW THIS LINE #################################################################

gpuid=$(echo "$gpuid" | sed 's/ *$//')

gpuid=$(echo "$gpuid" | sed 's/^ *//g')

dumpid="0000:$gpuid"

mygpu=$(lspci -s $gpuid)

disconnectid=$(echo "$dumpid" | sed 's?:?\\:?g')

disconnectid2=$(echo "$disconnectid" | sed 's/\(.*\)0/\11/')

vganame=$( lspci | grep -i "$gpuid" )

forcereset="no"



########## Script functions #################################################################
checkgpuiscorrect() {
	mygpu=$(lspci -s $gpuid) || { notvalidpci; exit; } 
	echo "You have selected this device to dump the vbios from"
	if grep -i 'VGA compatible controller' <<< "$mygpu"  ; then 
		if grep -i 'Intel' <<< "$mygpu"  ; then 
			echo "This looks like its an integrated INTEL GPU and vbios dump will most likely FAIL"
			echo "Please select a dedicated GPU to dump vbios from"
			echo "If you really want to try then rerun script changing variable to safety=off"
		else
			echo
			echo "This does look like a valid GPU to me. Continuing ........."
			echo
		fi
	elif  grep -i 'Audio Device' <<< "$mygpu"  ; then 
	echo
	echo "This doesn't look like a GPU to me. It looks like an AUDIO device"
	echo "Maybe you have selected the audio part of your GPU ?"
	echo "Please edit the script and make sure to put the id of ONLY the VGA part of your GPU"
	echo "If you are 100 % sure this is the VGA part of your GPU then rerun script changing variable to safety=off"
	echo
	echo "These are all the GPUs that I can see in your server"
	lspci | grep -i 'vga'
	exit
	elif  grep -i 'USB controller' <<< "$mygpu"  ; then 
	echo
	echo "This doesn't look like a GPU to me. It looks like a USB controller"
	echo "Some GPUs have a USB part to them. Maybe you selected that ?"
	echo "Please edit the script and make sure to put the id of ONLY the VGA part of your GPU"
	echo "If you are 100 % sure this is the VGA part of your GPU then rerun script changing variable to safety=off"
	echo
	echo "These are the GPUs that I can see in your server"
	lspci | grep -i 'vga'
	exit
	elif  grep -i 'Serial bus controller' <<< "$mygpu"  ; then 
	echo
	echo "This doesn't look like a GPU to me. It looks like a USB type C controller"
	echo "Some GPUs have a USB type C part to them. Maybe you selected that ?"
	echo "Please edit the script and make sure to put the id of ONLY the VGA part of your GPU"
	echo "If you are 100 % sure this is the VGA part of your GPU then rerun script changing variable to safety=off"
	echo
	echo "These are the GPUs that I can see in your server"
	lspci | grep -i 'vga'
	exit
	elif  grep -i 'Network controller' <<< "$mygpu"  ; then 
	echo
	echo "This doesn't look like a GPU to me. It looks like a NETWORK adapter "
	echo "Please correct the id and rerun the script."
	echo "If you are 100 % sure this is the VGA part of your GPU then rerun script changing variable to safety=off"
	echo
	echo "These are the GPUs that I can see in your server"
	lspci | grep -i 'vga'
	exit
	elif  grep -i 'Ethernet controller' <<< "$mygpu"  ; then 
	echo
	echo "This doesn't look like a GPU to me. It looks like a NETWORK adapter "
	echo "Please correct the id and rerun the script."
	echo "If you are 100 % sure this is the VGA part of your GPU then rerun script changing variable to safety=off"
	echo
	echo "These are the GPUs that I can see in your server"
	lspci | grep -i 'vga'
	exit
	elif  grep -i 'SATA controller' <<< "$mygpu"  ; then 
	echo
	echo "This doesn't look like a GPU to me. It looks like a SATA controller "
	echo "Please correct the id and rerun the script."
	echo "If you are 100 % sure this is the VGA part of your GPU then rerun script changing variable to safety=off"
	echo
	echo "These are the GPUs that I can see in your server"
	lspci | grep -i 'vga'
	exit
	elif  grep -i 'Non-Volatile memory controller' <<< "$mygpu"  ; then 
	echo
	echo "This doesn't look like a GPU to me. It looks like a NVME controller "
	echo "Please correct the id and rerun the script."
	echo "If you are 100 % sure this is the VGA part of your GPU then rerun script changing variable to safety=off"
	echo
	echo "These are the GPUs that I can see in your server"
	lspci | grep -i 'vga'
	exit
	elif  grep -i 'PCI bridge' <<< "$mygpu"  ; then 
	echo
	echo "This doesn't look like a GPU to me. It looks like a PCI bridge "
	echo "Please correct the id and rerun the script."
	echo "If you are 100 % sure this is the VGA part of your GPU then rerun script changing variable to safety=off"
	echo
	echo "These are the GPUs that I can see in your server"
	lspci | grep -i 'vga'
	exit
	elif  grep -i 'Host bridge' <<< "$mygpu"  ; then 
	echo
	echo "This doesn't look like a GPU to me. It looks like a HOST bridge "
	echo "Please correct the id and rerun the script."
	echo "If you are 100 % sure this is the VGA part of your GPU then rerun script changing variable to safety=off"
	echo
	echo "These are the GPUs that I can see in your server"
	lspci | grep -i 'vga'
	exit
	elif  grep -i 'SMBus' <<< "$mygpu"  ; then 
	echo
	echo "This doesn't look like a GPU to me. It looks like a SMBus controller "
	echo "Please correct the id and rerun the script."
	echo "If you are 100 % sure this is the VGA part of your GPU then rerun script changing variable to safety=off"
	echo
	echo "These are the GPUs that I can see in your server"
	lspci | grep -i 'vga'
	exit
	elif  grep -i 'Encryption controller' <<< "$mygpu"  ; then 
	echo
	echo "This doesn't look like a GPU to me. It looks like a Encryption controller "
	echo "Please correct the id and rerun the script."
	echo "If you are 100 % sure this is the VGA part of your GPU then rerun script changing variable to safety=off"
	echo
	echo "These are the GPUs that I can see in your server"
	lspci | grep -i 'vga'
	exit
	else
	echo "$mygpu"
	echo
	echo "This doesn't look like a GPU to me. Please correct the id and rerun the script."
	echo "If you are 100 % sure this is the VGA part of your GPU then rerun script changing variable to safety=off"
	echo
	echo "These are the GPUs that I can see in your server"
	lspci | grep -i 'vga'
	exit
	fi
	
}

notvalidpci() {
	echo "That is NOT a valid PCI device. Please correct the id and rerun the script"
 	echo
 	echo "These are all the GPUs that I can see in your server. Please choose one of these"
 	lspci | grep -i 'vga'
}
	

checklocation() {
	# check if vbios location exists and if not create it
	echo
	echo "Checking if location to put vbios file exists"
		if [ ! -d "$vbioslocation" ] ; then
 
			echo "Vbios folder created at "$mountlocation" "
			echo
			mkdir -vp "$vbioslocation" # make the directory as it doesnt exist
		else
			echo "Vbios folder "$mountlocation" already exists"
			echo
		fi
}

buildtempvm() {
cat > /tmp/dumpvbios.xml << EOF
<?xml version='1.0' encoding='UTF-8'?>
<domain type='kvm'>
<name>dumpvbios</name>
<memory unit='KiB'>1048576</memory>
<currentMemory unit='KiB'>1048576</currentMemory>
<memoryBacking>
<nosharepages/>
</memoryBacking>
<vcpu placement='static'>1</vcpu>
<cputune>
<vcpupin vcpu='0' cpuset='0'/>
</cputune>
<os>
<type arch='x86_64' machine='pc-q35-3.0'>hvm</type>
</os>
<cpu mode='host-passthrough' check='none' >
</cpu>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/local/sbin/qemu</emulator>
<controller type='pci' index='1' model='pcie-root-port'>
<model name='pcie-root-port'/>
<target chassis='1' port='0x8'/>
</controller>
<hostdev mode='subsystem' type='pci' managed='yes' xvga='yes'>
<driver name='vfio'/>
<source>
<address domain='0x${dumpid:0:4}' bus='0x${dumpid:5:2}' slot='0x${dumpid:8:2}' function='0x${dumpid:11:1}'/>;
</source>
</hostdev>
</devices>
</domain>
EOF
}

isgpuprimary () {
	# Check Primary GPU and wether gpu has already been disconnected
	# Disconnect GPU and set server to sleep mode then rescan bus
	if [ "$forcereset" = "yes" ] ; then	
			echo "Disconnecting the graphics card"
			echo "1" | tee -a /sys/bus/pci/devices/$disconnectid/remove
			echo "Entered suspended (sleep) state ......"
			echo
			echo " PRESS POWER BUTTON ON SERVER TO CONTINUE"
			echo
			echo -n mem > /sys/power/state
			echo "Rescanning pci bus"
			echo "1" | tee -a /sys/bus/pci/rescan
			echo "Graphics card has now sucessfully been disconnected and reconnected"
			echo "It is now ready to begin the dump vbios process"
			echo
			
	elif [ "$forcereset" = "no" ] ; then			
			echo "I will try and dump the vbios without disconnecting and reconnecting the GPU"
			echo "This normally only works if the GPU is NOT the Primary or the only GPU"
			echo "I will check the vbios at the end. If it seems wrong I will then retry after disconnecting the GPU"
			echo

	else 
			echo "forcereset is set as "$forcereset" this is not a recognised option"
			echo "Please set forcereset to either yes or no "
			exit
	fi
}


startstopvm() {
	
	echo "Defining temp vm with gpu attached"
	virsh define /tmp/dumpvbios.xml 
	echo "Starting the temp vm to allow dump"
	virsh start dumpvbios
	echo "Waiting for a few seconds ....."
	echo
	sleep 9
	echo "Stopping the temp vm "
	virsh destroy dumpvbios
	echo "Removing the temp vm"
	virsh undefine dumpvbios

}

dumpvbios() {
	# if no name was given for vbios then make name from vga name from lspci
	if [ "$vbiosname" = "gpu vbios.rom" ] ; then
		vbiosname=$( echo "$vganame" |  awk 'NR > 1 {print $1}' RS='[' FS=']' )
	fi
	echo
	cd /sys/bus/pci/devices/"$dumpid"/ 
	echo 1 > rom
	echo
	echo "Okay dumping vbios file named "$vbiosname" to the location "$vbioslocation" "
	cat rom > "$vbioslocation""$vbiosname" || needtobind
	echo 0 > rom
}

needtobind() {
	echo
	echo "Um.... somethings gone wrong and I couldn't dump the vbios for some reason"
	echo "Sometimes when this happens all we need to do to fix this is 'stub' or 'bind to the vfio' the gpu and reboot the server"
	echo
	echo "This can be done in Unraid 6.8.3 with the use of the vfio config plugin or if you are on Unraid 6.9 or above it can be done"
	echo "directly from the gui in Tools/System Devices .....So please do this and run the script again"
	echo
	exit 
}


cleanup() {
	if [ -e /tmp/dumpvbios.xml ] ; then
		rm /tmp/dumpvbios.xml 
	fi
}


checkvbios() {
	filepath="$vbioslocation""$vbiosname"
	if [ -n "$(find "$filepath" -prune -size -2000c)" ]; then
		needtobind
	
	
	elif [ -n "$(find "$filepath" -prune -size -70000c)" ]; then
	    printf '%s is less than 70kb\n' "$filepath"
		echo "This seems too small. Probably the GPU is Primary and needs disconnecting and reconnecting to get proper vbios"
		echo
		echo "Running again"
		forcereset="yes"
		buildtempvm
		isgpuprimary
		startstopvm
		dumpvbios
		cleanup
		if [ -n "$(find "$filepath" -prune -size -70000c)" ]; then
		    printf '%s is less than 70kb\n' "$filepath"
			echo "This seems small but maybe its correct. Please try it. All done !"
			exit
		fi
		echo
		echo "vbios seems to be correct. All done :)"
		exit
		
	else
	echo
	echo "vbios seems to be correct. All done :)"
	exit	
	fi
}



########## run functions #################################################################
if [ "$safety" = "no" ] ; then	
echo "Safety checks are disabled. Continuing ......"
else
checkgpuiscorrect
fi
checklocation
buildtempvm
isgpuprimary
startstopvm
dumpvbios
checkvbios
exit

 

  • Like 3
Link to comment

@mgutt

 

Definitiv ist das Legacy Boot notwendig, da ich in UEFI mit den anderen Optionen alle möglichen Varianten durch hatte 😅 zur Zeit teste ich die Gaming VM und die finale Einrichtung des Unraid Systems. 
 

eventuell teste ich mal andere Kombinationen. Mein Bauchgefühl sagt mir, dass die zwei Booteinstellungen in der syslinux.cfg maßgeblich ausschlaggebend sind. 
 

@Weifer

 

super, freut mich, dass ich dir helfen konnte 😊 ich hoffe du bist soweit zufrieden mit dem Ergebnis?

  • Thanks 1
Link to comment

Hi Zusammen,

 

also bei mir ist ein vbios auf jeden Fall Pflicht. Sonst kann ich meine Grafikkarte nicht durchschleifen. Falls jemand bei einer Single-GPU ein vbios-Dump mit dem oben erwähnten Skript machen muss, habe ich nochmals eine Ergänzung zur oberen Anleitung:

 

- Wechsel ins Bios

- Deaktivierung der Resize Bar

- Deaktivierung des CSM-Boots

-> Wichtig bei mir: keine Reaktivierung von UEFI, einfach alles mit CSM deaktivieren

- Booten mit Unraid

- Ausführung des oberen Skripts von Spaceinvader

- Danach Wechsel ins Bios und die gerade umgesetzten Einstellungen wieder rückgängig machen

 

  • Thanks 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.