Skip to content

Commit f1981b5

Browse files
kvaneeshmpe
authored andcommitted
powerpc/mm/hugetlb/book3s: add _PAGE_PRESENT to hugepd pointer.
This make hugetlb directory pointer similar to other page able entries. A hugepd entry is identified by lack of _PAGE_PTE bit set and directory size stored in HUGEPD_SHIFT_MASK. We update that to also look at _PAGE_PRESENT Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
1 parent da7ad36 commit f1981b5

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

arch/powerpc/include/asm/book3s/64/hash-4k.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ static inline int hash__hugepd_ok(hugepd_t hpd)
6666
* if it is not a pte and have hugepd shift mask
6767
* set, then it is a hugepd directory pointer
6868
*/
69-
if (!(hpdval & _PAGE_PTE) &&
69+
if (!(hpdval & _PAGE_PTE) && (hpdval & _PAGE_PRESENT) &&
7070
((hpdval & HUGEPD_SHIFT_MASK) != 0))
7171
return true;
7272
return false;

arch/powerpc/include/asm/book3s/64/hugetlb.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,7 @@ static inline bool gigantic_page_supported(void)
3939
}
4040
#endif
4141

42+
/* hugepd entry valid bit */
43+
#define HUGEPD_VAL_BITS (0x8000000000000000UL)
44+
4245
#endif

arch/powerpc/mm/hugetlbpage.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ static int __hugepte_alloc(struct mm_struct *mm, hugepd_t *hpdp,
9595
break;
9696
else {
9797
#ifdef CONFIG_PPC_BOOK3S_64
98-
*hpdp = __hugepd(__pa(new) |
98+
*hpdp = __hugepd(__pa(new) | HUGEPD_VAL_BITS |
9999
(shift_to_mmu_psize(pshift) << 2));
100100
#elif defined(CONFIG_PPC_8xx)
101101
*hpdp = __hugepd(__pa(new) | _PMD_USER |

0 commit comments

Comments
 (0)