Single GPU pass-thru to VM: Cant disable/remove Nouveau

Why do I need/want to do this ?
I want to do single gpu passtrough to my gaming VM(KVM/QEMU).

My setup: Fedora 37 KDE PLASMA spin(Fresh install only with virt stuff + everything updated), AMD Ryzen 7, Nvidia GTX 1050ti

What I’m doing ?
ssh to my pc(from another one) run thees commands:

systemctl stop display-manager.service
modprobe -r nouveau

What happens ?
I get this error message after running modprobe: modprobe: FATAL: Module nouveau is in use.
What should happen ?
I should be able to remove/disable the nouveau driver without the error.

What have I done to try to solve this ?
General searching around, didn’t find anything.
Using lsmod, that doesn’t return “used by”.

[User@fedora ~]$ lsmod | grep nouveau
nouveau              2703360  70
drm_ttm_helper         16384  1 nouveau
ttm                    94208  2 drm_ttm_helper,nouveau
mxm_wmi                16384  1 nouveau
video                  65536  2 asus_wmi,nouveau
drm_display_helper    180224  1 nouveau
wmi                    45056  4 asus_wmi,wmi_bmof,mxm_wmi,nouveau

As I understand it you must have 2 discrete GPUs installed if you intend to GPU pass-thru to the VM.

On the host you also would need to blacklist the GPU that is being passed to the VM so the host ignores it and it does not get a driver or firmware installed when the host boots. Then when the VM boots it handles the config for the GPU, both driver and firmware.

I have not done this personally but there have been a couple threads recently about managing GPU pass-thru to the VM. Search the forum and you should find them.

Doing so does not seem trivial nor for the faint at heart users, though it appears doable.

1 Like

No, I only have 1 gpu and I want to pass-thru it to a vm.
So I want to Start my PC use it to start up my gaming vm Run the script to unload all drivers and firmware from it and then pass-thru it to the vm.
I know that I can blacklist the GPU but I cant as of right now I only have 1 GPU and if i did i could not use my linux host after I shutdown my VM.

Well I managed to find somewhat of a workaround.
I just switch my desktop environment to Gnome and then start my VM.

Going to update this thread/topic when i’m going to find a solution for kde plasma.