You are here
KVM Virtualizáció + GPU Passtrough Debian
Debian rendszer alatt az alábbi módon sikerült működésre bírnom KVM GPU passtrough-al. Kernel forgatásra is szükségem volt.
A szükséges hardver ellenőrzése
Intel core i5-3570 VT-d támogatás:
cat /proc/cpuinfo kimenete alapján:
Intel(R) Core(TM) i5-3570 CPU @ 3.40GHz
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
Intel® Virtualization Technology (VT-x) ‡ | Yes |
Intel® Virtualization Technology for Directed I/O (VT-d) ‡ | Yes |
Alaplap:
Intel H77 chipset
GA-H77-DS3H
A gyári F2 -es bios csak VT-x-et tudott. Frissitettem F10-re mert az alaplap kézikönyvében már irta, hogy van VT-d lehetőség is.
Biosban a következőket engedélyeztem:
Intel Virtualization Technology - enabled.
VT-d - enabled
Hardverek leválasztása:
A gépben jelenleg 2 GPU van.
GPU #1
01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GK107 [GeForce GTX 650] [10de:0fc6] (rev a1) (prog-if 00 [VGA controller])
Subsystem: Gigabyte Technology Co., Ltd Device [1458:3553]
Flags: bus master, fast devsel, latency 0, IRQ 49
Memory at f6000000 (32-bit, non-prefetchable) [size=16M]
Memory at c0000000 (64-bit, prefetchable) [size=256M]
Memory at d0000000 (64-bit, prefetchable) [size=32M]
I/O ports at e000 [size=128]
[virtual] Expansion ROM at f7000000 [disabled] [size=512K]
Capabilities: <access denied>
Kernel driver in use: nvidia
01:00.1 Audio device [0403]: NVIDIA Corporation GK107 HDMI Audio Controller [10de:0e1b] (rev a1)
Subsystem: Gigabyte Technology Co., Ltd Device [1458:3553]
Flags: bus master, fast devsel, latency 0, IRQ 17
Memory at f7080000 (32-bit, non-prefetchable) [size=16K]
Capabilities: <access denied>
Kernel driver in use: snd_hda_intel
GPU # 2
07:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Bonaire XTX [Radeon R7 260X] [1002:6658] (prog-if 00 [VGA controller])
Subsystem: Gigabyte Technology Co., Ltd Device [1458:22a9]
Flags: fast devsel, IRQ 11
Memory at e0000000 (64-bit, prefetchable) [disabled] [size=256M]
Memory at f0000000 (64-bit, prefetchable) [disabled] [size=8M]
I/O ports at a000 [disabled] [size=256]
Memory at f7100000 (32-bit, non-prefetchable) [disabled] [size=256K]
Expansion ROM at f7140000 [disabled] [size=128K]
Capabilities: <access denied>
Kernel driver in use: pci-stub
07:00.1 Audio device [0403]: Advanced Micro Devices, Inc. [AMD/ATI] Device [1002:aac0]
Subsystem: Gigabyte Technology Co., Ltd Device [1458:aac0]
Flags: bus master, fast devsel, latency 0, IRQ 10
Memory at f7160000 (64-bit, non-prefetchable) [size=16K]
Capabilities: <access denied>
Kernel driver in use: pci-stub
A GPU#1 et, Geforce GTX 650 használom a host linuxot kiszolgáló legacy 346.72 NVIDIA driverrel.
A GPU#2 -t Radeon R7 260X használom KVM-ben GPU passtrough-al.
07:00.0 VENDOR / PRODUCT ID: 1002:6658
07:00.1 :VENDOR / PRODUCT ID: 1002:aac0
Blacklistre is tettem a "radeon" és az "snd_hda_intel" modult ami a HDMI-n keresztül használható. A pci-stub modullal tudjuk majd a virtuális rendszernek továbbadni.
blackbox:~$ cat /etc/modprobe.d/KVM2GPUatiradeonblacklist.conf
blacklist radeon
blacklist snd_hda_intel
Az /etc/initramfs-tools/modules fájlba betettem a következőt:
pci_stub ids=1002:6658,1002:aac0
A blacklist azt a célt szolgálja, hogy ne töltse be a működtető modult a kívánt eszközhöz, az utóbbi módosítással pedig a pci_stub modult fogja használni a megadott vid:pid(vendor id, product id)-hez tartozó GPU-hoz.
Egy kis érdekesség:
FA struktúrában az alábbi groupok vannak:
blackbox:~$ lspci -tvnn
-[0000:00]-+-00.0 Intel Corporation Xeon E3-1200 v2/3rd Gen Core processor DRAM Controller [8086:0150]
+-01.0-[01]--+-00.0 NVIDIA Corporation GK107 [GeForce GTX 650] [10de:0fc6]
| \-00.1 NVIDIA Corporation GK107 HDMI Audio Controller [10de:0e1b]
+-14.0 Intel Corporation 7 Series/C210 Series Chipset Family USB xHCI Host Controller [8086:1e31]
+-16.0 Intel Corporation 7 Series/C210 Series Chipset Family MEI Controller #1 [8086:1e3a]
+-1a.0 Intel Corporation 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #2 [8086:1e2d]
+-1c.0-[02]--
+-1c.1-[03]----00.0 Intel Corporation 82574L Gigabit Network Connection [8086:10d3]
+-1c.2-[04]----00.0 Qualcomm Atheros AR8151 v2.0 Gigabit Ethernet [1969:1083]
+-1c.3-[05-06]----00.0-[06]----01.0 Creative Labs SB0400 Audigy2 Value [1102:0008]
+-1c.4-[07]--+-00.0 Advanced Micro Devices, Inc. [AMD/ATI] Bonaire XTX [Radeon R7 260X] [1002:6658]
| \-00.1 Advanced Micro Devices, Inc. [AMD/ATI] Device [1002:aac0]
+-1d.0 Intel Corporation 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #1 [8086:1e26]
+-1f.0 Intel Corporation H77 Express Chipset LPC Controller [8086:1e4a]
+-1f.2 Intel Corporation 7 Series/C210 Series Chipset Family 6-port SATA Controller [AHCI mode] [8086:1e02]
\-1f.3 Intel Corporation 7 Series/C210 Series Chipset Family SMBus Controller [8086:1e22]
Ahhoz, hogy működésre bírjuk az egészet, a grub indításánál az alábbi sort kell hozzáadni:
/etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on pci-stub.ids=1002:6558,1002:aac0"
Ha betettük ezt a sort, akkor szükséges még rendszergazdaként kiadni az update-grub parancsot, hogy frissüljön a rendszerbetöltő.
A gyári Debian Jessie gyári kernel verzióval nekem nem akart elindulni az X felület miután engedélyeztem az iommu-t. Sajnos nem tudtam megoldani, csak kernelfrissítéssel + modulok hozzáadásával.
Jelenleg stabilan megy a 3.18.16 os kernellel, az alábbi modulokat kellett még "beforgatni" pl. menuconfig-al:
-Kernel-based Virtual Machine (KVM) Support
-KVM_INTEL
-PCI Stub Driver
-VFIO Non-Privileged userspace driver framework
-VFIO support for PCI Devices
-VFIO support for VGA Devices
-Host kernel accelerator for virtio net
-PCI driver for virtio devices
-Virtio balloon driver
Ha minden ok, akkor ezzel a paranccsal lehet ellenőrizni:
qemu-system-x86_64 -enable-kvm -M q35 -m 4096 -cpu host -smp 4,sockets=1,cores=4,threads=2 -vga none -device ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1 -device piix4-ide,bus=pcie.0,id=piix4-ide -device vfio-pci,host=07:00.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on -device vfio-pci,host=07:00.1,bus=pcie.0 -hda /media/teszt/Virtuality/windowstestKVM.img -hdb /media/teszt/Virtuality/games.raw -usb -device usb-host,hostbus=4,hostaddr=10 -usb -device usb-host,hostbus=4,hostaddr=11 -usb -device usb-host,hostbus=4,hostaddr=12 -cdrom /media/teszt/Virtuality/INSTALLS/Win7Ult-SP1-x64-en-US-Jan2013.iso
Grafikusan pl.: virt-manager használható.
Add new comment