Repository navigation
x86: enable guest-managed Intel VT-d on Windows - #5143
John Starks (jstarks) merged 3 commits into
Conversation
Set the DMAR DMA-control platform opt-in flag and mask the Hyper-V hardware-feature bits that claim DMA and interrupt remapping are hypervisor-managed when Intel VT-d is configured. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: bec97463-419f-4fb3-a9ae-e8d73e3257dc
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the ACPI and CPUID changes supporting guest-managed Intel VT-d.
No open issues 🎉
What changed in this PR
This PR enables Windows guests to manage emulated Intel VT-d by updating OpenVMM’s ACPI and Hyper-V CPUID reporting.
Changes:
- Set the DMAR DMA-control platform opt-in flag.
- Clear only the CPUID bits indicating hypervisor-managed DMA and interrupt remapping when Intel VT-d is configured, preserving unrelated bits.
- Add a focused CPUID masking test and update the DMAR flag assertion.
| File | Description |
|---|---|
vmm_core/src/cpuid/mod.rs |
Add the masked CPUID override and its unit test. |
vmm_core/src/acpi_builder.rs |
Set the DMAR opt-in flag and update the existing test. |
vm/acpi_spec/src/dmar.rs |
Define the DMA-control platform opt-in flag constant. |
openvmm/openvmm_core/src/worker/dispatch.rs |
Apply the CPUID override when Intel VT-d is configured. |
Review effort: Balanced
Use the simplified complement expression expected by clippy::identity-op. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: bec97463-419f-4fb3-a9ae-e8d73e3257dc
|
is there a way we can test this in a vmm_test (nested one?) |
|
CI follow-up: the original Linux Clippy failure was fixed in 9a25a35, and the replacement quick check now passes. The three remaining failed VMM jobs appear unrelated to this change: both Windows AMD jobs failed downloading x64-openhcl-igvm with GitHub HTTP 503 (egress account limit), and the Linux AMD KVM job timed out in the virtio-net KDNET Windows test after 600 seconds; that test's logged VM config has iommu: None, so the IntelVtd-only CPUID override is not applied. I do not have upstream permission to rerun failed jobs. |
|
I prototyped this in Unfortunately, the available Windows test images do not distinguish this change:
So those images program VT-d without enforcing the newer Windows platform-opt-in policy. Landing either test would be green before and after this PR and would provide false regression confidence. The current coverage is therefore:
I did not keep the non-discriminating test changes. If there is a newer Windows artifact available to |
|
maybe perhaps now i'm wondering what it woudl take to onboard a test for this, does it need a new windows image? |
| use x86defs::cpuid::CpuidFunction; | ||
|
|
||
| // EAX bits 4 and 5 report hypervisor-managed DMA and interrupt remapping. | ||
| const HYPERV_HARDWARE_FEATURES_IOMMU_IN_USE_MASK: u32 = (1 << 4) | (1 << 5); |
There was a problem hiding this comment.
Please derive this mask from hvdef::HvHardwareFeatures's dma_remapping_in_use and interrupt_remapping_in_use fields instead of hard-coding their bit positions here. Those fields already define bits 4 and 5 in vm/hv1/hvdef/src/lib.rs; the guest-managed-IOMMU override policy can remain in vmm_core.
There was a problem hiding this comment.
Addressed in c83621f. The mask is now derived from the named dma_remapping_in_use and interrupt_remapping_in_use fields on HvHardwareFeatures, while the override policy remains in vmm_core. The existing test independently checks the architectural 0x30 EAX mask and verifies that unrelated bits and registers are preserved.
Use the canonical DMA and interrupt remapping fields while retaining the masked override policy in vmm_core. Assert the architectural mask independently in the existing behavioral test. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ae062255-030e-4c06-861c-055fa337171c
70157be to
c83621f
Compare
5d6ab1c
into
microsoft:main
Summary
Motivation
When OpenVMM runs on WHP, the underlying Hyper-V CPUID hardware-features leaf can report that DMA and interrupt remapping are already managed by the hypervisor. A Windows guest then does not take control of the emulated VT-d unit. Separately, Windows requires the DMAR DMA-control platform opt-in flag before enabling DMA remapping.
The CPUID override is masked, so all unrelated hardware-feature bits continue to come from the underlying hypervisor.
Validation
cargo xtask fmt --fix --only-diffedcargo test -p vmm_core guest_managed_iommu_leaf_clears_only_iommu_bitscargo test -p vmm_core test_dmar_basiccargo clippy -p acpi_spec -p vmm_core -p openvmm_core --all-targetscargo doc --no-deps -p acpi_spec -p vmm_core -p openvmm_corecargo build --release -p openvmmThe resulting current-main binary was boot-smoked with a Windows guest on WHP using emulated NVMe and Intel VT-d. Windows reported the DMAR opt-in, selected native IOMMU policy, configured four-level IOMMU page tables, and started the NVMe controller and disk.