summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPipat Methavanitpong <pipat.methavanitpong@linaro.org>2020-02-03 15:25:09 +0900
committerSughosh Ganu <sughosh.ganu@linaro.org>2021-01-21 12:29:42 +0530
commitbb8916bb1e1f34eefb9c8f108e0a43ec78384b59 (patch)
tree8228cdaf80998082d7f3c6ba0f980843e527a509
parent289050e29fb93425813771002aa209a367ec3980 (diff)
core: Allow mobj_phys to allocate IO regionsqemu_secure_storage_on_upstream
This commit makes mobj_phys to allocate IO regions. It distinguishes between memory and IO allocation requests by using `battr` and `cattr` parameters. If `battr` is `CORE_MEM_TA_RAM` and `cattr` is `TEE_NATTR_CACHE_NONCACHE`, then it is an IO allocation request. Signed-off-by: Pipat Methavanitpong <pipat1010@gmail.com>
-rw-r--r--core/arch/arm/mm/mobj.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/core/arch/arm/mm/mobj.c b/core/arch/arm/mm/mobj.c
index 7a129cf5..1ab96f3d 100644
--- a/core/arch/arm/mm/mobj.c
+++ b/core/arch/arm/mm/mobj.c
@@ -147,7 +147,10 @@ struct mobj *mobj_phys_alloc(paddr_t pa, size_t size, uint32_t cattr,
area_type = MEM_AREA_TEE_RAM_RW_DATA;
break;
case CORE_MEM_TA_RAM:
- area_type = MEM_AREA_TA_RAM;
+ if (cattr == TEE_MATTR_CACHE_NONCACHE)
+ area_type = MEM_AREA_IO_NSEC;
+ else
+ area_type = MEM_AREA_TA_RAM;
break;
case CORE_MEM_NSEC_SHM:
area_type = MEM_AREA_NSEC_SHM;
@@ -161,9 +164,13 @@ struct mobj *mobj_phys_alloc(paddr_t pa, size_t size, uint32_t cattr,
}
/* Only SDP memory may not have a virtual address */
- va = phys_to_virt(pa, area_type);
- if (!va && battr != CORE_MEM_SDP_MEM)
+ if (area_type == MEM_AREA_IO_SEC || area_type == MEM_AREA_IO_NSEC)
+ va = phys_to_virt_io(pa);
+ else
+ va = phys_to_virt(pa, area_type);
+ if (!va && battr != CORE_MEM_SDP_MEM) {
return NULL;
+ }
moph = calloc(1, sizeof(*moph));
if (!moph)