Skip to content

Commit 687993c

Browse files
rpptmpe
authored andcommitted
powerpc/8xx: use pmd_off() to access a PMD entry in pte_update()
The pte_update() implementation for PPC_8xx unfolds page table from the PGD level to access a PMD entry. Since 8xx has only 2-level page table this can be simplified with pmd_off() shortcut. Replace explicit unfolding with pmd_off() and drop defines of pgd_index() and pgd_offset() that are no longer needed. Signed-off-by: Mike Rapoport <[email protected]> Reviewed-by: Christophe Leroy <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 0bdcfa1 commit 687993c

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

arch/powerpc/include/asm/nohash/32/pgtable.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,6 @@ static inline void pmd_clear(pmd_t *pmdp)
205205
*pmdp = __pmd(0);
206206
}
207207

208-
/* to find an entry in a page-table-directory */
209-
#define pgd_index(address) ((address) >> PGDIR_SHIFT)
210-
#define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address))
211-
212208
/*
213209
* PTE updates. This function is called whenever an existing
214210
* valid PTE is updated. This does -not- include set_pte_at()
@@ -230,14 +226,16 @@ static inline void pmd_clear(pmd_t *pmdp)
230226
* For other page sizes, we have a single entry in the table.
231227
*/
232228
#ifdef CONFIG_PPC_8xx
229+
static pmd_t *pmd_off(struct mm_struct *mm, unsigned long addr);
230+
233231
static inline pte_basic_t pte_update(struct mm_struct *mm, unsigned long addr, pte_t *p,
234232
unsigned long clr, unsigned long set, int huge)
235233
{
236234
pte_basic_t *entry = &p->pte;
237235
pte_basic_t old = pte_val(*p);
238236
pte_basic_t new = (old & ~(pte_basic_t)clr) | set;
239237
int num, i;
240-
pmd_t *pmd = pmd_offset(pud_offset(p4d_offset(pgd_offset(mm, addr), addr), addr), addr);
238+
pmd_t *pmd = pmd_off(mm, addr);
241239

242240
if (!huge)
243241
num = PAGE_SIZE / SZ_4K;

0 commit comments

Comments
 (0)