Radeon RX 6800 XT GPU passthrough virtio

You will likely need to include a link to your VM’s configuration xml as well. Since that’s likely where one of your problems is (at least the black screen one).

Make sure you have:

<kvm>
      <hidden state='on'/>
</kvm>

In your VM’s configuration.

However I’m not sure you have the VFIO settings setup properly if you’re having issues that require fiddling with the cables after reboots.

I know not all motherboard vendors allow switching which is the boot GPU, which is one of the reasons I ended up going with a gigabyte for my setup.

You could be booting from the wrong GPU from the bios/UEFI, and maybe that’s giving you some issues. I’d double check the bios settings, to make sure you have all the right options checked, csm off, svm on, iommu (usually multiple places on, not auto) etc…

I’ve also got something like this in /usr/local/bin/vfio.sh. Note that I have 2 AMD cards, so this just makes sure the one I want gets the driver bound to it.

#!/bin/bash
for i in /sys/bus/pci/devices/*/boot_vga; do
    if [ $(cat "$i") -eq 1 ]; then # 1 here for second gpu, 0 for first.
        GPU="${i%/boot_vga}"
        AUDIO="$(echo "$GPU" | sed -e "s/0$/1/")"
        echo "vfio-pci" > "$GPU/driver_override"
        if [ -d "$AUDIO" ]; then
            echo "vfio-pci" > "$AUDIO/driver_override"
        fi
    fi
done

modprobe -i vfio-pci

That’s being included in the /etc/mkinitcpio.conf:

FILES=(/usr/local/bin/vfio.sh)

And lastly in my grub config I have the following added.

GRUB_CMDLINE_LINUX="iommu=pt amd_iommu=on vfio-pci.ids=1002:73bf,1002:ab28 video=efifb:off"

I’m on Arch as well, and my 6800xt’s passed through fine with my Win10 VM.

Hope it helps.