Skip to content

Commit 7e2e348

Browse files
committed
arch: arm: mmu: allow to select the memory type for non-cacheable mem
Selecting MT_DEVICE for non cache-able memory does no work in all use cases. For instance for net samples a non-cacheable memory can be used for descriptors and buffers exchanged between the lib and the hardware. In such context, the net lib can perform some non word aligned memory this lead to an alignment data abort if the attribute is MT_DEVICE. Memories attribute should be MT_NORMAL, allowing non aligned transfer Signed-off-by: Arnaud Pouliquen <[email protected]>arch: arm: mmu: allow selecting memory type for non-cacheable memory
1 parent 9978844 commit 7e2e348

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

arch/arm/core/mmu/arm_mmu.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -891,6 +891,17 @@ static int __arch_mem_map(void *virt, uintptr_t phys, size_t size, uint32_t flag
891891
switch (flags & K_MEM_CACHE_MASK) {
892892

893893
case K_MEM_CACHE_NONE:
894+
switch (flags & K_MEM_ARM_NC_TYPE_MASK) {
895+
case K_MEM_ARM_STRONGLY_ORDERED_NC:
896+
conv_flags |= MT_STRONGLY_ORDERED;
897+
break;
898+
case K_MEM_ARM_NORMAL_NC:
899+
conv_flags |= MT_NORMAL;
900+
break;
901+
default:
902+
conv_flags |= MT_DEVICE;
903+
}
904+
break;
894905
default:
895906
conv_flags |= MT_DEVICE;
896907
break;

0 commit comments

Comments
 (0)