Commit 6c435456 authored by Jeremy Fitzhardinge's avatar Jeremy Fitzhardinge Committed by Ingo Molnar

x86: add mm parameter to paravirt_alloc_pd

Add mm to paravirt_alloc_pd, partly to make it consistent with
paravirt_alloc_pt, and because later changes will make use of it.
Signed-off-by: default avatarJeremy Fitzhardinge <jeremy@xensource.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent a89780f3
...@@ -398,7 +398,7 @@ static void vmi_allocate_pt(struct mm_struct *mm, u32 pfn) ...@@ -398,7 +398,7 @@ static void vmi_allocate_pt(struct mm_struct *mm, u32 pfn)
vmi_ops.allocate_page(pfn, VMI_PAGE_L1, 0, 0, 0); vmi_ops.allocate_page(pfn, VMI_PAGE_L1, 0, 0, 0);
} }
static void vmi_allocate_pd(u32 pfn) static void vmi_allocate_pd(struct mm_struct *mm, u32 pfn)
{ {
/* /*
* This call comes in very early, before mem_map is setup. * This call comes in very early, before mem_map is setup.
......
...@@ -65,7 +65,7 @@ static pmd_t * __init one_md_table_init(pgd_t *pgd) ...@@ -65,7 +65,7 @@ static pmd_t * __init one_md_table_init(pgd_t *pgd)
if (!(pgd_val(*pgd) & _PAGE_PRESENT)) { if (!(pgd_val(*pgd) & _PAGE_PRESENT)) {
pmd_table = (pmd_t *) alloc_bootmem_low_pages(PAGE_SIZE); pmd_table = (pmd_t *) alloc_bootmem_low_pages(PAGE_SIZE);
paravirt_alloc_pd(__pa(pmd_table) >> PAGE_SHIFT); paravirt_alloc_pd(&init_mm, __pa(pmd_table) >> PAGE_SHIFT);
set_pgd(pgd, __pgd(__pa(pmd_table) | _PAGE_PRESENT)); set_pgd(pgd, __pgd(__pa(pmd_table) | _PAGE_PRESENT));
pud = pud_offset(pgd, 0); pud = pud_offset(pgd, 0);
if (pmd_table != pmd_offset(pud, 0)) if (pmd_table != pmd_offset(pud, 0))
...@@ -365,7 +365,7 @@ void __init native_pagetable_setup_start(pgd_t *base) ...@@ -365,7 +365,7 @@ void __init native_pagetable_setup_start(pgd_t *base)
memset(&base[USER_PTRS_PER_PGD], 0, memset(&base[USER_PTRS_PER_PGD], 0,
KERNEL_PGD_PTRS * sizeof(pgd_t)); KERNEL_PGD_PTRS * sizeof(pgd_t));
#else #else
paravirt_alloc_pd(__pa(swapper_pg_dir) >> PAGE_SHIFT); paravirt_alloc_pd(&init_mm, __pa(base) >> PAGE_SHIFT);
#endif #endif
} }
......
...@@ -330,13 +330,15 @@ pgd_t *pgd_alloc(struct mm_struct *mm) ...@@ -330,13 +330,15 @@ pgd_t *pgd_alloc(struct mm_struct *mm)
if (PTRS_PER_PMD == 1 || !pgd) if (PTRS_PER_PMD == 1 || !pgd)
return pgd; return pgd;
mm->pgd = pgd; /* so that alloc_pd can use it */
for (i = 0; i < UNSHARED_PTRS_PER_PGD; ++i) { for (i = 0; i < UNSHARED_PTRS_PER_PGD; ++i) {
pmd_t *pmd = pmd_cache_alloc(i); pmd_t *pmd = pmd_cache_alloc(i);
if (!pmd) if (!pmd)
goto out_oom; goto out_oom;
paravirt_alloc_pd(__pa(pmd) >> PAGE_SHIFT); paravirt_alloc_pd(mm, __pa(pmd) >> PAGE_SHIFT);
set_pgd(&pgd[i], __pgd(1 + __pa(pmd))); set_pgd(&pgd[i], __pgd(1 + __pa(pmd)));
} }
return pgd; return pgd;
......
...@@ -221,7 +221,7 @@ struct pv_mmu_ops { ...@@ -221,7 +221,7 @@ struct pv_mmu_ops {
/* Hooks for allocating/releasing pagetable pages */ /* Hooks for allocating/releasing pagetable pages */
void (*alloc_pt)(struct mm_struct *mm, u32 pfn); void (*alloc_pt)(struct mm_struct *mm, u32 pfn);
void (*alloc_pd)(u32 pfn); void (*alloc_pd)(struct mm_struct *mm, u32 pfn);
void (*alloc_pd_clone)(u32 pfn, u32 clonepfn, u32 start, u32 count); void (*alloc_pd_clone)(u32 pfn, u32 clonepfn, u32 start, u32 count);
void (*release_pt)(u32 pfn); void (*release_pt)(u32 pfn);
void (*release_pd)(u32 pfn); void (*release_pd)(u32 pfn);
...@@ -903,9 +903,9 @@ static inline void paravirt_release_pt(unsigned pfn) ...@@ -903,9 +903,9 @@ static inline void paravirt_release_pt(unsigned pfn)
PVOP_VCALL1(pv_mmu_ops.release_pt, pfn); PVOP_VCALL1(pv_mmu_ops.release_pt, pfn);
} }
static inline void paravirt_alloc_pd(unsigned pfn) static inline void paravirt_alloc_pd(struct mm_struct *mm, unsigned pfn)
{ {
PVOP_VCALL1(pv_mmu_ops.alloc_pd, pfn); PVOP_VCALL2(pv_mmu_ops.alloc_pd, mm, pfn);
} }
static inline void paravirt_alloc_pd_clone(unsigned pfn, unsigned clonepfn, static inline void paravirt_alloc_pd_clone(unsigned pfn, unsigned clonepfn,
......
...@@ -8,8 +8,7 @@ ...@@ -8,8 +8,7 @@
#include <asm/paravirt.h> #include <asm/paravirt.h>
#else #else
#define paravirt_alloc_pt(mm, pfn) do { } while (0) #define paravirt_alloc_pt(mm, pfn) do { } while (0)
#define paravirt_alloc_pd(pfn) do { } while (0) #define paravirt_alloc_pd(mm, pfn) do { } while (0)
#define paravirt_alloc_pd(pfn) do { } while (0)
#define paravirt_alloc_pd_clone(pfn, clonepfn, start, count) do { } while (0) #define paravirt_alloc_pd_clone(pfn, clonepfn, start, count) do { } while (0)
#define paravirt_release_pt(pfn) do { } while (0) #define paravirt_release_pt(pfn) do { } while (0)
#define paravirt_release_pd(pfn) do { } while (0) #define paravirt_release_pd(pfn) do { } while (0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment