Skip to content

tdcall: return hypercall error code directly from tdvmcalls, let caller handle errors #1659

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

Conversation

babayet2
Copy link
Contributor

@babayet2 babayet2 commented Jul 8, 2025

resolves #1565

@babayet2 babayet2 requested a review from a team as a code owner July 8, 2025 02:19
@babayet2 babayet2 force-pushed the tdx_hypercall_errors branch from ffc1858 to 94c09ce Compare July 8, 2025 02:25
@benhillis benhillis requested a review from Copilot July 8, 2025 17:01
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 changes the TD call path to return raw hypercall output codes so the caller can handle errors directly.

  • Changed tdcall_hypercall signature to return HypercallOutput instead of Result<(), TdVmCallR10Result>.
  • Updated invoke_tdcall_hypercall in OpenHCL to propagate HypercallOutput directly.
  • Adjusted imports to bring in the new HypercallOutput type.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
vm/x86/tdcall/src/lib.rs Switched return type of tdcall_hypercall and removed result mapping
openhcl/openhcl_boot/src/arch/x86_64/tdx.rs Simplified invoke_tdcall_hypercall to forward HypercallOutput directly
Comments suppressed due to low confidence (3)

vm/x86/tdcall/src/lib.rs:90

  • Update the doc comment for tdcall_hypercall to reflect that it now returns a HypercallOutput instead of a Result. This will make the new error-handling contract clear to callers.
) -> HypercallOutput {

vm/x86/tdcall/src/lib.rs:90

  • Add unit tests for the updated tdcall_hypercall function to verify that HypercallOutput::from correctly interprets various r11 codes, per the guideline to write unit tests for new functionality.
) -> HypercallOutput {

openhcl/openhcl_boot/src/arch/x86_64/tdx.rs:158

  • [nitpick] Consider adding a doc comment on invoke_tdcall_hypercall to clarify that it now directly returns the HypercallOutput and that callers must inspect the returned code for errors.
) -> hvdef::hypercall::HypercallOutput {

@benhillis
Copy link
Member

@babayet2 - would you mind writing a bit more description about the change? Thanks!

Copy link

github-actions bot commented Jul 8, 2025

@benhillis
Copy link
Member

benhillis commented Jul 8, 2025

@babayet2 - looks like there is a tdx test failure.

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.

tdcall: tdvmcall for hypercalls does not check/return right status code
2 participants