Skip to content

refactor(migtd): unify migration and rebinding VMM request buffer layout#869

Open
haitaohuang wants to merge 3 commits into
intel:mainfrom
haitaohuang:upstream/pr2b-init-tdinfo
Open

refactor(migtd): unify migration and rebinding VMM request buffer layout#869
haitaohuang wants to merge 3 commits into
intel:mainfrom
haitaohuang:upstream/pr2b-init-tdinfo

Conversation

@haitaohuang

@haitaohuang haitaohuang commented May 29, 2026

Copy link
Copy Markdown
Contributor
Fold init_td_info into MigtdMigrationInformation

Add init_td_info [u8; 512] field to MigtdMigrationInformation so both
migration and rebinding use the same VMM request buffer layout. Delete
RebindingInfo, InitData, and init_data.rs. Widen policy_v2 cfg gates
that were incorrectly restricted to vmcall-raw only.

Peer-to-peer wire protocol is unchanged.

fixes #868

@haitaohuang haitaohuang requested review from jyao1 and sgrams as code owners May 29, 2026 19:15
Comment thread src/migtd/src/spdm/spdm_req.rs Outdated
@haitaohuang haitaohuang marked this pull request as draft May 29, 2026 20:10
@haitaohuang haitaohuang force-pushed the upstream/pr2b-init-tdinfo branch from b34b699 to c335d76 Compare May 29, 2026 21:04
@haitaohuang haitaohuang changed the title refactor(migtd): unify init_td_info handling for all transports refactor(migtd): unify migration and rebinding VMM request buffer layout May 29, 2026
@haitaohuang haitaohuang force-pushed the upstream/pr2b-init-tdinfo branch 2 times, most recently from 262ea9a to 72fb08f Compare May 29, 2026 21:35
@haitaohuang haitaohuang marked this pull request as ready for review May 29, 2026 23:29
@haitaohuang haitaohuang force-pushed the upstream/pr2b-init-tdinfo branch from 72fb08f to 9627bef Compare June 5, 2026 23:11
@haitaohuang

Copy link
Copy Markdown
Contributor Author

Added 2 more commits to fix parser tests for vmcall-raw and non-vmcall-raw. (all previously in rebinding.rs and gated by main+vmcall-raw+policy_v2 so not invoked by ci).

Removed the workaround in parser now that is not needed, see commit messages for details

@sgrams sgrams closed this Jun 8, 2026
@sgrams sgrams reopened this Jun 8, 2026

@sgrams sgrams 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.

looks good to me

@sgrams

sgrams commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

@haitaohuang can you please resolve the conflict? Thanks

haitaohuang and others added 3 commits June 8, 2026 18:48
Add init_td_info [u8; 512] field to MigtdMigrationInformation so both
migration and rebinding use the same VMM request buffer layout. Delete
RebindingInfo, InitData, and init_data.rs. Widen policy_v2 cfg gates
that were incorrectly restricted to vmcall-raw only.

Peer-to-peer wire protocol is unchanged.

Signed-off-by: Haitao Huang <haitaohuang@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The policy_v2 length check accepted a full-size payload with
has_init_data == 0 — a band-aid for a test whose fixture started
writing the full struct after the buffer-unification refactor grew
its size. Replace it with a symmetric check that rejects whenever the
flag and length disagree:

    (has_init_data == 1) != (data_length == full_size)  =>  reject

Move the 8 parser tests from rebinding.rs (only built under
main+policy_v2+vmcall-raw, never run by `xtask lib-test`) to a
policy_v2-gated module in mod.rs. The shared build_mig_info fixture
is now layout-aware so the same tests cover both vmcall-raw (56/568)
and non-vmcall-raw (72/584) struct layouts.

Make MIGTD_MIGRATION_INFO_HEADER_SIZE pub(crate) and update two
fixtures to emit short-form payloads that satisfy the new check:
data::create_mig_info_hob (policy_v2 only) and
session::build_migration_payload. The production HOB consumer
create_migration_information stays layout-neutral; consistency is now
enforced inside the parser.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Haitao Huang <haitaohuang@microsoft.com>
Add a third `cargo test --lib` invocation for migtd under
`--no-default-features --features main,policy_v2,vmcall-raw` so the
rebinding module and the vmcall-raw layout of
MigtdMigrationInformation are exercised by the Library Crates
workflow. `--lib` is required because the bin's `fn main` collides
with the cfg(test) stub under `main + !AzCVMEmu` (pre-existing,
out of scope).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Haitao Huang <haitaohuang@microsoft.com>
@haitaohuang haitaohuang force-pushed the upstream/pr2b-init-tdinfo branch 2 times, most recently from 02c0485 to c0ab8e6 Compare June 8, 2026 19:04
@haitaohuang

Copy link
Copy Markdown
Contributor Author

@haitaohuang can you please resolve the conflict? Thanks

Rebased

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.

Rebinding protocol mismatch with spec

2 participants