How To Enable IOMMU in KVM host system

In KVM, IOMMU (Input-Output Memory Management Unit) is a hardware functionality that gives better security to the VMs by ensuring that they don’t interfere with the memory each other.

The host system is also protected in an instance where the VM is compromised through malicious attacks. IOMMU can isolate faults in the system and reduces the likelihood of a system-wide crashes that can be caused by a single VM or device.

Excerpt from Mastering KVM Virtualization. Get the complete eBook to unlock hands-on labs, tips, and expert strategies. Download now.

For DMA (Direct Memory Access) capable devices, IOMMU allows VMs to have direct access to physical devices on the host system. This results in a near-native performance on VMs since it reduces overhead by bypassing the host OS.

Check if your system supports IOMMU:

grep -E --color 'vmx|svm' /proc/cpuinfo

If you get any output it means your system likely supports IOMMU.

Enable IOMMU on Debian based systems

To enable IOMMU we need to modify OS kernel boot parameters. Open the file /etc/default/grubwith a text editor of your choice.

# Open with vim
sudo vim /etc/default/grub

# Open with nano
sudo nano /etc/default/grub

Locate the line GRUB_CMDLINE_LINUX_DEFAULT and add intel_iommu=on or amd_iommu=on depending on the processor type in your host device.

# For Intel CPU add
intel_iommu=on

# For AMD CPU add
amd_iommu=on

Here are samples of a modified GRUB_CMDLINE_LINUX_DEFAULT line.

# Example 1
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash intel_iommu=on"

# Example 2
GRUB_CMDLINE_LINUX_DEFAULT="consoleblank=0 systemd.show_status=true console=tty1 console=ttyS0 intel_iommu=on"

# Example 3
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash amd_iommu=on"

After the file is edited, you need to generate a new GRUB configuration file.

sudo update-grub

For the changes to take effect, you will need to reboot the system.

sudo reboot

Enable IOMMU on RHEL based systems

As a root or user with administrative privileges, open GRUB configuration file

# Open with vim
sudo vim /etc/default/grub

# Open with nano
sudo nano /etc/default/grub

Locate the line GRUB_CMDLINE_LINUX_DEFAULT and add intel_iommu=on or amd_iommu=on depending on the processor type in your host device.

# For Intel CPU add
intel_iommu=on

# For AMD CPU add
amd_iommu=on

Examples of modified GRUB_CMDLINE_LINUX lines:

# Example 1
GRUB_CMDLINE_LINUX="rhgb quiet intel_iommu=on"

# Example 2
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=rl/root intel_iommu=on"

# Example 3
GRUB_CMDLINE_LINUX="rhgb quiet amd_iommu=on"

Run below commands to update GRUB and apply the changes:

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

For the changes to take effect you must reboot the server.

sudo shutdown -r now

Confirm if IOMMU is enabled

Once the system has been rebooted, you can verify if IOMMU is enabled by querying the current kernel boot parameters:

grep -i iommu /proc/cmdline

If IOMMU is enabled, then there should be intel_iommu=on or amd_iommu=on in the output.

Join our Linux and open source community. Subscribe to our newsletter for tips, tricks, and collaboration opportunities!

Recent Post

Unlock the Right Solutions with Confidence

At CloudSpinx, we don’t just offer services - we deliver clarity, direction, and results. Whether you're navigating cloud adoption, scaling infrastructure, or solving DevOps challenges, our seasoned experts help you make smart, strategic decisions with total confidence. Let us turn complexity into opportunity and bring your vision to life.

Leave a Comment

Your email address will not be published. Required fields are marked *

Related Post

If you’re looking to upgrade your PC or laptop, 32GB of DDR4 RAM strikes the perfect balance between performance and […]

What is Zsh? Short for Z shell, Zsh is command line shell with a lot of new features and supports […]

When you’re shopping for a 64GB DDR4 RAM kits, you’re not just upgrading memory, but upgrading capability. Whether you’re powering […]

Let's Connect

Unleash the full potential of your business with CloudSpinx. Our expert solutions specialists are standing by to answer your questions and tailor a plan that perfectly aligns with your unique needs.
You will get a response from our solutions specialist within 12 hours
We understand emergencies can be stressful. For immediate assistance, chat with us now

Contact CloudSpinx today!

Download CloudSpinx Profile

Discover the full spectrum of our expertise and services by downloading our detailed Company Profile. Simply enter your first name, last name, and email address.