Skip to content

Commit c88a82f

Browse files
author
Peter Zijlstra
committed
powerpc/8xx: Implement pXX_leaf_size() support
Christophe Leroy wrote: > I can help with powerpc 8xx. It is a 32 bits powerpc. The PGD has 1024 > entries, that means each entry maps 4M. > > Page sizes are 4k, 16k, 512k and 8M. > > For the 8M pages we use hugepd with a single entry. The two related PGD > entries point to the same hugepd. > > For the other sizes, they are in standard page tables. 16k pages appear > 4 times in the page table. 512k entries appear 128 times in the page > table. > > When the PGD entry has _PMD_PAGE_8M bits, the PMD entry points to a > hugepd with holds the single 8M entry. > > In the PTE, we have two bits: _PAGE_SPS and _PAGE_HUGE > > _PAGE_HUGE means it is a 512k page > _PAGE_SPS means it is not a 4k page > > The kernel can by build either with 4k pages as standard page size, or > 16k pages. It doesn't change the page table layout though. Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 9748217 commit c88a82f

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

arch/powerpc/include/asm/nohash/32/pte-8xx.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,29 @@ static inline pte_t pte_mkhuge(pte_t pte)
135135
}
136136

137137
#define pte_mkhuge pte_mkhuge
138+
139+
static inline unsigned long pgd_leaf_size(pgd_t pgd)
140+
{
141+
if (pgd_val(pgd) & _PMD_PAGE_8M)
142+
return SZ_8M;
143+
return SZ_4M;
144+
}
145+
146+
#define pgd_leaf_size pgd_leaf_size
147+
148+
static inline unsigned long pte_leaf_size(pte_t pte)
149+
{
150+
pte_basic_t val = pte_val(pte);
151+
152+
if (val & _PAGE_HUGE)
153+
return SZ_512K;
154+
if (val & _PAGE_SPS)
155+
return SZ_16K;
156+
return SZ_4K;
157+
}
158+
159+
#define pte_leaf_size pte_leaf_size
160+
138161
#endif
139162

140163
#endif /* __KERNEL__ */

0 commit comments

Comments
 (0)