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

Firmware handoff #6308

Merged
merged 4 commits into from Nov 9, 2023
Merged

Firmware handoff #6308

merged 4 commits into from Nov 9, 2023

Conversation

raymo200915
Copy link
Contributor

@raymo200915 raymo200915 commented Sep 20, 2023

Add supports for Transfer List into core, which are compliant to the Firmware Handoff
specification v0.9 (https://github.com/FirmwareHandoff/firmware_handoff/releases/tag/v0.9).

The motivation for this patch set is to unify the way of arguments handoff between all boot stages (BL2/BL31/BL32/BL33).
In current practice, when the Transfer List is enabled between BL2 and BL33 (See the related patch sets for TF-A below for reference),
we need this patch to allow the DTB nodes appended by OP-TEE can be reflected into the Transfer List memory and passed to BL33.

Reference:

  1. Patch to introduce Transfer List into TF-A: https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/22215
  2. Patch to enable Transfer List between the handoff from BL2 to BL33 on qemu: https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/22178

@jenswi-linaro
Copy link
Contributor

Please rebase to resolve the conflicts. We also need to decide if firmware handoff will be used by OP-TEE or not. A good use case is enough motivation to include this.

Copy link
Contributor

@etienne-lms etienne-lms left a comment

Choose a reason for hiding this comment

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

Some generic coding style comments that could be addressed before you rebase.
Could you add a link the the Firmware Handoff Transfer List specification?

TL is too vague I think as acronym. If you want an acronym, maybe FHTL would be better (Firmware Handoff Transfer List, as its the name of the spec).

core/include/mm/core_mmu.h Show resolved Hide resolved
core/include/mm/core_mmu.h Outdated Show resolved Hide resolved
core/include/kernel/transfer_list.h Outdated Show resolved Hide resolved
core/kernel/transfer_list.c Outdated Show resolved Hide resolved
core/kernel/transfer_list.c Outdated Show resolved Hide resolved
mk/config.mk Show resolved Hide resolved
core/include/kernel/transfer_list.h Outdated Show resolved Hide resolved
@raymo200915
Copy link
Contributor Author

Updated the patch set with:

  1. Fix to enhance the backwards compatibility for legacy handoff if no Transfer List is detected through the arguments.
  2. Fix of coding style issues (False-positive spelling warnings are still remained).
  3. Rebase to master.

@raymo200915
Copy link
Contributor Author

Please rebase to resolve the conflicts. We also need to decide if firmware handoff will be used by OP-TEE or not. A good use case is enough motivation to include this.

Rebased and add description on the motivation, links of specification and reference.

@raymo200915
Copy link
Contributor Author

raymo200915 commented Sep 21, 2023

Some generic coding style comments that could be addressed before you rebase. Could you add a link the the Firmware Handoff Transfer List specification?

TL is too vague I think as acronym. If you want an acronym, maybe FHTL would be better (Firmware Handoff Transfer List, as its the name of the spec).

Fix in the commit [fixup] core: init dt when no DTB observed from TL

I guess at current stage I would prefer keep it named as "Transfer List", since the specification is named as "Firmware Handoff specification", generally "handoff" is a common terms and can by different implementations - The current one is implemented via "Transfer List" - That is the reason I use "TL" for the acronym, similiarly "TE" for "Transfer Entry".

@raymo200915
Copy link
Contributor Author

All comments have been addressed.

@jenswi-linaro
Copy link
Contributor

Please squash the fixups.

@raymo200915
Copy link
Contributor Author

Squash done.

core/include/kernel/transfer_list.h Outdated Show resolved Hide resolved
core/kernel/transfer_list.c Outdated Show resolved Hide resolved
core/kernel/transfer_list.c Outdated Show resolved Hide resolved
core/kernel/transfer_list.c Outdated Show resolved Hide resolved
core/kernel/transfer_list.c Outdated Show resolved Hide resolved
core/arch/arm/kernel/entry_a64.S Outdated Show resolved Hide resolved
core/arch/arm/kernel/entry_a64.S Outdated Show resolved Hide resolved
core/arch/arm/kernel/entry_a64.S Outdated Show resolved Hide resolved
core/arch/arm/kernel/entry_a64.S Outdated Show resolved Hide resolved
core/arch/arm/kernel/entry_a64.S Outdated Show resolved Hide resolved
core/arch/arm/kernel/boot.c Outdated Show resolved Hide resolved
core/arch/arm/kernel/boot.c Outdated Show resolved Hide resolved
core/arch/arm/kernel/boot.c Outdated Show resolved Hide resolved
core/kernel/dt.c Outdated Show resolved Hide resolved
core/kernel/dt.c Outdated Show resolved Hide resolved
core/arch/arm/kernel/entry_a32.S Outdated Show resolved Hide resolved
core/include/kernel/transfer_list.h Outdated Show resolved Hide resolved
core/include/kernel/transfer_list.h Show resolved Hide resolved
core/include/kernel/transfer_list.h Show resolved Hide resolved
core/kernel/transfer_list.c Outdated Show resolved Hide resolved
@raymo200915
Copy link
Contributor Author

All comments have been addressed.

core/arch/arm/kernel/boot.c Outdated Show resolved Hide resolved
core/arch/arm/kernel/entry_a32.S Outdated Show resolved Hide resolved
core/arch/arm/kernel/boot.c Outdated Show resolved Hide resolved
core/arch/arm/kernel/boot.c Outdated Show resolved Hide resolved
core/arch/arm/kernel/boot.c Outdated Show resolved Hide resolved
core/kernel/transfer_list.c Outdated Show resolved Hide resolved
core/kernel/transfer_list.c Outdated Show resolved Hide resolved
core/kernel/transfer_list.c Outdated Show resolved Hide resolved
core/kernel/transfer_list.c Outdated Show resolved Hide resolved
core/kernel/dt.c Outdated Show resolved Hide resolved
@jenswi-linaro
Copy link
Contributor

The handling of boot arguments becomes even more complicated with this. I'm about to propose a PR to use common handling of boot arguments in C.

@jenswi-linaro
Copy link
Contributor

#6335

@raymo200915
Copy link
Contributor Author

The handling of boot arguments becomes even more complicated with this. I'm about to propose a PR to use common handling of boot arguments in C.

Just took a quick look at the PR, seems that all arguments are saved instead of passing into individual boot functions.
I can hold this patch after addressing remained comments and rebase all after your PR is merged.

@raymo200915
Copy link
Contributor Author

All comments have been addressed.

core/include/kernel/transfer_list.h Outdated Show resolved Hide resolved
core/include/kernel/transfer_list.h Outdated Show resolved Hide resolved
core/include/kernel/transfer_list.h Outdated Show resolved Hide resolved
core/kernel/transfer_list.c Outdated Show resolved Hide resolved
core/kernel/transfer_list.c Outdated Show resolved Hide resolved
@raymo200915
Copy link
Contributor Author

All comments have been addressed.
If there no upcoming comments I will squash all [review] commits and add Reviewed-by tags.

Copy link
Contributor

@etienne-lms etienne-lms left a comment

Choose a reason for hiding this comment

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

I fine you squash the fixup commits.
Some minor late comments.

core/arch/arm/kernel/boot.c Show resolved Hide resolved
core/kernel/dt.c Outdated Show resolved Hide resolved
core/kernel/dt.c Outdated Show resolved Hide resolved
core/kernel/transfer_list.c Show resolved Hide resolved
@raymo200915
Copy link
Contributor Author

All comments have been addressed.
Rebased to master, squashed all fixup commits, added Reviewed-by tags.

@etienne-lms
Copy link
Contributor

etienne-lms commented Oct 12, 2023

@raymo200915, actually no review tag were posted yet for the 3 commits. We only posted comments.
Please update mine with Acked-by: Etienne Carriere <etienne.carriere@foss.st.com> for the 3 commits.
(edited: my A-b tag assuming #6308 (comment) is irrelevant or fixed)

@etienne-lms
Copy link
Contributor

Checkpatch report are all false positive, all about missspelled te:

WARNING: 'te' may be misspelled - perhaps 'the'?
#55: FILE: core/arch/arm/kernel/boot.c:1262:
+	struct transfer_list_entry *te = NULL;
 	                            ^^

@raymo200915
Copy link
Contributor Author

@raymo200915, actually no review tag were posted yet for the 3 commits. We only posted comments. Please update mine with Acked-by: Etienne Carriere <etienne.carriere@foss.st.com> for the 3 commits. (edited: my A-b tag assuming #6308 (comment) is irrelevant or fixed)

Done. Sorry, I misunderstand the purpose of Reviewed-by tag.

@raymo200915
Copy link
Contributor Author

For "core: add memory area for transfer list" please apply: Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>

Done.

@raymo200915
Copy link
Contributor Author

All comments have been addressed.

@jenswi-linaro
Copy link
Contributor

For "core: add support for transfer list" please apply:
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>

For "core: add transfer list API" please apply:
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>

@raymo200915
Copy link
Contributor Author

For "core: add support for transfer list" please apply: Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>

For "core: add transfer list API" please apply: Acked-by: Jens Wiklander <jens.wiklander@linaro.org>

Thanks @jenswi-linaro , tags added.

@jforissier
Copy link
Contributor

  • There is a link error in "CI / make (multi-platform)"
  • How about renaming te to e to please checkpatch? e for entry is as good as te for transfer list entry IMO.
  • The Hafnium CI error is probably unrelated, I'll look into it

Copy link
Contributor

@etienne-lms etienne-lms left a comment

Choose a reason for hiding this comment

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

comment for commit "core: add transfer list API".

core/kernel/transfer_list.c Show resolved Hide resolved
core/kernel/transfer_list.c Outdated Show resolved Hide resolved
core/kernel/transfer_list.c Outdated Show resolved Hide resolved
@raymo200915 raymo200915 force-pushed the firmware_handoff branch 2 times, most recently from 40b48a0 to 993ab14 Compare November 6, 2023 20:35
@raymo200915
Copy link
Contributor Author

raymo200915 commented Nov 6, 2023

  • There is a link error in "CI / make (multi-platform)"
  • How about renaming te to e to please checkpatch? e for entry is as good as te for transfer list entry IMO.
  • The Hafnium CI error is probably unrelated, I'll look into it

Fixed the clang build error in multi-platform.
All te are renamed to tl_e for 'transfer list entry', no more checkpatch complains observed.

@raymo200915
Copy link
Contributor Author

Minor fixes applied:
Adding a stub function "boot_save_transfer_list()" to fix the CI clang build error.
Optimize function transfer_list_add().
Clean up checkpatch false positive warnings.

@raymo200915
Copy link
Contributor Author

Fixed another CI multi-platform build error.

@etienne-lms
Copy link
Contributor

etienne-lms commented Nov 7, 2023

@raymo200915, it's hard to review again the whole changes after your latest updates since we don't really know which piece of code you updated. This is where appending fixup commits on top of an series of the patches we have reviewed (acked or not acked, not matter) is quite handy for the dear reviewers.
Nevertheless i'll have another review round...

@jforissier, could you enable CI tests for this P-R?
@raymo200915, it would be nice the CI includes a build test with CFG_TRANSFER_LIST=y. You can archive achieve that by patching file .github/workflows/ci.yaml, see that file Git history for examples.

(edited ;-)>

@raymo200915
Copy link
Contributor Author

@raymo200915, it's hard to review again the whole changes after your latest updates since we don't really know which piece of code you updated. This is where appending fixup commits on top of an series of the patches we have reviewed (acked or not acked, not matter) is quite handy for the dear reviewers. Nevertheless i'll have another review round...

@jforissier, could you enable CI tests for this P-R? @raymo200915, it would be nice the CI includes a build test with CFG_TRANSFER_LIST=y. You can archive achieve that by patching file .github/workflows/ci.yaml, see that file Git history for examples.

(edited ;-)>

Sorry for my last force-push...
Applied a minor fix for the stub function as @jenswi-linaro suggested.
Added CI build with CFG_TRANSFER_LIST and CFG_MAP_EXT_DT_SECURE.

Copy link
Contributor

@etienne-lms etienne-lms left a comment

Choose a reason for hiding this comment

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

Thanks @raymo200915.
Acked-by: Etienne Carriere <etienne.carriere@foss.st.com> for the series.

@jenswi-linaro
Copy link
Contributor

The latest fixups look good.

Adding a new area to map a transfer list if it is handed over
from previous boot stage

Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Acked-by: Etienne Carriere <etienne.carriere@foss.st.com>
Introduce Transfer List API into kernel to implement Firmware
Handoff specification

Link: https://github.com/FirmwareHandoff/firmware_handoff
Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Acked-by: Etienne Carriere <etienne.carriere@foss.st.com>
Add supports for Transfer List on both aarch32/64.
Fetch arguments from {x,r}{0-3} and check if a valid Transfer List
exists, which compliant to the Firmware Handoff specification.
The Transfer List will be mapped during early initialization and
unmapped before exiting to next boot stage.
DTB and pagable address will be parsed from the Transfer List if
they exist as Transfer Entries.
If Transfer List does not exist or is invalid, legacy argument
handoff is backwards compatible.

Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Acked-by: Etienne Carriere <etienne.carriere@foss.st.com>
Add CI multi-platform build with CFG_TRANSFER_LIST

Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
Acked-by: Etienne Carriere <etienne.carriere@foss.st.com>
@raymo200915
Copy link
Contributor Author

Squashed fixup commits and added Etienne's tag.

@jforissier
Copy link
Contributor

Thanks @raymo200915

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.

None yet

4 participants