Enabling IOMMU support - Qrivi/KVM GitHub Wiki

First, edit the GRUB boot loader configuration to enable the I/O memory management unit (IOMMU). You will need sudo to edit this file.

sudo nano /etc/default/grub

Depending on the CPU architecture, add the intel_iommu or amd_iommu parameter to GRUB_CMDLINE_LINUX_DEFAULT and set it to on. Also add the general iommu parameter and set this one to pt — this will prevent Linux from touching devices which cannot be passed through. Leave every other parameter as is.

GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on iommu=pt apparmo r=1 security=apparmor udev.log_priority=3"

To persist these changes, rebuild the boot loader and reboot the system.

sudo grub-mkconfig -o /boot/grub/grub.cfg
reboot

Once rebooted, verify that IOMMU has been correctly enabled and IOMMU groups were created. If the dmesg output contains DMAR: IOMMU enabled and lists PCI slots being added to IOMMU groups, we are golden.

sudo dmesg | grep -i -e DMAR -e IOMMU

Next up, we will modify mkinitcpio to load the VFIO stub drivers early in order to prevent Manjaro itself from interacting with certain PCI devices (so we can pass them through to a guest VM) we will define later on.

sudo nano /etc/mkinitcpio.conf

Edit the MODULES to load vfio_pci, vfio, vfio_iommu_type1, and vfio_virqfd in that order and add modconf to the HOOKS. Make sure the VFIO modules are loaded before any other modules that interact with PCI hardware you want to passthrough to a guest OS (e.g. the radeon or amdgpu module). In most scenarios, simply add the VFIO modules to the beginning of the MODULES list.

...
MODULES=(vfio_pci vfio vfio_iommu_type1 vfio_virqfd)
...
HOOKS="base udev autodetect modconf block keyboard keymap filesystems"
...

To persist these changes, regenerate the initramfs while passing it the kernel you are using as a preset. You can look this up or simply have it autocompleted by hitting tab. And reboot.

sudo mkinitcpio -p linux56
reboot

Done!

⚠️ **GitHub.com Fallback** ⚠️