-
Notifications
You must be signed in to change notification settings - Fork 3
VFIO
stanislaw_jakiel edited this page Mar 29, 2020
·
1 revision
Set of technologies that allows to 'push' device(s) to virtual machine.
The device is managed by the VM only, 'typical' use case for Linux hosts: Windows guest VM with GPU access.
Allows writing userspace drivers.
Ensure:
> egrep -q '^flags.*(svm|vmx)' /proc/cpuinfo && echo virtualization extensions available
virtualization extensions available
> aptitude install qemu-kvm
...
Enable IOMMU (mapping of device address to main memory):
> cat /etc/default/grub.d/vfio.cfg
GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on iommu=pt"
Find PCI port, using script that groups devices by their IOMMU groups
#!/bin/bash
shopt -s nullglob
for g in /sys/kernel/iommu_groups/*; do
echo "IOMMU Group ${g##*/}:"
for d in $g/devices/*; do
echo -e "\t$(lspci -nns ${d##*/})"
done;
done;
It may not be possible to 'push' single device to VM, normally whole IOMMU group is 'pushed'. This means that all devices belonging to such group won't be available on host.
> cat /usr/share/initramfs-tools/modules.d/vfio
vfio_pci ids=10df:1122,10de:1133,10de:1aaa,11de:bbbb
vfio_iommu_type1
> update-initramfs -u -k all
Disable any drivers that may take over device before VFIO (kernel)
> cat /etc/modprobe.d/nvidia.conf
softdep nouveau pre: vfio-pci
softdep nvidia pre: vfio-pci
softdep nvidia* pre: vfio-pci
> cat /etc/modprobe.d/blacklist-nvidia-nouveau.conf
blacklist nouveau
options nouveau modeset=0
Reboot, and verify
> lspci -v
01:00.0 VGA compatible controller: NVIDIA ... [GeForce ... Rev. A] (rev ...) (prog-if 00 [VGA controller])
...
Kernel driver in use: vfio-pci
...
Create VM, attach GPU, configure evdev
so that same mouse is shared between host and guest.
- General
- OS
- Networks
- Configuration
- Protocols
- Link layer
- Sockets
- Routing
- Tunneling
- Debugging
- LoRa
- Virtualization
- Infrastructure as a code
- Desktop environments
- Monitoring
- Benchmarking