Software:
Fedora KDE 35
QEMU/KVM & IOMMU already enabled
Story:
I started using linux 2 years ago now, I’m very far from proficient, but I’m trying. I have been trying to pass through my gpu through my egpu enclosure to my windows vm, I’ve already disabled the amd kernel modules to make sure nothing binds on either side. I’m having trouble figuring out which pci devices to passthrough, doing the gpu + audio has been unsuccessful. I really appreciate any help but if worst comes to worst I’ll just use the spice/qxl rendering for my GIS work; obviously not ideal but I’d rather do it than dual booting.
Brainstorming:
Should I maybe get one of those external pcie express slots and do it that way?
Maybe my gpu is not great for passing through, I have a rx 560 that I could try out, not sure if that’ll change anything though.
Again thanks to anyone for any help they might be able to offer, I’ve been looking at dozens of search results and nothing really seems to address what I’ve been dealing with. Like I said, I’ll make it work with the spice server for my VM but doing GIS work with just integrated graphics rendering is really challenging.
I’ve tried using the common egpu-switcher script but it kept booting into a black screen. I was using X-org so I’m not really sure what could have caused it to fail.
You can confirm vfio-pci is bound to the GPU yes? check lspci -nnk .
You say unsuccessful, what does that mean? Does libvirt give you an error when starting the VM? or does the VM start but the devices are errorring in device manager? what exactly is going wrong?
There’s no error, the gpu is just not being utilized. Being passthrough’d to the vm doesn’t redirect the display out put to the gpu and when closing the vm the hardware virtualization halts and I need to do a hard reset.
Trying to switch to the gpu using a xorg script (egpu-switcher from egpu.io) never boots back into the system.
As I may have mentioned in that blog post, I’m running stock Fedora, but have added two COPR repositories to give me better gaming performance when using eGPUs or AMD cards.
I made a post-install script to set Fedora up this way here if interested.
Good News !! I got it to work. I started thinking about the different things that need to go just right for it work.
Disabled thunderbolt on my host os
Used a different display port cable to make sure the output was working
Used my 5700xt to avoid the amd reset power bug
All that and the past few updates for the bolt packages have made it work!
I’m now able to pass my egpu through to a VM!
Thank you for everyone who’s tried to help, I’m so happy
This is great, and awesome to see! It would be cool if you could talk about the performance you are seeing in your Window’s VM as a result. I imagine gaming is the primary focus there, or are you using some GPU heavy CAD software that is Windows only?
@2disbetter The main focus and use for the VM is ArcGIS pro which is spatial analysis software, gaming is secondary but still being done. What do you think would be good benchmarks for the gaming side of things?
Some things I’ve noticed:
Network issues where webpages need a few reloads to properly work, but that’s a larger issue with KVM as a whole which I haven’t figured out yet
There is the odd time where shutting down the VM hangs and it requires a hard reset of the whole machine, in my experience with this it’s not proven to be too common and generally related with leaving apps open. !Very important not to disconnect the egpu while the VM is shutting down because that will definitely require a hard reset. Unplugging the egpu after the VM has shutdown might be necessary due to the amd reset bug, though since I’m using a 5700xt it should really be related to the egpu enclosure more than the gpu itself
Since I’ve gotten it working I’ve dealt with some unforeseen problems.
I had to keep the spice display agent going on my host because the guest windows vm wouldn’t shutdown properly without it
I can’t use kvm after using the guest windows vm after a long session, virt-manager just hangs with “connecting.” I can use it again for short sessions but I’m not sure why. If I have a long session that locks out virt-manager I will also need to do a hard shutdown of my framework using the power button, I might need to end up using some shutdown command on terminal to stop whatever process is hanging up.