aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorCatalin Marinas <catalin.marinas@arm.com>2011-09-05 12:52:36 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2011-10-06 10:40:06 -0400
commitd7c5d0dcffb3b5702d9477faceff4b8398e6fed0 (patch)
treea1b670fac0f11868ff280380dca98db1c3926b46 /arch/arm
parent442e70c0b3536e832547eed89629435462f4b515 (diff)
ARM: 7077/1: LPAE: Use a mask for physical addresses in page table entries
With LPAE, the physical address mask is 40-bit while the page table entry is 64-bit. This patch introduces PHYS_MASK for the 2-level page table format, defined as ~0UL. Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/include/asm/pgtable-2level-hwdef.h2
-rw-r--r--arch/arm/include/asm/pgtable.h6
2 files changed, 5 insertions, 3 deletions
diff --git a/arch/arm/include/asm/pgtable-2level-hwdef.h b/arch/arm/include/asm/pgtable-2level-hwdef.h
index 2b52c40edd8..5cfba15cb40 100644
--- a/arch/arm/include/asm/pgtable-2level-hwdef.h
+++ b/arch/arm/include/asm/pgtable-2level-hwdef.h
@@ -88,4 +88,6 @@
88#define PTE_SMALL_AP_URO_SRW (_AT(pteval_t, 0xaa) << 4) 88#define PTE_SMALL_AP_URO_SRW (_AT(pteval_t, 0xaa) << 4)
89#define PTE_SMALL_AP_URW_SRW (_AT(pteval_t, 0xff) << 4) 89#define PTE_SMALL_AP_URW_SRW (_AT(pteval_t, 0xff) << 4)
90 90
91#define PHYS_MASK (~0UL)
92
91#endif 93#endif
diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h
index d6436dacb17..8ade1840c6f 100644
--- a/arch/arm/include/asm/pgtable.h
+++ b/arch/arm/include/asm/pgtable.h
@@ -196,10 +196,10 @@ extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
196 196
197static inline pte_t *pmd_page_vaddr(pmd_t pmd) 197static inline pte_t *pmd_page_vaddr(pmd_t pmd)
198{ 198{
199 return __va(pmd_val(pmd) & PAGE_MASK); 199 return __va(pmd_val(pmd) & PHYS_MASK & (s32)PAGE_MASK);
200} 200}
201 201
202#define pmd_page(pmd) pfn_to_page(__phys_to_pfn(pmd_val(pmd))) 202#define pmd_page(pmd) pfn_to_page(__phys_to_pfn(pmd_val(pmd) & PHYS_MASK))
203 203
204/* we don't need complex calculations here as the pmd is folded into the pgd */ 204/* we don't need complex calculations here as the pmd is folded into the pgd */
205#define pmd_addr_end(addr,end) (end) 205#define pmd_addr_end(addr,end) (end)
@@ -220,7 +220,7 @@ static inline pte_t *pmd_page_vaddr(pmd_t pmd)
220#define pte_offset_map(pmd,addr) (__pte_map(pmd) + pte_index(addr)) 220#define pte_offset_map(pmd,addr) (__pte_map(pmd) + pte_index(addr))
221#define pte_unmap(pte) __pte_unmap(pte) 221#define pte_unmap(pte) __pte_unmap(pte)
222 222
223#define pte_pfn(pte) (pte_val(pte) >> PAGE_SHIFT) 223#define pte_pfn(pte) ((pte_val(pte) & PHYS_MASK) >> PAGE_SHIFT)
224#define pfn_pte(pfn,prot) __pte(__pfn_to_phys(pfn) | pgprot_val(prot)) 224#define pfn_pte(pfn,prot) __pte(__pfn_to_phys(pfn) | pgprot_val(prot))
225 225
226#define pte_page(pte) pfn_to_page(pte_pfn(pte)) 226#define pte_page(pte) pfn_to_page(pte_pfn(pte))