aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2013-10-24 05:26:40 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2013-12-11 04:53:14 -0500
commit2e2c9de207be043ee80161971c814d740759d3bc (patch)
tree8c818e8ea95b4c9cbfc9a25ab8719c12954d9f75 /arch/arm
parent1fd15b879d0075c8916e52fb9e52522827433d1f (diff)
ARM: add permission annotations to MT_MEMORY* mapping types
Document the permissions which the various MT_MEMORY* mapping types will provide. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/include/asm/mach/map.h26
-rw-r--r--arch/arm/kernel/tcm.c4
-rw-r--r--arch/arm/mach-at91/setup.c2
-rw-r--r--arch/arm/mach-omap2/io.c4
-rw-r--r--arch/arm/mach-omap2/omap4-common.c2
-rw-r--r--arch/arm/mach-ux500/setup.h2
-rw-r--r--arch/arm/mm/ioremap.c4
-rw-r--r--arch/arm/mm/mmu.c30
8 files changed, 38 insertions, 36 deletions
diff --git a/arch/arm/include/asm/mach/map.h b/arch/arm/include/asm/mach/map.h
index 2fe141fcc8d6..447be0744a85 100644
--- a/arch/arm/include/asm/mach/map.h
+++ b/arch/arm/include/asm/mach/map.h
@@ -22,18 +22,20 @@ struct map_desc {
22}; 22};
23 23
24/* types 0-3 are defined in asm/io.h */ 24/* types 0-3 are defined in asm/io.h */
25#define MT_UNCACHED 4 25enum {
26#define MT_CACHECLEAN 5 26 MT_UNCACHED = 4,
27#define MT_MINICLEAN 6 27 MT_CACHECLEAN,
28#define MT_LOW_VECTORS 7 28 MT_MINICLEAN,
29#define MT_HIGH_VECTORS 8 29 MT_LOW_VECTORS,
30#define MT_MEMORY 9 30 MT_HIGH_VECTORS,
31#define MT_ROM 10 31 MT_MEMORY_RWX,
32#define MT_MEMORY_NONCACHED 11 32 MT_ROM,
33#define MT_MEMORY_DTCM 12 33 MT_MEMORY_RWX_NONCACHED,
34#define MT_MEMORY_ITCM 13 34 MT_MEMORY_RW_DTCM,
35#define MT_MEMORY_SO 14 35 MT_MEMORY_RWX_ITCM,
36#define MT_MEMORY_DMA_READY 15 36 MT_MEMORY_RW_SO,
37 MT_MEMORY_DMA_READY,
38};
37 39
38#ifdef CONFIG_MMU 40#ifdef CONFIG_MMU
39extern void iotable_init(struct map_desc *, int); 41extern void iotable_init(struct map_desc *, int);
diff --git a/arch/arm/kernel/tcm.c b/arch/arm/kernel/tcm.c
index f50f19e5c138..7a3be1d4d0b1 100644
--- a/arch/arm/kernel/tcm.c
+++ b/arch/arm/kernel/tcm.c
@@ -52,7 +52,7 @@ static struct map_desc dtcm_iomap[] __initdata = {
52 .virtual = DTCM_OFFSET, 52 .virtual = DTCM_OFFSET,
53 .pfn = __phys_to_pfn(DTCM_OFFSET), 53 .pfn = __phys_to_pfn(DTCM_OFFSET),
54 .length = 0, 54 .length = 0,
55 .type = MT_MEMORY_DTCM 55 .type = MT_MEMORY_RW_DTCM
56 } 56 }
57}; 57};
58 58
@@ -61,7 +61,7 @@ static struct map_desc itcm_iomap[] __initdata = {
61 .virtual = ITCM_OFFSET, 61 .virtual = ITCM_OFFSET,
62 .pfn = __phys_to_pfn(ITCM_OFFSET), 62 .pfn = __phys_to_pfn(ITCM_OFFSET),
63 .length = 0, 63 .length = 0,
64 .type = MT_MEMORY_ITCM 64 .type = MT_MEMORY_RWX_ITCM,
65 } 65 }
66}; 66};
67 67
diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c
index 094b3459c288..2742e00ec5d6 100644
--- a/arch/arm/mach-at91/setup.c
+++ b/arch/arm/mach-at91/setup.c
@@ -81,7 +81,7 @@ void __init at91_init_sram(int bank, unsigned long base, unsigned int length)
81 81
82 desc->pfn = __phys_to_pfn(base); 82 desc->pfn = __phys_to_pfn(base);
83 desc->length = length; 83 desc->length = length;
84 desc->type = MT_MEMORY_NONCACHED; 84 desc->type = MT_MEMORY_RWX_NONCACHED;
85 85
86 pr_info("AT91: sram at 0x%lx of 0x%x mapped at 0x%lx\n", 86 pr_info("AT91: sram at 0x%lx of 0x%x mapped at 0x%lx\n",
87 base, length, desc->virtual); 87 base, length, desc->virtual);
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index cd22262a2cc0..07b68d5a7940 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -244,7 +244,7 @@ static struct map_desc omap44xx_io_desc[] __initdata = {
244 .virtual = OMAP4_SRAM_VA, 244 .virtual = OMAP4_SRAM_VA,
245 .pfn = __phys_to_pfn(OMAP4_SRAM_PA), 245 .pfn = __phys_to_pfn(OMAP4_SRAM_PA),
246 .length = PAGE_SIZE, 246 .length = PAGE_SIZE,
247 .type = MT_MEMORY_SO, 247 .type = MT_MEMORY_RW_SO,
248 }, 248 },
249#endif 249#endif
250 250
@@ -282,7 +282,7 @@ static struct map_desc omap54xx_io_desc[] __initdata = {
282 .virtual = OMAP4_SRAM_VA, 282 .virtual = OMAP4_SRAM_VA,
283 .pfn = __phys_to_pfn(OMAP4_SRAM_PA), 283 .pfn = __phys_to_pfn(OMAP4_SRAM_PA),
284 .length = PAGE_SIZE, 284 .length = PAGE_SIZE,
285 .type = MT_MEMORY_SO, 285 .type = MT_MEMORY_RW_SO,
286 }, 286 },
287#endif 287#endif
288}; 288};
diff --git a/arch/arm/mach-omap2/omap4-common.c b/arch/arm/mach-omap2/omap4-common.c
index 57911430324e..08def5665e76 100644
--- a/arch/arm/mach-omap2/omap4-common.c
+++ b/arch/arm/mach-omap2/omap4-common.c
@@ -88,7 +88,7 @@ void __init omap_barriers_init(void)
88 dram_io_desc[0].virtual = OMAP4_DRAM_BARRIER_VA; 88 dram_io_desc[0].virtual = OMAP4_DRAM_BARRIER_VA;
89 dram_io_desc[0].pfn = __phys_to_pfn(paddr); 89 dram_io_desc[0].pfn = __phys_to_pfn(paddr);
90 dram_io_desc[0].length = size; 90 dram_io_desc[0].length = size;
91 dram_io_desc[0].type = MT_MEMORY_SO; 91 dram_io_desc[0].type = MT_MEMORY_RW_SO;
92 iotable_init(dram_io_desc, ARRAY_SIZE(dram_io_desc)); 92 iotable_init(dram_io_desc, ARRAY_SIZE(dram_io_desc));
93 dram_sync = (void __iomem *) dram_io_desc[0].virtual; 93 dram_sync = (void __iomem *) dram_io_desc[0].virtual;
94 sram_sync = (void __iomem *) OMAP4_SRAM_VA; 94 sram_sync = (void __iomem *) OMAP4_SRAM_VA;
diff --git a/arch/arm/mach-ux500/setup.h b/arch/arm/mach-ux500/setup.h
index bdb356498a74..b1dd8584bed4 100644
--- a/arch/arm/mach-ux500/setup.h
+++ b/arch/arm/mach-ux500/setup.h
@@ -43,7 +43,7 @@ extern void ux500_timer_init(void);
43 .virtual = IO_ADDRESS(x), \ 43 .virtual = IO_ADDRESS(x), \
44 .pfn = __phys_to_pfn(x), \ 44 .pfn = __phys_to_pfn(x), \
45 .length = sz, \ 45 .length = sz, \
46 .type = MT_MEMORY, \ 46 .type = MT_MEMORY_RWX, \
47} 47}
48 48
49extern struct smp_operations ux500_smp_ops; 49extern struct smp_operations ux500_smp_ops;
diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
index f123d6eb074b..f9c32ba73544 100644
--- a/arch/arm/mm/ioremap.c
+++ b/arch/arm/mm/ioremap.c
@@ -392,9 +392,9 @@ __arm_ioremap_exec(phys_addr_t phys_addr, size_t size, bool cached)
392 unsigned int mtype; 392 unsigned int mtype;
393 393
394 if (cached) 394 if (cached)
395 mtype = MT_MEMORY; 395 mtype = MT_MEMORY_RWX;
396 else 396 else
397 mtype = MT_MEMORY_NONCACHED; 397 mtype = MT_MEMORY_RWX_NONCACHED;
398 398
399 return __arm_ioremap_caller(phys_addr, size, mtype, 399 return __arm_ioremap_caller(phys_addr, size, mtype,
400 __builtin_return_address(0)); 400 __builtin_return_address(0));
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index 580ef2de82d7..fce2e7388098 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -287,7 +287,7 @@ static struct mem_type mem_types[] = {
287 .prot_l1 = PMD_TYPE_TABLE, 287 .prot_l1 = PMD_TYPE_TABLE,
288 .domain = DOMAIN_USER, 288 .domain = DOMAIN_USER,
289 }, 289 },
290 [MT_MEMORY] = { 290 [MT_MEMORY_RWX] = {
291 .prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY, 291 .prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY,
292 .prot_l1 = PMD_TYPE_TABLE, 292 .prot_l1 = PMD_TYPE_TABLE,
293 .prot_sect = PMD_TYPE_SECT | PMD_SECT_AP_WRITE, 293 .prot_sect = PMD_TYPE_SECT | PMD_SECT_AP_WRITE,
@@ -297,26 +297,26 @@ static struct mem_type mem_types[] = {
297 .prot_sect = PMD_TYPE_SECT, 297 .prot_sect = PMD_TYPE_SECT,
298 .domain = DOMAIN_KERNEL, 298 .domain = DOMAIN_KERNEL,
299 }, 299 },
300 [MT_MEMORY_NONCACHED] = { 300 [MT_MEMORY_RWX_NONCACHED] = {
301 .prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY | 301 .prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY |
302 L_PTE_MT_BUFFERABLE, 302 L_PTE_MT_BUFFERABLE,
303 .prot_l1 = PMD_TYPE_TABLE, 303 .prot_l1 = PMD_TYPE_TABLE,
304 .prot_sect = PMD_TYPE_SECT | PMD_SECT_AP_WRITE, 304 .prot_sect = PMD_TYPE_SECT | PMD_SECT_AP_WRITE,
305 .domain = DOMAIN_KERNEL, 305 .domain = DOMAIN_KERNEL,
306 }, 306 },
307 [MT_MEMORY_DTCM] = { 307 [MT_MEMORY_RW_DTCM] = {
308 .prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY | 308 .prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY |
309 L_PTE_XN, 309 L_PTE_XN,
310 .prot_l1 = PMD_TYPE_TABLE, 310 .prot_l1 = PMD_TYPE_TABLE,
311 .prot_sect = PMD_TYPE_SECT | PMD_SECT_XN, 311 .prot_sect = PMD_TYPE_SECT | PMD_SECT_XN,
312 .domain = DOMAIN_KERNEL, 312 .domain = DOMAIN_KERNEL,
313 }, 313 },
314 [MT_MEMORY_ITCM] = { 314 [MT_MEMORY_RWX_ITCM] = {
315 .prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY, 315 .prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY,
316 .prot_l1 = PMD_TYPE_TABLE, 316 .prot_l1 = PMD_TYPE_TABLE,
317 .domain = DOMAIN_KERNEL, 317 .domain = DOMAIN_KERNEL,
318 }, 318 },
319 [MT_MEMORY_SO] = { 319 [MT_MEMORY_RW_SO] = {
320 .prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY | 320 .prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY |
321 L_PTE_MT_UNCACHED | L_PTE_XN, 321 L_PTE_MT_UNCACHED | L_PTE_XN,
322 .prot_l1 = PMD_TYPE_TABLE, 322 .prot_l1 = PMD_TYPE_TABLE,
@@ -487,11 +487,11 @@ static void __init build_mem_type_table(void)
487 mem_types[MT_DEVICE_WC].prot_pte |= L_PTE_SHARED; 487 mem_types[MT_DEVICE_WC].prot_pte |= L_PTE_SHARED;
488 mem_types[MT_DEVICE_CACHED].prot_sect |= PMD_SECT_S; 488 mem_types[MT_DEVICE_CACHED].prot_sect |= PMD_SECT_S;
489 mem_types[MT_DEVICE_CACHED].prot_pte |= L_PTE_SHARED; 489 mem_types[MT_DEVICE_CACHED].prot_pte |= L_PTE_SHARED;
490 mem_types[MT_MEMORY].prot_sect |= PMD_SECT_S; 490 mem_types[MT_MEMORY_RWX].prot_sect |= PMD_SECT_S;
491 mem_types[MT_MEMORY].prot_pte |= L_PTE_SHARED; 491 mem_types[MT_MEMORY_RWX].prot_pte |= L_PTE_SHARED;
492 mem_types[MT_MEMORY_DMA_READY].prot_pte |= L_PTE_SHARED; 492 mem_types[MT_MEMORY_DMA_READY].prot_pte |= L_PTE_SHARED;
493 mem_types[MT_MEMORY_NONCACHED].prot_sect |= PMD_SECT_S; 493 mem_types[MT_MEMORY_RWX_NONCACHED].prot_sect |= PMD_SECT_S;
494 mem_types[MT_MEMORY_NONCACHED].prot_pte |= L_PTE_SHARED; 494 mem_types[MT_MEMORY_RWX_NONCACHED].prot_pte |= L_PTE_SHARED;
495 } 495 }
496 } 496 }
497 497
@@ -502,15 +502,15 @@ static void __init build_mem_type_table(void)
502 if (cpu_arch >= CPU_ARCH_ARMv6) { 502 if (cpu_arch >= CPU_ARCH_ARMv6) {
503 if (cpu_arch >= CPU_ARCH_ARMv7 && (cr & CR_TRE)) { 503 if (cpu_arch >= CPU_ARCH_ARMv7 && (cr & CR_TRE)) {
504 /* Non-cacheable Normal is XCB = 001 */ 504 /* Non-cacheable Normal is XCB = 001 */
505 mem_types[MT_MEMORY_NONCACHED].prot_sect |= 505 mem_types[MT_MEMORY_RWX_NONCACHED].prot_sect |=
506 PMD_SECT_BUFFERED; 506 PMD_SECT_BUFFERED;
507 } else { 507 } else {
508 /* For both ARMv6 and non-TEX-remapping ARMv7 */ 508 /* For both ARMv6 and non-TEX-remapping ARMv7 */
509 mem_types[MT_MEMORY_NONCACHED].prot_sect |= 509 mem_types[MT_MEMORY_RWX_NONCACHED].prot_sect |=
510 PMD_SECT_TEX(1); 510 PMD_SECT_TEX(1);
511 } 511 }
512 } else { 512 } else {
513 mem_types[MT_MEMORY_NONCACHED].prot_sect |= PMD_SECT_BUFFERABLE; 513 mem_types[MT_MEMORY_RWX_NONCACHED].prot_sect |= PMD_SECT_BUFFERABLE;
514 } 514 }
515 515
516#ifdef CONFIG_ARM_LPAE 516#ifdef CONFIG_ARM_LPAE
@@ -543,10 +543,10 @@ static void __init build_mem_type_table(void)
543 543
544 mem_types[MT_LOW_VECTORS].prot_l1 |= ecc_mask; 544 mem_types[MT_LOW_VECTORS].prot_l1 |= ecc_mask;
545 mem_types[MT_HIGH_VECTORS].prot_l1 |= ecc_mask; 545 mem_types[MT_HIGH_VECTORS].prot_l1 |= ecc_mask;
546 mem_types[MT_MEMORY].prot_sect |= ecc_mask | cp->pmd; 546 mem_types[MT_MEMORY_RWX].prot_sect |= ecc_mask | cp->pmd;
547 mem_types[MT_MEMORY].prot_pte |= kern_pgprot; 547 mem_types[MT_MEMORY_RWX].prot_pte |= kern_pgprot;
548 mem_types[MT_MEMORY_DMA_READY].prot_pte |= kern_pgprot; 548 mem_types[MT_MEMORY_DMA_READY].prot_pte |= kern_pgprot;
549 mem_types[MT_MEMORY_NONCACHED].prot_sect |= ecc_mask; 549 mem_types[MT_MEMORY_RWX_NONCACHED].prot_sect |= ecc_mask;
550 mem_types[MT_ROM].prot_sect |= cp->pmd; 550 mem_types[MT_ROM].prot_sect |= cp->pmd;
551 551
552 switch (cp->pmd) { 552 switch (cp->pmd) {