aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/xen
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2011-04-13 07:32:28 -0400
committerPatrick McHardy <kaber@trash.net>2011-04-13 07:32:28 -0400
commitb32e3dc7860d00124fa432dba09667e647cb9bcc (patch)
tree2fa6e56f389431dfb84609d3d7572cad76e88e71 /arch/x86/xen
parent6604271c5bc658a6067ed0c3deba4d89e0e50382 (diff)
parent96120d86fe302c006259baee9061eea9e1b9e486 (diff)
Merge branch 'master' of ssh://master.kernel.org/pub/scm/linux/kernel/git/kaber/nf-2.6
Diffstat (limited to 'arch/x86/xen')
-rw-r--r--arch/x86/xen/mmu.c21
-rw-r--r--arch/x86/xen/p2m.c10
2 files changed, 18 insertions, 13 deletions
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index 39ee7182fd18..c82df6c9c0f0 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -1487,10 +1487,12 @@ static __init pte_t mask_rw_pte(pte_t *ptep, pte_t pte)
1487 /* 1487 /*
1488 * If the new pfn is within the range of the newly allocated 1488 * If the new pfn is within the range of the newly allocated
1489 * kernel pagetable, and it isn't being mapped into an 1489 * kernel pagetable, and it isn't being mapped into an
1490 * early_ioremap fixmap slot, make sure it is RO. 1490 * early_ioremap fixmap slot as a freshly allocated page, make sure
1491 * it is RO.
1491 */ 1492 */
1492 if (!is_early_ioremap_ptep(ptep) && 1493 if (((!is_early_ioremap_ptep(ptep) &&
1493 pfn >= pgt_buf_start && pfn < pgt_buf_end) 1494 pfn >= pgt_buf_start && pfn < pgt_buf_end)) ||
1495 (is_early_ioremap_ptep(ptep) && pfn != (pgt_buf_end - 1)))
1494 pte = pte_wrprotect(pte); 1496 pte = pte_wrprotect(pte);
1495 1497
1496 return pte; 1498 return pte;
@@ -1700,9 +1702,6 @@ static __init void xen_map_identity_early(pmd_t *pmd, unsigned long max_pfn)
1700 for (pteidx = 0; pteidx < PTRS_PER_PTE; pteidx++, pfn++) { 1702 for (pteidx = 0; pteidx < PTRS_PER_PTE; pteidx++, pfn++) {
1701 pte_t pte; 1703 pte_t pte;
1702 1704
1703 if (pfn > max_pfn_mapped)
1704 max_pfn_mapped = pfn;
1705
1706 if (!pte_none(pte_page[pteidx])) 1705 if (!pte_none(pte_page[pteidx]))
1707 continue; 1706 continue;
1708 1707
@@ -1760,6 +1759,12 @@ __init pgd_t *xen_setup_kernel_pagetable(pgd_t *pgd,
1760 pud_t *l3; 1759 pud_t *l3;
1761 pmd_t *l2; 1760 pmd_t *l2;
1762 1761
1762 /* max_pfn_mapped is the last pfn mapped in the initial memory
1763 * mappings. Considering that on Xen after the kernel mappings we
1764 * have the mappings of some pages that don't exist in pfn space, we
1765 * set max_pfn_mapped to the last real pfn mapped. */
1766 max_pfn_mapped = PFN_DOWN(__pa(xen_start_info->mfn_list));
1767
1763 /* Zap identity mapping */ 1768 /* Zap identity mapping */
1764 init_level4_pgt[0] = __pgd(0); 1769 init_level4_pgt[0] = __pgd(0);
1765 1770
@@ -1864,9 +1869,7 @@ __init pgd_t *xen_setup_kernel_pagetable(pgd_t *pgd,
1864 initial_kernel_pmd = 1869 initial_kernel_pmd =
1865 extend_brk(sizeof(pmd_t) * PTRS_PER_PMD, PAGE_SIZE); 1870 extend_brk(sizeof(pmd_t) * PTRS_PER_PMD, PAGE_SIZE);
1866 1871
1867 max_pfn_mapped = PFN_DOWN(__pa(xen_start_info->pt_base) + 1872 max_pfn_mapped = PFN_DOWN(__pa(xen_start_info->mfn_list));
1868 xen_start_info->nr_pt_frames * PAGE_SIZE +
1869 512*1024);
1870 1873
1871 kernel_pmd = m2v(pgd[KERNEL_PGD_BOUNDARY].pgd); 1874 kernel_pmd = m2v(pgd[KERNEL_PGD_BOUNDARY].pgd);
1872 memcpy(initial_kernel_pmd, kernel_pmd, sizeof(pmd_t) * PTRS_PER_PMD); 1875 memcpy(initial_kernel_pmd, kernel_pmd, sizeof(pmd_t) * PTRS_PER_PMD);
diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c
index 215a3ce61068..141eb0de8b06 100644
--- a/arch/x86/xen/p2m.c
+++ b/arch/x86/xen/p2m.c
@@ -497,7 +497,7 @@ static bool alloc_p2m(unsigned long pfn)
497 return true; 497 return true;
498} 498}
499 499
500bool __early_alloc_p2m(unsigned long pfn) 500static bool __init __early_alloc_p2m(unsigned long pfn)
501{ 501{
502 unsigned topidx, mididx, idx; 502 unsigned topidx, mididx, idx;
503 503
@@ -530,7 +530,7 @@ bool __early_alloc_p2m(unsigned long pfn)
530 } 530 }
531 return idx != 0; 531 return idx != 0;
532} 532}
533unsigned long set_phys_range_identity(unsigned long pfn_s, 533unsigned long __init set_phys_range_identity(unsigned long pfn_s,
534 unsigned long pfn_e) 534 unsigned long pfn_e)
535{ 535{
536 unsigned long pfn; 536 unsigned long pfn;
@@ -671,7 +671,9 @@ int m2p_add_override(unsigned long mfn, struct page *page)
671 page->private = mfn; 671 page->private = mfn;
672 page->index = pfn_to_mfn(pfn); 672 page->index = pfn_to_mfn(pfn);
673 673
674 __set_phys_to_machine(pfn, FOREIGN_FRAME(mfn)); 674 if (unlikely(!set_phys_to_machine(pfn, FOREIGN_FRAME(mfn))))
675 return -ENOMEM;
676
675 if (!PageHighMem(page)) 677 if (!PageHighMem(page))
676 /* Just zap old mapping for now */ 678 /* Just zap old mapping for now */
677 pte_clear(&init_mm, address, ptep); 679 pte_clear(&init_mm, address, ptep);
@@ -709,7 +711,7 @@ int m2p_remove_override(struct page *page)
709 spin_lock_irqsave(&m2p_override_lock, flags); 711 spin_lock_irqsave(&m2p_override_lock, flags);
710 list_del(&page->lru); 712 list_del(&page->lru);
711 spin_unlock_irqrestore(&m2p_override_lock, flags); 713 spin_unlock_irqrestore(&m2p_override_lock, flags);
712 __set_phys_to_machine(pfn, page->index); 714 set_phys_to_machine(pfn, page->index);
713 715
714 if (!PageHighMem(page)) 716 if (!PageHighMem(page))
715 set_pte_at(&init_mm, address, ptep, 717 set_pte_at(&init_mm, address, ptep,