From 361767155919cb5eb7c9a75cc747b6e91551a031 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alf=20H=C3=B8gemark?= Date: Sat, 18 Mar 2023 11:22:26 +0100 Subject: [PATCH] Added some details on checking IOMMU for PCI passthrough MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add info on how to check if IOMMU is enabled on the current running kernel, and how to add the kernel parameters. Also add some info related to iommu_groups, and hint on iommu=pt for performance. I used this to enable PCI passthrough of USB controller, which worked, even if I did not have anything in the /sys/kernel/iommu_groups. Signed-off-by: Alf Høgemark --- docs/compute.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/docs/compute.md b/docs/compute.md index 38aafb23..02164ddd 100644 --- a/docs/compute.md +++ b/docs/compute.md @@ -14,6 +14,34 @@ In order to use PCI passthrough your host system must have VT-d/IOMMU functional Consult your system or motherboard manual for instructions on where to find the setting in your BIOS/UEFI. In addition, system BIOS updates may reset the feature to its default state, which may require you to re-enable it. +Check your current kernel boot parameters to see that you have either iommu_intel=on, iommu_amd=on, or iommu=pt enabled. +``` +[root@xen ~]# cat /proc/cmdline | grep iommu +... +root=LABEL=root-peursi ro ... intel_iommu=on +``` + +Check that DMAR/IOMMU is enablled by the kernel. +``` +[root@xen ~]# dmesg | grep -i dmar +... +[ 0.697084] DMAR: IOMMU enabled +``` +For performance, some guides recommend to replace the Intel/AMD setting with iommu=pt, if that is working. + +If you need to enable or disable the kernel parameters then use xen-cmdline, and reboot afterwards. +``` +[root@xen ~]# /opt/xensource/libexec/xen-cmdline --set-dom0 intel_iommu=on +[root@xen ~]# /opt/xensource/libexec/xen-cmdline --get-dom0 intel_iommu +[root@xen ~]# /opt/xensource/libexec/xen-cmdline --delete-dom0 intel_iommu +``` + +Some, for example https://www.heiko-sieger.info/iommu-groups-what-you-need-to-consider/, also mentions that the /sys/kernel/iommu_groups should contain entries +``` +[root@xen ~]# ls -l /sys/kernel/iommu_groups/ +``` +Even with no entries in the iommu_groups, the PCI passthrough can still work. + If you attempt to perform PCI passthrough on a system which does not have VT-d/IOMMU enabled, you may encounter the following error when you start the target virtual machine: ```