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

plat-rockchip: rk3588: Allow Passing of Devicetree #7254

Merged
merged 2 commits into from
Mar 7, 2025

Conversation

macromorgan
Copy link
Contributor

In order to pass the devicetree from the first stage bootloader through Arm Trusted Firmware and into Optee, we need to increase the max allowable size of the FDT. 128KiB is enough today for my specific use case (an Indiedroid Nova), however if we add symbols and allow for future growth using a larger value would be prudent. Arm Trusted Firmware today has a hard limit with its current configuration of slightly above 512KiB, so set it to 384KiB to allow for future growth of also Arm Trusted Firmware code.

https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/34997

Additionally, U-Boot today uses an address for compressed kernels by default that is very close to the address used by Optee. As a result, if we use the default values from both projects the system will fail to boot when Optee is used. Update the TZDRAM_START and SHMEM_START to values used by RK3399 and PX30, which uses addresses not in use today by U-Boot.

@edtubbs
Copy link
Contributor

edtubbs commented Jan 30, 2025

These changes hang the NanoPC-T6, including the TF-A FDT_BUFFER_SIZE 0x60000 patch. Will need time to debug.

U-Boot SPL board init
U-Boot SPL 2017.09-ge4e124926e-230922 #lxh (Sep 25 2023 - 10:58:38), fwver: v1.13
Trying to boot from MMC2
No misc partition
Trying fit image at 0x4000 sector
## Verified-boot: 0
## Checking atf-1 0x00040000 ... sha256(c85fdb5713...) + OK
## Checking uboot 0x00200000 ... sha256(0b958ce0ab...) + OK
## Checking fdt 0x003385c0 ... sha256(9ff849197b...) + OK
## Checking atf-2 0xff100000 ... sha256(20d7ba5854...) + OK
## Checking optee 0x08400000 ... sha256(0e23999ce3...) + OK
Jumping to U-Boot(0x00200000) via ARM Trusted Firmware(0x00040000)
Total: 666.765/825.461 ms

NOTICE:  BL31: v2.12.0(release):v2.12.0
NOTICE:  BL31: Built : 19:46:40, Jan 23 2025

@macromorgan
Copy link
Contributor Author

That seems to be a very old version of U-Boot. Any reason you're still using that? That's not the Rockchip BSP version is it?

@edtubbs
Copy link
Contributor

edtubbs commented Jan 30, 2025

It's NanoPC-T6 U-Boot nanopi5-v2017.09, maintained by the vendor. It lacks CONFIG_OPTEE_LIB, so I can't use that feature yet. I'm working to change the TEE load address to 0x30000000 in the image and will submit a PR in the build repo if it works.

@edtubbs
Copy link
Contributor

edtubbs commented Jan 30, 2025

TEE_OFFSET=0x08400000 is the default per fit_args.sh#L42, consistent with OP-TEE builds for RK3588 from Rockchip. That said, I'm patching this script to 0x30000000 to align with your changes. It works, so I'll submit a PR to the build repo.

Copy link
Contributor

@jforissier jforissier left a comment

Choose a reason for hiding this comment

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

For " plat-rockchip: rk3588: Increase FDT Max Size to 384KiB":
s/Optee/OP-TEE/ in the commit description

Then for both commits:
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>

@jforissier
Copy link
Contributor

Fixes https://github.com/OP-TEE/optee_os/commit/14754b93b1b78d8cc6715ad83aa709d1e21b1fad ("plat-rockchip: add support for Rockchip rk3588")

Signed-off-by: Chris Morgan <macromorgan@hotmail.com>

Please use:

Fixes: 14754b93b1b7 ("plat-rockchip: add support for Rockchip rk3588")
Signed-off-by: Chris Morgan <macromorgan@hotmail.com>

Increase the maximum size of the FDT to 384KiB to match the proposed
changes with Arm Trusted Firmware. This allows us to pass and parse
the FDT within OP-TEE. When doing this, we also need to allow OP-TEE
to detect the maximum PA bits so that allocating RAM above 4GiB does
not fail.

With these two changes, OP-TEE can parse and add the correct memory
nodes to the devicetree passed to it automatically.

Associated A-TF commit:
https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/34997

Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
Update the TZDRAM_START and SHMEM_START values to match the PX30 and
RK3399 values. If this is not done, a compressed kernel using the
default value of kernel_comp_addr_r (0x0a000000) within U-Boot and
having a decompressed size greater than 28MiB puts the decompressed
kernel in the reserved address space for OP-TEE that starts at
0x08400000. Using the values for the RK3399 and PX30 avoids this
problem.

Fixes: 14754b9 ("plat-rockchip: add support for Rockchip rk3588")
Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
Copy link

github-actions bot commented Mar 7, 2025

This pull request has been marked as a stale pull request because it has been open (more than) 30 days with no activity. Remove the stale label or add a comment, otherwise this pull request will automatically be closed in 5 days. Note, that you can always re-open a closed issue at any time.

@github-actions github-actions bot added the Stale label Mar 7, 2025
@jforissier jforissier merged commit 6169a1f into OP-TEE:master Mar 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants