-
Notifications
You must be signed in to change notification settings - Fork 131
tdx: init APs with the ACPI mailbox protocol #970
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
Merged
+669
−86
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
181fee6
mailbox boot for TDX
babayet2 a504041
Update openhcl/openhcl_boot/src/arch/x86_64/hypercall.rs
babayet2 bc52649
Update openhcl/openhcl_boot/src/arch/x86_64/hypercall.rs
babayet2 8387a10
Update openhcl/openhcl_boot/src/arch/x86_64/hypercall.rs
babayet2 a0b4156
tdcall hypercall unsafe
babayet2 598e930
feedback from Chris
babayet2 056f154
clippy errors and TODO for Chris
babayet2 5aa96b7
safety changes and misc Chris feedback
babayet2 47c99f4
add mailbox to e820 + temporary hack to test CI
babayet2 0c99df7
add tdx io newtype pages to HvCall
babayet2 f7579c6
remove logging
babayet2 8e4addc
clippy fix: remove unnecessary import
babayet2 ea2761d
Chris feedback: HvCall safety refactoring/comments
babayet2 8bd1103
remove extra 'pub', restore 'init_if_needed'
babayet2 b6c1e56
chris feedback and arm fixes
babayet2 a332112
io page ownership and misc feedback
babayet2 b2dcece
Chris feedback
babayet2 6faf9de
update kernel versions
babayet2 9d9741b
aarch64 clippy fix
babayet2 e887ec3
cleaner fix
babayet2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,8 @@ | |
use super::address_space::LocalMap; | ||
use super::address_space::init_local_map; | ||
use crate::ShimParams; | ||
use crate::arch::TdxHypercallPage; | ||
use crate::arch::x86_64::address_space::tdx_share_large_page; | ||
use crate::host_params::PartitionInfo; | ||
use crate::host_params::shim_params::IsolationType; | ||
use crate::hypercall::hvcall; | ||
|
@@ -118,6 +120,21 @@ pub fn setup_vtl2_memory(shim_params: &ShimParams, partition_info: &PartitionInf | |
accept_pending_vtl2_memory(shim_params, &mut local_map, ram_buffer, imported_range); | ||
} | ||
} | ||
|
||
// For TDVMCALL based hypercalls, take the first 2 MB region from ram_buffer for | ||
// hypercall IO pages. ram_buffer must not be used again beyond this point | ||
// TODO: find an approach that does not require re-using the ram_buffer | ||
if shim_params.isolation_type == IsolationType::Tdx { | ||
let free_buffer = ram_buffer.as_mut_ptr() as u64; | ||
assert!(free_buffer % X64_LARGE_PAGE_SIZE == 0); | ||
// SAFETY: The bottom 2MB region of the ram_buffer is unused by the shim | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This safety comment isn't strong enough - see the discussion in the TdxHypercallPage type |
||
// The region is aligned to 2MB, and mapped as a large page | ||
let tdx_io_page = unsafe { | ||
tdx_share_large_page(free_buffer); | ||
TdxHypercallPage::new(free_buffer) | ||
}; | ||
hvcall().initialize_tdx(tdx_io_page); | ||
} | ||
} | ||
|
||
/// Accepts VTL2 memory in the specified gpa range. | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.