Workaround for passthrough primary GPU

rafaame

Member
Oct 27, 2020
1
1
23
32
For those who are having problems doing gpu passthrough after the 7.2 update OR want to passthrough the primary gpu and despite blacklisting the drivers get the BAR can't reserve mem

Create a simple script (in /root/detach-gpu.sh for example) replacing XX with the appropriate value (your device address as of lspci -nnk):
Bash:
#!/bin/sh

echo 1 > /sys/bus/pci/devices/0000\:[B]XX[/B]\:00.0/remove
echo 1 > /sys/bus/pci/rescan

echo 0 > /sys/class/vtconsole/vtcon0/bind
echo 0 > /sys/class/vtconsole/vtcon1/bind

echo vesa-framebuffer.0 > /sys/bus/platform/drivers/vesa-framebuffer/unbind
echo efi-framebuffer.0 > /sys/bus/platform/drivers/efi-framebuffer/unbind
echo simple-framebuffer.0 > /sys/bus/platform/drivers/simple-framebuffer/unbind

This script should be executed on reboot, so open your cron jobs with crontab -e and insert the following:
Code:
@reboot /root/detach-gpus.sh

Hope this helps
 
  • Like
Reactions: Dunuin