[TUTORIAL] Easy tutorial for eGPU thunderbolt passthrough on a Minisforum UM790 Pro

RedKage

New Member
Dec 22, 2023
16
4
3
Tested with

Overview
  1. Activate GPU passthrough.
  2. Make the eGPU work
  3. Find the GPU and disable it from being used by the OS
  4. Passthrough the raw PCI devide to the VM

1. Edit modules
Edit /etc/modules and add:
Code:
vfio
vfio_iommu_type1
vfio_pci
vfio_virtqfd
thunderbolt

Thunderbolt was working for me even without this module as the kernel seems to be built with it,
So the line with `thunderbolt` may not be necessary.


2. Edit grub
Edit /etc/default/grub and change the GRUB_CMDLINE_LINUX_DEFAULT with:
Code:
GRUB_CMDLINE_LINUX_DEFAULT="quiet iommu=pt amd_pstate=active intel_iommu=on iommu=pt pcie_acs_override=downstream,multifunction"

Update grub with update-grub


3. Configure thunderbolt
When you unplug and replug the AOOSTAR eGPU it lights up, and after a few seconds it shutdowns.
That's because the OS needs to authorize this device first.
  • Install boltctl with apt-get install bolt
  • Type boltctl list -a to find the device UUID of the AOOSTAR itself.
  • Enroll it using boltctl enroll <device uuid>

If you get a weird error :
DBus.Error.ServiceUnknown: The name org.freedesktop.PolicyKit1 was not provided by any .service files

Then:
  • Install apt install policykit-1
  • Activate systemctl start polkit and systemctl enable polkit
  • Retry the boltctl commands

Now the eGPU is enrolled, it should stay on when you unplug/plug it again.
We have to enroll the GPU now.

Use boltctl list and you should see the GPU, it should be a different UUID.
Enroll it using boltctl enroll <device uuid>

If for some reason you have trouble to get the UUID, you can use boltctl monitor and unplug/replug the eGPU.
It will show the UUID.

Once that's done, you should see the GPU using lspci -nn | grep -e 'NVIDIA'.


4. Edit modeprobe

Use lspci -nn | grep -e 'NVIDIA' to find the device IDs.

We find
XX:00.0 VGA compatible controller [XXXX]: NVIDIA Corporation GM206 [GeForce GTX 960] [12ab:cd34]
YY:00.1 Audio device [XXXX]: NVIDIA Corporation GM206 High Definition Audio Controller [56ab:cd78]

Those are the things in the square brackets at the end, like [12ab:cd34]
For a typical NVIDIA GPU you will find two of them, one is VGA compatible controller and the other its Audio device.
You just need the VGA ID, but can also add the Audio device if you wish.

Edit or create this file /etc/modprobe.d/vfio.conf.
And add a line with the found ID (or IDs):
Code:
options vfio-pci ids=12ab:cd34,56ab:cd78

Update with update-initramfs -u -k all
Restart with reboot now


5. Configure your VM
In the GUI you can go to the Hardware > Add > PCI Device.
  • Choose "Raw Device", select the GPU.
  • Check "All functions"
  • Check "Advanced"
  • Check "PCI-Express"

Resulting config should look like this in your /etc/pve/qemu-server/XXX.conf:
Code:
hostpci0: 0000:XX:00,pcie=1,x-vga=1

6. Configure your VM OS
  1. Install the NVIDIA drivers (I use nvcleaninstall on Windows).
  2. Enjoy.