Skip to content

openvmm: support launching UEFI from IGVM#3726

Open
jiong-microsoft wants to merge 2 commits into
microsoft:mainfrom
jiong-microsoft:fix-igvm-uefi
Open

openvmm: support launching UEFI from IGVM#3726
jiong-microsoft wants to merge 2 commits into
microsoft:mainfrom
jiong-microsoft:fix-igvm-uefi

Conversation

@jiong-microsoft

Copy link
Copy Markdown
Contributor

This PR adds support for launching UEFI packaged inside an IGVM file, starting
with the x64 non-isolated UEFI IGVM case.

The broader goal is to enable launching CCA OpenHCL. To get there, OpenVMM needs
to be usable as the VM manager inside the paravisor. As a first step, we are
moving from the current tmk_vmm + simple_tmk flow toward an openvmm + equivalent
simple_test flow, where the test payload is packaged as an IGVM.

While investigating that path, we found that OpenVMM does not yet have complete
AArch64 IGVM loader support. Before implementing and validating that path, we
wanted a simple existing IGVM payload to use as test input. UEFI packaged inside
IGVM was a good candidate because the repo already has build configuration for
it.

However, launching UEFI from IGVM did not work even on x64. OpenVMM could
directly boot UEFI via --uefi, and it could load IGVM files, but the IGVM path
did not provide the UEFI-specific helper/configuration flow that UEFI firmware
expects. This PR fixes that gap as an incremental step toward the larger
CCA/OpenHCL bring-up.

UEFI boot in OpenVMM depends on a UEFI configuration blob built by the VMM. That
blob carries firmware-facing configuration such as ACPI tables, MMIO ranges,
memory map, processor information, entropy, firmware flags, and other platform
data.

The direct --uefi path already builds and passes this blob to UEFI. However, when
UEFI is packaged into an IGVM, the generic --igvm path did not know that the IGVM
payload was UEFI and therefore did not provide the UEFI config blob/helper
behavior.

This meant there was no supported way to launch a UEFI IGVM even on x64.
Therefore, we have the following changes:

  • Adds a typed IGVM CLI form: --igvm type=uefi,path=/path/to/file.bin
  • Preserves legacy behavior for existing IGVM launches: --igvm /path/to/file.bin
  • Marks LoadMode::Igvm with whether the IGVM contains UEFI.
  • Makes type=uefi imply the fixed-address/file-address IGVM path used by the
    UEFI IGVM case.
  • Rejects incompatible explicit relocation settings for UEFI IGVMs.
  • Reuses the existing UEFI config blob construction for both:
    • direct --uefi boot
    • --igvm type=uefi,path=...
  • Writes the completed UEFI config blob to CONFIG_BLOB_GPA_BASE for UEFI IGVM
    launch.
  • On x64, supplies CONFIG_BLOB_GPA_BASE in R12 if the IGVM did not already
    provide that register.
  • Updates the UEFI IGVM manifest to include the non-isolated x64 UEFI guest
    config.

The legacy --igvm FILE behavior remains unchanged so existing IGVM users are
not affected.

The new type=uefi,path=... form gives OpenVMM an explicit signal that the IGVM
payload is UEFI and needs UEFI-specific setup. This avoids guessing based on
relocation mode or file contents, and leaves room for other typed IGVM payloads
in the future.

Manually tested the x64 UEFI IGVM launch path and verified that it reaches the
same expected UEFI behavior as direct --uefi boot.

The UEFI IGVM is built by:
cargo xflowey build-igvm x64 --override-manifest=vm/loader/manifests/uefi-x64.json

The test command is: (on WSL2)
sudo ./target/debug/openvmm --igvm type=uefi,path=
OPENVMM_ROOT/flowey-out/artifacts/build-igvm/debug/uefi-x64-custom/openhcl-uefi-x64-custom.bin
-m 2GB -p 1

Add an explicit typed IGVM CLI form for UEFI payloads:

    --igvm type=uefi,path=/path/to/file.bin

This lets OpenVMM distinguish UEFI IGVM payloads from the legacy generic IGVM
path, while preserving existing --igvm FILE behavior.

UEFI boot requires OpenVMM to provide the firmware config blob that is already
used by direct --uefi boot. Reuse that config blob construction for UEFI IGVM
launches, write it to CONFIG_BLOB_GPA_BASE, and on x64 pass that GPA in R12
when the IGVM did not already provide R12.

Make typed UEFI IGVMs imply the fixed-address/file-address IGVM path and reject
incompatible explicit relocation settings. Also add the non-isolated x64 UEFI
guest config to the UEFI IGVM manifest.

This is an incremental step toward using OpenVMM to launch IGVM-packaged test
payloads, which is needed for the CCA OpenHCL bring-up path.
@jiong-microsoft jiong-microsoft requested a review from a team as a code owner June 11, 2026 22:03
Copilot AI review requested due to automatic review settings June 11, 2026 22:03

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

Note

Copilot was unable to run its full agentic suite in this review.

Adds support for a “UEFI helper” IGVM path, including CLI parsing/validation and runtime patching of the UEFI config blob when loading an IGVM.

Changes:

  • Extend --igvm CLI to accept type=uefi,path=... and validate related option combinations.
  • Add an uefi flag to LoadMode::Igvm and patch the UEFI config blob + register state when uefi=true.
  • Refactor UEFI loader to expose a reusable build_config_blob helper; update UEFI x64 manifest to include an IGVM config.

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
vm/loader/manifests/uefi-x64.json Adds an IGVM-based UEFI guest config entry.
openvmm/openvmm_entry/src/lib.rs Wires new IGVM CLI structure into config building and load mode selection.
openvmm/openvmm_entry/src/cli_args.rs Introduces IgvmCli, updates flags, and adds parsing tests + validation hook.
openvmm/openvmm_defs/src/config.rs Extends LoadMode::Igvm with a uefi boolean.
openvmm/openvmm_core/src/worker/vm_loaders/uefi.rs Refactors to expose build_config_blob for reuse.
openvmm/openvmm_core/src/worker/dispatch.rs Enables UEFI dependencies for IGVM(UEFI) and patches config blob into guest memory.

Comment thread openvmm/openvmm_entry/src/cli_args.rs
Comment thread openvmm/openvmm_entry/src/cli_args.rs
Comment thread openvmm/openvmm_entry/src/cli_args.rs
Comment on lines 65 to 66
let mut entropy = [0; 64];
getrandom::fill(&mut entropy).expect("rng failure");
Comment thread openvmm/openvmm_entry/src/cli_args.rs

@smalis-msft smalis-msft 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.

Maybe this is a question for @chris-oo, but is this really something that needs to be specified by the user? We can't determine it from the IGVM file alone?

@smalis-msft

Copy link
Copy Markdown
Contributor

If this is something we want to support long term we should probably add a VMM test or two for it too.

@github-actions

Copy link
Copy Markdown

@jiong-microsoft

Copy link
Copy Markdown
Contributor Author

Maybe this is a question for @chris-oo, but is this really something that needs to be specified by the user? We can't determine it from the IGVM file alone?

I investigated this as well, but there doesn't seem to be a simple or clean way to determine whether the content inside an IGVM is UEFI.

@chris-oo

Copy link
Copy Markdown
Member

Yes, the IGVM file does not tell you what the shape of host configuration should be. So we need a hint/configuration lever to effectively say "this is the set of devices/config you should use" along with "here is the igvm file you should boot".

This is also required once we support IGVM based boot for CCA/SNP in openvmm, for the same reasons. If we are booting a linux direct IGVM file, we'd want a linux direct chipset, versus if we boot an enlightened UEFI, versus an OpenHCL IGVM image.

@chris-oo chris-oo 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.

I think this seems reasonable, but in some ways I think "load mode IGVM" needs to be able to specify more/different levers. In some ways, we may want to allow load mode igvm to be the same as some other config like uefi/pcat/etc, and perhaps the current mode should be renamed to OpenHCL load mode which only loads from IGVM.

But I don't think we need to do this refactor now.

@smalis-msft

smalis-msft commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Alright if we want to punt on that let's at least add a VMM test for this flow.

@jiong-microsoft

Copy link
Copy Markdown
Contributor Author

Alright if we want to punt on that let's at least add a VMM test for this flow.

Sure, let me explore how to add a test

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants