Skip to content

Conversation

romank-msft
Copy link
Contributor

Implement what the TODO requests:

  • Add a comment to explain why halt messages are expected,
  • Check that the only exception intercept messages are for the VC traps, and document that.

Tested by booting various SEV-SNP VMs.

@romank-msft romank-msft requested a review from a team as a code owner June 30, 2025 21:39
// Ignore.
//
// TODO SNP: Figure out why we are getting these.
HvMessageType::HvMessageTypeX64Halt => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Where is it being processed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  • Above in the match block, there is an arm for the HLT exit,
  • In the same block, when processing the MSR exit, read_msr_snp is called which checks for hvdef::HV_X64_MSR_GUEST_IDLE.

The intercept message from the hypervisor can't offer a better/more trustworthy data than that one (generated by the hardware). Both cases are handled with the VP "parked" in the state allowing for interrupts being delivered. That all made the impression all that's required to be done must be already done.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should assert or check/warn that the SevExitCode is what we'd expect here?

Implement what the TODO requests:

* Add a comment to explain why halt messages are expected,
* Check that the only exception intercept messages are for the VC traps,
and document that.

Tested by booting various SEV-SNP VMs.
@Copilot Copilot AI review requested due to automatic review settings August 27, 2025 15:21
@romank-msft romank-msft force-pushed the mwhy_halts_and_expts branch from 6804c94 to ad96835 Compare August 27, 2025 15:21
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR addresses a TODO comment in the SNP (SEV-SNP) intercept processing code by implementing proper handling and validation for two specific message types: halt messages and exception intercept messages.

  • Separates the handling of halt and exception intercept messages that were previously grouped together
  • Adds documentation explaining why halt messages are expected and require no action
  • Implements validation for exception intercept messages to ensure only #VC (VMM Communication) traps are received

.runner
.exit_message()
.as_message::<hvdef::HvX64ExceptionInterceptMessage>();
if exception_message.vector
Copy link
Preview

Copilot AI Aug 27, 2025

Choose a reason for hiding this comment

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

Consider adding a comment explaining what the SEV_VMM_COMMUNICATION exception vector represents and why it's the only expected exception type in the SNP context.

Copilot uses AI. Check for mistakes.

Copy link

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