{"slug": "vfio-pass-through-working-on-9070xt", "title": "VFIO Pass through working on 9070XT", "summary": "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.", "body_md": "Hi All,\n\nI just wanted to share some updates, that might help anyone struggling with their 9070XT.\n\nMy initial process was:\n\n``` bash\n#!/bin/bash\n\nsystemctl stop lightdm.service\nsleep 2\n\necho 0000:10:00.0 > /sys/bus/pci/drivers/amdgpu/unbind\nsleep 2\n\n 0000:10:00.1 > /sys/bus/pci/drivers/snd_hda_intel/unbind\n#sleep 2\n\necho 3 > /sys/bus/pci/devices/0000:10:00.0/resource2_resize\nsleep 2\n\nsystemctl start lightdm.service\n```\n\nI 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.\n\nHowever, 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.\n\n``` bash\n#!/bin/bash\n\n# CONFIGURATION: The target PCIe address of your secondary AMD card\nGPU_PCI=\"0000:10:00.0\"\n\nACTION=\"$2\"\nPHASE=\"$3\"\n\n# 1. RUN BEFORE ANY VM BOOTS (Prepares the card without freezing)\nif [ \"$ACTION\" = \"prepare\" ] && [ \"$PHASE\" = \"begin\" ]; then\n    # Stop LightDM cleanly from the system background\n    systemctl stop lightdm.service\n    sleep 2\n\n    # Unbind from host driver\n    if [ -e \"/sys/bus/pci/devices/$GPU_PCI/driver\" ]; then\n        echo \"$GPU_PCI\" > /sys/bus/pci/drivers/amdgpu/unbind 2>/dev/null\n        sleep 2\n    fi\n\n    # Set BAR size down for VM compatibility\n    echo 3 > /sys/bus/pci/devices/$GPU_PCI/resource2_resize 2>/dev/null\n    sleep 1\n    \n    # Restart LightDM right away so your host desktop comes back online while VM is running\n    systemctl start lightdm.service\nfi\n\n# 2. RUN AFTER ANY VM SHUTS DOWN (Reclaims the card safely for successive boots)\nif [ \"$ACTION\" = \"release\" ] && [ \"$PHASE\" = \"end\" ]; then\n    # Stop LightDM in the background so X11 stops polling the hardware lanes\n    systemctl stop lightdm.service\n    sleep 2\n\n    # Clear driver overrides and force bind safely\n    echo \"amdgpu\" > /sys/bus/pci/devices/$GPU_PCI/driver_override 2>/dev/null\n    echo \"$GPU_PCI\" > /sys/bus/pci/drivers/amdgpu/bind 2>/dev/null\n    sleep 2\n\n    # Restart LightDM to securely restore your desktop environment\n    systemctl start lightdm.service\nfi\n```\n\nSo, I wanted to share it in case it can help anyone else.", "url": "https://wpnews.pro/news/vfio-pass-through-working-on-9070xt", "canonical_source": "https://forum.level1techs.com/t/vfio-pass-through-working-on-9070xt/227194?page=4#post_79", "published_at": "2026-09-15 13:19:42+00:00", "updated_at": "2026-09-15 13:42:37.008863+00:00", "lang": "en", "topics": ["ai-infrastructure"], "entities": ["AMD Radeon RX 9070 XT", "amdgpu", "libvirt", "LightDM", "Linux kernel 6.12", "Linux kernel 7.2"], "alternates": {"html": "https://wpnews.pro/news/vfio-pass-through-working-on-9070xt", "markdown": "https://wpnews.pro/news/vfio-pass-through-working-on-9070xt.md", "text": "https://wpnews.pro/news/vfio-pass-through-working-on-9070xt.txt", "jsonld": "https://wpnews.pro/news/vfio-pass-through-working-on-9070xt.jsonld"}}