Kae Travis

Configure GPU Passthrough (GPU-P) for a Hyper-V Virtual Machine

The following steps configure Hyper-V GPU Partitioning (GPU-P) and copy the required graphics driver files from the Hyper-V host to the virtual machine.

1. Check the Graphics Card Installed on the Hyper-V Host

Open PowerShell as Administrator on the Hyper-V host and run:

Get-CimInstance Win32_VideoController |
    Select-Object Name, DriverVersion, AdapterRAM

Make a note of the GPU name and driver version.  For example:

Name: Intel(R) Iris(R) Xe Graphics 
DriverVersion: 32.0.101.7077
AdapterRAM: 2147479552

2. Check That the GPU Supports GPU Partitioning

Run the following PowerShell command on the Hyper-V host:

Get-VMHostPartitionableGpu

If the GPU is returned, it is available to Hyper-V for GPU partitioning.

More detailed information can be displayed using:

Get-VMHostPartitionableGpu | Format-List *

3. Identify the Graphics Driver INF

Run the following command on the Hyper-V host, replacing (in my example) *Iris* with part of the name of the installed GPU if required:

Get-CimInstance Win32_PnPSignedDriver | Where-Object {$_.DeviceName -eq "Intel(R) Iris(R) Xe Graphics"} | Format-List DeviceName,DriverVersion,InfName,DriverProviderName

For example:

DeviceName         : Intel(R) Iris(R) Xe Graphics
DriverVersion      : 32.0.101.7077
InfName            : oem155.inf
DriverProviderName : Intel Corporation

4. Find the Original Driver INF Name

Run:

pnputil /enum-drivers

Match “Published Name” to “InfName” in the previous step.

For example:

Published Name: oem155.inf
Original Name:  iigd_dch.inf
Provider Name:  Intel Corporation
Class Name:     Display
Driver Version: 32.0.101.7077

Make a note of the Original Name. In this example it is iigd_dch.inf.

5. Locate the Graphics Driver Files

The installed driver packages are held in the following directory on the Hyper-V host:

C:\Windows\System32\DriverStore\FileRepository

Use PowerShell to find the directory containing the original INF:

Get-ChildItem "C:\Windows\System32\DriverStore\FileRepository" -Directory |
    Where-Object Name -like "iigd_dch.inf*" |
    Select-Object FullName

For example:

C:\Windows\System32\DriverStore\FileRepository\iigd_dch.inf_amd64_xxxxxxxxxxxxxxxx

Copy this entire directory. Do not copy only the INF file.

6. Configure the Hyper-V Virtual Machine

Shut down the virtual machine.

On the Hyper-V host, open PowerShell as Administrator and add a GPU partition adapter:

Add-VMGpuPartitionAdapter -VMName "YourVMName"

Then configure the required memory-mapped I/O settings:

Set-VM -VMName "YourVMName" -GuestControlledCacheTypes $true

Set-VM -VMName "YourVMName" -LowMemoryMappedIoSpace 1GB

Set-VM -VMName "YourVMName" -HighMemoryMappedIoSpace 32GB

7. Confirm That the GPU Has Been Assigned

On the Hyper-V host, run:

Get-VMGpuPartitionAdapter -VMName "YourVMName" | Format-List *

The output should contain an InstancePath referencing the physical GPU.

8. Create the HostDriverStore Directory in the VM

Start the virtual machine and log in as an administrator.

Open PowerShell as Administrator and create the following directory (“HostDriverStore” and “FileRepository” will probably not exist):

New-Item -Path "C:\Windows\System32\HostDriverStore\FileRepository" -ItemType Directory -Force

9. Copy the Graphics Driver Files into the VM

Copy the complete graphics driver directory identified earlier from the Hyper-V host.

For example, copy:

C:\Windows\System32\DriverStore\FileRepository\iigd_dch.inf_amd64_xxxxxxxxxxxxxxxx

from the Hyper-V host into:

C:\Windows\System32\HostDriverStore\FileRepository

on the virtual machine.

The resulting directory should therefore look similar to:

C:\Windows\System32\HostDriverStore\FileRepository\iigd_dch.inf_amd64_xxxxxxxxxxxxxxxx

The complete directory and all of its contents must be copied.

10. Restart the Virtual Machine

Restart the VM after copying the driver files:

shutdown /r /t 0

11. Confirm That the GPU Is Working

After restarting the VM, open PowerShell and run:

Get-PnpDevice -Class Display |
    Format-Table Status,FriendlyName -Auto

The physical GPU should now appear with a status of OK. For example (Assuming not an Enhanced session):

OK       Microsoft Hyper-V Video
Unknown  Microsoft Remote Display Adapter
OK       Intel(R) Iris(R) Xe Graphics

If the physical GPU previously displayed Device Manager Code 43, copying the matching host graphics driver files into HostDriverStore should allow the GPU-P device to initialise correctly.

12. Verify Direct3D

Finally, run:

dxdiag

Select the tab corresponding to the physical GPU and confirm that Direct3D acceleration and the required DirectX feature levels are available.

Configure GPU Passthrough (GPU-P) for a Hyper-V Virtual Machine
Configure GPU Passthrough (GPU-P) for a Hyper-V Virtual Machine

Leave a Reply