Skip to content
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

td shim: support large payload #694

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

gaojiaqi7
Copy link
Member

  • The metadata offset at the end - 0x20of image is the offset of the
    metadata from the beginning of the file, so subtract the large payload
    size when calculating metadata offset.

  • As upstream qemu does not support TDVF payload section type, try both
    Payload and LargePayload region to find the firmware volume that
    payload image may be packaged in.

@gaojiaqi7 gaojiaqi7 force-pushed the 0510/td_shim_support_large_payload branch 2 times, most recently from 82d4a0c to cd57a3a Compare May 15, 2024 05:10
+----------------------------------------+ <- 0x40000
| MAILBOX | (0x1000) 4 KB
| MAILBOX | (0x1000) 4 kB
Copy link
Member

Choose a reason for hiding this comment

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

why change KB to kB?

Update the `td-layout` with `td-layout-config`.

Signed-off-by: Jiaqi Gao <jiaqi.gao@intel.com>
@gaojiaqi7 gaojiaqi7 force-pushed the 0510/td_shim_support_large_payload branch from cd57a3a to e21e8dc Compare May 20, 2024 14:05
@@ -35,7 +37,8 @@ impl BootTimeStatic {
// Validate the metadata and get the basic infomation from
// it if any
pub fn new() -> Option<Self> {
let metadata_offset = unsafe { *((u32::MAX - TDX_METADATA_OFFSET + 1) as *const u32) };
let metadata_offset = unsafe { *((u32::MAX - TDX_METADATA_OFFSET + 1) as *const u32) }
- TD_SHIM_LARGE_PAYLOAD_SIZE;
Copy link
Member

Choose a reason for hiding this comment

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

will this overflow?

Copy link
Member Author

Choose a reason for hiding this comment

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

Added the checked_sub to prevent potential overflow, thanks

gaojiaqi7 added 2 commits May 22, 2024 23:29
The metadata offset at the `end - 0x20`of image is the offset of the
metadata from the beginning of the file, so subtract the large payload
size when calculating metadata offset.

Signed-off-by: Jiaqi Gao <jiaqi.gao@intel.com>
As upstream qemu does not support TDVF `payload` section type, try both
`Payload` and `LargePayload` region to find the firmware volume that
payload image may be packaged in.

Signed-off-by: Jiaqi Gao <jiaqi.gao@intel.com>
@gaojiaqi7 gaojiaqi7 force-pushed the 0510/td_shim_support_large_payload branch from e21e8dc to 2d5a36e Compare May 23, 2024 03:29
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