Guest User

Untitled

a guest
Apr 24th, 2019
467
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. Create file in /etc/default/grub.d/enable_iommu.cfg, then run update-grub:
  2. -------------------------
  3. GRUB_CMDLINE_LINUX_DEFAULT="${GRUB_CMDLINE_LINUX_DEFAULT} intel_iommu=on disable_idle_d3=1 pcie_acs_override=downstream i915.enable_hd_vgaarb=1 kvm.ignore_msrs=1 video=efifb:off"
  4. -------------------------
  5.  
  6.  
  7.  
  8. Create config in /etc/vfio-pci.cfg listing addresses of PCI cards to be passed through:
  9. -------------------------
  10. DEVICES="0000:03:00.0 0000:03:00.1 0000:04:00.0 0000:04:00.1 0000:05:00.0 0000:05:00.1 0000:06:00.0 0000:06:00.1"
  11. -------------------------
  12.  
  13.  
  14.  
  15. Create (and enable) init script in /etc/init.d/vfiobind
  16. -------------------------
  17. #! /bin/sh
  18.  
  19. ### BEGIN INIT INFO
  20. # Provides: vfiobind
  21. # Required-Start: $remote_fs $network $syslog
  22. # Required-Stop: $remote_fs $network $syslog
  23. # Default-Start: 2 3 4 5
  24. # Default-Stop: 0 1 6
  25. # Short-Description: vfio device binding
  26. ### END INIT INFO
  27.  
  28. PATH=/sbin:/bin:/usr/bin:/usr/sbin
  29. CONFIG_FILE=/etc/vfio-pci.cfg
  30. NAME=vfiobind
  31. DESC="VFIO device binding script"
  32.  
  33. . /lib/init/vars.sh
  34. . /lib/lsb/init-functions
  35.  
  36.  
  37. if [ -f $CONFIG_FILE ] ; then
  38. . $CONFIG_FILE
  39. fi
  40.  
  41. bind_devices() {
  42. modprobe vfio-pci
  43. for dev in $DEVICES; do
  44. vendor=$(cat /sys/bus/pci/devices/$dev/vendor)
  45. device=$(cat /sys/bus/pci/devices/$dev/device)
  46. if [ -e /sys/bus/pci/devices/$dev/driver ]; then
  47. echo $dev > /sys/bus/pci/devices/$dev/driver/unbind
  48. fi
  49. echo $vendor $device > /sys/bus/pci/drivers/vfio-pci/new_id
  50. done
  51. }
  52.  
  53.  
  54. case "$1" in
  55. start)
  56. log_daemon_msg "Starting $DESC" "$NAME"
  57. bind_devices
  58. log_end_msg $?
  59. ;;
  60. stop)
  61. # No-op
  62. ;;
  63. restart|reload|force-reload)
  64. echo "Error: argument '$1' not supported" >&2
  65. exit 3
  66. ;;
  67. *)
  68. N=/etc/init.d/$NAME
  69. echo "Usage: $N {start}"
  70. exit 1
  71. ;;
  72. esac
  73.  
  74. exit 0
  75. -------------------------
Advertisement
Add Comment
Please, Sign In to add comment