diff mbox

ARM: LPAE: fix access flag setup in mem_type_table

Message ID 1337018189-27356-1-git-send-email-vitalya@ti.com
State Accepted
Commit 1a3abcf41f13666d4ed241c8cc7f48bd38e7b543
Headers show

Commit Message

Vitaly Andrianov May 14, 2012, 5:56 p.m. UTC
A zero value for prot_sect in the memory types table implies that
section mappings should never be created for the memory type in question.
This is checked for in alloc_init_section().

With LPAE, we set a bit to mask access flag faults for kernel mappings.
This breaks the aforementioned (!prot_sect) check in alloc_init_section().

This patch fixes this bug by first checking for a non-zero
prot_sect before setting the PMD_SECT_AF flag.

Signed-off-by: Vitaly Andrianov <vitalya@ti.com>

Acked-by: Catalin Marinas <catalin.marinas@arm.com>
---
 arch/arm/mm/mmu.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

Comments

Russell King - ARM Linux May 15, 2012, 12:22 p.m. UTC | #1
On Mon, May 14, 2012 at 01:56:29PM -0400, Vitaly Andrianov wrote:
> A zero value for prot_sect in the memory types table implies that
> section mappings should never be created for the memory type in question.
> This is checked for in alloc_init_section().
> 
> With LPAE, we set a bit to mask access flag faults for kernel mappings.
> This breaks the aforementioned (!prot_sect) check in alloc_init_section().
> 
> This patch fixes this bug by first checking for a non-zero
> prot_sect before setting the PMD_SECT_AF flag.
> 
> Signed-off-by: Vitaly Andrianov <vitalya@ti.com>
> 
> Acked-by: Catalin Marinas <catalin.marinas@arm.com>

Same comments as for the previous patch.
diff mbox

Patch

diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index b9fbec2..1e16b20 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -494,7 +494,8 @@  static void __init build_mem_type_table(void)
 	 */
 	for (i = 0; i < ARRAY_SIZE(mem_types); i++) {
 		mem_types[i].prot_pte |= PTE_EXT_AF;
-		mem_types[i].prot_sect |= PMD_SECT_AF;
+		if (mem_types[i].prot_sect)
+			mem_types[i].prot_sect |= PMD_SECT_AF;
 	}
 	kern_pgprot |= PTE_EXT_AF;
 	vecs_pgprot |= PTE_EXT_AF;