UTM icon indicating copy to clipboard operation
UTM copied to clipboard

Request/Question: (macOS 15) Nested virtualization for Windows ARM and MacOS guests?

Open oscarbg opened this issue 2 years ago • 23 comments

Hi, In utm 4.6 beta says: (macOS 15) Nested virtualization for Linux” but since it’s a hypervisor feature why not supported also for windows arm vm’s for wsl2 support.. It’s a qemu 9.1 limitation or apple virtualization limitation? Expected to be supported soon via MacOS 15.x update or UTm update? Thanks..

oscarbg avatar Nov 20 '24 12:11 oscarbg

We need QEMU to support it for Windows. As soon as support is added, we will pick it up.

osy avatar Nov 20 '24 17:11 osy

We need QEMU to support it for Windows. As soon as support is added, we will pick it up.

Great! I'm also waiting support for WSA on Windows ARM and wish this would be added too. I'd like to appreciate you guys for my newly buying M4 Mac Mini!

Thanks.

just4id avatar Nov 22 '24 07:11 just4id

thanks @osy! is there an issue/feature request open on Qemu gitlab for tracking the status?

oscarbg avatar Nov 23 '24 15:11 oscarbg

I don't know

osy avatar Nov 23 '24 17:11 osy

thanks! expanding the issue to request/ask also about MacOS guest nested support.. seems not available using M4 and UTM 4.6.1 on Macos guest 15.1 image..

Virtualization is not available on this hardware

more context:

tested installing lima and get:

INFO[0089] [hostagent] Starting VZ (hint: to watch the boot progress, see "/Users/obgutm/.lima/default/serial*.log") 
FATA[0090] exiting, status={Running:false Degraded:false Exiting:true Errors:[] SSHLocalPort:0} (hint: see "/Users/obgutm/.lima/default/ha.stderr.log") 

cat .lima/default/ha.stderr.log

{"level":"fatal","msg":"Error Domain=VZErrorDomain Code=2 Description=\"Invalid virtual machine configuration. Virtualization is not available on this hardware.\" UserInfo={\n    NSLocalizedFailure = \"Invalid virtual machine configuration.\";\n    NSLocalizedFailureReason = \"Virtualization is not available on this hardware.\";\n}","time":"2024-11-24T00:18:49-08:00"}

oscarbg avatar Nov 24 '24 08:11 oscarbg

I don't think Apple enabled it for macOS guests

osy avatar Nov 24 '24 09:11 osy

Is there anything new on this request? @osy?

ghost avatar Mar 07 '25 14:03 ghost

Don't ask me ask Apple

osy avatar Mar 07 '25 15:03 osy

IMHO its not an Apple hypervisor issue, just a virtual machine monitor thing, which means, that in theory, you could replace it and still remain app-store compliant. Parallels did replace both for their Intel-Mac nested hypervisor support, but for Apple Silicon, you have to use Apple's hypervisor. The virtual-GPU feature of Vulkan in Podman containers for Apple silicon also IMHO uses a custom VMM.

AndreasKunar avatar Mar 07 '25 15:03 AndreasKunar

We are talking about macOS guests. Hypervisor.framework does NOT work to boot macOS. Virtualization.framework is what is used and it does not support nested virt for macOS.

osy avatar Mar 07 '25 17:03 osy

IMHO, but I might be wrong - For MacOS you definitely need Apple to write a VMM which supports nested virtualization. But Parallels have demonstrated on x64, that you can do a custom nested-virtualization VMM for Windows. To my knowledge, the Apple Hypervisor can do nested virtualization and run with a custom VMM on top - see the Vulkan GPU virtualization in Podman. To my knowledge, Apple does not even fully support Windows virtualization with their VMM.

AndreasKunar avatar Mar 08 '25 08:03 AndreasKunar

What you said is correct but also completely orthogonal to the point I just made

osy avatar Mar 08 '25 13:03 osy

Sorry, its just, that the initial request was for nested virtualization with Windows on ARM and macOS.

AndreasKunar avatar Mar 08 '25 15:03 AndreasKunar

Okay I see that was answered in the first reply: https://github.com/utmapp/UTM/issues/6821#issuecomment-2489149854

osy avatar Mar 08 '25 16:03 osy

Using emulated aarch64 on aarch64 it is possible to run WSL2 on Windows 11. I needed https://snapshots.linaro.org/components/kernel/leg-virt-tianocore-edk2-upstream/5312/QEMU-KERNEL-AARCH64/RELEASE_GCC/QEMU_EFI.fd, which I added as a drive of none (advanced) as a Linux kernel.

System -> CPU "neoverse-n1" QEMU -> Tweaks, I turned off UEFI Boot and Use Hypervisor (system was originally installed as a virtualized Win11) QEMU -> Machine Properties, I added "virtualization=on,gic-version=3,secure=on" QEMU -> Arguments, I added: -kernel /Users/(my user)/Library/Containers/com.utmapp.UTM/Data/Documents/Windows.utm/Data/QEMU_EFI.fd

I am now running WSL2 2.5.4 inside the VM.

I used https://gist.github.com/Vogtinator/293c4f90c5e92838f7e72610725905fd#file-wsl2-md as a guide.

Edit: if it doesn't boot, make sure you imported QEMU_EFI.fd correctly; before I realized I needed it to be a "Linux kernel" i managed to import it as a qcow and it added headers. You should be able to confirm the QEMU_EFI.fd matches the one you downloaded, and if not, make it match.

dariaphoebe avatar Mar 31 '25 01:03 dariaphoebe

thanks @osy! is there an issue/feature request open on Qemu gitlab for tracking the status?

I believe this is the relevant issue to watch in the Qemu repo: https://gitlab.com/qemu-project/qemu/-/issues/628

t1m0thyj avatar Apr 01 '25 21:04 t1m0thyj

Using emulated aarch64 on aarch64 it is possible to run WSL2 on Windows 11.

@dariaphoebe - Very cool idea, thanks. Since it's emulated, but on the same architecture, can you please provide some ideas on its performance?

AndreasKunar avatar Apr 02 '25 12:04 AndreasKunar

@AndreasKunar on the M4 Pro; i gave 14gb of memory to the win11 vm. it's not fast but it's absolutely usable.

dariaphoebe avatar Apr 03 '25 17:04 dariaphoebe

seems progress in QEMU patches site: https://patchew.org/QEMU/[email protected]/

mentions:

"Nested virtualisation support. Note that the nested virtualisation implementation
shipping as of macOS 26.0 is nVHE only, and does not leverage VNCR (FEAT_NV1-style)."

more notes from patch:

However, this is usable and there seems to be some interest for it. Hopefully
it'll be at least somewhat useful.

PS: I can step up to maintain HVF support if needed. WHPX arm64 patch series
is coming soon too.

unfortunately will not even be in QEMU 10.1 which is in RC phase so for QEMU 10.2?..

oscarbg avatar Jul 29 '25 22:07 oscarbg

To set proper expectations: note that Hyper-V for Windows version 24H2 onwards operates in VHE mode. It won't work with the nested virtualisation support currently implemented on macOS.

mediouni-m avatar Aug 08 '25 07:08 mediouni-m