Last active
March 30, 2025 16:34
-
-
Save Ruffo324/1044ceea67d6dbc43d35cae8cb250212 to your computer and use it in GitHub Desktop.
Hyper-V PCIe passthrough CheatSheet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Change to name of TARGET-VM. | |
$vm='CHANGE_ME' | |
# Change to PCI device location (π‘ Location). | |
$Location = 'CHANGE_ME' | |
# Enable CPU features. | |
Set-VM -GuestControlledCacheTypes $true -VMName $vm | |
# Host-Shutdown rule must be changed for the VM. | |
Set-VM -Name $vm -AutomaticStopAction TurnOff | |
# Change size to fit your requirements ("π‘ Min required MMOU Space"). | |
# (See https://docs.microsoft.com/en-us/windows-server/virtualization/hyper-v/plan/plan-for-deploying-devices-using-discrete-device-assignment#mmio-space) | |
Set-VM -LowMemoryMappedIoSpace 3Gb -VMName $vm # 32bit | |
Set-VM -HighMemoryMappedIoSpace 6Gb -VMName $vm # 64bit | |
# Dismount device | |
Dismount-VMHostAssignableDevice -LocationPath $Location | |
Dismount-VMHostAssignableDevice -force -LocationPath $Location | |
Add-VMAssignableDevice -LocationPath $Location -VMName $vm | |
# Try start the VM in Hyper-V manager. | |
# β Starting fails with: "A hypervisor feature is not available to the user." β | |
# See: https://social.technet.microsoft.com/Forums/ie/en-US/a7c2940a-af32-4dab-8b31-7a605e8cf075/a-hypervisor-feature-is-not-available-to-the-user?forum=WinServerPreview | |
# Reboot host. | |
bcdedit /set hypervisoriommupolicy enable | |
Restart-Computer -Confirm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SOURCE: https://docs.microsoft.com/en-us/windows-server/virtualization/hyper-v/plan/plan-for-deploying-devices-using-discrete-device-assignment#machine-profile-script | |
# 1. Get Powershell script-helper: | |
curl -o SurveyDDA.ps1 https://raw.githubusercontent.com/MicrosoftDocs/Virtualization-Documentation/live/hyperv-tools/DiscreteDeviceAssignment/SurveyDDA.ps1 | |
# 2. Run the script. | |
.\SurveyDDA.ps1 | |
# Find your device (must be enabled). See valid example: | |
# | |
# | |
# AMD PSP 3.0 Device <---- π‘ Device name | |
# Express Endpoint -- more secure. | |
# And its interrupts are message-based, assignment can work. | |
# And it requires at least: 2 MB of MMIO gap space <---- π‘ Min required MMOU Space | |
# PCIROOT(0)#PCI(0701)#PCI(0002) <---- π‘ Location | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
So did anyone found a solution ?