57 lines
1.6 KiB
Markdown
Raw Normal View History

2023-09-20 22:34:29 +01:00
1) In your PC/Laptop/Server BIOS make sure the following is enabled in the BIOS:
Intel VT-d & VT-x Intel Compatible list
All AMD CPUs from Bulldozer onwards should be compatible.
2) Get device IDs:
2024-01-29 22:03:51 -05:00
`lspci -nn`
2023-09-20 22:34:29 +01:00
3) Enable IOMMU in GRUB (check Intel or AMD commands below - choose the right one)
nano /etc/default/grub
2024-01-29 22:03:51 -05:00
`GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on iommu=pt"`
2023-09-20 22:34:29 +01:00
2024-01-29 22:03:51 -05:00
`GRUB_CMDLINE_LINUX_DEFAULT="quiet amd_iommu=on"`
2024-01-29 22:08:12 -05:00
Verify that IOMMU is enabled by running `dmesg | grep -e DMAR -e IOMMU` and looking for a line indicating it is enabled
2024-01-29 22:03:51 -05:00
Save and exit
4) run the command `"update-grub"` now reboot
5) Enable VFIO Modules
`nano /etc/modules`
2023-09-20 22:34:29 +01:00
Add the following modules:
2024-01-29 22:03:51 -05:00
```
2023-09-20 22:34:29 +01:00
vfio
vfio_iommu_type1
vfio_pci
vfio_virqfd
2024-01-29 22:03:51 -05:00
```
2023-09-20 22:34:29 +01:00
Then, save and exit
2024-01-29 22:03:51 -05:00
6) `update-initramfs -u -k all` and reboot
2023-09-20 22:34:29 +01:00
2024-01-29 22:10:25 -05:00
Verify the modules are enabled with `dmesg | grep -i vfio` and checking the driver version line is present
8) GPU Isolation From the Host (amend the below to include the IDs of the device you want to isolate)
2024-01-29 22:03:51 -05:00
`echo "options vfio-pci ids=10de:1381,10de:0fbc disable_vga=1" > /etc/modprobe.d/vfio.conf`
2023-09-20 22:34:29 +01:00
8) Blacklist GPU drivers (here are all that you would ever need)
2024-01-29 22:03:51 -05:00
```
2023-09-20 22:34:29 +01:00
echo "blacklist radeon" >> /etc/modprobe.d/blacklist.conf
echo "blacklist nouveau" >> /etc/modprobe.d/blacklist.conf
echo "blacklist nvidia" >> /etc/modprobe.d/blacklist.conf
echo "blacklist nvidiafb" >> /etc/modprobe.d/blacklist.conf
echo "blacklist nvidia_drm" >> /etc/modprobe.d/blacklist.conf
2024-01-29 22:03:51 -05:00
```
2023-09-20 22:34:29 +01:00
9) Create a new VM and add the GPU via hardware menu
You may need to set it as primary GPU
You may need to add a ROM BAR