You are not logged in.

#1 2021-08-15 23:53:50

lord_rafa
Member
From: Canary Islands (Spain)
Registered: 2013-03-19
Posts: 12
Website

PRIME GPU Passthought

Hello,

It look like now NVIDIA has added support for GPU Passthought on muxless laptops. Now it is possible to passthought the dgpu to a windows guest and it will work even if a monitor is not connected to the dgpu.

This works pretty much straight forward just following any tutorial to setup the VFIO and instalign the latest NVIDIA driver.

However I have not managed to bind and unbind the dgpu without restarting the xserver. I would like to know if this is possible at all and if so how can I do it.

Edit:

I can unbind the GPU using this script but it requires to kill the xserver:

systemctl stop gdm.service

echo 0 > /sys/class/vtconsole/vtcon0/bind || echo "console0 already unbound"
echo 0 > /sys/class/vtconsole/vtcon1/bind || echo "console1 already unbound"
echo efi-framebuffer.0 > /sys/bus/platform/drivers/efi-framebuffer/unbind || echo "efi FB already unbound"

echo -n "0000:02:00.0" > /sys/bus/pci/drivers/nvidia/unbind || echo "Failed to unbind gpu from nvidia"

#tell vfio-pci that it takes care of gpu
echo -n "10de 1f96" > /sys/bus/pci/drivers/vfio-pci/new_id

systemctl start gdm.service

Then I can passtrought the GPU to my VM using the virtmanager without any problem... I think that the main problem is that the xorg server is running on the dgpu when NVIDIA driver is on use. I try to edit the xorg.conf files but the system becomes unstable, and the PRIME offload becomes broken (at least when using steam)

I also found this script to bind the GPU back but it never worked and I am forced to reboot my laptop to get the GPU back in my host:

echo -n 0000:02:00.0 > /sys/bus/pci/drivers/vfio-pci/unbind || echo "Failed to unbind gpu from vfio-pci"

echo -n 10de 1f96 > /sys/bus/pci/drivers/vfio-pci/remove_id

modprobe -r vfio-pci

echo -n 0000:02:00.0 > /sys/bus/pci/drivers/nvidia/bind || echo "Failed to bind nvidia gpu"

systemctl restart gdm.service

Last edited by lord_rafa (2021-08-16 00:30:41)


Errare humanum est sed perseverare diabolicum

Offline

#2 2021-08-21 22:20:08

f_fouad
Member
Registered: 2017-09-08
Posts: 8

Re: PRIME GPU Passthought

You can do early binding to vfio-pci or pci-stub and then after boot unbind it and load the nvidia module.

echo '0000:01:00.0' > "/sys/bus/pci/devices/0000:01:00.0/driver/unbind"
modprobe nvidia

After that, switching nvidia card between host and guest works flawlessly in my case.

Last edited by f_fouad (2021-08-21 22:21:10)

Offline

#3 2021-08-28 22:59:20

lord_rafa
Member
From: Canary Islands (Spain)
Registered: 2013-03-19
Posts: 12
Website

Re: PRIME GPU Passthought

f_fouad wrote:

You can do early binding to vfio-pci or pci-stub and then after boot unbind it and load the nvidia module.

echo '0000:01:00.0' > "/sys/bus/pci/devices/0000:01:00.0/driver/unbind"
modprobe nvidia

After that, switching nvidia card between host and guest works flawlessly in my case.

Thanks for your response, by attaching the my dgpu to the vfio on boot I can avoid xorg to use the dgpu.

This means that now, I can attach the nvidia driver and run ie. firefox and after switch back to vfio and run a guest passing trough the dgpu without performing a Xs reboot

However native steam is not happy at all with this, if I try to run the client with "__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia steam" the windows breaks not showing steam contents.

Also if I try to start steam on the igpu and then run a game on the dpgu using proton the game will refuse to start....

Does anyone know what can be wrong?

Last edited by lord_rafa (2021-08-28 23:19:41)


Errare humanum est sed perseverare diabolicum

Offline

#4 2021-08-29 06:51:20

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

Re: PRIME GPU Passthought

AFAIK Xorg makes the setup for nvidia render offloading when it starts, no hotplug.
So I don't really think you can avoid that.

Last edited by kokoko3k (2021-08-29 07:15:39)


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

Offline

Board footer

Powered by FluxBB