aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWill Deacon <will.deacon@arm.com>2016-06-07 12:57:54 -0400
committerRussell King <rmk+kernel@armlinux.org.uk>2016-06-09 12:51:47 -0400
commit624531886987f0f1b5d01fb598034d039198e090 (patch)
tree540802405c84de4a0578bbbb8c4e40a407ad2469
parentaf8c34ce6ae32addda3788d54a7e340cad22516b (diff)
ARM: 8578/1: mm: ensure pmd_present only checks the valid bit
In a subsequent patch, pmd_mknotpresent will clear the valid bit of the pmd entry, resulting in a not-present entry from the hardware's perspective. Unfortunately, pmd_present simply checks for a non-zero pmd value and will therefore continue to return true even after a pmd_mknotpresent operation. Since pmd_mknotpresent is only used for managing huge entries, this is only an issue for the 3-level case. This patch fixes the 3-level pmd_present implementation to take into account the valid bit. For bisectability, the change is made before the fix to pmd_mknotpresent. [catalin.marinas@arm.com: comment update regarding pmd_mknotpresent patch] Fixes: 8d9625070073 ("ARM: mm: Transparent huge page support for LPAE systems.") Cc: <stable@vger.kernel.org> # 3.11+ Cc: Russell King <linux@armlinux.org.uk> Cc: Steve Capper <Steve.Capper@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--arch/arm/include/asm/pgtable-2level.h1
-rw-r--r--arch/arm/include/asm/pgtable-3level.h1
-rw-r--r--arch/arm/include/asm/pgtable.h1
3 files changed, 2 insertions, 1 deletions
diff --git a/arch/arm/include/asm/pgtable-2level.h b/arch/arm/include/asm/pgtable-2level.h
index aeddd28b3595..92fd2c8a9af0 100644
--- a/arch/arm/include/asm/pgtable-2level.h
+++ b/arch/arm/include/asm/pgtable-2level.h
@@ -193,6 +193,7 @@ static inline pmd_t *pmd_offset(pud_t *pud, unsigned long addr)
193 193
194#define pmd_large(pmd) (pmd_val(pmd) & 2) 194#define pmd_large(pmd) (pmd_val(pmd) & 2)
195#define pmd_bad(pmd) (pmd_val(pmd) & 2) 195#define pmd_bad(pmd) (pmd_val(pmd) & 2)
196#define pmd_present(pmd) (pmd_val(pmd))
196 197
197#define copy_pmd(pmdpd,pmdps) \ 198#define copy_pmd(pmdpd,pmdps) \
198 do { \ 199 do { \
diff --git a/arch/arm/include/asm/pgtable-3level.h b/arch/arm/include/asm/pgtable-3level.h
index fa70db7c714b..4dce1580bc15 100644
--- a/arch/arm/include/asm/pgtable-3level.h
+++ b/arch/arm/include/asm/pgtable-3level.h
@@ -211,6 +211,7 @@ static inline pmd_t *pmd_offset(pud_t *pud, unsigned long addr)
211 : !!(pmd_val(pmd) & (val))) 211 : !!(pmd_val(pmd) & (val)))
212#define pmd_isclear(pmd, val) (!(pmd_val(pmd) & (val))) 212#define pmd_isclear(pmd, val) (!(pmd_val(pmd) & (val)))
213 213
214#define pmd_present(pmd) (pmd_isset((pmd), L_PMD_SECT_VALID))
214#define pmd_young(pmd) (pmd_isset((pmd), PMD_SECT_AF)) 215#define pmd_young(pmd) (pmd_isset((pmd), PMD_SECT_AF))
215#define pte_special(pte) (pte_isset((pte), L_PTE_SPECIAL)) 216#define pte_special(pte) (pte_isset((pte), L_PTE_SPECIAL))
216static inline pte_t pte_mkspecial(pte_t pte) 217static inline pte_t pte_mkspecial(pte_t pte)
diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h
index 348caabb7625..d62204060cbe 100644
--- a/arch/arm/include/asm/pgtable.h
+++ b/arch/arm/include/asm/pgtable.h
@@ -182,7 +182,6 @@ extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
182#define pgd_offset_k(addr) pgd_offset(&init_mm, addr) 182#define pgd_offset_k(addr) pgd_offset(&init_mm, addr)
183 183
184#define pmd_none(pmd) (!pmd_val(pmd)) 184#define pmd_none(pmd) (!pmd_val(pmd))
185#define pmd_present(pmd) (pmd_val(pmd))
186 185
187static inline pte_t *pmd_page_vaddr(pmd_t pmd) 186static inline pte_t *pmd_page_vaddr(pmd_t pmd)
188{ 187{