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

How to use 64MB secure memory at ls1012a #2833

Closed
mofanv opened this issue Feb 19, 2019 · 6 comments
Closed

How to use 64MB secure memory at ls1012a #2833

mofanv opened this issue Feb 19, 2019 · 6 comments
Labels

Comments

@mofanv
Copy link

mofanv commented Feb 19, 2019

Please help!

I want to use as much as secure memory on a ls1012a board. I tried the followed methods.

1. Increased PGT_CACHE_SIZE in /optee_os/core/arch/arm/include/mm/pgt_cache.h
#define PGT_CACHE_SIZE ROUNDUP(CFG_NUM_THREADS 2, PGT_NUM_PGT_PER_PAGE)
changed to:
#define PGT_CACHE_SIZE ROUNDUP(CFG_NUM_THREADS 130, PGT_NUM_PGT_PER_PAGE)

2. Decreased TTBCR_N_VALUE in /optee_os/core/arch/arm/mm/core_mmu_v7.c to the smallest possible
#define TTBCR_N_VALUE 7
changed to:
#define TTBCR_N_VALUE 5

3. Increased CFG_SHMEM_SIZE in /optee_os/core/arch/arm/plat-ls/conf.mk
CFG_SHMEM_SIZE ?= 0X00200000
changed to:
CFG_SHMEM_SIZE ?= 0X00400000

4. Tried to change memory size in user_ta_header_defines.h to:
#define TA_STACK_SIZE (1 * 1024 * 1024)
#define TA_DATA_SIZE (10 * 1024 * 1024)

I find the definition of CFG_TEE_OS_DRAM0_SIZE is 0x4000000 for plat-ls, which is 64MB. So the CFG_TZDRAM_SIZE is CFG_TEE_OS_DRAM0_SIZE - CFG_SHMEM_SIZE, around 60MB.

However, my TA gets errors at the segmentation fault. Could you please tell me, do I understand the memory map size in the correct way? How to correctly increase the secure memory?

Thank you in advance.
Vincent

@pangupta
Copy link
Contributor

Can you share the board name, you are using?
Can you share the DRAM size on the board?

Also share the crash logs.

@mofanv
Copy link
Author

mofanv commented Feb 20, 2019

@pangupta Thanks for the reply.
The board is Grapeboard. The DRAM size is 1GB.
The OP-TEE Implementation is from Openenclave.

I cannot see the crash logs, but only the segmentation fault. Even though having set the CFG_TEE_CORE_LOG_LEVEL=3 and CFG_TEE_TA_LOG_LEVEL=3, I still couldn't see any IMSG and DMSG logs from the Serial terminal. Have no clue why there is no log. :(

@pangupta
Copy link
Contributor

I can see that you are trying to change parameters PGT_CACHE_SIZE, TTBCR_N_VALUE, ?
What is the reason for the same?

Yes, you can increase the OPTEE_OS DRAM size "CFG_TEE_OS_DRAM0_SIZE" by increasing its value.
and it should work, but we did not tested more than 64 MB.

@mofanv
Copy link
Author

mofanv commented Feb 20, 2019

I changed PGT_CACHE_SIZE and TTBCR_N_VALUE according to steps in #2079. Before that, I have used this in QEMU.

I still think that the error in Grapeboard is because of the TZDRAM size. I tried several TA_STACK_SIZE and TA_DATA_SIZE in the Hello World example. After TA_DATA_SIZE larger than 5MB, the app failed with 0xffff0008.

Do I miss some parameters to use larger secure memory? 5 MB is still far from 60 MB.

@xiaxinkai
Copy link

@mofanv Do you solve the problem? I have met the same issue on Raspberry Pi 3b.

@github-actions
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants