Skip to content

Commit 9163d58

Browse files
ekohandelkartben
authored andcommitted
arch: arm: mmu: Make all device memory shareable
ARM has deprecated usage of non-shareable device memory. K_MEM_CACHE_NONE flag used by devices to map physical memory translates to MT_DEVICE but no MATTR_SHARED attribute is set in such a request. This results in mapping device memory that is non-shareable. Depending on the memory interconnect of a SoC, mapping the device memory as non-shareable can prevent access to the device. Such behavior has been observed on the TI AM3358 SoC. To comply with the ARM deprecation notice and prevent access issues to device memory, all device memory is mapped as shareable. Signed-off-by: Abe Kohandel <[email protected]>
1 parent d3539d6 commit 9163d58

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

arch/arm/core/mmu/arm_mmu.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -304,13 +304,15 @@ static struct arm_mmu_perms_attrs arm_mmu_convert_attr_flags(uint32_t attrs)
304304
perms_attrs.cacheable = 0;
305305
perms_attrs.domain = ARM_MMU_DOMAIN_DEVICE;
306306

307-
if (attrs & MATTR_SHARED) {
308-
perms_attrs.tex = 0;
309-
perms_attrs.bufferable = 1;
310-
} else {
311-
perms_attrs.tex = 2;
312-
perms_attrs.bufferable = 0;
313-
}
307+
/*
308+
* ARM deprecates the marking of Device memory with a
309+
* shareability attribute other than Outer Shareable
310+
* or Shareable. This means ARM strongly recommends
311+
* that Device memory is never assigned a shareability
312+
* attribute of Non-shareable or Inner Shareable.
313+
*/
314+
perms_attrs.tex = 0;
315+
perms_attrs.bufferable = 1;
314316
} else if (attrs & MT_NORMAL) {
315317
/*
316318
* TEX[2] is always 1. TEX[1:0] contain the outer cache attri-

0 commit comments

Comments
 (0)