You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
VFIO/PCIe Passthrough configuration support (#247)
* added basic support for PCIe passthrough for Intel and AMD CPUs
Feature can be enabled via `pve_pcie_passthrough_enabled`.
Mediated devices are supported, but disabled by default since not all boards support GVT-g.
Interrupt remapping can also be disabled for boards that do not support it.
* moved GRUB update task to a handler to deduplicate tasks
* added handler for updating initramfs when updating modprobe configuration
* added support for certain PCIe passthrough configurations
Role variables have been added to allow stubbing PCI devices via Vendor:Product ID when GRUB boots, blocking the loading of modules (e.g. nvidia drivers) via `softdep`, enabling GPU OVMF passthrough, and disabling DMA translation by the hypervisor for passthrough devices.
* added new section for PCIe passthrough in documentation
* added ability to configure KVM module to ignore MSRS and disable logging ignored MSRs
This fixes issues with certain applications in Windows guests.
Copy file name to clipboardExpand all lines: README.md
+60Lines changed: 60 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -386,6 +386,15 @@ pve_check_for_kernel_update: true # Runs a script on the host to check kernel ve
386
386
pve_reboot_on_kernel_update: false # If set to true, will automatically reboot the machine on kernel updates
387
387
pve_reboot_on_kernel_update_delay: 60 # Number of seconds to wait before and after a reboot process to proceed with next task in cluster mode
388
388
pve_remove_old_kernels: true # Currently removes kernel from main Debian repository
389
+
pve_pcie_passthrough_enabled: false # Set this to true to enable PCIe passthrough.
390
+
pve_iommu_passthrough_mode: false # Set this to true to allow VMs to bypass the DMA translation. This might increase performance for IOMMU passthrough.
391
+
pve_iommu_unsafe_interrupts: false # Set this to true if your system doesn't support interrupt remapping.
392
+
pve_mediated_devices_enabled: false # Set this to true if your device supports gtv-g and you wish to enable split functionality.
393
+
pve_pcie_ovmf_enabled: false # Set this to true to enable GPU OVMF PCI passthrough.
394
+
pve_pci_device_ids: [] # List of pci device ID's (see https://pve.proxmox.com/wiki/Pci_passthrough#GPU_Passthrough).
395
+
pve_vfio_blacklist_drivers: [] # List of device drivers to blacklist from the Proxmox host (see https://pve.proxmox.com/wiki/PCI(e)_Passthrough).
396
+
pve_pcie_ignore_msrs: false # Set this to true if passing through to Windows machine to prevent VM crashing.
397
+
pve_pcie_report_msrs: true # Set this to false to prevent dmesg system from logging msrs crash reports.
389
398
pve_watchdog: none # Set this to "ipmi" if you want to configure a hardware watchdog. Proxmox uses a software watchdog (nmi_watchdog) by default.
390
399
pve_watchdog_ipmi_action: power_cycle # Can be one of "reset", "power_cycle", and "power_off".
391
400
pve_watchdog_ipmi_timeout: 10 # Number of seconds the watchdog should wait
@@ -760,6 +769,56 @@ nodes).
760
769
`pve_ceph_osds` by default creates unencrypted ceph volumes. To use encrypted
761
770
volumes the parameter `encrypted` has to be set per drive to `true`.
762
771
772
+
## PCIe Passthrough
773
+
774
+
This role can be configured to allow PCI device passthrough from the Proxmox host to VMs. This feature is not enabled by default since not all motherboards and CPUs support this feature. To enable passthrough, the devices CPU must support hardware virtualization (VT-d for Intel based systems and AMD-V for AMD based systems). Refer to the manuals of all components to determine whether this feature is supported or not. Naming conventions of will vary, but is usually referred to as IOMMU, VT-d, or AMD-V.
775
+
776
+
By enabling this feature, dedicated devices (such as a GPU or USB devices) can be passed through to the VMs. Along with dedicated devices, various integrated devices such as Intel or AMD's integrated GPU's are also able to be passed through to VMs.
777
+
778
+
Some devices are able to take advantage of Mediated usage. Mediated devices are able to be passed through to multiple VMs to share resources, while still remaining usable by the host system. Splitting of devices is not always supported and should be validated before being enabled to prevent errors. Refer to the manual of the device you want to pass through to determine whether the device is capable of mediated usage (Currently this role only supports GVT-g; SR-IOV is not currently supported and must be enable manually after role completion).
779
+
780
+
The following is an example configuration which enables PCIe passthrough:
781
+
782
+
```yaml
783
+
pve_pcie_passthrough_enabled: true
784
+
pve_iommu_passthrough_mode: true
785
+
pve_iommu_unsafe_interrupts: false
786
+
pve_mediated_devices_enabled: false
787
+
pve_pcie_ovmf_enabled: false
788
+
pve_pci_device_ids:
789
+
- id: "10de:1381"
790
+
- id: "10de:0fbc"
791
+
pve_vfio_blacklist_drivers:
792
+
- name: "radeon"
793
+
- name: "nouveau"
794
+
- name: "nvidia"
795
+
pve_pcie_ignore_msrs: false
796
+
pve_pcie_report_msrs: true
797
+
```
798
+
799
+
`pve_pcie_passthrough_enabled` is required to use any PCIe passthrough functionality. Without this enabled, all other PCIe related fields will be unused.
800
+
801
+
`pve_iommu_passthrough_mode`enabling IOMMU passthrough mode might increase device performance. By enabling this feature, it allows VMs to bypass the default DMA translation which would normally be performed by the hyper-visor. Instead, VMs pass DMA requests directly to the hardware IOMMU.
802
+
803
+
`pve_iommu_unsafe_interrupts` is required to be enabled to allow PCI passthrough if your system doesn't support interrupt remapping. You can find check whether the device supports interrupt remapping by using `dmesg | grep 'remapping'`. If you see one of the following lines:
804
+
805
+
- "AMD-Vi: Interrupt remapping enabled"
806
+
- "DMAR-IR: Enabled IRQ remapping in x2apic mode"('x2apic' can be different on old CPUs, but should still work)
807
+
808
+
Then system interrupt remapping is supported and you do not need to enable unsafe interrupts. Be aware that by enabling this value your system can become unstable.
809
+
810
+
`pve_mediated_devices_enabled`enables GVT-g support for integrated devices such as Intel iGPU's. Not all devices support GVT-g so it is recommended to check with your specific device beforehand to ensure it is allowed.
811
+
812
+
`pve_pcie_ovmf_enabled`enables GPU OVMF PCI passthrough. When using OVMF you should select 'OVMF' as the BIOS option for the VM instead of 'SeaBIOS' within Proxmox. This setting will try to opt-out devices from VGA arbitration if possible.
813
+
814
+
`pve_pci_device_ids`is a list of device and vendor ids that is wished to be passed through to VMs from the host. See the section 'GPU Passthrough' on the [Proxmox WIKI](https://pve.proxmox.com/wiki/Pci_passthrough) to find your specific device and vendor id's. When setting this value, it is required to specify an 'id' for each new element in the array.
815
+
816
+
`pve_vfio_blacklist_drivers`is a list of drivers to be excluded/blacklisted from the host. This is required when passing through a PCI device to prevent the host from using the device before it can be assigned to a VM. When setting this value, it is required to specify a 'name' for each new element in the array.
817
+
818
+
`pve_pcie_ignore_msrs`prevents some Windows applications like GeForce Experience, Passmark Performance Test and SiSoftware Sandra from crashing the VM. This value is only required when passing PCI devices to Windows based systems.
819
+
820
+
`pve_pcie_report_msrs`can be used to enable or disable logging messages of msrs warnings. If you see a lot of warning messages in your 'dmesg' system log, this value can be used to silence msrs warnings.
821
+
763
822
## Developer Notes
764
823
765
824
When developing new features or fixing something in this role, you can test out
@@ -802,6 +861,7 @@ PendaGTP ([@PendaGTP](https://github.com/PendaGTP)) - Ceph support
802
861
John Marion ([@jmariondev](https://github.com/jmariondev))
803
862
foerkede ([@foerkede](https://github.com/foerkede)) - ZFS storage support
804
863
Guiffo Joel ([@futuriste](https://github.com/futuriste)) - Pool configuration support
864
+
Adam Delo ([@ol3d](https://github.com/ol3d)) - PCIe Passthrough Support
805
865
806
866
[Full list of contributors](https://github.com/lae/ansible-role-proxmox/graphs/contributors)
- name: Modify vfio IOMMU references and configuration in default grub
3
+
ansible.builtin.blockinfile:
4
+
dest: /etc/default/grub
5
+
marker: "# {mark}: IOMMU default grub configuration (managed by ansible)."
6
+
content: "\
7
+
{% if '\"GenuineIntel\" in ansible_processor | unique' %}GRUB_CMDLINE_LINUX=\"$GRUB_CMDLINE_LINUX intel_iommu=on\"\n{% endif %}\
8
+
{% if (pve_iommu_passthrough_mode | bool) %}GRUB_CMDLINE_LINUX=\"$GRUB_CMDLINE_LINUX iommu=pt\"\n{% endif %}\
9
+
{% if (pve_mediated_devices_enabled | bool) %}GRUB_CMDLINE_LINUX=\"$GRUB_CMDLINE_LINUX i915.enable_gvt=1 i915.enable_guc=0\"\n{% endif %}\
10
+
{% if (pve_pci_device_ids | length > 0) %}GRUB_CMDLINE_LINUX=\"$GRUB_CMDLINE_LINUX vfio-pci.ids={% for k in pve_pci_device_ids %}{{ k.id }}{% if k != (pve_pci_device_ids | last) %},{% endif %}{% endfor %}\"{% endif %}"
0 commit comments