Jump to content

5700XT Code 43 on Windows VM


Roosteyr
Go to solution Solved by Jumbo_Erdnuesse,

Recommended Posts

I've been trying to resolve this code 43 error on my unraid server that I've been experiencing with my 5700xt but can't seem to get it resolved so that I can have a working VM with proper screen resolution. I've updated vbios to the lastest version for my 5700xt from the techpowerup website but that resolved nothing. I'm using Q35-7.1 have the GPU selected as the sound card and am also passing vbios through unraid. I've read all the forums I can find on the subject but can't seem to get pass this code 43 error. Loving unraid besides this issue. My hardware info and VM xml are below. Any ideas?

 

Hardware:

Model:Custom

M/B:ASUSTeK COMPUTER INC. PRIME A520M-A II Version Rev X.0x - s/n: 210180524100050

BIOS:American Megatrends Inc. Version 2423. Dated: 08/10/2021

CPU:AMD Ryzen 7 2700 Eight-Core @ 3200 MHz

HVM:Enabled

IOMMU:Enabled

Cache:768 KiB, 4 MB, 16 MB

Memory:32 GiB DDR4 (max. installable capacity 128 GiB)

Network:bond0: fault-tolerance (active-backup), mtu 1500

Kernel:Linux 5.19.17-Unraid x86_64

OpenSSL:1.1.1s

 

GPU: Gigabyte 5700XT Gaming OC

 

 

<?xml version='1.0' encoding='UTF-8'?>
<domain type='kvm' id='1'>
  <name>Slave1</name>
  <uuid>2ac27d48-726f-3c1c-4503-f7224b407706</uuid>
  <description>For slave stuff I mean work.</description>
  <metadata>
    <vmtemplate xmlns="unraid" name="Windows 10" icon="windows.png" os="windows10"/>
  </metadata>
  <memory unit='KiB'>12582912</memory>
  <currentMemory unit='KiB'>12582912</currentMemory>
  <memoryBacking>
    <nosharepages/>
  </memoryBacking>
  <vcpu placement='static'>8</vcpu>
  <cputune>
    <vcpupin vcpu='0' cpuset='4'/>
    <vcpupin vcpu='1' cpuset='12'/>
    <vcpupin vcpu='2' cpuset='5'/>
    <vcpupin vcpu='3' cpuset='13'/>
    <vcpupin vcpu='4' cpuset='6'/>
    <vcpupin vcpu='5' cpuset='14'/>
    <vcpupin vcpu='6' cpuset='7'/>
    <vcpupin vcpu='7' cpuset='15'/>
  </cputune>
  <resource>
    <partition>/machine</partition>
  </resource>
  <os>
    <type arch='x86_64' machine='pc-q35-7.1'>hvm</type>
    <loader readonly='yes' type='pflash'>/usr/share/qemu/ovmf-x64/OVMF_CODE-pure-efi.fd</loader>
    <nvram>/etc/libvirt/qemu/nvram/2ac27d48-726f-3c1c-4503-f7224b407706_VARS-pure-efi.fd</nvram>
  </os>
  <features>
    <acpi/>
    <apic/>
    <hyperv mode='custom'>
      <relaxed state='on'/>
      <vapic state='on'/>
      <spinlocks state='on' retries='8191'/>
      <vendor_id state='on' value='none'/>
    </hyperv>
  </features>
  <cpu mode='host-passthrough' check='none' migratable='on'>
    <topology sockets='1' dies='1' cores='4' threads='2'/>
    <cache mode='passthrough'/>
    <feature policy='require' name='topoext'/>
  </cpu>
  <clock offset='localtime'>
    <timer name='hypervclock' present='yes'/>
    <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/Slave1/vdisk1.img' index='3'/>
      <backingStore/>
      <target dev='hdc' bus='virtio'/>
      <boot order='1'/>
      <alias name='virtio-disk2'/>
      <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/mnt/user/isos/Windows.iso' index='2'/>
      <backingStore/>
      <target dev='hda' bus='sata'/>
      <readonly/>
      <boot order='2'/>
      <alias name='sata0-0-0'/>
      <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' index='1'/>
      <backingStore/>
      <target dev='hdb' bus='sata'/>
      <readonly/>
      <alias name='sata0-0-1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
    <controller type='pci' index='0' model='pcie-root'>
      <alias name='pcie.0'/>
    </controller>
    <controller type='pci' index='1' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='1' port='0x8'/>
      <alias name='pci.1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0' multifunction='on'/>
    </controller>
    <controller type='pci' index='2' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='2' port='0x9'/>
      <alias name='pci.2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <controller type='pci' index='3' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='3' port='0xa'/>
      <alias name='pci.3'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>
    <controller type='pci' index='4' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='4' port='0xb'/>
      <alias name='pci.4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x3'/>
    </controller>
    <controller type='pci' index='5' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='5' port='0xc'/>
      <alias name='pci.5'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x4'/>
    </controller>
    <controller type='pci' index='6' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='6' port='0xd'/>
      <alias name='pci.6'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x5'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <alias name='virtio-serial0'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
    </controller>
    <controller type='sata' index='0'>
      <alias name='ide'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
    </controller>
    <controller type='usb' index='0' model='ich9-ehci1'>
      <alias name='usb'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <alias name='usb'/>
      <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'>
      <alias name='usb'/>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <alias name='usb'/>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x2'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:da:5f:22'/>
      <source bridge='br0'/>
      <target dev='vnet0'/>
      <model type='virtio-net'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
    </interface>
    <serial type='pty'>
      <source path='/dev/pts/0'/>
      <target type='isa-serial' port='0'>
        <model name='isa-serial'/>
      </target>
      <alias name='serial0'/>
    </serial>
    <console type='pty' tty='/dev/pts/0'>
      <source path='/dev/pts/0'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>
    <channel type='unix'>
      <source mode='bind' path='/var/lib/libvirt/qemu/channel/target/domain-1-Slave1/org.qemu.guest_agent.0'/>
      <target type='virtio' name='org.qemu.guest_agent.0' state='disconnected'/>
      <alias name='channel0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <input type='mouse' bus='ps2'>
      <alias name='input0'/>
    </input>
    <input type='keyboard' bus='ps2'>
      <alias name='input1'/>
    </input>
    <audio id='1' type='none'/>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x0a' slot='0x00' function='0x0'/>
      </source>
      <alias name='hostdev0'/>
      <rom file='/mnt/user/public share/Gigabyte.RX5700XT.8192.190909.rom'/>
      <address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x0a' slot='0x00' function='0x1'/>
      </source>
      <alias name='hostdev1'/>
      <address type='pci' domain='0x0000' bus='0x05' slot='0x00' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='usb' managed='no'>
      <source>
        <vendor id='0x046d'/>
        <product id='0xc52f'/>
        <address bus='1' device='5'/>
      </source>
      <alias name='hostdev2'/>
      <address type='usb' bus='0' port='1'/>
    </hostdev>
    <hostdev mode='subsystem' type='usb' managed='no'>
      <source>
        <vendor id='0x413c'/>
        <product id='0x2003'/>
        <address bus='1' device='3'/>
      </source>
      <alias name='hostdev3'/>
      <address type='usb' bus='0' port='2'/>
    </hostdev>
    <memballoon model='none'/>
  </devices>
  <seclabel type='dynamic' model='dac' relabel='yes'>
    <label>+0:+100</label>
    <imagelabel>+0:+100</imagelabel>
  </seclabel>
</domain>
 

Link to comment
  • Solution

For Radeon cards you do not have to use a VBIOS file.

 

First Steps: Set your machine in UEFI to CSM mode "enabled". Set your Unraid to Legacy mode. In "Main" klick on "Flash" right next to the Unraid usb drive this will bring you to Unraid settings, in the settings uncheck "Allow UEFI boot". Open "Settings", "VM Manger" and set "PCI ACS Override" to "Both", set "Allow unsafe interrupts" to "Yes", reboot Unraid, go to "Tools" "System devices" and set the VFIO passthrough devices, then click "Bind selected devices to VFIO", click "Done", install the AMD Vendor reset plugin. Go to "Main", "Flash", "Syslinux Configuration", the section "Unraid OS" should look something like this:

 

kernel /bzimage
append pcie_acs_override=downstream,multifunction vfio_iommu_type1.allow_unsafe_interrupts=1 initrd=/bzroot

 

after "append" add this: video=efifb:off,vesafb:off

 

it should now look like this:

 

kernel /bzimage
append video=efifb:off,vesafb:off pcie_acs_override=downstream,multifunction vfio_iommu_type1.allow_unsafe_interrupts=1 initrd=/bzroot

 

Reboot again.

 

Create a VM. Edit the VM in GUI, the first gpu should be "Virtual" for the VNC card, the second GPU should be your Radeon card. As first soundcard set Radeon HDMI passthrough, click "Update", then edit the VM again in XML.

 

In the XML File go to <features> and edit

 

<features>
    <acpi/>
    <apic/>
    <hyperv mode='custom'>
      <relaxed state='on'/>
      <vapic state='on'/>
      <spinlocks state='on' retries='8191'/>
      <vendor_id state='on' value='1234567890ab'/>       <----  with Vendor ID set to 'none' you get error 43
    </hyperv>

    <kvm>
      <hidden state='on'/>
     <--- set this for kvm, if you do not do it, you get error 43
    </kvm>

  </features>

.

.

For the graphics card edit the following lines:

 

<hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x0a' slot='0x00' function='0x0'/>
      </source>
     <alias name='hostdev0'/> remove the vbios
      <address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0' multifunction='on'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x0a' slot='0x00' function='0x1'/>     
      </source>                                                                                               
      <alias name='hostdev1'/>                                                                    
      <address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x1'/>
    </hostdev>

.

.

.

After you set everthing, you have to set your VM to autoboot and reboot Unraid. Don´t forget do pass through a keyboard for pressing the any key to boot from the Windows Image. During the reboot process Unraid will launch the VM at start and you will not be able to get any screen output. Just keep pressing the space bar when the keyboard lights up a second time during VM boot.

 

When the VM starts you can install Windows, reboot, install VirtIO drivers, reboot, then configure Windows using the vnc connection. Usually when i am in the process of configuring Windows the video card will get installed in the background after some minutes of runnig the VM. A second "Microsoft Basic Dispay Adapter" will appear in the windows device manger, reporting Code 31, which means you did not install drivers yet. At this point your screen connected to the Radeon card should light up.

 

A critical step will be preventing Windows from loading driver updates through Windows Update. If that happens, your VM will be borked and you have to reinstall it again because the standard Windows Update driver for Radeon does not work.

 

BEFORE you install the VIRTIO drivers you have to configure Windows Update. Run "gpedit.msc" and select "Computer configuration", "Administrative templates", "Windows components", "Windows Update", "Do not allow driver updates through Windows Update" and set this rule to "Active". ALSO check System Properties, Hardware, Device installation settings, set it to "No, do not download apps and device symbols". There will be a warning wich can be accepted clicking "OK".

 

During the whole process do NOT shutdown your VM through the Unraid GUI. The VM should be working and you should reboot the VM using the Windows start menu every time you have to manually reboot the guest.

 

Do not install the latest video drivers. Install WHQL 22.5.1 drivers. I tried latest drivers wich resulted in slow video performance and black screen.

 

For some reason the installation of the virtio drivers fails everytime in a Windows 10 VM when i run the setup for the first time. Just rerun  the installer and it will work the second time. Then open the virtio driver folder on the virtio driver disk and navigate to "qemu system agent" and install that on top of the drivers. Do not install anything else from the virtio drivers disk. I tried installing the guest agent using the "virtio-win-guest-tools.exe" in the main folder and that borked my vm. Do not use that.

 

A lot of errors in dealing with VM are solved when you realise that when you make changes to the VM template in the GUI all former changes you made in the XML template get discarded. As soon as you click the "Update" button in the GUI the current XML gets overwritten by a standard template and you have to edit your XML setting again.

Edited by Jumbo_Erdnuesse
Mistakenly removed alias, added Syslinx Configuration which was missing
  • Like 1
  • Thanks 3
Link to comment
  • 2 weeks later...

Thank you genuinely for taking the time to write such detailed response.  I knew about the sleep bug and had intended to passthrough a pci USB controler but wanted to take it one problem at a time and get the GPU passthrough working first. With your help I was able to get everything done in one go. Someone should take this or something because ive read a lot of post addressing gpu with a 5700xt and you covered everything and then some. I had some issues booting in legacy mode but after resolving that I followed your instructions through to the second reboot. At that point I switched on the old VM I had previously configured just to see if it work and it worked perfectly. Everything is working flawlessly now. Really great getting that annoying sleep bug fix and being able to switch on and off different vm's using the 5700xt. Again thanks a ton. 

Link to comment
  • 11 months later...
  • 3 months later...
On 12/16/2022 at 11:44 PM, Jumbo_Erdnuesse said:

 

@Jumbo_Erdnuesse Thankyou so much for your helpful info.  

I was about to give up unRAID for something else.  I bought a 6600XT because it works OOB with Monterey.  Had to get Windows working first 🙂

Your changes to XML file + disabling re-BAR support in BIOS done it for me 😄.  

 

Installed a few test VMs and so far no issues... Now onto Monterey.

Thankyou!!

 

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.

×
×
  • Create New...