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-layout: load payload image into physical memory space #675

Conversation

gaojiaqi7
Copy link
Member

@gaojiaqi7 gaojiaqi7 commented Mar 20, 2024

The old implementation loads the payload image into ROM space which limited the size of the payload to be smaller than 16MiB.

  • The previous layout 1:1 maps the image to the ROM space, as we move payload to physical memory space, ROM layout and image layout will be different in td-layout-config tool.
  • Firmware volume header has limitation on the size of the data inside which needs to be smaller than maximum value of u24 (0xffffff). To lift the restriction, FV header is removed for payload images as it is not mandatory.
  • At runtime, if td-shim image is not loaded into memory 1:1, the metadata offset at firmware_end - 0x20 will be invalid because it is the offset from the beginning of the image. The value inside the OVMF GUID table is the offset from the end of the image which is not changed after loading into memory.

Related issue: #665

@gaojiaqi7 gaojiaqi7 force-pushed the 0320/load_payload_image_into_physical_memory branch 4 times, most recently from b72f137 to d39abbb Compare March 21, 2024 01:37
Firmware volume header has limitation on the size of the data inside
which needs to be smaller than maximum value of u24 (0xffffff).

To lift the restriction, FV header is removed for payload images as it
is not mandatory.

Signed-off-by: Jiaqi Gao <[email protected]>
At runtime, if td-shim image is not loaded into memory 1:1, the metadata
offset at firmware_end - 0x20 will be invalid because it is the offset
from the beginning of the image.

The value inside the OVMF GUID table is the offset from the end of the
image which is not changed after loading into memory.

Signed-off-by: Jiaqi Gao <[email protected]>
| FREE | (0x1000) 4 KB
+----------------------------------------+ <- 0x82000
| PAYLOAD | (0xC2D000) 12.18 MB
| FREE | (0x0) 0 B
Copy link
Member

Choose a reason for hiding this comment

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

what is this?

@@ -39,7 +39,7 @@ impl SliceType {
match self {
SliceType::Config => "Config",
SliceType::TdHob => "TdHob",
SliceType::ShimPayload => "ShimPayload",
SliceType::PayloadImage => "PayloadImage",
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 this?

@@ -4,7 +4,7 @@
"TempStack": "0x020000",
"TempHeap": "0x020000",
"Metadata": "0x001000",
"Payload": "0xC2D000",
"Payload": "0xC2E000",
Copy link
Member

Choose a reason for hiding this comment

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

why we need to enlarge for load into physical memory?

0x984a,
0x4798,
[0x86, 0x5e, 0x46, 0x85, 0xa7, 0xbf, 0x8e, 0xc2],
);
Copy link
Member

Choose a reason for hiding this comment

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

why we need this?

The old implementation loads the payload image into ROM space which
limited the size of the payload to be smaller than 16MiB.

The previous layout 1:1 maps the image to the ROM space. As we move
payload to physical memory space, ROM layout and image layout will be
different in td-layout-config tool.

The default image config is adjusted to generate a 16MiB image by
default.

Signed-off-by: Jiaqi Gao <[email protected]>
Payload image is loaded into physical memory space so the functions
under memslice are updated and the metadata is updated.

Signed-off-by: Jiaqi Gao <[email protected]>
@gaojiaqi7 gaojiaqi7 force-pushed the 0320/load_payload_image_into_physical_memory branch from d39abbb to 1b71a3c Compare March 24, 2024 11:20
@gaojiaqi7 gaojiaqi7 closed this May 10, 2024
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