SrcBits

unRAID NVIDIA GPU Passthrough Fix (QEMU)

I tried out unRAID last year as an alternative to VMWare vSphere because getting non-server hardware to work with vSphere is getting more difficult with each release. Now I know that unRAID's bread and butter is functioning as a NAS, but in recent releases they've added a ton of features, one of them being VM hosting support via QEMU. One of the surprising features that led me to eventually purchase unRAID is the ability to passthrough NVIDIA GPU's to your VM. This allows users to play the latest titles on a VM with little to no performance loss. Say bye-bye to virtual graphics that can barely run Minesweeper let alone Minecraft. OK, that's a bit of an exaggeration. I get great frame rates in Minesweeper. Keep in mind that this isn't exclusive to unRAID and you can accomplish the same thing with QEMU on a standalone Linux box.

Now the setup for GPU passthrough with unRAID is fairly straightforward, but one of the bugs that has become more noticable with version 6.2 and above is video and audio stuttering. I would occassionally have some audio stuttering issues with unRAID 6.1, but never really saw any video problems until I upgraded to 6.2. This was very frustrating to say the least as gaming on my VM was effectively crippled. The problem was so severe that I couldn't even play Youtube videos on the VM.

After much research I found a Windows registry fix that seems to have made everything all better. Now this fix will only work for NVIDIA cards that support MSI or Message Signaled Interrupt.

Synopsis

Checking GPU for MSI Capabilities

With your VM running, you'll want to SSH to your unRAID server as root and run this command.

lspci -v -s 01:00.0

GPU lspci Output

Look for the line that begins with Capabilities: [68]. If you see MSI: Enable-, that means your GPU supports MSI, but it currently isn't enabled. MSI: Enable+, means MSI is already enabled for your GPU. If you don't see MSI listed at all, that means you're out of luck and it may be time for an upgrade. It's important that the VM you're passing your GPU to is running as MSI will always report as disabled when the VM is off.

If you've discovered your GPU doesn't support MSI then you can stop reading and head to Amazon or NewEgg to order a new GPU. If, however, you're fortunate enough to have a modern GPU with MSI support, you'll want to check if your GPU's Audio has MSI enabled.

lspci -v -s 01:00.1

GPU Audio lspci Output

As you can see, both the Video & Audio portions of this NVIDIA GPU support MSI, but currently don't have MSI enabled. Time to implement the fix.

Reclaiming your GPU Performance

Now it's time to login to the VM in question and apply a reghack that will enable MSI. My gaming VM is running Windows 10, but this fix should work all the way back to Windows 7.

Once logged into your Windows VM, go to Control Panel -> Device Manager and open the Properties of your GPU under Display adapters.

Device Manager -> Display Adapters -> GPU

In the Properties window, click on the Details tab and select Device instance path from the Property drop-down menu.

GPU Device Instance Path

Copy or take note of the path (Yes I know its really, really long) and next open up regedit. Locate your GPU regkey under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\ plus the Device instance path we found in Device Manager.

Example GPU Regkey

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\PCI\VEN_10DE&DEV_1402&SUBSYS_29513842&REV_A1\5&2188997F&0&2800F0

Under your GPU regkey, locate the Device Parameters key. You'll need to create the following regkey and sub-regkey, Interrupt Management -> MessageSignaledInterruptProperties. Then create a DWord Value named MSISupported and set its value to 1. When completed your registry should look something like this.

GPU Reg Fix

Doing the Same for your Audio Performance

You may think you know exactly what we're going to do next, but here's the tricky part. I originally thought I needed to apply the regfix to the NVIDIA High Definition Audio device, but it turns out that for me, I needed to apply it to the High Definition Audio Controller under System devices instead. If this doesn't work for you, you can try applying the fix to both, but this is what worked with my setup. Head back to Device Manager.

Device Manager -> System Devices -> High Definition Audio Controller

Open the Properties of the High Definition Audio Controller and click on the Details tab and find the Device instance path in the Property drop-down just like before, then copy or write down the path.

Audio Device Path

Go back to regedit and locate the Audio Regkey under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\ plus the Device instance path.

Example Audio Regkey

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\PCI\VEN_10DE&DEV_0FBA&SUBSYS_29513842&REV_A1\5&2188997F&0&3000F0

You'll need to create the same Regkey, Sub-Regkey and DWord Value. Interrupt Management -> MessageSignaledInterruptProperties and MSISupported with the value 1. After making these changes, your registry should look like this.

Audio Reg Fix

Checking Your Work

Now that our regfixes are in, reboot your VM and SSH into your unRAID server again.

lspci -v -s 01:00.0
lspci -v -s 01:00.1

After running these two commands, you should see MSI: Enable+ for both devices. With the hard work out of the way, log into your VM and enjoy all the games and HD videos the world has to offer.

GPU MSI Enabled

Audio MSI Enabled

Please Share Me, I'm Lonely

8 Responses to unRAID NVIDIA GPU Passthrough Fix (QEMU)

  1. I follow your guide, but still fail to enable HDMI audio, I am using GT730. Tiny10 vm on Unraid 6.12.8

  2. Was having sound issues when using the HDMI audio output in a pass-though Unraid (also uses QEMU) configuration in a Windows10 vm with a Asus GTX 1060 6gb. This fix worked perfectly, thank you so much for sharing 🙂

  3. Avatar lightninjay
    lightninjay says:

    Just another happy customer wanting to report in! I’m running an Arch linux host, passing through an EVGA GTX 1060 SC, to a Windows 7 guest, under QEMU running through libvirt API. I applied the fix to the NVIDIA display adapter, the High Definition Audio Controller, as well as the NVIDIA High Definition Audio device, and everything seems to be running flawlessly. I was experiencing choppy audio and occasional video artifact-ing, but this fix seems to have belayed all of that.

    Thank you for your thorough write-up!

  4. registered to say thanx for the regedit fix, worked perfect!
    -bluxwave