Skip to content

feat(vmcall_raw): handle VMM cancellation (0x302)#860

Merged
jyao1 merged 1 commit into
intel:mainfrom
haitaohuang:upstream/pr1a-cancellation
May 29, 2026
Merged

feat(vmcall_raw): handle VMM cancellation (0x302)#860
jyao1 merged 1 commit into
intel:mainfrom
haitaohuang:upstream/pr1a-cancellation

Conversation

@haitaohuang
Copy link
Copy Markdown
Contributor

The VMM signals migration session cancellation by writing data_status byte[0]=0x02, byte[1]=0x03 (0x302) to the shared buffer.

Previously, 0x302 was treated as a generic TdVmcallErr, reported as SecureSessionError (6), change to propagate and report it as VmmCanceled (10) in ReportStatus.

In the SPDM path, MigtdTransport's send/receive implement the SpdmDeviceIo trait which cannot represent this error in its return types (SpdmResult and Result<usize, usize>). Log a warning when ConnectionAborted is detected so the VMM cancellation is visible in logs, even though the typed error cannot propagate through the SPDM library's trait boundary.

Comment thread src/devices/vmcall_raw/src/transport/vmcall.rs Outdated
@haitaohuang haitaohuang force-pushed the upstream/pr1a-cancellation branch from 90a2aa8 to 9134a47 Compare May 28, 2026 16:12
Detect VMM-initiated session cancellation (data_status byte[0]=0x02,
byte[1]=0x03) in both send and receive poll loops.  Return a new
VmcallRawError::VmmCanceled variant, which maps to
io::ErrorKind::ConnectionAborted so callers can distinguish cancellation
from other transport errors.

Define named constants TDX_VMCALL_STATUS_NOT_COMPLETED and
TDX_VMCALL_STATUS_VMM_CANCEL for the magic status bytes.

Upper layers (spdm, migration) translate ConnectionAborted into
MigrationResult::VmmCanceled and report it to the VMM host.

Signed-off-by: Haitao Huang <haitaohuang@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@haitaohuang haitaohuang force-pushed the upstream/pr1a-cancellation branch from 9134a47 to f057273 Compare May 28, 2026 16:13
@jyao1 jyao1 merged commit b4a75a3 into intel:main May 29, 2026
55 checks passed
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.

2 participants