Edit2: This works for the first time you run the VM after every host boot. If I shut down the VM and then start it again, the display out works but I get constant GPU driver crashes when I try to game and I need to restart the host to make it work again. It seems like something doesn’t get reset and the driver crashes.
Once booted to Windows, I used GPU-Z to dump the card’s VBIOS to a file. I did that while having the Code 43 error, it worked regardless. Then I copied the file over to the host and set the “rom file” section in the VM XML, at the GPU passthrough section:
<hostdev mode="subsystem" type="pci" managed="yes">
<driver name="vfio"/>
<source>
<address domain="0x0000" bus="0x44" slot="0x00" function="0x0"/> *<- THIS IS WHERE MY 7900XTX IS PLUGGED INTO THE HOST*
</source>
<rom file="*FULL PATH TO YOUR VBIOS FILE*"/> *<- THIS IS THE PART THAT SOLVES THE RESET BUG*
<address type="pci" domain="0x0000" bus="0x01" slot="0x00" function="0x0" multifunction="on"/>
</hostdev>
That was close that I almost got 7900xtx but it was not in stock. Thus, I ended up 4070 Ti. It turned out a good thing that GPU passthrough works like a charm.
A way to use the large BAR for the 7900XTX in the Windows guest VM:
Turn Resizable BAR OFF in BIOS.
Manually set BAR 0 to 32GB at the Linux host.
Manually set BAR 2 to 8MB at the Linux host. Anything larger than 8MB causes code 43 in Windows.
How do manually resize the BARs:
echo -n "0000:03:00.0" > /sys/bus/pci/drivers/vfio-pci/unbind ## change 0000:03:00.0 to your GPU's address
echo 15 > /sys/bus/pci/devices/0000\:03\:00.0/resource0_resize ## numbers 1-15 correspond to different bar sizes. 15 is 32GB, for more check the reddit comment mentioned below
echo 3 > /sys/bus/pci/devices/0000\:03\:00.0/resource2_resize ## same as above
echo -n "0000:03:00.0" > /sys/bus/pci/drivers/vfio-pci/bind
How to automatically resize the BAR at each boot: PCI passthrough via OVMF - ArchWikiSee 10.24
Edit: The udev rule is not working for me ATM, working on a solution.
hello
i have a question. If you manage 7900XT? get working in virt WIN, then … does it suffer from reset bug? Are u able to reset/force reset VM anytime and get VM working again ? Is it working after WIN crash/BSOD ?
Hello! I have a question here. I think you didn’t used it as a single gpu passthrough? I have a 7900 xtx and somehow can’t get it to work as for now. As the start hook gets activated, I just get a blackscreen and with the end hook it doesnt re-activate for the linux host. I use a Rom, which I have exported while I was on Windows before switching to Linux.