Skip to content

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions openhcl/virt_mshv_vtl/src/processor/snp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1623,11 +1623,24 @@ impl UhProcessor<'_, SnpBacked> {
HvMessageType::HvMessageTypeSynicSintDeliverable => {
self.handle_synic_deliverable_exit();
}
HvMessageType::HvMessageTypeX64Halt
| HvMessageType::HvMessageTypeExceptionIntercept => {
// 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?

// Nothing to do here, the halt has already been processed.
}
HvMessageType::HvMessageTypeExceptionIntercept => {
// Only #VC's are expected due to the alternate injection.
let exception_message = self
.runner
.exit_message()
.as_message::<hvdef::HvX64ExceptionInterceptMessage>();
if exception_message.vector
!= x86defs::Exception::SEV_VMM_COMMUNICATION.0 as u16
{
tracelimit::error_ratelimited!(
CVM_ALLOWED,
"unexpected intercept message {:x?}",
exception_message
);
}
}
message_type => {
tracelimit::error_ratelimited!(
Expand Down