sudo pacman -S qemu-full virt-manager bridge-utils libguestfs dnsmasq vde2 openbsd-netcat && sudo systemctl enable libvirtd && sudo systemctl start libvirtd && sudo usermod -aG kvm $USER && sudo usermod -aG libvirt $USER && sudo virsh net-start default && sudo virsh net-autostart default
sudo pacman -S linux-vfio linux-vfio-headers
lspci -nn | grep -E "NVIDIA"
Trim the IDs and separate them with commas (,
) only.
Save the IDs somewhere.
You will need both your GPU ID and your GPU audio device ID.
Edit the file: sudo vim /boot/grub/grub.cfg
Then add the following to your "GRUB_CMDLINE" configuration:
amd_iommu=on iommu=pt vfio-pci.ids=your,ids
Then change your configuration:
GRUB_DEFAULT="0" -> 1>2 (replace with your number)
If you're booting from the GRUB menu, you can go under "Advanced options" and see the different kernels. The first option is always 0
, the second is 1
, and so on. You want to change it to the linux-vfio
kernel.
To boot from the "Advanced options," use GRUB_DEFAULT="1>2"
with the extra >
sign to select the correct kernel (replace 2
with the correct boot option).
For GRUB, run:
sudo grub-mkconfig -o /boot/grub/grub.cfg
Edit the file: sudo vim /boot/loader/entries/arch.conf
Add after the "rw":
amd_iommu=on iommu=pt vfio-pci.ids=your,ids
Then change the bootloader configuration to (DO NOT REMOVE ANYTHING):
linux /vmlinuz-linux-vfio
initrd /initramfs-linux-vfio.img
*You can replace amd_iommu=on
with intel_iommu=on
if you have an Intel CPU.*
*Replace your,ids
with the IDs you saved earlier.*
sudo touch /etc/modprobe.d/vfio.conf
sudo vim /etc/modprobe.d/vfio.conf
Paste the following into the file:
options vfio-pci ids=your,ids
softdep nvidia pre: vfio-pci
Replace your,ids
with your GPU IDs.
sudo mkinitcpio -P linux-vfio
sudo reboot now
sudo modprobe vfio-pci
In your VM settings, click "Add" and select your NVIDIA GPU and NVIDIA audio device.