For use of UART3 from OPTEE, I think the error is related to use of wrong address after physical to virtual translation.
From a related question (Physical address UART3?), UART3 is in IOMCU range. Which of the following memory regions would UART3 belong to ? Is it under MEM_AREA_IO_* ?
/*
* Memory area type:
* MEM_AREA_END: Reserved, marks the end of a table of mapping areas.
* MEM_AREA_TEE_RAM: core RAM (read/write/executable, secure, reserved to TEE)
* MEM_AREA_TEE_RAM_RX: core private read-only/executable memory (secure)
* MEM_AREA_TEE_RAM_RO: core private read-only/non-executable memory (secure)
* MEM_AREA_TEE_RAM_RW: core private read/write/non-executable memory (secure)
* MEM_AREA_TEE_COHERENT: teecore coherent RAM (secure, reserved to TEE)
* MEM_AREA_TEE_ASAN: core address sanitizer RAM (secure, reserved to TEE)
* MEM_AREA_TA_RAM: Secure RAM where teecore loads/exec TA instances.
* MEM_AREA_NSEC_SHM: NonSecure shared RAM between NSec and TEE.
* MEM_AREA_RAM_NSEC: NonSecure RAM storing data
* MEM_AREA_RAM_SEC: Secure RAM storing some secrets
* MEM_AREA_IO_NSEC: NonSecure HW mapped registers
* MEM_AREA_IO_SEC: Secure HW mapped registers
* MEM_AREA_RES_VASPACE: Reserved virtual memory space
* MEM_AREA_SHM_VASPACE: Virtual memory space for dynamic shared memory buffers
* MEM_AREA_TA_VASPACE: TA va space, only used with phys_to_virt()
* MEM_AREA_DDR_OVERALL: Overall DDR address range, candidate to dynamic shm.
* MEM_AREA_MAXTYPE: lower invalid 'type' value
*/
enum teecore_memtypes {
MEM_AREA_END = 0,
MEM_AREA_TEE_RAM,
MEM_AREA_TEE_RAM_RX,
MEM_AREA_TEE_RAM_RO,
MEM_AREA_TEE_RAM_RW,
MEM_AREA_TEE_COHERENT,
MEM_AREA_TEE_ASAN,
MEM_AREA_TA_RAM,
MEM_AREA_NSEC_SHM,
MEM_AREA_RAM_NSEC,
MEM_AREA_RAM_SEC,
MEM_AREA_IO_NSEC,
MEM_AREA_IO_SEC,
MEM_AREA_RES_VASPACE,
MEM_AREA_SHM_VASPACE,
MEM_AREA_TA_VASPACE,
MEM_AREA_PAGER_VASPACE,
MEM_AREA_SDP_MEM,
MEM_AREA_DDR_OVERALL,
MEM_AREA_MAXTYPE
};