How likely is this to work? KVM/VFIO Single GPU Passthrough

I’ve been wanting to make a proper switch over to Linux for a while now. I’ve currently have a dual-boot setup but still mostly use Windows. The majority of my games should work without fuss, but I’d like to have a simple solution for running the handful of things that don’t work in Linux, such as my WMR VR headset and a handful of Steam games.

Linked is a video on Single GPU passthrough with KVM/VFIO, which I’d like to try.

Before I try this, I’d like a sense of how likely it is to work, and I’m wondering if there might be a better solution I don’t know of. I’m also open to any tips you might have about speeding up the transition between Host/Guest OS.

Here are the specs of my machine:

Motherboard: MSI B550 A-Pro

CPU: AMD Ryzen 7 3700X (no integrated graphics)

GPU: Nvidia GeForce RTX 3070

RAM: 32GB DDR4 3200MHz

Host OS: Manjaro

Guest OS: Windows 10 Pro

DaPorkchop_,

I do this for testing graphics code on different OS/GPU combos - I have an AMD and Nvidia GPU (hoping to add an Intel one eventually) which can each be passed through to Windows or Linux VMs as needed. It works like a charm, with the only minor issue being that I have to use separate monitors for each because I can’t seem to figure out how to get the GPU output to be forwarded to the virt-manager virtual console window.

tal,
tal avatar

I don't know if you can do it in software with passthrough, as the guest controls the hardware and would need to coordinate things.

Using a KVM would be a hardware solution that would permit for one monitor, though.

DaPorkchop_,

I considered a KVM or something similar, but I still need access to the host machine in parallel (ideally side-by-side so I can step through the code running in the guest from a debugger in my dev environment on the host). I’ve already got a multi-monitor setup, so dedicating one of them to a VM while testing stuff isn’t too much of a big deal - I just have to keep track of whether or not my hands are on separate keyboard+mouse for the guest :)

tal, (edited )
tal avatar

Ah, I gotcha. One keyboard/mouse, VM guest output in a window on the host would be ideal.

Run a VNC or RDP server on the guest VM, connect with a client on the host? That won't have quite the performance -- if you're debugging a 3d game and playing it as part of it, you'll get latency, so that won't be a good solution for OP -- but that may not matter for your use case.

adam,

I now have two gpus, but I’ve run single gpu passthrough for a long time without any issues. However, you have to keep in mind that some software (such as anticheat for games) will refuse to run in a virtual machine.

nicman24,

i am writing this message from a single gpu vfio setup

BeanCounter,

I ended up giving up on this because this is more of a headache than a solution… Check out Proxmox. I think they now support single gpu pass though.

maengooen,

I set this up with proxmox on a lark over a weekend It would have been perfectly fine for desktop usage, but I had terrible performance, like sub 30 fps in vanilla Minecraft. (i3-8100, 1060 6gb) It may be possible to optimize it further, but I think you need some much better hardware than I have. It was surprisingly simple though, there are guides on the proxmox website.

dragnet,

I have almost the same setup hardware wise. I got an RX550 GPU for the host, or sub in any cheap graphics card. If you have the spare slot and lanes its much nicer of an experience to have 2 GPUs. Plug a dummy plug into the guest GPU with looking glass set up and its great! :)

SirNuke,
SirNuke avatar

I'm not going to watch the video, but what's the procedure for switching between Linux and Windows? Usually you dedicate a GPU entirely to VFIO, with a 2nd GPU for the host OS (or run headless).

Anyway, will it work? Yes, minus some anti-cheat software. Will it be a simple solution? Well, once you get things stable, yes. The tech behind this is mature, but it can be a rabbit hole.

I would look into a non-Nvidia GPU for your 2nd PCIe x16 slot (x4, shared with the 2nd M.2 slot FYI). Good idea to check IOMMU groups before buying anything, but modern AMD motherboards are usually fine. Blacklist the Nvidia drivers and dedicate the 3070 to VFIO to make your life easier, and run Linux off the secondary GPU. Intel A380 might be a good choice. Do gaming stuff on Windows and stream via Parsec/Looking Glass/Moonlight+Sunshine; everything else on Linux.

cyanarchy,

I currently have a VFIO setup and it works great. There’s just almost nothing I need it for with how great Proton has become. I have an AMD APU and GPU. My Linux desktop runs on the APU and only offloads to the discrete GPU when invoked with the DRI_PRIME=1 environment variable.

Virt-Manager has the ability to run scripts at certain points in the VM startup and shutdown process. This is what I use to reassign the GPU to the VFIO stub driver so it can be handed to Windows, remove half of my CPU cores from the process scheduler so Windows isn’t suffering constant cache misses, and open looking-glass which uses a shared memory device to render the GPU output in a window on my desktop with minimal latency. Scream starts on login to handle audio, and you’re going to want to use a shared memory device for that because it has latency problems over network.

I’ve been told I have one foot in each bucket labeled “single GPU passthrough” and the other labeled “dual GPU passthrough”. If you’ve only got one you’ll have to exit your X or Wayland session to use the VM because your GPU cannot abide two masters. Nvidia has a functional equivalent to Prime, I think, but I don’t think it just works out of box. I understand Nvidia isn’t happy about their consumer cards being handed to VMs as it’s usually an expensive enterprise trick, so there might be a workaround process there.

The Arch wiki has a great tutorial on GPU passthrough using VFIO and OVMF, that’s probably your best bet on an arch based system like Manjaro.

a_fancy_kiwi,

I did it a few years ago, although I had an AMD GPU.

It works surprisingly well but games that require anti-cheat software (ex. Valorant) won’t work.

The only other good solution that wasn’t mentioned in your post is to just buy and maintain a dedicated windows box. Short of that, GPU passthrough is a great option

whileloop,
@whileloop@lemmy.world avatar

The only games that have anti-cheat on them actually support Linux anyway, just CS:GO. Not to mention, 77% of my hours in Steam games were spent in games that support Linux natively. 91% in games with ProtonDB scores Gold or better.

Owljfien,

How did you get those percentages? I’m curious to know what they are for me

russjr08,

This can be obtained from ProtonDB, once you’ve signed in then click the the “Dashboard” tab!

whileloop,
@whileloop@lemmy.world avatar

I used ProtonDB. You can log in with your Steam account and it will show the rating for each of your games, along with how many hours they are. It won’t give the percentages for you, I had to calculate those myself, but the site got me 80% of the way there.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • linux@lemmy.ml
  • DreamBathrooms
  • mdbf
  • ngwrru68w68
  • magazineikmin
  • thenastyranch
  • rosin
  • khanakhh
  • osvaldo12
  • Youngstown
  • slotface
  • Durango
  • kavyap
  • InstantRegret
  • tacticalgear
  • anitta
  • ethstaker
  • provamag3
  • cisconetworking
  • tester
  • GTA5RPClips
  • cubers
  • everett
  • modclub
  • megavids
  • normalnudes
  • Leos
  • JUstTest
  • lostlight
  • All magazines