mirror of
https://github.com/torvalds/linux.git
synced 2024-12-28 13:51:44 +00:00
arch: Add pmd_pfn() where it is missing
We need to use this function in common code, so define it for architectures and/or configrations that miss it. The result of pmd_pfn() will only be used if TRANSPARENT_HUGEPAGE is enabled, but a function or macro called pmd_pfn() must be defined, even on machines with two level page tables. Signed-off-by: Mike Rapoport <rppt@linux.ibm.com> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
This commit is contained in:
parent
eed05e54d2
commit
7106c51ee9
@ -233,6 +233,7 @@ pmd_page_vaddr(pmd_t pmd)
|
|||||||
return ((pmd_val(pmd) & _PFN_MASK) >> (32-PAGE_SHIFT)) + PAGE_OFFSET;
|
return ((pmd_val(pmd) & _PFN_MASK) >> (32-PAGE_SHIFT)) + PAGE_OFFSET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define pmd_pfn(pmd) (pmd_val(pmd) >> 32)
|
||||||
#define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> 32))
|
#define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> 32))
|
||||||
#define pud_page(pud) (pfn_to_page(pud_val(pud) >> 32))
|
#define pud_page(pud) (pfn_to_page(pud_val(pud) >> 32))
|
||||||
|
|
||||||
|
@ -31,7 +31,6 @@ static inline pmd_t pte_pmd(pte_t pte)
|
|||||||
|
|
||||||
#define pmd_write(pmd) pte_write(pmd_pte(pmd))
|
#define pmd_write(pmd) pte_write(pmd_pte(pmd))
|
||||||
#define pmd_young(pmd) pte_young(pmd_pte(pmd))
|
#define pmd_young(pmd) pte_young(pmd_pte(pmd))
|
||||||
#define pmd_pfn(pmd) pte_pfn(pmd_pte(pmd))
|
|
||||||
#define pmd_dirty(pmd) pte_dirty(pmd_pte(pmd))
|
#define pmd_dirty(pmd) pte_dirty(pmd_pte(pmd))
|
||||||
|
|
||||||
#define mk_pmd(page, prot) pte_pmd(mk_pte(page, prot))
|
#define mk_pmd(page, prot) pte_pmd(mk_pte(page, prot))
|
||||||
|
@ -161,6 +161,7 @@
|
|||||||
#define pmd_present(x) (pmd_val(x))
|
#define pmd_present(x) (pmd_val(x))
|
||||||
#define pmd_clear(xp) do { pmd_val(*(xp)) = 0; } while (0)
|
#define pmd_clear(xp) do { pmd_val(*(xp)) = 0; } while (0)
|
||||||
#define pmd_page_vaddr(pmd) (pmd_val(pmd) & PAGE_MASK)
|
#define pmd_page_vaddr(pmd) (pmd_val(pmd) & PAGE_MASK)
|
||||||
|
#define pmd_pfn(pmd) ((pmd_val(pmd) & PAGE_MASK) >> PAGE_SHIFT)
|
||||||
#define pmd_page(pmd) virt_to_page(pmd_page_vaddr(pmd))
|
#define pmd_page(pmd) virt_to_page(pmd_page_vaddr(pmd))
|
||||||
#define set_pmd(pmdp, pmd) (*(pmdp) = pmd)
|
#define set_pmd(pmdp, pmd) (*(pmdp) = pmd)
|
||||||
#define pmd_pgtable(pmd) ((pgtable_t) pmd_page_vaddr(pmd))
|
#define pmd_pgtable(pmd) ((pgtable_t) pmd_page_vaddr(pmd))
|
||||||
|
@ -208,6 +208,8 @@ static inline pmd_t *pmd_offset(pud_t *pud, unsigned long addr)
|
|||||||
}
|
}
|
||||||
#define pmd_offset pmd_offset
|
#define pmd_offset pmd_offset
|
||||||
|
|
||||||
|
#define pmd_pfn(pmd) (__phys_to_pfn(pmd_val(pmd) & PHYS_MASK))
|
||||||
|
|
||||||
#define pmd_large(pmd) (pmd_val(pmd) & 2)
|
#define pmd_large(pmd) (pmd_val(pmd) & 2)
|
||||||
#define pmd_leaf(pmd) (pmd_val(pmd) & 2)
|
#define pmd_leaf(pmd) (pmd_val(pmd) & 2)
|
||||||
#define pmd_bad(pmd) (pmd_val(pmd) & 2)
|
#define pmd_bad(pmd) (pmd_val(pmd) & 2)
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#define pgd_ERROR(e) \
|
#define pgd_ERROR(e) \
|
||||||
pr_err("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e))
|
pr_err("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e))
|
||||||
|
|
||||||
|
#define pmd_pfn(pmd) (pmd_phys(pmd) >> PAGE_SHIFT)
|
||||||
#define pmd_page(pmd) (pfn_to_page(pmd_phys(pmd) >> PAGE_SHIFT))
|
#define pmd_page(pmd) (pfn_to_page(pmd_phys(pmd) >> PAGE_SHIFT))
|
||||||
#define pte_clear(mm, addr, ptep) set_pte((ptep), \
|
#define pte_clear(mm, addr, ptep) set_pte((ptep), \
|
||||||
(((unsigned int) addr >= PAGE_OFFSET) ? __pte(_PAGE_GLOBAL) : __pte(0)))
|
(((unsigned int) addr >= PAGE_OFFSET) ? __pte(_PAGE_GLOBAL) : __pte(0)))
|
||||||
|
@ -235,6 +235,11 @@ static inline int pmd_bad(pmd_t pmd)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* pmd_pfn - converts a PMD entry to a page frame number
|
||||||
|
*/
|
||||||
|
#define pmd_pfn(pmd) (pmd_val(pmd) >> PAGE_SHIFT)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* pmd_page - converts a PMD entry to a page pointer
|
* pmd_page - converts a PMD entry to a page pointer
|
||||||
*/
|
*/
|
||||||
|
@ -267,6 +267,7 @@ ia64_phys_addr_valid (unsigned long addr)
|
|||||||
#define pmd_present(pmd) (pmd_val(pmd) != 0UL)
|
#define pmd_present(pmd) (pmd_val(pmd) != 0UL)
|
||||||
#define pmd_clear(pmdp) (pmd_val(*(pmdp)) = 0UL)
|
#define pmd_clear(pmdp) (pmd_val(*(pmdp)) = 0UL)
|
||||||
#define pmd_page_vaddr(pmd) ((unsigned long) __va(pmd_val(pmd) & _PFN_MASK))
|
#define pmd_page_vaddr(pmd) ((unsigned long) __va(pmd_val(pmd) & _PFN_MASK))
|
||||||
|
#define pmd_pfn(pmd) ((pmd_val(pmd) & _PFN_MASK) >> PAGE_SHIFT)
|
||||||
#define pmd_page(pmd) virt_to_page((pmd_val(pmd) + PAGE_OFFSET))
|
#define pmd_page(pmd) virt_to_page((pmd_val(pmd) + PAGE_OFFSET))
|
||||||
|
|
||||||
#define pud_none(pud) (!pud_val(pud))
|
#define pud_none(pud) (!pud_val(pud))
|
||||||
|
@ -322,6 +322,7 @@ extern pgd_t kernel_pg_dir[PTRS_PER_PGD];
|
|||||||
#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
|
#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
|
||||||
#define __swp_entry_to_pte(x) (__pte((x).val))
|
#define __swp_entry_to_pte(x) (__pte((x).val))
|
||||||
|
|
||||||
|
#define pmd_pfn(pmd) (pmd_val(pmd) >> PAGE_SHIFT)
|
||||||
#define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT))
|
#define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT))
|
||||||
|
|
||||||
#define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
|
#define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
|
||||||
|
@ -147,6 +147,7 @@ static inline void pud_set(pud_t *pudp, pmd_t *pmdp)
|
|||||||
#define pmd_present(pmd) (pmd_val(pmd) & _PAGE_TABLE)
|
#define pmd_present(pmd) (pmd_val(pmd) & _PAGE_TABLE)
|
||||||
#define pmd_clear(pmdp) ({ pmd_val(*pmdp) = 0; })
|
#define pmd_clear(pmdp) ({ pmd_val(*pmdp) = 0; })
|
||||||
|
|
||||||
|
#define pmd_pfn(pmd) ((pmd_val(pmd) & _TABLE_MASK) >> PAGE_SHIFT)
|
||||||
/*
|
/*
|
||||||
* m68k does not have huge pages (020/030 actually could), but generic code
|
* m68k does not have huge pages (020/030 actually could), but generic code
|
||||||
* expects pmd_page() to exists, only to then DCE it all. Provide a dummy to
|
* expects pmd_page() to exists, only to then DCE it all. Provide a dummy to
|
||||||
|
@ -130,6 +130,7 @@ static inline void pte_clear (struct mm_struct *mm, unsigned long addr, pte_t *p
|
|||||||
({ pte_t __pte; pte_val(__pte) = pfn | pgprot_val(pgprot); __pte; })
|
({ pte_t __pte; pte_val(__pte) = pfn | pgprot_val(pgprot); __pte; })
|
||||||
|
|
||||||
#define pte_page(pte) virt_to_page(__pte_page(pte))
|
#define pte_page(pte) virt_to_page(__pte_page(pte))
|
||||||
|
#define pmd_pfn(pmd) (pmd_val(pmd) >> PAGE_SHIFT)
|
||||||
#define pmd_page(pmd) virt_to_page(pmd_page_vaddr(pmd))
|
#define pmd_page(pmd) virt_to_page(pmd_page_vaddr(pmd))
|
||||||
|
|
||||||
|
|
||||||
|
@ -399,6 +399,9 @@ static inline unsigned long pmd_page_vaddr(pmd_t pmd)
|
|||||||
return ((unsigned long) (pmd_val(pmd) & PAGE_MASK));
|
return ((unsigned long) (pmd_val(pmd) & PAGE_MASK));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* returns pfn of the pmd entry*/
|
||||||
|
#define pmd_pfn(pmd) (__pa(pmd_val(pmd)) >> PAGE_SHIFT)
|
||||||
|
|
||||||
/* returns struct *page of the pmd entry*/
|
/* returns struct *page of the pmd entry*/
|
||||||
#define pmd_page(pmd) (pfn_to_page(__pa(pmd_val(pmd)) >> PAGE_SHIFT))
|
#define pmd_page(pmd) (pfn_to_page(__pa(pmd_val(pmd)) >> PAGE_SHIFT))
|
||||||
|
|
||||||
|
@ -308,6 +308,7 @@ static inline pmd_t __mk_pmd(pte_t * ptep, unsigned long prot)
|
|||||||
return pmd;
|
return pmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define pmd_pfn(pmd) (pmd_val(pmd) >> PAGE_SHIFT)
|
||||||
#define pmd_page(pmd) virt_to_page(__va(pmd_val(pmd)))
|
#define pmd_page(pmd) virt_to_page(__va(pmd_val(pmd)))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -235,6 +235,7 @@ static inline void pte_clear(struct mm_struct *mm,
|
|||||||
* and a page entry and page directory to the page they refer to.
|
* and a page entry and page directory to the page they refer to.
|
||||||
*/
|
*/
|
||||||
#define pmd_phys(pmd) virt_to_phys((void *)pmd_val(pmd))
|
#define pmd_phys(pmd) virt_to_phys((void *)pmd_val(pmd))
|
||||||
|
#define pmd_pfn(pmd) (pmd_phys(pmd) >> PAGE_SHIFT)
|
||||||
#define pmd_page(pmd) (pfn_to_page(pmd_phys(pmd) >> PAGE_SHIFT))
|
#define pmd_page(pmd) (pfn_to_page(pmd_phys(pmd) >> PAGE_SHIFT))
|
||||||
|
|
||||||
static inline unsigned long pmd_page_vaddr(pmd_t pmd)
|
static inline unsigned long pmd_page_vaddr(pmd_t pmd)
|
||||||
|
@ -361,6 +361,7 @@ static inline void pmd_set(pmd_t *pmdp, pte_t *ptep)
|
|||||||
pmd_val(*pmdp) = _KERNPG_TABLE | (unsigned long) ptep;
|
pmd_val(*pmdp) = _KERNPG_TABLE | (unsigned long) ptep;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define pmd_pfn(pmd) (pmd_val(pmd) >> PAGE_SHIFT)
|
||||||
#define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT))
|
#define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT))
|
||||||
|
|
||||||
static inline unsigned long pmd_page_vaddr(pmd_t pmd)
|
static inline unsigned long pmd_page_vaddr(pmd_t pmd)
|
||||||
|
@ -405,6 +405,7 @@ static inline unsigned long pmd_page_vaddr(pmd_t pmd)
|
|||||||
return ((unsigned long) __va(pmd_address(pmd)));
|
return ((unsigned long) __va(pmd_address(pmd)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define pmd_pfn(pmd) (pmd_address(pmd) >> PAGE_SHIFT)
|
||||||
#define __pmd_page(pmd) ((unsigned long) __va(pmd_address(pmd)))
|
#define __pmd_page(pmd) ((unsigned long) __va(pmd_address(pmd)))
|
||||||
#define pmd_page(pmd) virt_to_page((void *)__pmd_page(pmd))
|
#define pmd_page(pmd) virt_to_page((void *)__pmd_page(pmd))
|
||||||
|
|
||||||
|
@ -406,6 +406,7 @@ static inline unsigned long pmd_page_vaddr(pmd_t pmd)
|
|||||||
return (unsigned long)pmd_val(pmd);
|
return (unsigned long)pmd_val(pmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define pmd_pfn(pmd) (__pa(pmd_val(pmd)) >> PAGE_SHIFT)
|
||||||
#define pmd_page(pmd) (virt_to_page(pmd_val(pmd)))
|
#define pmd_page(pmd) (virt_to_page(pmd_val(pmd)))
|
||||||
|
|
||||||
#ifdef CONFIG_X2TLB
|
#ifdef CONFIG_X2TLB
|
||||||
|
@ -109,6 +109,7 @@ extern unsigned long end_iomem;
|
|||||||
#define p4d_newpage(x) (p4d_val(x) & _PAGE_NEWPAGE)
|
#define p4d_newpage(x) (p4d_val(x) & _PAGE_NEWPAGE)
|
||||||
#define p4d_mkuptodate(x) (p4d_val(x) &= ~_PAGE_NEWPAGE)
|
#define p4d_mkuptodate(x) (p4d_val(x) &= ~_PAGE_NEWPAGE)
|
||||||
|
|
||||||
|
#define pmd_pfn(pmd) (pmd_val(pmd) >> PAGE_SHIFT)
|
||||||
#define pmd_page(pmd) phys_to_page(pmd_val(pmd) & PAGE_MASK)
|
#define pmd_page(pmd) phys_to_page(pmd_val(pmd) & PAGE_MASK)
|
||||||
|
|
||||||
#define pte_page(x) pfn_to_page(pte_pfn(x))
|
#define pte_page(x) pfn_to_page(pte_pfn(x))
|
||||||
|
@ -241,6 +241,7 @@ static inline void paging_init(void) { }
|
|||||||
* The pmd contains the kernel virtual address of the pte page.
|
* The pmd contains the kernel virtual address of the pte page.
|
||||||
*/
|
*/
|
||||||
#define pmd_page_vaddr(pmd) ((unsigned long)(pmd_val(pmd) & PAGE_MASK))
|
#define pmd_page_vaddr(pmd) ((unsigned long)(pmd_val(pmd) & PAGE_MASK))
|
||||||
|
#define pmd_pfn(pmd) (__pa(pmd_val(pmd)) >> PAGE_SHIFT)
|
||||||
#define pmd_page(pmd) virt_to_page(pmd_val(pmd))
|
#define pmd_page(pmd) virt_to_page(pmd_val(pmd))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user