Modern machine learning workflows, GPU-accelerated computing, and high-frequency network engineering often require virtual machines to communicate directly with physical hardware without passing through hypervisor emulation layers. In Windows 11 Hyper-V, Discrete Device Assignment (DDA)—commonly referred to as PCIe passthrough—allows an administrator to detach an entire physical PCI Express device (such as a dedicated NVIDIA/AMD graphics card, an ultra-fast NVMe storage controller, or a high-throughput network interface) from the host operating system and pass it exclusively to a guest virtual machine. By leveraging PowerShell cmdlets such as Dismount-VMHostAssignableDevice and Add-VMAssignableDevice, systems engineers can unlock raw, bare-metal hardware acceleration inside virtualised environments.
Hardware and BIOS Prerequisites for Hyper-V DDA
Because Discrete Device Assignment hands control of physical PCIe hardware directly to untrusted guest kernels, both your motherboard firmware and processor must support hardware-enforced memory isolation and interrupt remapping:
- Intel VT-d or AMD-Vi (IOMMU): Must be enabled in UEFI/BIOS settings to prevent DMA attacks and partition physical memory addresses safely.
- SR-IOV / Access Control Services (ACS): Required on PCIe root ports and switches to ensure PCIe transactions cannot be snooped or spoofed between device slots.
- Host Power Management: Certain graphics drivers require CPU C-states and PCIe Active State Power Management (ASPM) to be adjusted to prevent bus sleep conflicts.
Auditing PCIe Hardware and Identifying Device Location Paths
Before passing a device into a virtual machine, identify its physical device location path in the Windows 11 host. Launch an elevated PowerShell session and query target devices.
To inspect eligible graphics adapters or NVMe controllers:
# Query display adapters
Get-PnpDevice -Class Display | Select-Object FriendlyName, InstanceId, Status
# Locate the exact Device Location Path
$Device = Get-PnpDevice -FriendlyName "*NVIDIA GeForce*"
$LocationPath = ($Device | Get-PnpDeviceProperty -KeyName "DEVPKEY_Device_LocationPaths").Data[0]
Write-Host "Device Location Path: $LocationPath"
A typical location path resembles: PCIROOT(0)#PCI(0100)#PCI(0000).
Dismounting the PCIe Device from the Windows Host
A physical PCIe device cannot be assigned to a virtual machine while the Windows 11 host operating system is actively bound to its kernel driver. You must disable the device and dismount it from the host partition.
# Disable the device in Windows Device Manager
Disable-PnpDevice -InstanceId $Device.InstanceId -Confirm:$false
# Dismount the device from the host Hyper-V parent partition
Dismount-VMHostAssignableDevice -LocationPath $LocationPath -Force
To verify that the device is now uncoupled from the host and available for assignment:
Get-VMHostAssignableDevice
Configuring Virtual Machine Memory Boundaries for DDA
PCIe devices with large memory apertures (such as GPUs with 8 GB to 24 GB of VRAM) require significant Memory-Mapped I/O (MMIO) space within the guest VM. If the guest’s 32-bit and 64-bit MMIO gap sizes are insufficient, the guest operating system will report “Code 12: This device cannot find enough free resources that it can use” in Device Manager.
Configure the target virtual machine’s memory boundaries and automatic stop action:
# Ensure VM is powered off
Stop-VM -Name "UbuntuAI" -Force
# Set guest memory to static allocation (Dynamic Memory is incompatible with DDA)
Set-VMMemory -VMName "UbuntuAI" -DynamicMemoryEnabled $false
# Configure MMIO space for GPU apertures (e.g. 128 MB low, 32 GB high)
Set-VM -VMName "UbuntuAI" -LowMemoryMappedIoSpace 128MB
Set-VM -VMName "UbuntuAI" -HighMemoryMappedIoSpace 32768MB
# Configure VM Automatic Stop Action to TurnOff (Save state is incompatible with DDA)
Set-VM -VMName "UbuntuAI" -AutomaticStopAction TurnOff
Assigning the PCIe Device to the Virtual Machine
With the host device dismounted and the virtual machine’s MMIO configuration expanded, attach the physical PCIe device directly to the guest VM:
# Assign the physical PCIe device to the target VM
Add-VMAssignableDevice -VMName "UbuntuAI" -LocationPath $LocationPath
To audit all assigned physical devices attached to the VM:
Get-VMAssignableDevice -VMName "UbuntuAI"
You can now start the virtual machine:
Start-VM -Name "UbuntuAI"
Inside the guest operating system (whether Windows or Linux), the physical hardware will appear directly on the PCI bus (e.g. via lspci in Linux or Device Manager in Windows), allowing you to install native vendor drivers and execute CUDA, OpenCL, or Direct3D workloads.
Reclaiming the Hardware Back to the Windows Host
When hardware passthrough is no longer required, tear down the assignment and restore the device to the host operating system:
# Stop the virtual machine
Stop-VM -Name "UbuntuAI" -Force
# Remove the device from the virtual machine
Remove-VMAssignableDevice -VMName "UbuntuAI" -LocationPath $LocationPath
# Mount the device back into the host parent partition
Mount-VMHostAssignableDevice -LocationPath $LocationPath
# Re-enable the hardware device in the Windows 11 host
Enable-PnpDevice -InstanceId $Device.InstanceId -Confirm:$false
Discrete Device Assignment in Windows 11 Hyper-V bridges enterprise hypervisor capabilities and workstation hardware, empowering engineers to run intensive graphics, computational modelling, and hardware-accelerated workloads within secure virtual machines.