diff options
-rw-r--r-- | arch/arm/mm/idmap.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/arch/arm/mm/idmap.c b/arch/arm/mm/idmap.c index 660f1bc68f99..feacf4c76712 100644 --- a/arch/arm/mm/idmap.c +++ b/arch/arm/mm/idmap.c | |||
@@ -8,6 +8,31 @@ | |||
8 | 8 | ||
9 | pgd_t *idmap_pgd; | 9 | pgd_t *idmap_pgd; |
10 | 10 | ||
11 | #ifdef CONFIG_ARM_LPAE | ||
12 | static void idmap_add_pmd(pud_t *pud, unsigned long addr, unsigned long end, | ||
13 | unsigned long prot) | ||
14 | { | ||
15 | pmd_t *pmd; | ||
16 | unsigned long next; | ||
17 | |||
18 | if (pud_none_or_clear_bad(pud) || (pud_val(*pud) & L_PGD_SWAPPER)) { | ||
19 | pmd = pmd_alloc_one(&init_mm, addr); | ||
20 | if (!pmd) { | ||
21 | pr_warning("Failed to allocate identity pmd.\n"); | ||
22 | return; | ||
23 | } | ||
24 | pud_populate(&init_mm, pud, pmd); | ||
25 | pmd += pmd_index(addr); | ||
26 | } else | ||
27 | pmd = pmd_offset(pud, addr); | ||
28 | |||
29 | do { | ||
30 | next = pmd_addr_end(addr, end); | ||
31 | *pmd = __pmd((addr & PMD_MASK) | prot); | ||
32 | flush_pmd_entry(pmd); | ||
33 | } while (pmd++, addr = next, addr != end); | ||
34 | } | ||
35 | #else /* !CONFIG_ARM_LPAE */ | ||
11 | static void idmap_add_pmd(pud_t *pud, unsigned long addr, unsigned long end, | 36 | static void idmap_add_pmd(pud_t *pud, unsigned long addr, unsigned long end, |
12 | unsigned long prot) | 37 | unsigned long prot) |
13 | { | 38 | { |
@@ -19,6 +44,7 @@ static void idmap_add_pmd(pud_t *pud, unsigned long addr, unsigned long end, | |||
19 | pmd[1] = __pmd(addr); | 44 | pmd[1] = __pmd(addr); |
20 | flush_pmd_entry(pmd); | 45 | flush_pmd_entry(pmd); |
21 | } | 46 | } |
47 | #endif /* CONFIG_ARM_LPAE */ | ||
22 | 48 | ||
23 | static void idmap_add_pud(pgd_t *pgd, unsigned long addr, unsigned long end, | 49 | static void idmap_add_pud(pgd_t *pgd, unsigned long addr, unsigned long end, |
24 | unsigned long prot) | 50 | unsigned long prot) |
@@ -36,7 +62,7 @@ static void identity_mapping_add(pgd_t *pgd, unsigned long addr, unsigned long e | |||
36 | { | 62 | { |
37 | unsigned long prot, next; | 63 | unsigned long prot, next; |
38 | 64 | ||
39 | prot = PMD_TYPE_SECT | PMD_SECT_AP_WRITE; | 65 | prot = PMD_TYPE_SECT | PMD_SECT_AP_WRITE | PMD_SECT_AF; |
40 | if (cpu_architecture() <= CPU_ARCH_ARMv5TEJ && !cpu_is_xscale()) | 66 | if (cpu_architecture() <= CPU_ARCH_ARMv5TEJ && !cpu_is_xscale()) |
41 | prot |= PMD_BIT4; | 67 | prot |= PMD_BIT4; |
42 | 68 | ||