diff options
author | Christoffer Dall <christoffer.dall@linaro.org> | 2014-02-02 16:21:31 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2014-02-10 06:44:05 -0500 |
commit | 4d9c5b89cf3605bbc39c6e274351ff25f0d83e6a (patch) | |
tree | 373136b67684e57583226d09149fff10cb2db5f5 /arch/arm/mm | |
parent | 87f9260bf1fb7ec4c3f88c6bb353df17ca1e1c19 (diff) |
ARM: 7950/1: mm: Fix stage-2 device memory attributes
The stage-2 memory attributes are distinct from the Hyp memory
attributes and the Stage-1 memory attributes. We were using the stage-1
memory attributes for stage-2 mappings causing device mappings to be
mapped as normal memory. Add the S2 equivalent defines for memory
attributes and fix the comments explaining the defines while at it.
Add a prot_pte_s2 field to the mem_type struct and fill out the field
for device mappings accordingly.
Cc: <stable@vger.kernel.org> [3.9+]
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mm')
-rw-r--r-- | arch/arm/mm/mm.h | 1 | ||||
-rw-r--r-- | arch/arm/mm/mmu.c | 7 |
2 files changed, 7 insertions, 1 deletions
diff --git a/arch/arm/mm/mm.h b/arch/arm/mm/mm.h index d5a982d15a88..7ea641b7aa7d 100644 --- a/arch/arm/mm/mm.h +++ b/arch/arm/mm/mm.h | |||
@@ -38,6 +38,7 @@ static inline pmd_t *pmd_off_k(unsigned long virt) | |||
38 | 38 | ||
39 | struct mem_type { | 39 | struct mem_type { |
40 | pteval_t prot_pte; | 40 | pteval_t prot_pte; |
41 | pteval_t prot_pte_s2; | ||
41 | pmdval_t prot_l1; | 42 | pmdval_t prot_l1; |
42 | pmdval_t prot_sect; | 43 | pmdval_t prot_sect; |
43 | unsigned int domain; | 44 | unsigned int domain; |
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index 4f08c133cc25..a623cb3ad012 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c | |||
@@ -232,12 +232,16 @@ __setup("noalign", noalign_setup); | |||
232 | #endif /* ifdef CONFIG_CPU_CP15 / else */ | 232 | #endif /* ifdef CONFIG_CPU_CP15 / else */ |
233 | 233 | ||
234 | #define PROT_PTE_DEVICE L_PTE_PRESENT|L_PTE_YOUNG|L_PTE_DIRTY|L_PTE_XN | 234 | #define PROT_PTE_DEVICE L_PTE_PRESENT|L_PTE_YOUNG|L_PTE_DIRTY|L_PTE_XN |
235 | #define PROT_PTE_S2_DEVICE PROT_PTE_DEVICE | ||
235 | #define PROT_SECT_DEVICE PMD_TYPE_SECT|PMD_SECT_AP_WRITE | 236 | #define PROT_SECT_DEVICE PMD_TYPE_SECT|PMD_SECT_AP_WRITE |
236 | 237 | ||
237 | static struct mem_type mem_types[] = { | 238 | static struct mem_type mem_types[] = { |
238 | [MT_DEVICE] = { /* Strongly ordered / ARMv6 shared device */ | 239 | [MT_DEVICE] = { /* Strongly ordered / ARMv6 shared device */ |
239 | .prot_pte = PROT_PTE_DEVICE | L_PTE_MT_DEV_SHARED | | 240 | .prot_pte = PROT_PTE_DEVICE | L_PTE_MT_DEV_SHARED | |
240 | L_PTE_SHARED, | 241 | L_PTE_SHARED, |
242 | .prot_pte_s2 = s2_policy(PROT_PTE_S2_DEVICE) | | ||
243 | s2_policy(L_PTE_S2_MT_DEV_SHARED) | | ||
244 | L_PTE_SHARED, | ||
241 | .prot_l1 = PMD_TYPE_TABLE, | 245 | .prot_l1 = PMD_TYPE_TABLE, |
242 | .prot_sect = PROT_SECT_DEVICE | PMD_SECT_S, | 246 | .prot_sect = PROT_SECT_DEVICE | PMD_SECT_S, |
243 | .domain = DOMAIN_IO, | 247 | .domain = DOMAIN_IO, |
@@ -508,7 +512,8 @@ static void __init build_mem_type_table(void) | |||
508 | cp = &cache_policies[cachepolicy]; | 512 | cp = &cache_policies[cachepolicy]; |
509 | vecs_pgprot = kern_pgprot = user_pgprot = cp->pte; | 513 | vecs_pgprot = kern_pgprot = user_pgprot = cp->pte; |
510 | s2_pgprot = cp->pte_s2; | 514 | s2_pgprot = cp->pte_s2; |
511 | hyp_device_pgprot = s2_device_pgprot = mem_types[MT_DEVICE].prot_pte; | 515 | hyp_device_pgprot = mem_types[MT_DEVICE].prot_pte; |
516 | s2_device_pgprot = mem_types[MT_DEVICE].prot_pte_s2; | ||
512 | 517 | ||
513 | /* | 518 | /* |
514 | * ARMv6 and above have extended page tables. | 519 | * ARMv6 and above have extended page tables. |