Home
last modified time | relevance | path

Searched hist:"7 cc4ae7ccca7ea5329981f97603374fa79ec6a95" (Results 1 – 1 of 1) sorted by relevance

/optee_os/core/mm/
H A Dcore_mmu.c7cc4ae7ccca7ea5329981f97603374fa79ec6a95 Wed Jun 26 09:38:47 UTC 2024 Yu Chien Peter Lin <peterlin@andestech.com> core: mm: core_mmu: skip unmapped regions when searching by PA

Currently, OP-TEE OS on RISC-V platforms uses the external
device-tree located at 'Domain1 Next Arg1' passed by previous
boot stages (i.e. U-Boot SPL and OpenSBI).
For example:

Domain1 Name : trusted-domain
...
Domain1 Next Address : 0x0000000010000000 // OP-TEE OS
> Domain1 Next Arg1 : 0x000000000187f760 // device-tree
Domain1 Next Mode : S-mode

In this case, 0x0187f760 lies in SHM_VASPACE, which is not yet
mapped and not intended to load an external DT:

type TEE_RAM_RX va 0x10000000..0x10092fff pa 0x10000000..0x10092fff
type TEE_RAM_RW va 0x10093000..0x101fffff pa 0x10093000..0x101fffff
type RES_VASPACE va 0x10200000..0x10bfffff pa 0x00000000..0x009fffff
> type SHM_VASPACE va 0x10c00000..0x12bfffff pa 0x00000000..0x01ffffff
type TA_RAM va 0x12c00000..0x139fffff pa 0x10200000..0x10ffffff
type IO_SEC va 0x13a00000..0x13bfffff pa 0xf0200000..0xf03fffff

To address this issue, add a memory region attribute check to
skip such regions. In this way, when init_external_dt() calls
core_mmu_get_type_by_pa(), it can properly return MEM_AREA_MAXTYPE
(i.e. valid region not found) and map a MEM_AREA_EXT_DT region.

Note that this bug cannot be reproduced on QEMU virt machine,
as its memory regions have no overlapping with the external DT.

Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
Reviewed-by: Alvin Chang <alvinga@andestech.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>