VFIO Pass through working on 9070XT A user on the Level1Techs forum shared a libvirt hook script that restores AMD Radeon RX 9070 XT GPU passthrough to virtual machines, fixing a regression the user attributes to hardware scheduler and power management changes between Linux kernel 6.12 and 7.2. The script unbinds the GPU from the amdgpu driver, sets BAR size via resource2_resize, and rebinds the card on VM release, eliminating the hard reset previously required to reclaim the GPU after a VM shut down. The user reported the script has worked every time across repeated VM start and stop cycles. Hi All, I just wanted to share some updates, that might help anyone struggling with their 9070XT. My initial process was: bash /bin/bash systemctl stop lightdm.service sleep 2 echo 0000:10:00.0 /sys/bus/pci/drivers/amdgpu/unbind sleep 2 0000:10:00.1 /sys/bus/pci/drivers/snd hda intel/unbind sleep 2 echo 3 /sys/bus/pci/devices/0000:10:00.0/resource2 resize sleep 2 systemctl start lightdm.service I haven’t actually used my VMs for several months, fast forward to a couple of days ago, and when i tried it, it no longer works the same. I can use the script, start the VM, and the VM starts with the GPU attached, but upon exiting, the driver would no longer grab the GPU back, meaning the only way i could run another VM or reset my GPU was by doing a hard reset. According to Google AI this is because between 6.12 and 7.2 there have been changes to the hardware scheduler and power management. However, with google’s help I was able to come up with the following script, which has been added to the libvirt/hooks directory. And now it automatically does everything. I can start and stop VMs without a hard reset. I have used it a bunch of times and so far, it has worked every time. bash /bin/bash CONFIGURATION: The target PCIe address of your secondary AMD card GPU PCI="0000:10:00.0" ACTION="$2" PHASE="$3" 1. RUN BEFORE ANY VM BOOTS Prepares the card without freezing if "$ACTION" = "prepare" && "$PHASE" = "begin" ; then Stop LightDM cleanly from the system background systemctl stop lightdm.service sleep 2 Unbind from host driver if -e "/sys/bus/pci/devices/$GPU PCI/driver" ; then echo "$GPU PCI" /sys/bus/pci/drivers/amdgpu/unbind 2 /dev/null sleep 2 fi Set BAR size down for VM compatibility echo 3 /sys/bus/pci/devices/$GPU PCI/resource2 resize 2 /dev/null sleep 1 Restart LightDM right away so your host desktop comes back online while VM is running systemctl start lightdm.service fi 2. RUN AFTER ANY VM SHUTS DOWN Reclaims the card safely for successive boots if "$ACTION" = "release" && "$PHASE" = "end" ; then Stop LightDM in the background so X11 stops polling the hardware lanes systemctl stop lightdm.service sleep 2 Clear driver overrides and force bind safely echo "amdgpu" /sys/bus/pci/devices/$GPU PCI/driver override 2 /dev/null echo "$GPU PCI" /sys/bus/pci/drivers/amdgpu/bind 2 /dev/null sleep 2 Restart LightDM to securely restore your desktop environment systemctl start lightdm.service fi So, I wanted to share it in case it can help anyone else.