OP-TEE / optee_os

Trusted side of the TEE
Other
1.51k stars 1.03k forks source link

How to enlarge the PTA heap size to store large amounts of data? #6894

Closed zwb-233 closed 1 day ago

zwb-233 commented 2 weeks ago

Hi, I'm trying to store a lot of data in PTA in hikey960, which may be larger than 80MB.

I resized CFG_CORE_HEAP_SIZE, but it doesn't seem to exceed 14MB. Beyond this value, compilation will fail. Is there any way to continue to increase CFG_CORE_HEAP_SIZE?

Or can I make PTA use secure memory like dynamic ta? I've increased the size of secure memory to 512MB.

jenswi-linaro commented 1 week ago

When increasing OP-TEE core memory like this it is expected to run into various errors. The error you're currently seeing is likely only one of many. I'm afraid you'll need to debug and sort out most of them yourself, but I can help review the patches when upstreaming.

zwb-233 commented 1 week ago
/*
 *  0x4000_0000                               -
 *    TA RAM: 14 MiB                          |
 *  0x3F20_0000                               | TZDRAM
 *    TEE RAM: 2 MiB (TEE_RAM_VA_SIZE)        |
 *  0x3F00_0000 [TZDRAM_BASE, BL32_LOAD_ADDR] -
 *    Shared memory: 2 MiB                    |
 *  0x3EE0_0000                               | DRAM0
 *    Reserved by UEFI for OP-TEE, unused     |
 *  0x3EC0_0000                               -
 *    Secure Data Path buffers: 4 MiB         | DRAM0 (secure)
 *  0x3E80_0000 [CFG_TEE_SDP_MEM_BASE]        -
 *    Reserved by UEFI for OP-TEE, unused     |
 *  0x3E00_0000                               | DRAM0
 *    Available to Linux                      |
 *  0x0000_0000 [DRAM0_BASE]                  -
 */

@jenswi-linaro Which of the above memory space is used by CFG_CORE_HEAP_SIZE?Does it use TA RAM memory space?

I found that CFG_TZDRAM_SIZE has been modified to 0x20000000(512MB).

jenswi-linaro commented 1 week ago

The OP-TEE Core heap is kept in TEE RAM.

zwb-233 commented 1 day ago

I've increased the size of TEE RAM, and have not encountered any other problems so far. Thanks.