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

Question about CFG_CORE_HEAP_SIZE #6814

Open
ydonghyuk opened this issue May 3, 2024 · 5 comments
Open

Question about CFG_CORE_HEAP_SIZE #6814

ydonghyuk opened this issue May 3, 2024 · 5 comments

Comments

@ydonghyuk
Copy link

CFG_CORE_HEAP_SIZE needs to be increased in the ongoing project.
In this case, I would like to inquire about which memory there is a trade-off.

In default settings without any modification,
It is confirmed that 2MB of TZDARM_SIZE is used as TEE_RAM. Is additional allocation being made here?

@jenswi-linaro
Copy link
Contributor

Yes, the heap memory is carved out from that range.

@etienne-lms
Copy link
Contributor

TZDRAM_SIZE covers both TEE_RAM and TA_RAM (in the most common case where CFG_WITH_PAGER=n).
CFG_CORE_HEAP_SIZE indeed that relates to core heap (malloc() and friends) in TEE_RAM only.

TA RAM is set by function core_mmu_get_ta_ram(): it is either hard coded or computed as the unused area of TZDRAM.

  • hard coded: defined by TA_RAM_START/TA_RAM_SIZE in platforms' platform_config.h (few platforms)
  • computed from TZDRAM_SIZE - TEE_RAM_VA_SIZE (minus TEE_SDP_TEST_MEM_SIZE, likely 0 on most platforms) where TEE_RAM_VA_SIZE is set from CFG_TEE_RAM_VA_SIZE if defined or fallback to CORE_MMU_PGDIR_SIZE. In this case, the bigger CFG_CORE_HEAP_SIZE is, the lower TA_RAM size is. Increasing by few dozen of kBytes should be straight forward. Increasing by many MBytes may need to increase also TZDRAM_SIZE.

@ydonghyuk
Copy link
Author

@etienne-lms

You told me that CFG_CORE_HEAP_SIZE is only involved in TEE_RAM, but I don't understand the sentence below.
"the bigger CFG_CORE_HEAP_SIZE is, the lower TA_RAM size is."

Is this only if CFG_TEE_RAM_VA_SIZE is set?

@etienne-lms
Copy link
Contributor

My mistake. Indeed TEE_RAM size is set from CFG_TEE_RAM_VA_SIZE (I agree the name is confusing).
Changing CFG_CORE_HEAP_SIZE will not modify CFG_TEE_RAM_VA_SIZE, hence not modify TA_RAM size.

@ydonghyuk
Copy link
Author

@etienne-lms
Thank you for the correction.
If CFG_WITH_PAGER=n and CFG_TEE_RAM_VA_SIZE is not set, I would like to know how TEE_RAM_VA_SIZE is set.

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

No branches or pull requests

3 participants