No module Published on Offcanvas position

Configure Hyper-V GPU passthrough

I feel like GPU passthrough is much easier done on other hypervisors like ESXi but alas... I can't be bothered to migrate my entire environment to ESXi.
I put some time and effort in trying to figure out how this is done, i'm running Hyper-V Server Core 2016 and the RemoteFX option isn't enabled or can be enabled at all.
Something about Microsoft and security leaks. But thank god it's still possible to configure GPU passthrough to your Hyper-V VM's!

I'm writing this based on my own experience configuring this running Hyper-V Server Core 2016, a Dell T140 and a Nvidia P2000 Quadro graphics card.
I configured it because I'm running a Plex server in a VM and want the card to handle the transcoding. Plex runs fine on a Windows Server 2016 Core installation and so does installing Nvidia drivers on it.
I've read alot about the "Error 43" that Nvidia cards produce when passing through but I havn't experienced this myself because the card is apparently supported for GPU passthrough scenarios.
You can follow this guide to get your going but I can't guarantee if this will work if you are using ATI or Nvidia consumer video cards.

To make this work, Microsoft has something that is called Discrete Device Assignment (DDA). This is only supported in Windows Server 2016 and above.
You can read more about it and a basic "How to configure it" here: https://docs.microsoft.com/en-us/windows-server/virtualization/hyper-v/deploy/deploying-graphics-devices-using-dda

The page doesn't seem to explain why and how to get the LowmemorymappedIOspace and HighMemoryMappedIoSpace but they mention something about it here: https://docs.microsoft.com/en-us/windows-server/virtualization/hyper-v/plan/plan-for-deploying-devices-using-discrete-device-assignment#mmio-space
Still doesn't help much in what value to enter exept that you have to download their Machine Profile Script but it never properly reported my P2000 card as usable...
Therefore I use these guidelines and that worked fine for me

  • LowmemorymappedIOSpace = half of the memory the GPU supports (P2000 Quadro ex. 2GB)
  • HighMemoryMappedIoSpace = the memory the GPU supports (P2000 Quadro ex. 5GB)

I'm guessing if you set these too low or too high, the VM might crash or the GPU might be underutlized.

By default all your graphics cards are assigned to the host and to make use of them, they need to be unassigned so they can be fully dedicated towards the VM.
I could explain all the steps in great detail, but to make it easier, I wrote a powershell script that does the needfull as long you enter the correct information.
You can find the script by clicking here
Run the script in the Hyper-V host with the GPU and you are all set!
What it will do is the following:

  1. Configure your VM for GPU passthrough.
    The default settings are in most cases not correct and need to be changed
  2. It finds all your installed GPU's and asks you to enter the name of the GPU you want to use. Then it will disconnect it from the host causing your screen to flicker for 1 second and assign it to the VM.

The only thing that needs to be done manually is installing the graphics card drivers. If you look under Device Manager it will be listed as Microsoft Display adapter I believe with a warning mark on it. Installing the drivers will fix this problem.
In Server Core installation you don't have Device manager, but to see the installed graphics cards you can use the following command in Powershell: Get-PnpDevice -PresentOnly | Where-Object {$_.Class -eq Display}
To see if your GPU is actually being utilized in a VM, you can check this in Performance Monitor and add the GPU counter. Server core sadly does not have Performance Monitor, instead you have to rely on Process Explorer https://docs.microsoft.com/en-us/sysinternals/downloads/process-explorer
This has a GPU tab so can see how much memory is being used.

In case you want to remove the GPU from the VM and assign it to another, you can use this script here.
The script gives you the option to remove the GPU from the VM only or connect it back to the host.