Skip to content

Commit

Permalink
drivers: tee: optee: handle configuration with MMU disabled.
Browse files Browse the repository at this point in the history
For configurations without MMU support, such as native_posix_64
which is used for the unit test. So use z_mem_phys_addr for non-mmu
configurations.

Signed-off-by: Oleksii Moisieiev <[email protected]>
Reviewed-by: Volodymyr Babchuk <[email protected]>
Acked-by: Dmytro Firsov <[email protected]>
  • Loading branch information
oleksiimoisieiev authored and firscity committed Jun 17, 2024
1 parent 083fb3b commit 46f83a3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion drivers/tee/optee/optee.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ struct shm_cache_entry {
struct tee_shm *shm;
};

#if IS_ENABLED(CONFIG_MMU)
/*
* Use arch_page_phys_get instead of z_mem_phys_addr for address
* conversion.
Expand All @@ -132,7 +133,13 @@ static uintptr_t optee_mem_phys_addr(void *virt)
arch_page_phys_get((void *)((uintptr_t)virt - offt), &phys);
return phys + offt;
}

#else
/*
* When MMU is disabled we should use common zephyr approach because
* there is no CONFIG_MMU_PAGE_SIZE definition.
*/
#define optee_mem_phys_addr(x) z_mem_phys_addr(x)
#endif /* IS_ENABLED(CONFIG_MMU) */
/* Wrapping functions so function pointer can be used */
static void optee_smccc_smc(unsigned long a0, unsigned long a1, unsigned long a2, unsigned long a3,
unsigned long a4, unsigned long a5, unsigned long a6, unsigned long a7,
Expand Down

0 comments on commit 46f83a3

Please sign in to comment.