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

[RFC] Enable Firmware Handoff in Qemu-Arm via bloblist #2

Draft
wants to merge 19 commits into
base: master
Choose a base branch
from

Conversation

raymo200915
Copy link
Owner

@raymo200915 raymo200915 commented Nov 10, 2023

This PR is base on below patch set series, added/amended new commits to align the bloblist APIs with the Firmware Handoff spec , and implemented Qemu-Arm platform custom functions to retrieve bloblist from previous loader via boot arguments when CONFIG_OF_BOARD option is enabled.
bloblist: Align to firmware handoff
[v2,30/32] fdt: Allow the devicetree to come from a bloblist

It is tested with my patches for TF-A and OP-TEE with a complete Firmware Handoff flow (BL2, BL31, BL32, BL33).
TF-A Patches:
feat(handoff): introduce firmware handoff library
feat(qemu): implement firmware handoff on qemu
feat(handoff): enhance transfer list library
feat(optee): enable transfer list in opteed
feat(qemu): enable transfer list to BL31/32
OP-TEE Patch:
Firmware handoff
fixup of transfer list entry overriding
Update transfer list to align to the spec

Align bloblist tags with the FW handoff spec v0.9.
The most common ones are from 0.
TF related ones are from 0x100.
All non-standard ones from 0xfff000.

Signed-off-by: Simon Glass <sjg@chromium.org>
Co-developed-by: Raymond Mao <raymond.mao@linaro.org>
Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
The updated bloblist structure stores the alignment as a power-of-two
value in its structures. Adjust the API to use this, to avoid needing to
calling ilog2().

Drop a stale comment while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
Co-developed-by: Raymond Mao <raymond.mao@linaro.org>
Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
sjg20 and others added 17 commits November 30, 2023 08:48
This uses a new value with spec v0.9 so change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Co-developed-by: Raymond Mao <raymond.mao@linaro.org>
Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
The new bloblist for v0.9 has version 1 so update this value.

Signed-off-by: Simon Glass <sjg@chromium.org>
Co-developed-by: Raymond Mao <raymond.mao@linaro.org>
Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
These values currently use a simple field. With spec v0.9 they have moved
to a packed format. Convert most accesses to use functions, so this change
can be accomodated.

Signed-off-by: Simon Glass <sjg@chromium.org>
There is no flags value in spec v0.9 so drop it.

For now it is still present in the header, with an underscore, so that
tests continue to pass.

Signed-off-by: Simon Glass <sjg@chromium.org>
There are no spare values in spec v0.9 so drop them.

For now they are still present in the headers, with an underscore, so that
tests continue to pass.

Signed-off-by: Simon Glass <sjg@chromium.org>
Use a sinple 8-bit checksum for bloblist, as specified by the spec
version 0.9

Signed-off-by: Simon Glass <sjg@chromium.org>
Spec v0.9 specifies that the entire bloblist area is checksummed,
including unused portions. Update the code to follow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Rather than setting the alignment using the header size, add an entirely
new entry to cover the gap left by the alignment.

Signed-off-by: Simon Glass <sjg@chromium.org>
The v0.9 spec provides for an 8-byte header for each blob, with fewer
fields.
The blob data start address should be aligned with the alignment specified
by the bloblist header.
Update the implementation to match this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Co-developed-by: Raymond Mao <raymond.mao@linaro.org>
Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
The v0.9 spec provides for a 16-byte header with fewer fields. Update
the implementation to match this.

This also adds an alignment field.

Signed-off-by: Simon Glass <sjg@chromium.org>
Allow the alignment to be specified when creating a bloblist.

Signed-off-by: Simon Glass <sjg@chromium.org>
Align the documentation with the v0.9 spec.

Signed-off-by: Simon Glass <sjg@chromium.org>
Standard passage provides for a bloblist to be passed from one firmware
phase to the next. That can be used to pass the devicetree along as well.
If CONFIG_OF_BOARD is defined, a board custom routine will provide a
bloblist or a specified memory address to retrieve the devicetree at
runtime.
A devicetree from a bloblist is prioritized than the one from specified
memory region.

Tests for this will be added as part of the Universal Payload work.

Signed-off-by: Simon Glass <sjg@chromium.org>
Co-developed-by: Raymond Mao <raymond.mao@linaro.org>
Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
Align used_size and total_size of the bloblist header to the definition
of the FW Handoff spec v0.9.
Update the related bloblist APIs and UT testcases.

Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
Add platform custom function to get bloblist from boot arguments.
Check whether boot arguments aligns with the register conventions
defined in FW Handoff spec v0.9.
Add bloblist related options into qemu default config.

Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
During bloblist initialization, when CONFIG_OF_BOARD is defined,
invoke the platform custom function to load the bloblist via boot
arguments from the previous loader.
If the bloblist exists, copy it into the fixed bloblist memory region.

Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
Add flags to bloblist header to align to the FW handoff spec.

Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
@raymo200915 raymo200915 marked this pull request as draft March 6, 2024 00: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