|
@@ -3,6 +3,8 @@
|
|
|
|
|
|
#include <linux/threads.h>
|
|
#include <linux/threads.h>
|
|
#include <linux/mm.h> /* for struct page */
|
|
#include <linux/mm.h> /* for struct page */
|
|
|
|
+#include <asm/tlb.h>
|
|
|
|
+#include <asm-generic/tlb.h>
|
|
|
|
|
|
#ifdef CONFIG_PARAVIRT
|
|
#ifdef CONFIG_PARAVIRT
|
|
#include <asm/paravirt.h>
|
|
#include <asm/paravirt.h>
|
|
@@ -14,19 +16,20 @@
|
|
#define paravirt_release_pd(pfn) do { } while (0)
|
|
#define paravirt_release_pd(pfn) do { } while (0)
|
|
#endif
|
|
#endif
|
|
|
|
|
|
-#define pmd_populate_kernel(mm, pmd, pte) \
|
|
|
|
-do { \
|
|
|
|
- paravirt_alloc_pt(mm, __pa(pte) >> PAGE_SHIFT); \
|
|
|
|
- set_pmd(pmd, __pmd(_PAGE_TABLE + __pa(pte))); \
|
|
|
|
-} while (0)
|
|
|
|
|
|
+static inline void pmd_populate_kernel(struct mm_struct *mm,
|
|
|
|
+ pmd_t *pmd, pte_t *pte)
|
|
|
|
+{
|
|
|
|
+ paravirt_alloc_pt(mm, __pa(pte) >> PAGE_SHIFT);
|
|
|
|
+ set_pmd(pmd, __pmd(__pa(pte) | _PAGE_TABLE));
|
|
|
|
+}
|
|
|
|
|
|
-#define pmd_populate(mm, pmd, pte) \
|
|
|
|
-do { \
|
|
|
|
- paravirt_alloc_pt(mm, page_to_pfn(pte)); \
|
|
|
|
- set_pmd(pmd, __pmd(_PAGE_TABLE + \
|
|
|
|
- ((unsigned long long)page_to_pfn(pte) << \
|
|
|
|
- (unsigned long long) PAGE_SHIFT))); \
|
|
|
|
-} while (0)
|
|
|
|
|
|
+static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, struct page *pte)
|
|
|
|
+{
|
|
|
|
+ unsigned long pfn = page_to_pfn(pte);
|
|
|
|
+
|
|
|
|
+ paravirt_alloc_pt(mm, pfn);
|
|
|
|
+ set_pmd(pmd, __pmd(((pteval_t)pfn << PAGE_SHIFT) | _PAGE_TABLE));
|
|
|
|
+}
|
|
|
|
|
|
/*
|
|
/*
|
|
* Allocate and free page tables.
|
|
* Allocate and free page tables.
|
|
@@ -48,20 +51,34 @@ static inline void pte_free(struct page *pte)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-#define __pte_free_tlb(tlb,pte) \
|
|
|
|
-do { \
|
|
|
|
- paravirt_release_pt(page_to_pfn(pte)); \
|
|
|
|
- tlb_remove_page((tlb),(pte)); \
|
|
|
|
-} while (0)
|
|
|
|
|
|
+static inline void __pte_free_tlb(struct mmu_gather *tlb, struct page *pte)
|
|
|
|
+{
|
|
|
|
+ paravirt_release_pt(page_to_pfn(pte));
|
|
|
|
+ tlb_remove_page(tlb, pte);
|
|
|
|
+}
|
|
|
|
|
|
#ifdef CONFIG_X86_PAE
|
|
#ifdef CONFIG_X86_PAE
|
|
/*
|
|
/*
|
|
* In the PAE case we free the pmds as part of the pgd.
|
|
* In the PAE case we free the pmds as part of the pgd.
|
|
*/
|
|
*/
|
|
-#define pmd_alloc_one(mm, addr) ({ BUG(); ((pmd_t *)2); })
|
|
|
|
-#define pmd_free(x) do { } while (0)
|
|
|
|
-#define __pmd_free_tlb(tlb,x) do { } while (0)
|
|
|
|
-#define pud_populate(mm, pmd, pte) BUG()
|
|
|
|
-#endif
|
|
|
|
|
|
+static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
|
|
|
|
+{
|
|
|
|
+ BUG();
|
|
|
|
+ return (pmd_t *)2;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static inline void pmd_free(pmd_t *pmd)
|
|
|
|
+{
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd)
|
|
|
|
+{
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd)
|
|
|
|
+{
|
|
|
|
+ BUG();
|
|
|
|
+}
|
|
|
|
+#endif /* CONFIG_X86_PAE */
|
|
|
|
|
|
#endif /* _I386_PGALLOC_H */
|
|
#endif /* _I386_PGALLOC_H */
|