[Guide] Remote Gaming on Unraid

8. Pass through your GPU (and Other Hardware)

1. Shut down your VM in the VMs tab.
2. Determine your device IDs (click me)
  1. Navigate to Tools>System Devices
  2. You may see this warning at the top. You can ignore it.
  3. What we’re looking for here is your device IDs. In this case, we will use the P2000 as an example.
    It’s usually easiest to press CTRL+F and find “nvidia” to highlight the devices we are looking for.
    In this case, there are two devices related to the P2000. We want to reserve both of these IDs in our syslinux config so that Unraid does not load them.

    And for another example, the RTX 2070 has 4 devices associated with it.
  4. Repeat this step for any other devices you want to be passed through to VMs. Other devices will not be covered in this guide.
3. Edit syslinux.cfg (click me)
  1. Navigate to Main, then click on your Unraid Flash device.
  2. Scroll down to “Syslinux Configuration” and click the toggle that switches from “Menu View” to “Raw View”.
    Each section under “label” is a boot option for Unraid. The top one is the default, so we will be using that.
    Add vfio-pci.ids= after the isolcpus= section as shown in the screenshot below. Add your passthrough device IDs in order that they appear in the system info we grabbed above.
    Shown below are the 4 devices for the RTX 2070.
    Apply changes and move on to the next step.
4. Reboot your Unraid server.
5. Edit the VM (click me)

image

  1. Remove the “OS Install ISO” text field.
    image
  2. Change the graphics card from VNC to your GPU.
    Take note of the device’s bus, in this case it’s “09”.
  3. Select your GPU’s vBIOS that we uploaded earlier in step [6.7] .
    It is located in /mnt/user/isos/biosname.rom
  4. Change the sound card to the GPU’s Audio controller.
    Make sure the bus starts with the same number.
  5. Since we are using a RTX card in this example, there are two additional devices for the USB-C hub that must be passed through. Every device will be different.
    Every device on the GPU must be passed through for native function.
  6. Click Update.
  7. Return to the VMs tab, and edit the VM again.
    image
  8. Switch from “Form View” to “XML View”
    This view will look intimidating, but it’s acutally not that bad.
    Any changes that you make in XML View will be reverted if you change back to Form View.
    Since that’s the case, I would highly recommend creating a local backup of your XML configuration when you’re done editing it.

    Your view should now look something like this.
  9. Find the <cputune> section and add the line <emulatorpin cpuset='X'/> below the core assignments.
    Where X is the CPU core you are pinning the emulation processes to.
    For the highest performance, use a core that is:
    1. Not in use by the VM
    2. Isolated from the Unraid host
    3. Not shared with another VM’s emulator pin (this doesn’t matter as much)
    4. Reference section 6.2 for more information on CPU pinning. In my case, cores 11 and 23 are isolated from the Unraid host, and I’m not going to use them for any VM. I will use core 11 for this VM, and I will use core 23 for two other VMs.
  10. Press CTRL+F and find your VBIOS file.
    (or just scroll down and find it)
  11. Each device starts with <hostdev mode=...
    and ends with </hostdev>
    The black brackets are host devices. There should be one host device for each device we passed through earlier.
    The red line is the physical bus, slot, and function the device is assigned.
    The blue line is the virtual bus, slot, and function the device is assigned.
    Note they are all on the same physical bus (magenta circle)
  12. Add a flag on the first virtual line below the BIOS that says multifunction='on'
    image
  13. Next, we need to change the virtual devices to be on the same bus, and set the functions to the same as their host.
    The first virtual bus (blue/yellow) is '0x00' so we’ll use that for all further virtual devices.
    The first virtual slot (blue/green) is '0x06' so we’ll also use that for all further virtual devices.
    The virtual functions (blue/cyan) must match the physical functions (red/cyan).
    image
  14. Scroll down, click “Update”
6. Boot the VM

>>Return to table of contents<<

3 Likes