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

core: add HOB creation and Apply FF-A v1.2 in stmm_sp. #7086

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

LeviYeoReum
Copy link
Contributor

According to Platform Initialization (PI) Specification [1] and
Discussion on edk2 mailing list [2],
StandaloneMm shouldn't create Hob but it should be passed from TF-A.
That's why StandaloneMm in Arm wouldn't produce Hob by itself [3] but
other software stack should pass boot information via PHIT Hob.

To make compatible with edk2 patches [3],
add HOB creation to load StandaloneMm properly.

Also, StandaloneMm doesn't support under FF-A v1.2 version ABI.
For this, update syscall handler with FF-A v1.2 compatiblity.

Links: https://uefi.org/sites/default/files/resources/PI_Spec_1_6.pdf [1]
Links: https://edk2.groups.io/g/devel/topic/103675962#114283 [2]
Links: tianocore/edk2#6116 [3]

@jenswi-linaro
Copy link
Contributor

Why is this HOB needed if StMM could create it by itself before? What is the long-term goal with StMM? Should it be turned into an SP or something else?

@LeviYeoReum
Copy link
Contributor Author

Why is this HOB needed if StMM could create it by itself before? What is the long-term goal with StMM? Should it be turned into an SP or something else?

Since StandaloneMm (StMM) is not producer of HOB but consumer according to specification,
StMM couldn't create HOB by itslef anymore.
Formerly, the creating HOB in StMM is against specification. So edk2 patches're required.

As long term, there is plan for StMM to move SP,
but before moving to StMM SP for support exist platform (i.e) RPMB
This patch is written.

Thanks.

@jenswi-linaro
Copy link
Contributor

Once StMM is an SP, who will create the HOB for StMM? How is this accommodated in the FF-A spec? Or do you anticipate a shim? If so how is that implemented?

@LeviYeoReum
Copy link
Contributor Author

Once StMM is an SP, who will create the HOB for StMM? How is this accommodated in the FF-A spec? Or do you anticipate a shim? If so how is that implemented?

TBH, I don't know exactly, But I think SPMC should create the HOB information according to manifest file.
(i.e. TF-A with SPMC_AT_EL3: https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/30481/17/services/std_svc/spm/el3_spmc/spmc_setup.c#104).

This build hob list passed via FF-A boot protocol and StMM get Hob List in FF-A boot protocol and initialize itself with it.

@jenswi-linaro
Copy link
Contributor

Do you expect to merge the same thing in Hafnium?
It looks strange that a generic component like SPMC should need custom glue code for StMM, not in one place but in three places, TF-A SPMC, OP-TEE SPMC, and Hafnium SPMC. Have you considered adding a shim to the StMM binary to create the HOB from the manifest before handing control over to StMM?

@LeviYeoReum
Copy link
Contributor Author

Do you expect to merge the same thing in Hafnium? It looks strange that a generic component like SPMC should need custom glue code for StMM, not in one place but in three places, TF-A SPMC, OP-TEE SPMC, and Hafnium SPMC. Have you considered adding a shim to the StMM binary to create the HOB from the manifest before handing control over to StMM?

No, It's not glue code for StMM, But it's based on the FF-A specfication.
Because according to FF-A Boot protocol, It can pass "HobList" instead of "FDT".
That's why in near future, there will be patch for Hafnium to sending HobList.

The FF-A boot protocol and its contents should be created from SPMC when it loads partition.
So, It's not a glue code but add a way which spec describes.

@jenswi-linaro
Copy link
Contributor

Thanks, I've found it in the spec too. :-)
I'll review with that in mind.

@jenswi-linaro
Copy link
Contributor

We should go with the lib approach as in TF-A. Please move all the HOB-related code under core/lib/libefi.
hob.c to core/lib/libefi/hob.c and the .h files needed outside of hob.c under core/lib/libefi/include/efi.
I'm choosing libefi over libhob since we need a prefix for the exported functions and I think the efi_ looks better than hob_.

@LeviYeoReum
Copy link
Contributor Author

We should go with the lib approach as in TF-A. Please move all the HOB-related code under core/lib/libefi. hob.c to core/lib/libefi/hob.c and the .h files needed outside of hob.c under core/lib/libefi/include/efi. I'm choosing libefi over libhob since we need a prefix for the exported functions and I think the efi_ looks better than hob_.

Thanks for reviewing this :)
I'll move it :)

@LeviYeoReum LeviYeoReum force-pushed the ffa_milestone2 branch 2 times, most recently from 17179c1 to 0370a5b Compare November 8, 2024 14:39
core/lib/libefi/hob.c Outdated Show resolved Hide resolved
core/lib/libefi/hob.c Outdated Show resolved Hide resolved
core/lib/libefi/hob.c Outdated Show resolved Hide resolved
core/lib/libefi/hob.c Outdated Show resolved Hide resolved
core/lib/libefi/hob.c Outdated Show resolved Hide resolved
core/lib/libefi/hob.c Outdated Show resolved Hide resolved
core/lib/libefi/hob.c Outdated Show resolved Hide resolved
core/lib/libefi/include/efi/mpinfo.h Outdated Show resolved Hide resolved
core/lib/libefi/include/efi/mpinfo.h Outdated Show resolved Hide resolved
core/lib/libefi/hob.c Outdated Show resolved Hide resolved
According to Platform Initialization (PI) Specification [1] and
Discussion on edk2 mailing list [2],
StandaloneMm shouldn't create Hob but it should be passed from TF-A.
That's why StandaloneMm in Arm wouldn't produce Hob by itself [3] but
other software stack should pass boot information via PHIT Hob.

This patch introduces libefi including create Hob to deliver
boot information to StandaloneMm and defines related data structures.

Link: https://uefi.org/sites/default/files/resources/PI_Spec_1_6.pdf [1]
Link: https://edk2.groups.io/g/devel/topic/103675962#114283 [2]
Link: tianocore/edk2#6116 [3]

Signed-off-by: Levi Yun <[email protected]>
edk2's StandaloneMm will be applied with FF-A v1.2.
while applying, StandaloneMm doesn't create anymore PHIT hob by itself
but it should be passed from other software stack.

To make StandaloneMm runs properly, create Hob information and
deliver it using FF-A Boot protocol according to FF-A specification [1].

Also, apply FF-A management protocol to change it [2] to
get/set memory permission instead of using DIRECT_REQ_MSG.

Also, implements some FF-A ABIs to communication StandaloneMm properly.

Link: https://developer.arm.com/documentation/den0077/latest [1]
Link: https://developer.arm.com/documentation/den0140/latest [2]
Signed-off-by: Levi Yun <[email protected]>
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