-
Notifications
You must be signed in to change notification settings - Fork 138
virt_mshv_vtl, SNP: Fix a todo in the intercept processing #1628
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
// Ignore. | ||
// | ||
// TODO SNP: Figure out why we are getting these. | ||
HvMessageType::HvMessageTypeX64Halt => { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 forhvdef::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.
There was a problem hiding this comment.
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.
6804c94
to
ad96835
Compare
There was a problem hiding this 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 |
There was a problem hiding this comment.
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.
Implement what the TODO requests:
Tested by booting various SEV-SNP VMs.