linux4sam / meta-atmel

OpenEmbedded/Yocto Project layer for for Microchip SoC (aka AT91)
https://www.linux4sam.org/bin/view/Linux4SAM/YoctoProject
MIT License
91 stars 120 forks source link

OPTEE stuck at U-Boot start #257

Closed SimoneBongini closed 1 year ago

SimoneBongini commented 1 year ago

Hello, I'm an optee newbie, I'm trying to integrate optee-os in Microchip SAMA5D2. I built optee-os with yocto, but seems that AT91bootstrap stuck when it tryies to start optee.

RomBOOT
Backup mode enabled

AT91Bootstrap 4.0.6 (2023-05-05 12:39:18)

SDHC: fix in place for SAMA5D2 SiP VDDSDMMC over-consumption errata
SD/MMC: Image: Read file u-boot.bin to 0x23f00000
MMC: ADMA supported
SD: Card Capacity: High or Extended
SD: Specification Version 3.0X
SD/MMC: Done to load image
SDHC: fix in place for SAMA5D2 SiP VDDSDMMC over-consumption errata
SD/MMC: Image: Read file tee.bin to 0x20000000
Starting OP-TEE, Run at 0x20000000, Non-secure entry at 0x23f00000

No other infos.

Enabling debug log I got:

...
SD/MMC: Image: Read file tee.bin to 0x20000000
Starting OP-TEE, Run at 0x20000000, Non-secure entry at 0x23f00000
D/TC:0   get_aslr_seed:1419 Cannot find /secure-chosen
D/TC:0   plat_get_aslr_seed:110 Warning: no ASLR seed
D/TC:0   add_phys_mem:571 VCORE_UNPG_RX_PA type TEE_RAM_RX 0x20000000 size 0x00088000
D/TC:0   add_phys_mem:571 VCORE_UNPG_RW_PA type TEE_RAM_RW 0x20088000 size 0x00078000
D/TC:0   add_phys_mem:571 TA_RAM_START type TA_RAM 0x20100000 size 0x00700000
D/TC:0   add_phys_mem:571 TEE_SHMEM_START type NSEC_SHM 0x21000000 size 0x00400000
D/TC:0   add_phys_mem:571 ROUNDDOWN(0xf8020000, CORE_MMU_PGDIR_SIZE) type IO_SEC 0xf8000000 size 0x00200000
D/TC:0   add_phys_mem:571 ROUNDDOWN(0xfc03c000, CORE_MMU_PGDIR_SIZE) type IO_SEC 0xfc000000 size 0x00200000
D/TC:0   add_phys_mem:571 ROUNDDOWN(0xf0018000, CORE_MMU_PGDIR_SIZE) type IO_SEC 0xf0000000 size 0x00200000
D/TC:0   add_phys_mem:571 ROUNDDOWN((0xf8030000), CORE_MMU_PGDIR_SIZE) type IO_SEC 0xf8000000 size 0x00200000
D/TC:0   add_phys_mem:585 Physical mem map overlaps 0xf8000000
D/TC:0   add_phys_mem:571 ROUNDDOWN((0x00A00000), CORE_MMU_PGDIR_SIZE) type IO_SEC 0x00a00000 size 0x00100000
D/TC:0   add_phys_mem:571 CFG_SCMI_SHMEM_START type IO_NSEC 0x21400000 size 0x00001000
D/TC:0   add_va_space:611 type RES_VASPACE size 0x00a00000
D/TC:0   add_va_space:611 type SHM_VASPACE size 0x02000000
D/TC:0   dump_mmap_table:724 type TEE_RAM_RX   va 0x20000000..0x20087fff pa 0x20000000..0x20087fff size 0x00088000 (smallpg)
D/TC:0   dump_mmap_table:724 type TEE_RAM_RW   va 0x20088000..0x200fffff pa 0x20088000..0x200fffff size 0x00078000 (smallpg)
D/TC:0   dump_mmap_table:724 type IO_NSEC      va 0x20100000..0x20100fff pa 0x21400000..0x21400fff size 0x00001000 (smallpg)
D/TC:0   dump_mmap_table:724 type SHM_VASPACE  va 0x20200000..0x221fffff pa 0x00000000..0x01ffffff size 0x02000000 (pgdir)
D/TC:0   dump_mmap_table:724 type RES_VASPACE  va 0x22200000..0x22bfffff pa 0x00000000..0x009fffff size 0x00a00000 (pgdir)
D/TC:0   dump_mmap_table:724 type IO_SEC       va 0x22c00000..0x22cfffff pa 0x00a00000..0x00afffff size 0x00100000 (pgdir)
D/TC:0   dump_mmap_table:724 type TA_RAM       va 0x22d00000..0x233fffff pa 0x20100000..0x207fffff size 0x00700000 (pgdir)
D/TC:0   dump_mmap_table:724 type NSEC_SHM     va 0x23400000..0x237fffff pa 0x21000000..0x213fffff size 0x00400000 (pgdir)
D/TC:0   dump_mmap_table:724 type IO_SEC       va 0x23800000..0x239fffff pa 0xf0000000..0xf01fffff size 0x00200000 (pgdir)
D/TC:0   dump_mmap_table:724 type IO_SEC       va 0x23a00000..0x23bfffff pa 0xf8000000..0xf81fffff size 0x00200000 (pgdir)
D/TC:0   dump_mmap_table:724 type IO_SEC       va 0x23c00000..0x23dfffff pa 0xfc000000..0xfc1fffff size 0x00200000 (pgdir)
D/TC:0   core_mmu_alloc_l2:272 L2 table used: 1/6
D/TC:0   core_mmu_alloc_l2:272 L2 table used: 2/6
I/TC:
I/TC: Non-secure external DT found
D/TC:0 0 discover_nsec_memory:1176 No non-secure memory found in FDT
I/TC: Embedded DTB found
I/TC: OP-TEE version: linux4sam-2022.10 (gcc version 11.3.0 (GCC)) #1 Wed 02 Nov 2022 02:08:46 PM UTC arm
I/TC: WARNING: This OP-TEE configuration might be insecure!
I/TC: WARNING: Please check https://optee.readthedocs.io/en/latest/architecture/porting_guidelines.html
I/TC: Primary CPU initializing
D/TC:0 0 boot_init_primary_late:1293 Executing at offset 0 with virtual load address 0x20000000
D/TC:0 0 saic_init_external:231 IRQ 49 is external
D/TC:0 0 call_preinitcalls:21 level 2 mobj_mapped_shm_init()
D/TC:0 0 mobj_mapped_shm_init:463 Shared memory address range: 20200000, 22200000
....
...
D/TC:0 0 print_probe_list:316 `- Failed list end
D/TC:0 0 call_initcalls:40 level 3 check_ta_store()
D/TC:0 0 check_ta_store:408 TA store: "Secure Storage TA"
D/TC:0 0 check_ta_store:408 TA store: "REE"
D/TC:0 0 call_initcalls:40 level 3 verify_pseudo_tas_conformance()
D/TC:0 0 call_initcalls:40 level 3 tee_cryp_init()
D/TC:0 0 call_initcalls:40 level 4 tee_fs_init_key_manager()
D/TC:0 0 call_initcalls:40 level 5 sfr_set_secure()
D/TC:0 0 call_initcalls:40 level 5 matrix_pm_init()
D/TC:0 0 call_initcalls:40 level 5 probe_dt_drivers()
F/TC:0 0 process_probe_list:449 Probe loop 5 after 0 for deferral(s)
D/TC:0 0 print_probe_list:299 Probe list: 0 elements
D/TC:0 0 print_probe_list:305 `- Probe list end
D/TC:0 0 print_probe_list:311 Failed list: 0 elements
D/TC:0 0 print_probe_list:316 `- Failed list end
D/TC:0 0 call_initcalls:40 level 6 sam_init_scmi_server()
D/TC:0 0 call_initcalls:40 level 6 mobj_init()
D/TC:0 0 call_initcalls:40 level 6 default_mobj_init()
D/TC:0 0 call_initcalls:40 level 7 release_probe_lists()
D/TC:0 0 call_finalcalls:59 level 1 release_external_dt()
I/TC: Primary CPU switching to normal world boot

But U-boot doesn't start.

Has anyone had this problem before? any suggestions?

Dharma-B commented 1 year ago

As we discussed over email and as you mentioned the upgrade to the latest u-boot-at91_2022.10.bb, U-Boot was able to start after OP-TEE. I'm closing this issue.