Last active
May 2, 2024 16:56
-
-
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 | |
I tried it with Win 10 22H2 Enterprise, so it should be a higher tier than pro for workstation.
I didn't try win11 or windows server until now. Atm, I also don't know if I ever will, as I'm planning to move my VMs off of Windows entirely.
I have Windows 11 Pro for Workstations and I got the same error. Quite a bummer.
Not really a guide, but just the normal documentation of libvirt and qemu/kvm
So did anyone found a solution ?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@agowa I have been trying (and failing) to get PCI passthrough working on KVM. Did you use a specific guide that you could link? What distro did you get this working on?
Thanks!