Renamed Host to Linux/Guides/GPU Passthrough/Linux Host Setup.
This commit is contained in:
149
Linux/Guides/GPU Passthrough/Linux Host Setup.md
Normal file
149
Linux/Guides/GPU Passthrough/Linux Host Setup.md
Normal file
@@ -0,0 +1,149 @@
|
||||
# Linux Host Setup
|
||||
|
||||
## Enable IOMMU
|
||||
|
||||
```bash
|
||||
sudo vim /etc/default/grub
|
||||
```
|
||||
|
||||
Add amd_iommu=on iommu=pt
|
||||
|
||||
`GRUB_CMDLINE_LINUX_DEFAULT="... amd_iommu=on iommu=pt"`
|
||||
|
||||
```bash
|
||||
sudo grub-mkconfig -o /boot/grub/grub.cfg
|
||||
sudo reboot
|
||||
```
|
||||
|
||||
Verify
|
||||
|
||||
```bash
|
||||
sudo dmesg | grep -i iommu
|
||||
```
|
||||
|
||||
## Find GPU IDs
|
||||
|
||||
```bash
|
||||
lspci -nn | grep -E "VGA|Audio"
|
||||
```
|
||||
|
||||
In my case, I get
|
||||
|
||||
- `10de:28a0`
|
||||
- `10de:22be`
|
||||
|
||||
## VFIO Module Options
|
||||
|
||||
```bash
|
||||
sudo vim /etc/modprobe.d/vfio.conf
|
||||
```
|
||||
|
||||
> ### Arch
|
||||
> ```bash
|
||||
> options vfio-pci ids=10de:28a0,10de:22be
|
||||
> ```
|
||||
|
||||
> ### Fedora
|
||||
> ```bash
|
||||
> options vfio-pci ids=10de:28a0,10de:22be disable_vga=1
|
||||
> softdep nvidia pre: vfio-pci
|
||||
> softdep nouveau pre: vfio-pci
|
||||
> ```
|
||||
|
||||
## Blacklist GPU
|
||||
|
||||
```bash
|
||||
sudo vim /etc/modprobe.d/blacklist-gpu.conf
|
||||
```
|
||||
|
||||
> ### Arch
|
||||
> ```
|
||||
> blacklist nouveau
|
||||
> blacklist nvidia
|
||||
> blacklist nvidia_drm
|
||||
> blacklist nvidia_modeset
|
||||
> ```
|
||||
|
||||
> ### Fedora
|
||||
> ```
|
||||
> blacklist nouveau
|
||||
> blacklist nvidia
|
||||
> blacklist nvidia_drm
|
||||
> blacklist nvidia_modeset
|
||||
> blacklist nvidia_uvm
|
||||
> blacklist rivafb
|
||||
> blacklist nvidiafb
|
||||
> blacklist snd_hda_intel
|
||||
> ```
|
||||
|
||||
## Load VFIO
|
||||
|
||||
> ### Arch
|
||||
> ```bash
|
||||
> sudo vim /etc/mkinitcpio.conf
|
||||
> ```
|
||||
> ```
|
||||
> MODULES=(vfio vfio_iommu_type1 vfio_pci)
|
||||
> ```
|
||||
> ```
|
||||
> sudo mkinitcpio -P
|
||||
> sudo reboot
|
||||
> ```
|
||||
|
||||
> ### Fedora
|
||||
> ```bash
|
||||
> sudo vim /etc/dracut.conf.d/10-vfio.conf
|
||||
> ```
|
||||
> ```
|
||||
> force_drivers+=" vfio vfio_iommu_type1 vfio_pci "
|
||||
> ```
|
||||
> ```bash
|
||||
> sudo dracut -f
|
||||
> ```
|
||||
> ```bash
|
||||
> sudo reboot
|
||||
> ```
|
||||
|
||||
### Confirm Kernel Driver
|
||||
|
||||
```bash
|
||||
lspci -nnk -d 10de:28a0
|
||||
```
|
||||
|
||||
```bash
|
||||
lspci -nnk -d 10de:22be
|
||||
```
|
||||
|
||||
## Install Virtualization Stack
|
||||
|
||||
> ### Arch
|
||||
> ```bash
|
||||
> sudo pacman -S --needed virt-manager qemu-full libvirt dnsmasq ovmf swtpm
|
||||
> ```
|
||||
|
||||
> ### Fedora
|
||||
> ```bash
|
||||
> sudo dnf install @virtualization virt-manager qemu-kvm libvirt-daemon-config-network libvirt-daemon-kvm bridge-utils edk2-ovmf swtpm
|
||||
> ```
|
||||
|
||||
## User Groups and Permissions
|
||||
|
||||
> ### Arch
|
||||
> ```bash
|
||||
> sudo usermod -aG libvirt,kvm,input,render,libvirt-qemu $USER
|
||||
> ```
|
||||
|
||||
> ### Fedora
|
||||
> ```bash
|
||||
> sudo usermod -aG libvirt,kvm,input,render $USER
|
||||
> ```
|
||||
|
||||
Reboot the system.
|
||||
|
||||
And now verify:
|
||||
|
||||
```bash
|
||||
virsh list --all
|
||||
```
|
||||
|
||||
If it doesn't error, you're good.
|
||||
Reference in New Issue
Block a user