-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
powerpc/mm: split asm/hugetlb.h into dedicated subarch files
Three subarches support hugepages: - fsl book3e - book3s/64 - 8xx This patch splits asm/hugetlb.h to reduce the #ifdef mess. Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
- Loading branch information
Christophe Leroy
authored and
Michael Ellerman
committed
May 2, 2019
1 parent
0001e5a
commit 8197af2
Showing
4 changed files
with
106 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 */ | ||
#ifndef _ASM_POWERPC_NOHASH_32_HUGETLB_8XX_H | ||
#define _ASM_POWERPC_NOHASH_32_HUGETLB_8XX_H | ||
|
||
static inline pte_t *hugepd_page(hugepd_t hpd) | ||
{ | ||
BUG_ON(!hugepd_ok(hpd)); | ||
|
||
return (pte_t *)__va(hpd_val(hpd) & ~HUGEPD_SHIFT_MASK); | ||
} | ||
|
||
static inline unsigned int hugepd_shift(hugepd_t hpd) | ||
{ | ||
return ((hpd_val(hpd) & _PMD_PAGE_MASK) >> 1) + 17; | ||
} | ||
|
||
static inline pte_t *hugepte_offset(hugepd_t hpd, unsigned long addr, | ||
unsigned int pdshift) | ||
{ | ||
unsigned long idx = (addr & ((1UL << pdshift) - 1)) >> PAGE_SHIFT; | ||
|
||
return hugepd_page(hpd) + idx; | ||
} | ||
|
||
static inline void flush_hugetlb_page(struct vm_area_struct *vma, | ||
unsigned long vmaddr) | ||
{ | ||
flush_tlb_page(vma, vmaddr); | ||
} | ||
|
||
#endif /* _ASM_POWERPC_NOHASH_32_HUGETLB_8XX_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 */ | ||
#ifndef _ASM_POWERPC_NOHASH_HUGETLB_BOOK3E_H | ||
#define _ASM_POWERPC_NOHASH_HUGETLB_BOOK3E_H | ||
|
||
static inline pte_t *hugepd_page(hugepd_t hpd) | ||
{ | ||
if (WARN_ON(!hugepd_ok(hpd))) | ||
return NULL; | ||
|
||
return (pte_t *)((hpd_val(hpd) & ~HUGEPD_SHIFT_MASK) | PD_HUGE); | ||
} | ||
|
||
static inline unsigned int hugepd_shift(hugepd_t hpd) | ||
{ | ||
return hpd_val(hpd) & HUGEPD_SHIFT_MASK; | ||
} | ||
|
||
static inline pte_t *hugepte_offset(hugepd_t hpd, unsigned long addr, | ||
unsigned int pdshift) | ||
{ | ||
/* | ||
* On FSL BookE, we have multiple higher-level table entries that | ||
* point to the same hugepte. Just use the first one since they're all | ||
* identical. So for that case, idx=0. | ||
*/ | ||
return hugepd_page(hpd); | ||
} | ||
|
||
void flush_hugetlb_page(struct vm_area_struct *vma, unsigned long vmaddr); | ||
|
||
#endif /* _ASM_POWERPC_NOHASH_HUGETLB_BOOK3E_H */ |