KVM: Как включить поддержу IOMMU на Intel или AMD?


В этой статье я расскажу как пробросить PCI или VGA устройства в виртуальную машину на KVM.

Таким образом можно будет использовать GPU на виртуальных машинах и запускать вычисления на с помощью CUDA, а так же  машинное обучение / глубокое обучение с помощью TensorFlow.
Первым делом в BIOS включите VT-d (Intel) или AMD IOMMU (AMD).

Включение IOMMU на KVM-хосте

 [root@dlp ~]# vi /etc/default/grub
# строка 6: добавить (если AMD CPU, то добавить [amd_iommu=on])
1 GRUB_TIMEOUT=5
2 GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
3 GRUB_DEFAULT=saved
4 GRUB_DISABLE_SUBMENU=true
5 GRUB_TERMINAL_OUTPUT="console"
6 GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet intel_iommu=on"
7 GRUB_DISABLE_RECOVERY="true"
Далее
[root@dlp ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
Перезагрузка
[root@dlp ~]# reboot
После перезагрузки проверяем включение IOMMU
[root@dlp ~]# dmesg | grep -E "DMAR|IOMMU"

[    0.000000] ACPI: DMAR 00000000bf79e0d0 00118 (v01    AMI  OEMDMAR 00000001 MSFT 00000097)
[    0.000000] DMAR: IOMMU enabled
[    0.069846] DMAR: Host address width 40
[    0.069848] DMAR: DRHD base: 0x000000fbffe000 flags: 0x1
[    0.069856] DMAR: dmar0: reg_base_addr fbffe000 ver 1:0 cap c90780106f0462 ecap f020fe
[    0.069858] DMAR: RMRR base: 0x000000000ec000 end: 0x000000000effff
[    0.069859] DMAR: RMRR base: 0x000000bf7ec000 end: 0x000000bf7fffff
[    0.069861] DMAR: ATSR flags: 0x0
[    0.069863] DMAR-IR: IOAPIC id 6 under DRHD base  0xfbffe000 IOMMU 0
[    0.070128] DMAR-IR: Enabled IRQ remapping in xapic mode
[    0.960840] DMAR: dmar0: Using Queued invalidation
[    0.960860] DMAR: Setting RMRR:
[    0.960890] DMAR: Setting identity map for device 0000:00:1a.0 [0xbf7ec000 - 0xbf7fffff]
[    0.960925] DMAR: Setting identity map for device 0000:00:1a.1 [0xbf7ec000 - 0xbf7fffff]
[    0.960958] DMAR: Setting identity map for device 0000:00:1a.2 [0xbf7ec000 - 0xbf7fffff]
[    0.960994] DMAR: Setting identity map for device 0000:00:1a.7 [0xbf7ec000 - 0xbf7fffff]
[    0.961031] DMAR: Setting identity map for device 0000:00:1d.0 [0xbf7ec000 - 0xbf7fffff]
[    0.961064] DMAR: Setting identity map for device 0000:00:1d.1 [0xbf7ec000 - 0xbf7fffff]
[    0.961100] DMAR: Setting identity map for device 0000:00:1d.2 [0xbf7ec000 - 0xbf7fffff]
[    0.961132] DMAR: Setting identity map for device 0000:00:1d.7 [0xbf7ec000 - 0xbf7fffff]
[    0.961153] DMAR: Setting identity map for device 0000:00:1a.0 [0xec000 - 0xeffff]
[    0.961167] DMAR: Setting identity map for device 0000:00:1a.1 [0xec000 - 0xeffff]
[    0.961182] DMAR: Setting identity map for device 0000:00:1a.2 [0xec000 - 0xeffff]
[    0.961196] DMAR: Setting identity map for device 0000:00:1a.7 [0xec000 - 0xeffff]
[    0.961210] DMAR: Setting identity map for device 0000:00:1d.0 [0xec000 - 0xeffff]
[    0.961224] DMAR: Setting identity map for device 0000:00:1d.1 [0xec000 - 0xeffff]
[    0.961238] DMAR: Setting identity map for device 0000:00:1d.2 [0xec000 - 0xeffff]
[    0.961255] DMAR: Setting identity map for device 0000:00:1d.7 [0xec000 - 0xeffff]
[    0.961270] DMAR: Prepare 0-16MiB unity mapping for LPC
[    0.961287] DMAR: Setting identity map for device 0000:00:1f.0 [0x0 - 0xffffff]
[    0.961424] DMAR: Intel(R) Virtualization Technology for Directed I/ O

Вот и всё.
+ 0 -
Быстрый хостинг на SSD от 60 руб. VPS на NVMe от 355 руб.

 

Установка любых CMS в пару кликов. Сервера в Москве. Саппорт 24/7.

 

Тарифы на хостинг | Тарифы на VPS | Домены от 90 руб.

Добавить комментарий