aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/xen/enlighten.c27
-rw-r--r--arch/x86/xen/mmu.c7
-rw-r--r--arch/x86/xen/mmu.h7
3 files changed, 27 insertions, 14 deletions
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index de4e6f05840b..16e2f8096a1a 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -667,10 +667,10 @@ static void xen_release_pt_init(u32 pfn)
667 make_lowmem_page_readwrite(__va(PFN_PHYS(pfn))); 667 make_lowmem_page_readwrite(__va(PFN_PHYS(pfn)));
668} 668}
669 669
670static void pin_pagetable_pfn(unsigned level, unsigned long pfn) 670static void pin_pagetable_pfn(unsigned cmd, unsigned long pfn)
671{ 671{
672 struct mmuext_op op; 672 struct mmuext_op op;
673 op.cmd = level; 673 op.cmd = cmd;
674 op.arg1.mfn = pfn_to_mfn(pfn); 674 op.arg1.mfn = pfn_to_mfn(pfn);
675 if (HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF)) 675 if (HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF))
676 BUG(); 676 BUG();
@@ -687,7 +687,10 @@ static void xen_alloc_ptpage(struct mm_struct *mm, u32 pfn, unsigned level)
687 687
688 if (!PageHighMem(page)) { 688 if (!PageHighMem(page)) {
689 make_lowmem_page_readonly(__va(PFN_PHYS(pfn))); 689 make_lowmem_page_readonly(__va(PFN_PHYS(pfn)));
690 pin_pagetable_pfn(level, pfn); 690 if (level == PT_PTE)
691 pin_pagetable_pfn(MMUEXT_PIN_L1_TABLE, pfn);
692 else if (level == PT_PMD)
693 pin_pagetable_pfn(MMUEXT_PIN_L2_TABLE, pfn);
691 } else 694 } else
692 /* make sure there are no stray mappings of 695 /* make sure there are no stray mappings of
693 this page */ 696 this page */
@@ -697,16 +700,16 @@ static void xen_alloc_ptpage(struct mm_struct *mm, u32 pfn, unsigned level)
697 700
698static void xen_alloc_pt(struct mm_struct *mm, u32 pfn) 701static void xen_alloc_pt(struct mm_struct *mm, u32 pfn)
699{ 702{
700 xen_alloc_ptpage(mm, pfn, MMUEXT_PIN_L1_TABLE); 703 xen_alloc_ptpage(mm, pfn, PT_PTE);
701} 704}
702 705
703static void xen_alloc_pd(struct mm_struct *mm, u32 pfn) 706static void xen_alloc_pd(struct mm_struct *mm, u32 pfn)
704{ 707{
705 xen_alloc_ptpage(mm, pfn, MMUEXT_PIN_L2_TABLE); 708 xen_alloc_ptpage(mm, pfn, PT_PMD);
706} 709}
707 710
708/* This should never happen until we're OK to use struct page */ 711/* This should never happen until we're OK to use struct page */
709static void xen_release_pt(u32 pfn) 712static void xen_release_ptpage(u32 pfn, unsigned level)
710{ 713{
711 struct page *page = pfn_to_page(pfn); 714 struct page *page = pfn_to_page(pfn);
712 715
@@ -718,6 +721,16 @@ static void xen_release_pt(u32 pfn)
718 } 721 }
719} 722}
720 723
724static void xen_release_pt(u32 pfn)
725{
726 xen_release_ptpage(pfn, PT_PTE);
727}
728
729static void xen_release_pd(u32 pfn)
730{
731 xen_release_ptpage(pfn, PT_PMD);
732}
733
721#ifdef CONFIG_HIGHPTE 734#ifdef CONFIG_HIGHPTE
722static void *xen_kmap_atomic_pte(struct page *page, enum km_type type) 735static void *xen_kmap_atomic_pte(struct page *page, enum km_type type)
723{ 736{
@@ -838,7 +851,7 @@ static __init void xen_pagetable_setup_done(pgd_t *base)
838 pv_mmu_ops.alloc_pt = xen_alloc_pt; 851 pv_mmu_ops.alloc_pt = xen_alloc_pt;
839 pv_mmu_ops.alloc_pd = xen_alloc_pd; 852 pv_mmu_ops.alloc_pd = xen_alloc_pd;
840 pv_mmu_ops.release_pt = xen_release_pt; 853 pv_mmu_ops.release_pt = xen_release_pt;
841 pv_mmu_ops.release_pd = xen_release_pt; 854 pv_mmu_ops.release_pd = xen_release_pd;
842 pv_mmu_ops.set_pte = xen_set_pte; 855 pv_mmu_ops.set_pte = xen_set_pte;
843 856
844 setup_shared_info(); 857 setup_shared_info();
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index 0144395448ae..2a054ef2a3da 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -310,13 +310,6 @@ pgd_t xen_make_pgd(unsigned long pgd)
310} 310}
311#endif /* CONFIG_X86_PAE */ 311#endif /* CONFIG_X86_PAE */
312 312
313enum pt_level {
314 PT_PGD,
315 PT_PUD,
316 PT_PMD,
317 PT_PTE
318};
319
320/* 313/*
321 (Yet another) pagetable walker. This one is intended for pinning a 314 (Yet another) pagetable walker. This one is intended for pinning a
322 pagetable. This means that it walks a pagetable and calls the 315 pagetable. This means that it walks a pagetable and calls the
diff --git a/arch/x86/xen/mmu.h b/arch/x86/xen/mmu.h
index c9ff27f3ac3a..b5e189b1519d 100644
--- a/arch/x86/xen/mmu.h
+++ b/arch/x86/xen/mmu.h
@@ -3,6 +3,13 @@
3#include <linux/linkage.h> 3#include <linux/linkage.h>
4#include <asm/page.h> 4#include <asm/page.h>
5 5
6enum pt_level {
7 PT_PGD,
8 PT_PUD,
9 PT_PMD,
10 PT_PTE
11};
12
6/* 13/*
7 * Page-directory addresses above 4GB do not fit into architectural %cr3. 14 * Page-directory addresses above 4GB do not fit into architectural %cr3.
8 * When accessing %cr3, or equivalent field in vcpu_guest_context, guests 15 * When accessing %cr3, or equivalent field in vcpu_guest_context, guests