-
-
Save Ruffo324/1044ceea67d6dbc43d35cae8cb250212 to your computer and use it in GitHub Desktop.
# 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 |
# 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 | |
Haven't tried win 11 yet, but it doesn't work on win 10 22H2, It works as far as assigning the device, but powering on the VM then keeps failing for me. Don't know if I'm missing something else.
The next thing I'm going to try is probably "Disable Access Control Services (ACS) and unique RID checks": https://withinrafael.com/2020/06/06/how-to-get-consumer-gpus-working-in-hyperv-virtual-machines/
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\HyperV" -Name "RequireSecureDeviceAssignment" -Type DWORD -Value 0 -Force
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\HyperV" -Name "RequireSupportedDeviceAssignment" -Type DWORD -Value 0 -Force
Edit: Nope, still doesn't work on win10, maybe I'll try it on win11 on the weekend. The error I get on powering on the VM on a win 10 host is: Failed to Power on with Error 'A hypervisor feature is not available to the user.' (0xC035001E).
Maybe look here: https://www.reddit.com/r/HyperV/comments/rd1pf5/comment/je4fe1h/?utm_source=share&utm_medium=web2x&context=3
Or try the Workstation Windows Version? Or go Windows Server
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.
Atm, I also don't know if I ever will, as I'm planning to move my VMs off of Windows entirely.
May I ask what kind of hypervisor you have in mind? Especially with regard to PCI(e) passthrough.
According to my research so far, there would only be:
- Citrix® Hypervisor (formerly XenServer)
- XCP-NG (https://xcp-ng.org/ | opensource XenServer)
- Hyper-V
- unRAID
KVM, and by now I already moved everything over. I even have the former Windows NVME (with hyper-v) running inside of KVM, and I've the entire SATA controller with 5 attached disks passed through to Windows (via PCI passthrough) so that the Storage Space I setup there continues to work.
The only annoying thing is that KVM creates its network bridges and interfaces in the main network namespace of the host, so if you run ip addr
or anything network related on the host you see a bunch of "junk"...
@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!
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 ?
Does this work on Windows 11 Pro Hyper-V or only Windows Server ?