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

Increase TA/TEE RAM size #4768

Closed
DevendraDevadiga opened this issue Jul 28, 2021 · 7 comments
Closed

Increase TA/TEE RAM size #4768

DevendraDevadiga opened this issue Jul 28, 2021 · 7 comments
Labels

Comments

@DevendraDevadiga
Copy link
Contributor

Dear Team,

We had implemented secure display and used 1920x1080 resolution display.
For CA and TA, refered the below test app:
https://github.com/jforissier/secvideo_demo/tree/master/app

I am able to write the test.bin (Image with 2MB) successfully and oly 1/4th of Display is covered by LCD (Becuase 8MB image is required in our case we used 1920x1080 resolution display. (1920108032/8).

But when I tried to write the image file with 8MB, app will be able to write the image till 2MB and after that crash is happening.

Below is the crash log:

F/TC:? 0 trace_syscall:132 syscall #71 (syscall_framebuffer_update)
D/TC:3 0 abort_handler:524 [abort] abort in User mode (TA will panic)
E/TC:? 0
E/TC:? 0 User TA undef-abort at address 0x4005c334
E/TC:? 0 esr 0x02000000 ttbr0 0x20000bc4a0060 ttbr1 0x00000000 cidr 0x0
E/TC:? 0 cpu #3 cpsr 0x40000100
E/TC:? 0 x0 000000004005ee4a x1 0000000000000720
E/TC:? 0 x2 0000000000000003 x3 0000000000000001
E/TC:? 0 x4 000000004005f2fc x5 0000000000000000
E/TC:? 0 x6 ffffffffffffffff x7 0000000040014e60
E/TC:? 0 x8 0000000000000047 x9 0000000000000001
E/TC:? 0 x10 0000000000000000 x11 0000000000000000
E/TC:? 0 x12 0000000000000000 x13 0000000040014f80
E/TC:? 0 x14 0000000000000000 x15 0000000000000020
E/TC:? 0 x16 00000000bc4309a4 x17 0000000000000000
E/TC:? 0 x18 0000000000000000 x19 0000000040014ea0
E/TC:? 0 x20 0000000000224000 x21 0000000040068440
E/TC:? 0 x22 0000000040014ea0 x23 0000000000004000
E/TC:? 0 x24 0000000000000001 x25 0000000000000000
E/TC:? 0 x26 0000000000000000 x27 0000000000000000
E/TC:? 0 x28 0000000000000000 x29 0000000040014e20
E/TC:? 0 x30 0000000040053148 elr 000000004005c334
E/TC:? 0 sp_el0 0000000040014e20
D/TC:3 0 abort_handler:524 [abort] abort in User mode (TA will panic)
E/TC:? 0 dump_state_ldelf_dbg:415 ldelf dump function panicked
E/TC:? 0
E/TC:? 0 User TA undef-abort at address 0x4000aaa4
E/TC:? 0 esr 0x02000000 ttbr0 0x20000bc4a0060 ttbr1 0x00000000 cidr 0x0
E/TC:? 0 cpu #3 cpsr 0x00000100
E/TC:? 0 x0 000000004000c66b x1 000000004000c65e
E/TC:? 0 x2 0000000000000023 x3 000000004000c6d9
E/TC:? 0 x4 0000000000000000 x5 0000000000000000
E/TC:? 0 x6 0000000000000000 x7 0000000000000000
E/TC:? 0 x8 0000000000000000 x9 0000000000000000
E/TC:? 0 x10 0000000000000000 x11 0000000000000000
E/TC:? 0 x12 0000000000000000 x13 0000000040005e80
E/TC:? 0 x14 0000000000000000 x15 0000000000000000
E/TC:? 0 x16 0000000000000000 x17 0000000000000000
E/TC:? 0 x18 0000000000000000 x19 0000000040005e80
E/TC:? 0 x20 000000004000e158 x21 0000000040012ec0
E/TC:? 0 x22 0000000000000000 x23 0000000000000000
E/TC:? 0 x24 0000000000000000 x25 0000000000000000
E/TC:? 0 x26 0000000000000000 x27 0000000000000000
E/TC:? 0 x28 0000000000000000 x29 0000000040005e50
E/TC:? 0 x30 00000000400062a4 elr 000000004000aaa4
E/TC:? 0 sp_el0 0000000040005e50
E/TC:? 0 region 0: va 0x0000000040000000 pa 0x00000000bc402000 size 0x002000 flags ---R-X
E/TC:? 0 region 1: va 0x0000000040002000 pa 0x00000000bc492000 size 0x001000 flags ---RW-
E/TC:? 0 region 2: va 0x0000000040004000 pa 0x00000000bc600000 size 0x002000 flags rw-RW-
E/TC:? 0 region 3: va 0x0000000040006000 pa 0x00000000bc602000 size 0x008000 flags r-x---
E/TC:? 0 region 4: va 0x000000004000e000 pa 0x00000000bc60a000 size 0x001000 flags rw-RW-
E/TC:? 0 region 5: va 0x000000004000f000 pa 0x00000000bc60b000 size 0x004000 flags rw-RW-
E/TC:? 0 region 6: va 0x0000000040013000 pa 0x00000000bc60f000 size 0x001000 flags r--R--
E/TC:? 0 region 7: va 0x0000000040014000 pa 0x00000000bc62d000 size 0x001000 flags rw-RW-
E/TC:? 0 region 8: va 0x0000000040050000 pa 0x00000000bc610000 size 0x011000 flags r-xR--
E/TC:? 0 region 9: va 0x0000000040061000 pa 0x00000000bc621000 size 0x00c000 flags rw-RW-
D/TC:? 0 user_ta_enter:166 tee_user_ta_enter: TA panicked with code 0xdeadbeef
D/TC:? 0 destroy_ta_ctx_from_session:313 Remove references to context (0xbc48fd70)
D/TC:? 0 destroy_context:298 Destroy TA ctx (0xbc48fd70)
Invoke CLEAR_SCREEN command (coloD/TC:? 0 tee_ta_close_session:498 csess 0xbc48fdd0 id 1
D/TC:? 0 tee_ta_close_session:518 Destroy session
r=0x007cfc00)...

What may be the possible reason for this ?

I tried to increase TA_DATA_SIZE to 1920 * 1080 * 4. That time I am getting error like:
E/TC:? 0 alloc_pgt:149 5 page tables not available

I tied to increase the PGT_CACHE_SIZE also but not working properly.
Please can you suggest me to solve this issue ?
Thanks and Regards,
Devendra

@DevendraDevadiga
Copy link
Contributor Author

I am using OPTEE version 3.10.0.

@sunnybird
Copy link

sunnybird commented Jul 28, 2021

hi @DevendraDevadiga
have you increase the CFG_TZDRAM_SIZE at optee_os/core/arch/arm/plat-vexpress/conf.mk ?
or you can dump the memory map to check.

@DevendraDevadiga
Copy link
Contributor Author

DevendraDevadiga commented Jul 29, 2021

Dear Sir,
Thanks for your reply.

In our case the memory layout is as below:

image

I am working on i.MX8MQ platform. We used total 60MB, in that 28MB as TZDRAM, 16MB fo Secure buffer and 16MB for shared memory.
But for TA or TEE didn't modified any memory layout. We used generic memory layout for TEE_RAM or TA_RAM.
How I can increase the TEE_RAM ? From the log below I came to know that TEE_RAM is only 2MB. Is this the issue for our application to crash ?

D/TC:0 get_aslr_seed:1344 Bad fdt: -9
D/TC:0 add_phys_mem:585 TEE_SHMEM_START type NSEC_SHM 0xbe000000 size 0x02000000
D/TC:0 add_phys_mem:585 TA_RAM_START type TA_RAM 0xbc600000 size 0x01a00000
D/TC:0 add_phys_mem:585 VCORE_UNPG_RW_PA type TEE_RAM_RW 0xbc463000 size 0x0019d000
D/TC:0 add_phys_mem:585 VCORE_UNPG_RX_PA type TEE_RAM_RX 0xbc400000 size 0x00063000
D/TC:0 add_phys_mem:585 ROUNDDOWN(((((((0x40000000 - 0x3C00000 + 0x80000000) + 0x01c00000) - 2 * 0x800000)) & ~((typeof((((0x40000000 - 0x3C00000 + 0x80000000) + 0x01c00000) - 2 * 0x800000)))(2 * 0x800000) - 1)) + 0x800000), CORE_MMU_PGDIR_SIZE) ty
D/TC:0 add_phys_mem:585 ROUNDDOWN((((((0x40000000 - 0x3C00000 + 0x80000000) + 0x01c00000) - 2 * 0x800000)) & ~((typeof((((0x40000000 - 0x3C00000 + 0x80000000) + 0x01c00000) - 2 * 0x800000)))(2 * 0x800000) - 1)), CORE_MMU_PGDIR_SIZE) type IO_SEC 0xb
D/TC:0 add_phys_mem:585 ROUNDDOWN(0x30320000, CORE_MMU_PGDIR_SIZE) type IO_SEC 0x30200000 size 0x00400000
D/TC:0 add_phys_mem:585 ROUNDDOWN(0x38800000, CORE_MMU_PGDIR_SIZE) type IO_SEC 0x38800000 size 0x00200000
D/TC:0 add_phys_mem:585 ROUNDDOWN(0x30360000, CORE_MMU_PGDIR_SIZE) type IO_SEC 0x30200000 size 0x00400000
D/TC:0 add_phys_mem:599 Physical mem map overlaps 0x30200000
D/TC:0 add_phys_mem:585 ROUNDDOWN((0x30860000), CORE_MMU_PGDIR_SIZE) type IO_NSEC 0x30800000 size 0x00400000
D/TC:0 add_phys_mem:585 TZASC_BASE type IO_SEC 0x32f80000 size 0x00010000
D/TC:0 verify_special_mem_areas:529 NSEC DDR memory [be400000 c0000000]
D/TC:0 verify_special_mem_areas:529 NSEC DDR memory [40000000 bc400000]
D/TC:0 add_va_space:625 type RES_VASPACE size 0x00a00000
D/TC:0 add_va_space:625 type SHM_VASPACE size 0x02000000
D/TC:0 dump_mmap_table:732 type NSEC_SHM va 0xb4800000..0xb67fffff pa 0xbe000000..0xbfffffff size 0x02000000 (pgdir)
D/TC:0 dump_mmap_table:732 type IO_SEC va 0xb6a00000..0xb6bfffff pa 0xbd800000..0xbd9fffff size 0x00200000 (pgdir)
D/TC:0 dump_mmap_table:732 type IO_SEC va 0xb6c00000..0xb6dfffff pa 0xbd000000..0xbd1fffff size 0x00200000 (pgdir)
D/TC:0 dump_mmap_table:732 type TA_RAM va 0xb6e00000..0xb87fffff pa 0xbc600000..0xbdffffff size 0x01a00000 (pgdir)
D/TC:0 dump_mmap_table:732 type IO_SEC va 0xb8a00000..0xb8bfffff pa 0x38800000..0x389fffff size 0x00200000 (pgdir)
D/TC:0 dump_mmap_table:732 type IO_NSEC va 0xb8c00000..0xb8ffffff pa 0x30800000..0x30bfffff size 0x00400000 (pgdir)
D/TC:0 dump_mmap_table:732 type IO_SEC va 0xb9000000..0xb93fffff pa 0x30200000..0x305fffff size 0x00400000 (pgdir)
D/TC:0 dump_mmap_table:732 type SHM_VASPACE va 0xb9400000..0xbb3fffff pa 0x00000000..0x01ffffff size 0x02000000 (pgdir)
D/TC:0 dump_mmap_table:732 type RES_VASPACE va 0xbb600000..0xbbffffff pa 0x00000000..0x009fffff size 0x00a00000 (pgdir)
D/TC:0 dump_mmap_table:732 type IO_SEC va 0xbc3f0000..0xbc3fffff pa 0x32f80000..0x32f8ffff size 0x00010000 (smallpg)
D/TC:0 dump_mmap_table:732 type TEE_RAM_RX va 0xbc400000..0xbc462fff pa 0xbc400000..0xbc462fff size 0x00063000 (smallpg)
D/TC:0 dump_mmap_table:732 type TEE_RAM_RW va 0xbc463000..0xbc5fffff pa 0xbc463000..0xbc5fffff size 0x0019d000 (smallpg)
D/TC:0 core_mmu_entry_to_finer_grained:761 xlat tables used 1 / 7
D/TC:0 core_mmu_entry_to_finer_grained:761 xlat tables used 2 / 7
D/TC:0 core_mmu_entry_to_finer_grained:761 xlat tables used 3 / 7

Any configuration is wrong ?
Please can you help me on this issue ?
Thanks and Regards,
Devendra

@DevendraDevadiga
Copy link
Contributor Author

Any suggestions?
What may be the possible reason for secure display application failure when I used 8MB image file ?

@DevendraDevadiga
Copy link
Contributor Author

Any suggestions for this issue?

@github-actions
Copy link

github-actions bot commented Sep 3, 2021

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, otherwise this issue 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 Sep 3, 2021
@github-actions github-actions bot closed this as completed Sep 9, 2021
@suntong30
Copy link

Any suggestions for this issue?

hello, have you fixed your problem?

zwb-233 added a commit to zwb-233/optee_os that referenced this issue Feb 6, 2024
This commit introduces the CFG_DRAM1_BASE configuration switch in the plat-hikey platform.

This change aligns with previous discussions and resolves issues OP-TEE#5146, OP-TEE#4768, and OP-TEE#6160.

Signed-off-by: zwb-233 <a1231512a@163.com>
zwb-233 added a commit to zwb-233/optee_os that referenced this issue Feb 7, 2024
This commit introduces the CFG_DRAM1_BASE configuration switch in the plat-hikey platform.

This change aligns with previous discussions and resolves issues OP-TEE#5146, OP-TEE#4768, and OP-TEE#6160.

Signed-off-by: Wen Bin <a1231512a@163.com>
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