VIRTUALIZZAZIONE GPU KVM + OVMF
#LD15BA
Francesco Dicarlo /
dicarlofrancesco@hotmail.it
About me
#LD15BA
- Francesco Dicarlo
- Freelance Game Developer (Mobile/Desktop)
- Linux user (Debian,Arch)
- RetroEmulation fan
- Home virtualization enthusiast (XEN,KVM,Proxmox,...)
About me
#LD15BA

About me
#LD15BA

KVM
#LD15BA
- Hypervisor di tipo 1 (ESXI,XEN)
- Disponibile in kernel dalla versione 2.6.20
- Sponsorizzato e supportato da RedHat
Obiettivi
#LD15BA
- Passthrough della gpu ad una vm (Windows, Linux)
- Performance della gpu > 90%
- Evitare VGA Arbitration come la peste
- Legacy e problematica
Perchè?
#LD15BA
- Gaming (Host linux + guest windows)
- Dual boot obsoleto
- Steam in home streaming Server
- Ambienti di sviluppo non Cross Platform
- Unity,Unreal engine,C4D,Autodesk
- Applicazioni legacy GPU
- Ed altro ancora...(Bitcoin mining, Home teather VM)
Hardware
#LD15BA
- Processore con tecnologia VT-D o AMD-V
- i5 - i7 serie non K
- AMD FX
- Motherboard con supporto a VT-D o AMD-V
- GPU secondaria UEFI compatibile
- AMD Radeon 5XXX+,Nvidia8 Series +
Software
#LD15BA
- Distro linux con kernel recente ( > 3.9) magari LTS
- Regressione nel 4.2
- KVM
- Qemu(>2.1)
- LibVirt(>1.2.8)
- Virt-Manager
OVMF
#LD15BA
-
OVMF "is a project to enable UEFI support for Virtual Machines".(linux-kvm.org)
- Rimpiazza SEABIOS (e VGA arbitration)
- Licenza BSD
- Presente su GitHub e buildabile su qualunque OS
- Binaries disponibili online tramite una build bot
- OS moderni (Linux con kernel recente,Win 8.1)
How-to (Arch)
#LD15BA
-
Installazione package da Aur
-
linux-vfio-lts (kernel + patch) i915/ACS override non necessarie
-
qemu-git
-
libvirt
-
virt-manager
-
rpm-extract
-
-
Binaries OVMF
-
https://www.kraxel.org/repos/jenkins/edk2/
-
rpmextract e mv in /usr/share
-
How-to (Arch)
#LD15BA
-
Installazione kernel + update GRUB/UEFI
-
Abilitazione servizio libvirt
-
sudo systemctl enable libvirt.service
-
-
Abilitazione IOMMU
-
intel: intel_iommu=on,igfx_off
-
amd: amd_iommu=on
-
Isolamento GPU
#LD15BA
-
Identificare i device-ids
-
lspci -nn | grep "NVIDIA"
-
01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GM204 [GeForce GTX 970] [10de:13c2] (rev a1)
-
01:00.1 Audio device [0403]: NVIDIA Corporation GM204 High Definition Audio Controller [10de:0fbb] (rev a1)
-
-
Device ids = 10de:13c2,10de:0fbb
VFIO-PCI
#LD15BA
-
Kernel >= 4.1
- modprobe vfio-pci
- /etc/modprobe.d/vfio.conf
- options vfio-pci ids=10de:13c2,10de:ofbb
- mkinitcpio -u linux-vfio
PCI-STUB
#LD15BA
-
/etc/mkinitcpio.conf
-
MODULES = pci-stub
-
-
GRUB_COMMANDLINE_LINUX_DEFAULT
-
pci-stub.ids=10de:13c2,10de:ofb
-
IOMMU GROUPS
#LD15BA
-
find /sys/kernel/iommu_groups -type l
- device nello stesso gruppo devono essere assegnati insieme
-
modificabili tramite patch ACS_OVERRIDE
QEMU
#LD15BA
-
/etc/libvirt/qemu.conf
-
user="root" group="root" clear_emulatore_capabilities="0"
-
- ls -l /dev/vfio
- Aggiungerli nei parametri cgroup_device_acl
- Rappresentano i device abilitati all'uso per le VM
CREAZIONE VM
#LD15BA
-
Virsh: CLI
-
Possibile definire le vm in xml
-
virsh edit VM per l'editing
-
-
Virt-Manager
-
GUI
-
-
Firmware UEFI
-
Add host pci device
-
Disabilitare HyperV enlightenments per NVIDIA
-
KVM hidden mode
INPUT
#LD15BA
-
Host usb Passthrough
-
Possibile passare i singoli device usb
-
-
Host PCI Passthrough
-
Possibile passare l'intero controller USB
-
-
Synergy
-
Server nell'host, Client nel guest
-
DEMO
#LD15BA
-
Motherboard: Gigabyte B85M-HD3
-
i5 4570, 8GB ram, 200GB Hard disk Sata2
-
NVIDIA Asus GTX 970 DirectCu-Mini
-
USB host device : Xbox360 Wired Controller
-
USB host device: Tastiera/Mouse Logitech K400 Wireless
-
Guest: Windows 8.1con ultimi driver Nvidia e Steam
-
4GB Ram, 2 core assegnati alla VM
-
VirtIO drivers (paravirtual) per scsi,ethernet e balooning
DOMANDE?
#LD15BA
CONTATTI
#LD15BA
https://github.com/evilsephiroth
https://twitter.com/frdicarlo
dicarlofrancesco@hotmail.it
RIFERIMENTI
#LD15BA
http://ubuntuforums.org/showthread.php?t=2266916
https://bbs.archlinux.org/viewtopic.php?id=162768
http://vfio.blogspot.it/
https://wiki.archlinux.org/index.php/PCI_passthrough_via_OVMF
https://www.redhat.com/mailman/listinfo/vfio-users
http://kvm-exp.blogspot.de/2015/07/TutorialPart1Debian8GPUPassthroughwithOVMFpoweredbylibvirtandVirt-Manager.html
http://ubuntuforums.org/showthread.php?t=2262351
https://wiki.ubuntu.com/UEFI/OVMF
https://virtualkvm.com/viewtopic.php?id=10
Virtualizzazione GPU KVM + OVMF
By francesco dicarlo
Virtualizzazione GPU KVM + OVMF
- 5,189