Skip to content

Commit 4d7d784

Browse files
carlocaionecarlescufi
authored andcommitted
arm64: mmu: Support userspace memory mapping
arch_mem_map() on ARM64 is currently not supporting the K_MEM_PERM_USER parameter so we cannot allocate userspace accessible memory using the memory helpers. Fix this. Signed-off-by: Carlo Caione <[email protected]>
1 parent 63fa264 commit 4d7d784

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/arm64/core/mmu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,7 @@ static void sync_domains(uintptr_t virt, size_t size)
862862
static int __arch_mem_map(void *virt, uintptr_t phys, size_t size, uint32_t flags)
863863
{
864864
struct arm_mmu_ptables *ptables;
865-
uint32_t entry_flags = MT_SECURE | MT_P_RX_U_NA;
865+
uint32_t entry_flags = MT_DEFAULT_SECURE_STATE | MT_P_RX_U_NA;
866866

867867
/* Always map in the kernel page tables */
868868
ptables = &kernel_ptables;
@@ -911,7 +911,7 @@ static int __arch_mem_map(void *virt, uintptr_t phys, size_t size, uint32_t flag
911911
}
912912

913913
if ((flags & K_MEM_PERM_USER) != 0U) {
914-
return -ENOTSUP;
914+
entry_flags |= MT_RW_AP_ELx;
915915
}
916916

917917
return add_map(ptables, "generic", phys, (uintptr_t)virt, size, entry_flags);

0 commit comments

Comments
 (0)