SHARE
TWEET

Prepare Intel iGPU Passthrough

a guest Feb 21st, 2020 102 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. set -e
  3.  
  4. function stopgdm() {
  5.     echo "Stopping GDM"
  6.     systemctl stop gdm
  7.     echo "Stopped."
  8.     sleep 0.5
  9.     echo "Stopping gdm-wayland-session"
  10.     killall gdm-wayland-session
  11.     echo "Stopped"
  12.     sleep 0.5
  13. }
  14.  
  15. function stopvt() {
  16.     echo "Stopping virtual terminals"
  17.     for i in /sys/class/vtconsole/*/bind
  18.     do
  19.         echo 0 >$i
  20.     done
  21. }
  22.  
  23. function stopsound() {
  24.     echo "Stopping Intel HDA sound"
  25.     for i in /sys/module/snd_hda_intel/drivers/pci\:snd_hda_intel/*/remove
  26.     do
  27.         echo 1 >$i
  28.     done
  29. }
  30.  
  31. function removemod() {
  32.     echo "Waiting for everything to settle down"
  33.     sleep 0.5
  34.     echo "Removing modules"
  35.     rmmod snd_hda_intel
  36.     rmmod i915
  37. }
  38. function probepci() {
  39.     devicestring="$(lspci -nn | grep "VGA compatible")"
  40.     pciid="$(echo "$devicestring" | grep -o "8086:....")"
  41.     pciaddr="$(echo "$devicestring" | cut -f 1 -d " ")"
  42.     modprobe vfio-pci ids=$pciid
  43.     echo "Probed: $devicestring"
  44.     echo "run qemu with -device vfio-pci,host=$pciaddr"
  45. }
  46.  
  47. stopgdm
  48. stopvt
  49. stopsound
  50. removemod
  51. probepci
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top