Skip to content

Commit 9e996c2

Browse files
author
Matthew Wilcox (Oracle)
committed
powerpc: Add pmd_pfn()
This is straightforward for everything except nohash64 where we indirect through pmd_page(). There must be a better way to do this. Signed-off-by: Matthew Wilcox (Oracle) <[email protected]>
1 parent 177bd2a commit 9e996c2

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,8 @@ static inline void __ptep_set_access_flags(struct vm_area_struct *vma,
372372
#define __HAVE_ARCH_PTE_SAME
373373
#define pte_same(A,B) (((pte_val(A) ^ pte_val(B)) & ~_PAGE_HASHPTE) == 0)
374374

375-
#define pmd_page(pmd) \
376-
pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT)
375+
#define pmd_pfn(pmd) (pmd_val(pmd) >> PAGE_SHIFT)
376+
#define pmd_page(pmd) pfn_to_page(pmd_pfn(pmd))
377377

378378
/*
379379
* Encode and decode a swap entry.

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -349,15 +349,14 @@ static inline int pte_young(pte_t pte)
349349
* of the pte page. -- paulus
350350
*/
351351
#ifndef CONFIG_BOOKE
352-
#define pmd_page(pmd) \
353-
pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT)
352+
#define pmd_pfn(pmd) (pmd_val(pmd) >> PAGE_SHIFT)
354353
#else
355354
#define pmd_page_vaddr(pmd) \
356355
((unsigned long)(pmd_val(pmd) & ~(PTE_TABLE_SIZE - 1)))
357-
#define pmd_page(pmd) \
358-
pfn_to_page((__pa(pmd_val(pmd)) >> PAGE_SHIFT))
356+
#define pmd_pfn(pmd) (__pa(pmd_val(pmd)) >> PAGE_SHIFT)
359357
#endif
360358

359+
#define pmd_page(pmd) pfn_to_page(pmd_pfn(pmd))
361360
/*
362361
* Encode and decode a swap entry.
363362
* Note that the bits we use in a PTE for representing a swap entry

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ static inline pte_t pmd_pte(pmd_t pmd)
142142
#define pmd_present(pmd) (!pmd_none(pmd))
143143
#define pmd_page_vaddr(pmd) (pmd_val(pmd) & ~PMD_MASKED_BITS)
144144
extern struct page *pmd_page(pmd_t pmd);
145+
#define pmd_pfn(pmd) (page_to_pfn(pmd_page(pmd)))
145146

146147
static inline void pud_set(pud_t *pudp, unsigned long val)
147148
{

0 commit comments

Comments
 (0)