Here is how i did it with official drivers.
AMD 3700x / GT1030
ASUS TUF B550M PLUS / BIOS:0805 / AGESA combo V2 PI 126.96.36.199
Latest bios with AGESA combo V2 PI 188.8.131.52 did not work. got same error43 with it.
1. Dumped vbios rom with GPUZ and removed nvflash header with hexeditor.
I had to dump mine even though techpowerup had exact model but i have 2 years newer revision.
Guide for making that dump: https://www.youtube.com/watch?v=1IP-h9IKof0
2. Having your GPU in own IOMMU group
Info about that: https://www.youtube.com/watch?v=qQiMMeVNw-o
My example at Tools>System Devices
IOMMU group 18: [1022:43ea] 03:00.0 PCI bridge: Advanced Micro Devices, Inc. [AMD] Device 43ea
[10de:1d01] 04:00.0 VGA compatible controller: NVIDIA Corporation GP108 [GeForce GT 1030] (rev a1)
[10de:0fb8] 04:00.1 Audio device: NVIDIA Corporation GP108 High Definition Audio Controller (rev a1)
3. UEFI / BIOS Settings:
Have virtualizion enabled in bios and other setting to help separating IOMMU groups.
Tweaker -> Advanced CPU Settings -> SVM Mode -> Enable
Settings -> Miscellaneous -> IOMMU -> Enable
Settings -> AMD CBS -> ACS Enable -> Enable
Settings -> AMD CBS -> Enable AER Cap -> Enable
There is also SR-IOV setting somewhere.
There is also PCIe ACS override setting in unraid to help separate IOMMU groups.
Setting>VM Manager and select advanced view.
Add VM>Windows 10
CPU Mode: Host Passtrough
Select OS install ISO. I used Windows 10 1909 version.
Download and select Virtio ISO. I used virtio-win-0.1.185.iso.
Select suitable disk size. 50G on mine.
Graphics as VNC.
Uncheck start VM after creation.
Edit and change to xml view.
Add this under <apic/> tag
Change hyper-V settings to look like this and add kvm setting after it:
<spinlocks state='on' retries='8191'/>
<vendor_id state='on' value='1234567890ab'/>
In my case for ryzen i need to apply fix for bluescreen KERNEL SECURITY CHECK ISSUE.
Add this to end of xml between </devices> and </domain>
As for others you can try these lines if those are enough.
Start VM and take VNC connection ASAP to be able to press any key.
Select language preferences next and install.
I don't have product key (set it after install)
Select your windows version. (My case 10 Pro)
Custom: Install Windows only (advanced)
Red Hat VirtIO SCSI controller>Next
Red Hat VirtIO Ethernet Adapter>Next
(You can add network later after installation also)
Select drive and next.
Set your personal account and privacy settings
You should be at your windows 10 desktop now.
Open start menu and type compmgmt.msc and open.
Open Device Manager.
On my case there are 2 devices without drivers.
Right click on driverless device and select update driver>Browse my computer>select whole virtio disk.
Write "This PC" on start menu > right click on it > properties
From right press "Change settings" > Take note on Full Computer Name > remote tab
Check "Allow remote connections" > uncheck tab below it > OK.
Test rdp connection to VM.
If it doesnt work. Fix it before you continue.
Edit VM in form view.
Press + on VNC selection to add another graphics card.
select your GPU and select vbios for your card.
select nvidia audio controller as sound card if it is in same IOMMU group.
(Optionally select attached KB+mouse)
Now go back to edit and change to xml view.
Add those qemu commandlines again which we did earlier as basic view gets rid of them.
Disable VNC by removing <graphics> and </graphics> and everything between them.
Same on <video> and </video>.
You should see it boot on attached monitor.
Use RDP or kb+mouse to install gpu drivers.
I use 399.24 version. Haven't tested on later versions.
I get error after installation that there drivers are not suitable but seems to work fine.
You should have now Windows 10 VM with gpu passtrough.
Hope this helps!
qemu-system-x86_64: vfio_region_write(0000:04:00.0:region1+0xa8ec8, 0x0,8) failed: Device or resource busy
vfio-pci 0000:04:00.0: BAR 1: can't reserve [mem 0xd0000000-0xdfffffff 64bit pref]
make this type of script and run everytime array starts or manually run from console.
echo 0 > /sys/class/vtconsole/vtcon0/bind
echo 0 > /sys/class/vtconsole/vtcon1/bind
echo efi-framebuffer.0 > /sys/bus/platform/drivers/efi-framebuffer/unbind