You are not logged in.

#1 2020-09-04 16:52:09

Grand
Member
Registered: 2020-06-12
Posts: 9

Dynamic GPU Passthrough w/ GTX 1060 6GB and Ryzen 3 2200G (integrated)

So I've really liked arch but one thing that i've wanted to set up is a windows VM (for my games that aren't supported on linux natively), using qemu and virt-manager to handle the VM. The VM is already set up ready for me to use, however I only have one dedicated GPU, my GTX 1060 6GB card, and although i do have integrated graphics on my Ryzen 3 2200G I don't want to be locked into passing through my only good GPU even when i don't need it for the VM. I have seen things around for Nvidia Optimus and others but i'm guessing since i'm running AMD as apposed to intel that it will be different for me (as well as the fact im on desktop rather than a laptop). I have relatively low experience with virtualization and gpu passthrough so if most of the tweaking could be done within virt-manager or another gui that would be helpful but i am willing to get into the command line to set this up as long as i don't need to open it every time i need the VM.

TL;DR: I need a way to dynamically pass my 1060 to a VM (with integrated graphics on standby in case of emergency) only when i need it in the VM with it accessible at all other times.

Any help would be appreciated.

Neofetch results:

OS: Arch Linux x86_64
Host: MS-7A38 8.0
Kernel: 5.8.5-arch1-1
Uptime: 9 hours, 11 mins 
Packages: 1108 (pacman)
Shell: bash 5.0.18
Resolution: 1920x1080, 1920x1080, 1920x1080
DE: Plasma
WM: KWin
WM Theme: Breeze
Theme: Breeze Dark [Plasma], Breeze [GTK2/3]
Icons: breeze-dark [Plasma], breeze-dark [GTK2/3]
Terminal: konsole
CPU: AMD Ryzen 3 2200G (4) @ 3.500GHz
GPU: NVIDIA GeForce GTX 1060 6GB
GPU: AMD ATI Radeon Vega Series / Radeon Vega Mobile Series
Memory: 3562MiB / 15766MiB

Sane GPU IOMMU Group

IOMMU Group 9:
        10:00.0 VGA compatible controller [0300]: NVIDIA Corporation GP106 [GeForce GTX 1060 6GB] [10de:1c03] (rev a1)
        10:00.1 Audio device [0403]: NVIDIA Corporation GP106 High Definition Audio Controller [10de:10f1] (rev a1)

inxi -Fxz

System:    Kernel: 5.8.5-arch1-1 x86_64 bits: 64 compiler: N/A Desktop: KDE Plasma 5.19.5 Distro: Arch Linux 
Machine:   Type: Desktop Mobo: Micro-Star model: B450M PRO-VDH MAX (MS-7A38) v: 8.0 serial: <filter> 
           UEFI: American Megatrends v: B.60 date: 05/19/2020 
CPU:       Topology: Quad Core model: AMD Ryzen 3 2200G with Radeon Vega Graphics bits: 64 type: MCP arch: Zen 
           L2 cache: 2048 KiB 
           flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm bogomips: 28011 
           Speed: 1600 MHz min/max: 1600/3500 MHz Core speeds (MHz): 1: 1537 2: 1585 3: 1549 4: 2062 
Graphics:  Device-1: NVIDIA GP106 [GeForce GTX 1060 6GB] vendor: ASUSTeK driver: nvidia v: 450.66 bus ID: 10:00.0 
           Device-2: AMD Raven Ridge [Radeon Vega Series / Radeon Vega Mobile Series] vendor: Micro-Star MSI driver: amdgpu 
           v: kernel bus ID: 2a:00.0 
           Display: x11 server: X.Org 1.20.9 driver: modesetting,nvidia unloaded: vesa resolution: 1: 1920x1080~60Hz 
           2: 1920x1080~60Hz 3: 1920x1080~60Hz 
           OpenGL: renderer: GeForce GTX 1060 6GB/PCIe/SSE2 v: 4.6.0 NVIDIA 450.66 direct render: Yes 
Audio:     Device-1: NVIDIA GP106 High Definition Audio vendor: ASUSTeK driver: snd_hda_intel v: kernel bus ID: 10:00.1 
           Device-2: Advanced Micro Devices [AMD/ATI] Raven/Raven2/Fenghuang HDMI/DP Audio driver: snd_hda_intel v: kernel 
           bus ID: 2a:00.1 
           Device-3: Advanced Micro Devices [AMD] Family 17h HD Audio vendor: Micro-Star MSI driver: snd_hda_intel v: kernel 
           bus ID: 2a:00.6 
           Device-4: Logitech G433 Gaming Headset type: USB driver: hid-generic,snd-usb-audio,usbhid bus ID: 1-4:3 
           Sound Server: ALSA v: k5.8.5-arch1-1 
Network:   Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet vendor: Micro-Star MSI driver: r8169 v: kernel 
           port: e000 bus ID: 25:00.0 
           IF: enp37s0 state: up speed: 1000 Mbps duplex: full mac: <filter> 
Drives:    Local Storage: total: 2.13 TiB used: 540.23 GiB (24.7%) 
           ID-1: /dev/nvme0n1 vendor: A-Data model: SX8200PNP size: 953.87 GiB 
           ID-2: /dev/sda vendor: HGST (Hitachi) model: HTS541010A9E680 size: 931.51 GiB 
           ID-3: /dev/sdb vendor: Seagate model: ST3320620AS size: 298.09 GiB 
Partition: ID-1: / size: 97.93 GiB used: 82.35 GiB (84.1%) fs: ext4 dev: /dev/nvme0n1p5 
Swap:      ID-1: swap-1 type: file size: 16.00 GiB used: 0 KiB (0.0%) file: /swapfile 
Sensors:   System Temperatures: cpu: 38.1 C mobo: N/A 
           Fan Speeds (RPM): N/A 
           GPU: device: nvidia screen: :0.0 temp: 53 C fan: 0% device: amdgpu temp: 38 C 
Info:      Processes: 243 Uptime: 9h 20m Memory: 15.33 GiB used: 3.57 GiB (23.3%) Init: systemd Compilers: gcc: 10.2.0 
           Shell: bash v: 5.0.18 inxi: 3.1.03 

Offline

#2 2020-09-04 17:20:47

kokoko3k
Member
Registered: 2008-11-14
Posts: 2,473

Re: Dynamic GPU Passthrough w/ GTX 1060 6GB and Ryzen 3 2200G (integrated)

Please, define 'dynamically'.
As far as i know, the best you can achieve is to restart Xorg when giving your 1060 to the vm and restart it when you want it back.
This means restarting all of running graphical programs.
I did it in the past and it required a lot of work.
You could learn a lot from it, so it could be even fun, but are you sure this is what you want or maybe it is easier to setup a dual boot system?

Last edited by kokoko3k (2020-09-04 17:24:03)


Help me to improve ssh-rdp !
Retroarch User? Try my koko-aio shader !

Offline

#3 2020-09-04 18:07:11

Grand
Member
Registered: 2020-06-12
Posts: 9

Re: Dynamic GPU Passthrough w/ GTX 1060 6GB and Ryzen 3 2200G (integrated)

What i have at the moment is a dual boot system with a vm with my windows partitions given to it but it seems a pain to have to restart the whole computer for me to play some games. I do know that some anti-cheat doesnt like being in VMs but i do want to try it to see how well it works. and as for dynamically i mean only when i start the vm would the GPU be taken from linux and when the VM shuts down it will be given back to it. i got the term dynamic from another post i made but i didnt want to try and revive a dead post so i just made a new one with a more accurate title and description of the problem.

the other post is here for reference

Offline

#4 2020-09-05 06:00:22

kokoko3k
Member
Registered: 2008-11-14
Posts: 2,473

Re: Dynamic GPU Passthrough w/ GTX 1060 6GB and Ryzen 3 2200G (integrated)

As said, binding the gpu requires Xorg restart.
So the answer is no, but i would be happy if someone proves the opposite.


Help me to improve ssh-rdp !
Retroarch User? Try my koko-aio shader !

Offline

#5 2020-09-05 08:44:39

solskog
Member
Registered: 2020-09-05
Posts: 462

Re: Dynamic GPU Passthrough w/ GTX 1060 6GB and Ryzen 3 2200G (integrated)

This is my suggestion based on your hardware/software resources:
1, Boot on Arch as KVM Supervisor with Radeon Vega GPU where you can install Xorg and virt-manager.
2, Bind GTX1060 and passing through GTX1060 to Arch VM for daily use. 
3, Shutdown Arch VM, Unbind GTX1060 and passing through GTX1060 to window VM for gaming.
Your Arch KVM Supervisor is the hub for both VMs and it should be isolated from both of them. This setup don't require cold restart anymore, but restart VMs are still required.

Offline

#6 2020-09-05 15:16:40

kokoko3k
Member
Registered: 2008-11-14
Posts: 2,473

Re: Dynamic GPU Passthrough w/ GTX 1060 6GB and Ryzen 3 2200G (integrated)

If i understood well your suggestion, instead of rebooting the real machine, you reboot a vm.
...and you are just shifting the "hub" from a real room to a virtual one :-)


Help me to improve ssh-rdp !
Retroarch User? Try my koko-aio shader !

Offline

#7 2020-09-05 23:49:56

solskog
Member
Registered: 2020-09-05
Posts: 462

Re: Dynamic GPU Passthrough w/ GTX 1060 6GB and Ryzen 3 2200G (integrated)

kokoko3k wrote:

If i understood well your suggestion, instead of rebooting the real machine, you reboot a vm.
...and you are just shifting the "hub" from a real room to a virtual one :-)

With this setup, rebooting VMs is preferred for sharing common hardware resource that is GTX1060. Keep VM runing and restarting Xorg could also be a solution. But, restart VM with VNC as virtual display is more reliable in this particular situation. The KVM Supervisor is Not a virtual Machine. If OP wishes running two VMs simultaneously with different GPU pass through, without restaring VMs, the setup would be different.

Last edited by solskog (2020-09-06 01:13:22)

Offline

Board footer

Powered by FluxBB