Skip to content

feat(aarch64): add WHP backend for ARM64 Windows - #1638

Open
cshung wants to merge 1 commit into
hyperlight-dev:mainfrom
cshung:cshung/whp-aarch64
Open

cshung wants to merge 1 commit into
hyperlight-dev:mainfrom
cshung:cshung/whp-aarch64

Conversation

@cshung

@cshung cshung commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Implements the WHP (Windows Hypervisor Platform) hypervisor backend for aarch64, enabling hyperlight to run micro-VMs on Windows ARM64 systems.

Resolves #1544

Changes

Structural

  • Restructure whp.rs into whp/ directory (mod.rs + x86_64.rs) to support per-architecture implementations, matching the existing kvm/ and mshv/ pattern
  • Fix super::x86_64::hw_interrupts module path after directory restructure

New: whp/aarch64.rs

  • Manual FFI bindings for ARM64 WHP register names, exit reasons, and exit context layout (extracted from Windows SDK WinHvPlatformDefs.h)
  • Full VirtualMachine trait implementation with:
    • MMIO-based I/O handling (ARM64 has no IO ports)
    • Register get/set via WHvGet/SetVirtualProcessorRegisters
    • Surrogate process support (same pattern as x86_64)

Integration

  • Wire WhpVm into hyperlight_vm/aarch64.rs for Windows platform
  • Add WindowsInterruptHandle for aarch64 Windows
  • Add CpuVendor::current() for aarch64 Windows target

Cross-compilation fix

  • Move vmm-sys-util to unix-only dependencies (it doesn't compile on Windows)

Verification

Verified compilation on three targets:

  • x86_64-pc-windows-msvc (native) — just clippy debug/release pass
  • aarch64-pc-windows-msvc (cross-compile) — cargo check passes
  • aarch64-unknown-linux-gnu (cross-compile) — cargo check --features kvm passes

Note: No runtime testing was possible — requires actual ARM64 Windows hardware with Hyper-V enabled. CI has no ARM64 Windows runners.

Why manual FFI bindings?

The windows crate (v0.62) does not expose ARM64 WHP types (register names, exit reasons, exit context structs). All definitions were extracted from the Windows SDK header WinHvPlatformDefs.h (SDK 10.0.26100.0) which has full ARM64 support behind #ifdef _ARM64_.

Copilot AI review requested due to automatic review settings July 12, 2026 15:02
@cshung cshung added kind/enhancement For PRs adding features, improving functionality, docs, tests, etc. ready-for-review PR is ready for (re-)review labels Jul 12, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a Windows Hypervisor Platform (WHP) backend for Windows/aarch64 so Hyperlight can run micro-VMs on ARM64 Windows systems, aligning WHP’s structure with existing per-arch hypervisor layouts.

Changes:

  • Introduces whp/aarch64.rs implementing the VirtualMachine trait for ARM64 WHP, including MMIO-based exit handling and register get/set via WHvGet/SetVirtualProcessorRegisters.
  • Restructures the WHP backend into whp/ with per-architecture modules and fixes x86_64 interrupt helper module paths.
  • Wires WHP into the aarch64 Hyperlight VM path on Windows and moves vmm-sys-util into unix-only dependencies to fix Windows builds.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/hyperlight_host/src/sandbox/snapshot/file/config.rs Adds Windows/aarch64 CPU vendor token for snapshot config.
src/hyperlight_host/src/hypervisor/virtual_machine/whp/x86_64.rs Updates hw_interrupts module paths after WHP directory restructure.
src/hyperlight_host/src/hypervisor/virtual_machine/whp/mod.rs New per-arch WHP module dispatcher (x86_64 vs aarch64).
src/hyperlight_host/src/hypervisor/virtual_machine/whp/aarch64.rs New ARM64 WHP backend implementation and manual ARM64 WHP FFI bindings.
src/hyperlight_host/src/hypervisor/hyperlight_vm/aarch64.rs Selects WHP on Windows/aarch64 and adds Windows interrupt handle wiring.
src/hyperlight_host/Cargo.toml Makes vmm-sys-util unix-only to avoid Windows compilation failures.

Comment thread src/hyperlight_host/src/hypervisor/virtual_machine/whp/aarch64.rs Outdated
Comment thread src/hyperlight_host/src/hypervisor/virtual_machine/whp/aarch64.rs Outdated
Comment thread src/hyperlight_host/src/hypervisor/virtual_machine/whp/aarch64.rs Outdated
Comment thread src/hyperlight_host/src/hypervisor/virtual_machine/whp/aarch64.rs Outdated
Comment thread src/hyperlight_host/src/sandbox/snapshot/file/config.rs Outdated
@cshung
cshung marked this pull request as draft July 13, 2026 02:13
@github-actions github-actions Bot removed the ready-for-review PR is ready for (re-)review label Jul 13, 2026
Comment thread src/hyperlight_host/src/sandbox/snapshot/file/config.rs Outdated
@cshung
cshung force-pushed the cshung/whp-aarch64 branch from 5f992dc to 1d3a299 Compare July 30, 2026 22:14
@jsturtevant jsturtevant mentioned this pull request Aug 5, 2026
2 tasks done
@cshung

cshung commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

End-to-end cargo-hyperlight validation completed on the ARM64 WHP hardware.

Using this PR's 0.16 crates, a freshly scaffolded sample successfully built aarch64-hyperlight-none guests and ran through WHP in debug and release. Host callbacks, typed calls, persistent state, snapshot, and restore passed. I also ran the release workflow 10 times with surrogate mappings and 10 times with surrogates disabled. All runs produced the expected output.

The backend works. The published scaffold is the remaining user-experience gap: cargo-hyperlight pins Hyperlight 0.15 and hardcodes the generated host's x64 guest path. Filed hyperlight-dev/cargo-hyperlight#70 with the reproduction and results.

@syntactically syntactically left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! I have a bunch of little nits, and also I (more majorly) think that the addition of reset_vcpu to InteruptHandle seems wrong.

Comment thread src/hyperlight_host/src/hypervisor/hyperlight_vm/aarch64.rs Outdated
Comment thread src/hyperlight_host/src/hypervisor/hyperlight_vm/aarch64.rs Outdated
Comment thread src/hyperlight_host/src/hypervisor/hyperlight_vm/aarch64.rs Outdated
Comment thread src/hyperlight_host/src/hypervisor/virtual_machine/whp/aarch64.rs
Comment thread src/hyperlight_host/src/hypervisor/virtual_machine/whp/aarch64.rs
Comment thread src/hyperlight_host/src/hypervisor/virtual_machine/whp/aarch64.rs
Comment thread src/hyperlight_host/src/hypervisor/virtual_machine/whp/x86_64.rs Outdated
Comment thread src/hyperlight_host/src/hypervisor/mod.rs Outdated
Comment thread src/hyperlight_host/tests/integration_test.rs
Comment thread src/hyperlight_host/tests/integration_test.rs
@cshung
cshung force-pushed the cshung/whp-aarch64 branch 5 times, most recently from 7e93813 to 4c2f4e4 Compare August 18, 2026 23:59
@cshung
cshung force-pushed the cshung/whp-aarch64 branch 3 times, most recently from 404a655 to 189317a Compare August 19, 2026 15:45
@hyperlight-gh-bot

This comment has been minimized.

11 similar comments
@hyperlight-gh-bot

This comment has been minimized.

@hyperlight-gh-bot

This comment has been minimized.

@hyperlight-gh-bot

This comment has been minimized.

@hyperlight-gh-bot

This comment has been minimized.

@hyperlight-gh-bot

This comment has been minimized.

@hyperlight-gh-bot

This comment has been minimized.

@hyperlight-gh-bot

This comment has been minimized.

@hyperlight-gh-bot

This comment has been minimized.

@hyperlight-gh-bot

This comment has been minimized.

@hyperlight-gh-bot

This comment has been minimized.

@hyperlight-gh-bot

This comment has been minimized.

@cshung
cshung marked this pull request as ready for review September 29, 2026 17:37
@simongdavies

Copy link
Copy Markdown
Member

@cshung the smoke test failed, but is there any reason for no just making this an additional job in the build-test matrix?

@hyperlight-gh-bot

This comment has been minimized.

@hyperlight-gh-bot

This comment has been minimized.

@hyperlight-gh-bot

This comment has been minimized.

@hyperlight-gh-bot

This comment has been minimized.

@hyperlight-gh-bot

This comment has been minimized.

@hyperlight-gh-bot

This comment has been minimized.

@hyperlight-gh-bot

This comment has been minimized.

@cshung
cshung force-pushed the cshung/whp-aarch64 branch from 4d08618 to 257930a Compare October 1, 2026 14:54
@hyperlight-gh-bot

This comment has been minimized.

@hyperlight-gh-bot

This comment has been minimized.

@cshung
cshung force-pushed the cshung/whp-aarch64 branch from 1d092ab to d1f0697 Compare October 1, 2026 22:53
@hyperlight-gh-bot

This comment has been minimized.

Add native Windows ARM64 support through WHP. Integrate debug and release coverage into the standard build-test matrix.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 6f20a05d-6bee-4e2e-b320-12f8d9759bbc
Signed-off-by: cshung <3410332+cshung@users.noreply.github.com>
@cshung
cshung force-pushed the cshung/whp-aarch64 branch from d1f0697 to 827ea49 Compare October 2, 2026 16:02
@cshung

cshung commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

@simongdavies Done. Windows ARM64 now runs as debug and release entries in the standard build-test matrix using the existing ARM64 guest artifacts. Both entries have passed, and the standalone smoke workflow has been removed.

@hyperlight-gh-bot

Copy link
Copy Markdown

Benchmark Results

Measured commit: 827ea49647c8
Baseline commit: 43cf3539bd10

kvm / amd (Linux) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 767.05 ns (➖ 1.01x faster)
vec_bytes 585.25 ns (➖ 1.00x slower)
373.26 µs (➖ 1.00x faster)

payload_allocation

slot_pool_segmented
262144 521.69 ns (➖ 1.02x faster)
65536 141.51 ns (➖ 1.02x faster)

sandboxes

create_initialized_and_drop
medium 75.58 ms (➖ 1.05x faster)

slot_pool

alloc_dealloc_1500 alloc_dealloc_4096 alloc_dealloc_128
7.73 ns (➖ 1.01x faster) 7.72 ns (➖ 1.00x slower) 7.72 ns (➖ 1.00x faster)

snapshot_files

load_snapshot_unverified
small 92.53 µs (➖ 1.00x slower)

virtq_readonly

slot_pool_segmented_fragmented slot_pool_segmented
262144 7.14 µs (➖ 1.01x faster) 7.24 µs (➖ 1.01x faster)
65536 2.07 µs (➖ 1.01x slower) 1.92 µs (➖ 1.00x faster)

virtq_readwrite

slot_pool_segmented_fragmented slot_pool_segmented
65536 6.26 µs (➖ 1.01x faster) 6.27 µs (➖ 1.02x faster)
8192 1.07 µs (➖ 1.01x slower) 1.07 µs (➖ 1.01x slower)
262144 27.00 µs (➖ 1.01x faster)
kvm / intel (Linux) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 697.88 ns (➖ 1.08x faster)
vec_bytes 504.38 ns (➖ 1.08x faster)
658.72 µs (➖ 1.05x faster)

payload_allocation

slot_pool_segmented
262144 505.77 ns (➖ 1.13x faster)
65536 136.35 ns (➖ 1.13x faster)

sandboxes

create_initialized_and_drop
medium 75.16 ms (➖ 1.06x faster)

slot_pool

alloc_dealloc_1500 alloc_dealloc_4096 alloc_dealloc_128
7.02 ns (➖ 1.07x faster) 6.93 ns (➖ 1.09x faster) 6.99 ns (➖ 1.09x faster)

snapshot_files

load_snapshot_unverified
small 45.61 µs (➖ 1.08x faster)

virtq_readonly

slot_pool_segmented_fragmented slot_pool_segmented
262144 7.53 µs (➖ 1.13x faster) 7.59 µs (➖ 1.13x faster)
65536 2.12 µs (➖ 1.13x faster) 2.15 µs (➖ 1.11x faster)

virtq_readwrite

slot_pool_segmented_fragmented slot_pool_segmented
65536 7.06 µs (➖ 1.12x faster) 7.02 µs (➖ 1.13x faster)
8192 748.89 ns (➖ 1.12x faster) 722.89 ns (➖ 1.09x faster)
262144 29.88 µs (➖ 1.11x faster)
mshv3 / amd (Linux) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 989.43 ns (➖ 1.03x slower)
vec_bytes 718.24 ns (➖ 1.00x slower)
305.32 µs (➖ 1.14x faster)

payload_allocation

slot_pool_segmented
262144 843.27 ns (➖ 1.14x slower)
65536 197.67 ns (➖ 1.00x faster)

sandboxes

create_initialized_and_drop
medium 57.04 ms (➖ 1.03x slower)

slot_pool

alloc_dealloc_1500 alloc_dealloc_4096 alloc_dealloc_128
9.79 ns (➖ 1.02x slower) 9.81 ns (➖ 1.01x slower) 9.82 ns (➖ 1.03x faster)

snapshot_files

load_snapshot_unverified
small 83.90 µs (➖ 1.00x faster)

virtq_readonly

slot_pool_segmented_fragmented slot_pool_segmented
262144 9.63 µs (➖ 1.03x faster) 8.86 µs (➖ 1.01x faster)
65536 2.25 µs (➖ 1.00x faster) 2.45 µs (➖ 1.01x faster)

virtq_readwrite

slot_pool_segmented_fragmented slot_pool_segmented
65536 8.11 µs (➖ 1.01x faster) 8.12 µs (➖ 1.01x slower)
8192 1.28 µs (➖ 1.00x slower) 1.41 µs (➖ 1.05x slower)
262144 36.73 µs (➖ 1.01x slower)
mshv3 / intel (Linux) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 944.75 ns (➖ 1.01x slower)
vec_bytes 662.76 ns (➖ 1.00x faster)
740.41 µs (➖ 1.13x slower)

payload_allocation

slot_pool_segmented
262144 630.05 ns (➖ 1.02x faster)
65536 166.18 ns (➖ 1.01x slower)

sandboxes

create_initialized_and_drop
medium 77.72 ms (➖ 1.25x slower)

slot_pool

alloc_dealloc_1500 alloc_dealloc_4096 alloc_dealloc_128
8.80 ns (➖ 1.00x slower) 8.78 ns (➖ 1.00x slower) 8.81 ns (➖ 1.00x slower)

snapshot_files

load_snapshot_unverified
small 47.12 µs (➖ 1.06x slower)

virtq_readonly

slot_pool_segmented_fragmented slot_pool_segmented
262144 7.80 µs (➖ 1.01x slower) 8.04 µs (➖ 1.00x slower)
65536 2.28 µs (➖ 1.02x slower) 2.26 µs (➖ 1.00x faster)

virtq_readwrite

slot_pool_segmented_fragmented slot_pool_segmented
65536 7.62 µs (➖ 1.01x slower) 7.59 µs (➖ 1.00x slower)
8192 880.18 ns (➖ 1.03x slower) 885.05 ns (➖ 1.00x slower)
262144 39.18 µs (➖ 1.03x slower)
hyperv-ws2025 / amd (Windows) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 1.13 µs (➖ 1.01x slower)
vec_bytes 754.20 ns (➖ 1.26x faster)
2.12 ms (➖ 1.18x faster)

payload_allocation

slot_pool_segmented
262144 783.70 ns (➖ 1.03x faster)
65536 228.90 ns (➖ 1.00x slower)

sandboxes

create_initialized_and_drop
medium 90.34 ms (➖ 1.22x faster)

slot_pool

alloc_dealloc_1500 alloc_dealloc_4096 alloc_dealloc_128
10.62 ns (➖ 1.30x faster) 11.03 ns (➖ 1.02x slower) 10.55 ns (➖ 1.00x slower)

snapshot_files

load_snapshot_unverified
small 666.37 µs (➖ 1.18x faster)

virtq_readonly

slot_pool_segmented_fragmented slot_pool_segmented
262144 8.70 µs (➖ 1.01x slower) 9.36 µs (➖ 1.00x slower)
65536 2.55 µs (➖ 1.01x slower) 2.52 µs (➖ 1.07x faster)

virtq_readwrite

slot_pool_segmented_fragmented slot_pool_segmented
65536 8.62 µs (➖ 1.01x faster) 8.99 µs (➖ 1.02x slower)
8192 1.43 µs (➖ 1.00x faster) 1.36 µs (➖ 1.03x faster)
262144 39.36 µs (➖ 1.09x slower)
hyperv-ws2025 / intel (Windows) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 1.30 µs (➖ 1.08x slower)
vec_bytes 890.56 ns (➖ 1.15x slower)
3.45 ms (➖ 1.11x slower)

payload_allocation

slot_pool_segmented
262144 741.01 ns (➖ 1.01x slower)
65536 212.07 ns (➖ 1.00x faster)

sandboxes

create_initialized_and_drop
medium 112.57 ms (➖ 1.07x faster)

slot_pool

alloc_dealloc_1500 alloc_dealloc_4096 alloc_dealloc_128
10.09 ns (➖ 1.01x slower) 10.16 ns (➖ 1.01x slower) 10.58 ns (➖ 1.00x faster)

snapshot_files

load_snapshot_unverified
small 622.62 µs (➖ 1.02x slower)

virtq_readonly

slot_pool_segmented_fragmented slot_pool_segmented
262144 7.87 µs (➖ 1.04x slower) 7.69 µs (➖ 1.01x faster)
65536 2.34 µs (➖ 1.03x slower) 2.27 µs (➖ 1.02x faster)

virtq_readwrite

slot_pool_segmented_fragmented slot_pool_segmented
65536 8.52 µs (➖ 1.02x slower) 8.36 µs (➖ 1.01x faster)
8192 1.18 µs (➖ 1.08x faster) 1.13 µs (➖ 1.02x slower)
262144 59.48 µs (➖ 1.40x slower)

Reported by cargo ci bench-report --candidate run:37031177925 --baseline run:36945564806 --config-file bench_report.toml.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/enhancement For PRs adding features, improving functionality, docs, tests, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support AArch64 on Windows

4 participants