1

I have a nvidia gpu which I use for passthrough to a =Windows VM. However, sometime I would like to have it accesible in my linux host (while the Windows VM is down), for example to be able to use for video encoding.

Is there anyway to unload the vfio driver and load the nvidia one on demand?

3
  • Haven't tried it, but does modprobe -r vfio-pci && modprobe nvidia not work? Jan 15, 2023 at 15:02
  • I'm not 100% sure but I don't think you can. It's been a few years since I last tried gaming in a Windows VM (Proton works well enough for me now) but AFAIK you have tell the kernel at boot time that certain PCI IDs are reserved for vfio (e.g. vfio-pci.ids=10de:1c03 on your kernel cmd line), and IIRC you can't change that at run time. Have you considered doing your video encoding in a VM? either your existing VM or maybe a new Linux VM (which will probably be easier to script the transcode than windows)...just don't run both windows and linux vm using the gpu at the same time.
    – cas
    Jan 15, 2023 at 15:30
  • So I was thinking on using OBS, with one card for gaming and the other one for streaming/recording my gameplays. I guess it would be possible to play on windows and use looking as an input for OBS, but I actually play on Linux with Proton (really works well!). I only have the Windows VM for Office and the likes...
    – jjcasmar
    Jan 15, 2023 at 18:04

1 Answer 1

0

To my knowledge only more expensive cards made specifically for virtualization support this properly. So be prepared for very strange problems including complete freezes as the card freaks out in a weird state. (Even if you find a way.)

And used to forbid Nvidia even forbids it on other cards. Which is why last time I checked you needed some hacks to hide that. Nividia only recently changed their stance on this:
https://nvidia.custhelp.com/app/answers/detail/a_id/5173/~/geforce-gpu-passthrough-for-windows-virtual-machine-%28beta%29
"Enabled" does not equal "Supported"

I currently have a pass through setup running and have been using it regularly for a few years now. And my experience tells me: You are in for a world of pain. Those other cards cost a lot more. So Nvidia isn't exactly incentivized to support this.
That said, I hope you succeed. I just wanted to tell you: Don't hold your breath you are working against the odds. Be prepared for heavy tinkering. Good luck!

Update: Mind sharing your setup?
Mainboard and GPU would be most interesting.

1
  • As far as I know, the more expensive cards allow SRIOV, which is a way of using it at the same time in the host system and in the guests systems. What I want is to be able to decide, on demand, for which system I want to use a secondary GPU I have. I have an asus x570, not sure which exact model, and two GPUs, a nvidia 2070 which is used only on linux and a gtx 1650 which is the one I want to decide on demand where to used it. Works fine for passthrough using looking glass
    – jjcasmar
    Jan 15, 2023 at 18:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .