How to Set Up Hyper-V Discrete Device Assignment on Windows Server 2019

Hyper-V Discrete Device Assignment (DDA) allows a physical PCIe device — typically a GPU, NVMe SSD, or specialised accelerator card — to be directly assigned to a virtual machine, bypassing the Hyper-V virtualisation layer entirely. The VM gains native, low-latency access to the hardware and can use the device’s full driver stack including vendor-specific features. DDA is available in Windows Server 2019 and is the preferred method for assigning high-performance devices to VMs when full device performance is required.

How DDA Works

Normally, Hyper-V intercepts all hardware access from VMs and translates it through virtual device drivers. DDA uses Intel VT-d or AMD-Vi IOMMU (Input/Output Memory Management Unit) technology to create a direct mapping between the PCIe device’s memory address space and the VM’s address space. The physical Hyper-V host relinquishes control of the device entirely while the VM is running, and the VM communicates directly with the physical hardware. Only one VM can own a DDA device at any time, and the device cannot be shared between multiple VMs.

Hardware Requirements

DDA requires the physical Hyper-V host to have an Intel CPU with VT-d support or an AMD CPU with AMD-Vi (IOMMU), and this must be enabled in the server’s BIOS/UEFI firmware. Not all PCIe devices are compatible with DDA — the device and its driver must be tested for DDA compatibility. Most modern NVMe storage controllers, GPUs (especially workstation and server GPUs like NVIDIA Quadro/Tesla and AMD Radeon Pro), and FPGA cards support DDA. Consumer gaming GPUs may have driver-level restrictions against running in VMs. The VM must be Generation 2 for DDA assignment.

Checking IOMMU Support on the Host

Before configuring DDA, verify the host’s IOMMU support. Run the following command on the Hyper-V host to check whether VT-d or AMD-Vi is active.

# Check if hardware IOMMU is enabled
Get-VMHostSupportedVersion | Select-Object -First 1

# More detailed check
(Get-VMHost).IovSupport
(Get-VMHost).IovSupportReasons

For a detailed hardware capability report, use the hypervisorlaunchtype check.

bcdedit /enum | findstr "hypervisorlaunchtype"

Identifying the PCIe Device for DDA Assignment

Use Get-PnpDevice to list all physical devices. Identify the device you want to assign by its friendly name and obtain its Instance ID, which is needed for subsequent steps.

# List all PCI devices with their instance IDs
Get-PnpDevice | Where-Object { $_.Class -eq "Display" -or $_.Class -eq "HDC" -or $_.Class -eq "SCSIAdapter" } |
    Select-Object FriendlyName, Status, InstanceId

# Get the location path for a specific device (needed for DDA)
$Device = Get-PnpDevice -FriendlyName "NVIDIA Quadro RTX 4000"
$LocationPath = ($Device | Get-PnpDeviceProperty -KeyName DEVPKEY_Device_LocationPaths).Data[0]
Write-Host "Location Path: $LocationPath"

Dismounting the Device from the Host

Before assigning the device to a VM, you must dismount it from the host operating system. This removes the device from the host’s control so it can be passed to the VM. The device will become inaccessible to the host once dismounted.

# Dismount the device from the host
# First, disable the device in Device Manager or via PowerShell
Disable-PnpDevice -InstanceId "PCIVEN_10DE&DEV_1EB0&SUBSYS_12BA10DE&REV_A14&2B89E1B8&0&0008" -Confirm:$false

# Dismount using the location path
Dismount-VMHostAssignableDevice -LocationPath "PCIROOT(0)#PCI(0200)#PCI(0000)" -Force

# Verify the device is dismounted
Get-VMHostAssignableDevice | Select-Object InstanceID, LocationPath

Assigning the Device to a Virtual Machine

With the device dismounted from the host, assign it to a Generation 2 VM. The VM must be shut down before adding the DDA device.

# Ensure the VM is off
Stop-VM -VMName "GPUWorkstation01" -Force

# Add the assignable device to the VM using its location path
Add-VMAssignableDevice -VMName "GPUWorkstation01" -LocationPath "PCIROOT(0)#PCI(0200)#PCI(0000)"

# Verify the assignment
Get-VMAssignableDevice -VMName "GPUWorkstation01"

For NVMe SSD DDA assignment, the process is identical but you specify the NVMe controller’s location path.

# Example with an NVMe controller
$NVMe = Get-PnpDevice -FriendlyName "*NVMe*" | Select-Object -First 1
$NVMePath = ($NVMe | Get-PnpDeviceProperty -KeyName DEVPKEY_Device_LocationPaths).Data[0]

Dismount-VMHostAssignableDevice -LocationPath $NVMePath -Force
Add-VMAssignableDevice -VMName "DatabaseVM01" -LocationPath $NVMePath

Setting Write-Combining Memory for GPU DDA

For GPU DDA, you may need to configure the write-combining cache policy on the VM to allow the GPU’s frame buffer to be accessed with write-combining memory, which is required for proper GPU performance. This is set with Set-VM.

# Enable write-combining for GPU DDA VMs
Set-VM -VMName "GPUWorkstation01" -LowMemoryMappedIoSpace 1GB
Set-VM -VMName "GPUWorkstation01" -HighMemoryMappedIoSpace 32GB
Set-VM -VMName "GPUWorkstation01" -GuestControlledCacheTypes $true

Installing Drivers Inside the VM

After starting the VM, the assigned PCIe device will appear as an unknown device in Device Manager if no drivers are installed. Install the vendor-specific driver for the device inside the VM exactly as you would on a physical machine. For NVIDIA GPUs, download and run the NVIDIA driver installer for the appropriate GPU family. The full GPU capabilities including CUDA, OpenGL, and DirectX should be available after driver installation.

# Start the VM after DDA configuration
Start-VM -VMName "GPUWorkstation01"

# Inside the VM - verify the device is visible (run in the VM's PowerShell)
Get-PnpDevice | Where-Object { $_.Class -eq "Display" } | Select-Object FriendlyName, Status

Removing a DDA Device from a VM

To remove a DDA device from a VM and return it to the host, first shut down the VM, remove the device assignment, and then remount the device on the host.

# Stop the VM
Stop-VM -VMName "GPUWorkstation01" -Force

# Remove the device from the VM
Remove-VMAssignableDevice -VMName "GPUWorkstation01" -LocationPath "PCIROOT(0)#PCI(0200)#PCI(0000)"

# Mount the device back to the host
Mount-VMHostAssignableDevice -LocationPath "PCIROOT(0)#PCI(0200)#PCI(0000)"

# Re-enable the device on the host
Enable-PnpDevice -InstanceId "PCIVEN_10DE&DEV_1EB0&..." -Confirm:$false

DDA Limitations and Considerations

DDA has several important constraints. The VM assigned a DDA device cannot be live-migrated to another host while the device is assigned, because the target host would need the same physical device at the same location path. Checkpoints (snapshots) are not supported on VMs with DDA devices assigned — attempting to create a checkpoint will fail. If the host reboots or the VM crashes, the device returns to the host in a dismounted state and must be re-assigned. Only one VM can own a DDA device at a time. For GPU sharing across multiple VMs, consider using RemoteFX or GPU-P (GPU Partitioning) introduced in later Windows builds, though these have different performance characteristics than full DDA.

Security is an important consideration. A VM with DDA can potentially perform DMA attacks against host memory. Use DDA only with trusted VMs and ensure the host IOMMU is configured to enforce memory isolation boundaries.

Scripting DDA Configuration

For environments where DDA devices need to be assigned and reassigned regularly (e.g., rotating GPU access between VMs for rendering jobs), a script can automate the dismount-assign-start cycle.

param(
    [string]$VMName,
    [string]$DeviceLocationPath
)

Write-Host "Stopping VM $VMName..."
Stop-VM -VMName $VMName -Force -ErrorAction Stop

Write-Host "Assigning device $DeviceLocationPath to $VMName..."
Add-VMAssignableDevice -VMName $VMName -LocationPath $DeviceLocationPath

Set-VM -VMName $VMName -GuestControlledCacheTypes $true -LowMemoryMappedIoSpace 1GB -HighMemoryMappedIoSpace 32GB

Write-Host "Starting VM $VMName..."
Start-VM -VMName $VMName

Write-Host "DDA assignment complete. VM $VMName is starting with device $DeviceLocationPath"

Conclusion

Hyper-V Discrete Device Assignment on Windows Server 2019 provides a robust path for assigning physical PCIe devices to VMs with near-native performance. The setup process involves dismounting the device from the host, assigning it to a Generation 2 VM with appropriate memory mapping settings, and then installing vendor drivers inside the VM. While DDA imposes constraints on live migration and checkpoints, it is the optimal choice for GPU compute workloads, high-performance NVMe storage, and specialised hardware accelerators that require direct hardware access.