diff options
Diffstat (limited to 'arch/x86/xen')
| -rw-r--r-- | arch/x86/xen/enlighten.c | 3 | ||||
| -rw-r--r-- | arch/x86/xen/mmu.c | 31 | ||||
| -rw-r--r-- | arch/x86/xen/setup.c | 3 |
3 files changed, 26 insertions, 11 deletions
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index 7d46c8441418..63b83ceebd1a 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c | |||
| @@ -30,6 +30,7 @@ | |||
| 30 | #include <linux/console.h> | 30 | #include <linux/console.h> |
| 31 | #include <linux/pci.h> | 31 | #include <linux/pci.h> |
| 32 | #include <linux/gfp.h> | 32 | #include <linux/gfp.h> |
| 33 | #include <linux/memblock.h> | ||
| 33 | 34 | ||
| 34 | #include <xen/xen.h> | 35 | #include <xen/xen.h> |
| 35 | #include <xen/interface/xen.h> | 36 | #include <xen/interface/xen.h> |
| @@ -1183,6 +1184,8 @@ asmlinkage void __init xen_start_kernel(void) | |||
| 1183 | local_irq_disable(); | 1184 | local_irq_disable(); |
| 1184 | early_boot_irqs_off(); | 1185 | early_boot_irqs_off(); |
| 1185 | 1186 | ||
| 1187 | memblock_init(); | ||
| 1188 | |||
| 1186 | xen_raw_console_write("mapping kernel into physical memory\n"); | 1189 | xen_raw_console_write("mapping kernel into physical memory\n"); |
| 1187 | pgd = xen_setup_kernel_pagetable(pgd, xen_start_info->nr_pages); | 1190 | pgd = xen_setup_kernel_pagetable(pgd, xen_start_info->nr_pages); |
| 1188 | 1191 | ||
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c index b2363fcbcd0f..f72d18c69221 100644 --- a/arch/x86/xen/mmu.c +++ b/arch/x86/xen/mmu.c | |||
| @@ -45,6 +45,7 @@ | |||
| 45 | #include <linux/vmalloc.h> | 45 | #include <linux/vmalloc.h> |
| 46 | #include <linux/module.h> | 46 | #include <linux/module.h> |
| 47 | #include <linux/gfp.h> | 47 | #include <linux/gfp.h> |
| 48 | #include <linux/memblock.h> | ||
| 48 | 49 | ||
| 49 | #include <asm/pgtable.h> | 50 | #include <asm/pgtable.h> |
| 50 | #include <asm/tlbflush.h> | 51 | #include <asm/tlbflush.h> |
| @@ -55,6 +56,7 @@ | |||
| 55 | #include <asm/e820.h> | 56 | #include <asm/e820.h> |
| 56 | #include <asm/linkage.h> | 57 | #include <asm/linkage.h> |
| 57 | #include <asm/page.h> | 58 | #include <asm/page.h> |
| 59 | #include <asm/init.h> | ||
| 58 | 60 | ||
| 59 | #include <asm/xen/hypercall.h> | 61 | #include <asm/xen/hypercall.h> |
| 60 | #include <asm/xen/hypervisor.h> | 62 | #include <asm/xen/hypervisor.h> |
| @@ -359,7 +361,8 @@ void make_lowmem_page_readonly(void *vaddr) | |||
| 359 | unsigned int level; | 361 | unsigned int level; |
| 360 | 362 | ||
| 361 | pte = lookup_address(address, &level); | 363 | pte = lookup_address(address, &level); |
| 362 | BUG_ON(pte == NULL); | 364 | if (pte == NULL) |
| 365 | return; /* vaddr missing */ | ||
| 363 | 366 | ||
| 364 | ptev = pte_wrprotect(*pte); | 367 | ptev = pte_wrprotect(*pte); |
| 365 | 368 | ||
| @@ -374,7 +377,8 @@ void make_lowmem_page_readwrite(void *vaddr) | |||
| 374 | unsigned int level; | 377 | unsigned int level; |
| 375 | 378 | ||
| 376 | pte = lookup_address(address, &level); | 379 | pte = lookup_address(address, &level); |
| 377 | BUG_ON(pte == NULL); | 380 | if (pte == NULL) |
| 381 | return; /* vaddr missing */ | ||
| 378 | 382 | ||
| 379 | ptev = pte_mkwrite(*pte); | 383 | ptev = pte_mkwrite(*pte); |
| 380 | 384 | ||
| @@ -1508,13 +1512,25 @@ static void xen_pgd_free(struct mm_struct *mm, pgd_t *pgd) | |||
| 1508 | #endif | 1512 | #endif |
| 1509 | } | 1513 | } |
| 1510 | 1514 | ||
| 1511 | #ifdef CONFIG_X86_32 | ||
| 1512 | static __init pte_t mask_rw_pte(pte_t *ptep, pte_t pte) | 1515 | static __init pte_t mask_rw_pte(pte_t *ptep, pte_t pte) |
| 1513 | { | 1516 | { |
| 1517 | unsigned long pfn = pte_pfn(pte); | ||
| 1518 | |||
| 1519 | #ifdef CONFIG_X86_32 | ||
| 1514 | /* If there's an existing pte, then don't allow _PAGE_RW to be set */ | 1520 | /* If there's an existing pte, then don't allow _PAGE_RW to be set */ |
| 1515 | if (pte_val_ma(*ptep) & _PAGE_PRESENT) | 1521 | if (pte_val_ma(*ptep) & _PAGE_PRESENT) |
| 1516 | pte = __pte_ma(((pte_val_ma(*ptep) & _PAGE_RW) | ~_PAGE_RW) & | 1522 | pte = __pte_ma(((pte_val_ma(*ptep) & _PAGE_RW) | ~_PAGE_RW) & |
| 1517 | pte_val_ma(pte)); | 1523 | pte_val_ma(pte)); |
| 1524 | #endif | ||
| 1525 | |||
| 1526 | /* | ||
| 1527 | * If the new pfn is within the range of the newly allocated | ||
| 1528 | * kernel pagetable, and it isn't being mapped into an | ||
| 1529 | * early_ioremap fixmap slot, make sure it is RO. | ||
| 1530 | */ | ||
| 1531 | if (!is_early_ioremap_ptep(ptep) && | ||
| 1532 | pfn >= e820_table_start && pfn < e820_table_end) | ||
| 1533 | pte = pte_wrprotect(pte); | ||
| 1518 | 1534 | ||
| 1519 | return pte; | 1535 | return pte; |
| 1520 | } | 1536 | } |
| @@ -1527,7 +1543,6 @@ static __init void xen_set_pte_init(pte_t *ptep, pte_t pte) | |||
| 1527 | 1543 | ||
| 1528 | xen_set_pte(ptep, pte); | 1544 | xen_set_pte(ptep, pte); |
| 1529 | } | 1545 | } |
| 1530 | #endif | ||
| 1531 | 1546 | ||
| 1532 | static void pin_pagetable_pfn(unsigned cmd, unsigned long pfn) | 1547 | static void pin_pagetable_pfn(unsigned cmd, unsigned long pfn) |
| 1533 | { | 1548 | { |
| @@ -1814,7 +1829,7 @@ __init pgd_t *xen_setup_kernel_pagetable(pgd_t *pgd, | |||
| 1814 | __xen_write_cr3(true, __pa(pgd)); | 1829 | __xen_write_cr3(true, __pa(pgd)); |
| 1815 | xen_mc_issue(PARAVIRT_LAZY_CPU); | 1830 | xen_mc_issue(PARAVIRT_LAZY_CPU); |
| 1816 | 1831 | ||
| 1817 | reserve_early(__pa(xen_start_info->pt_base), | 1832 | memblock_x86_reserve_range(__pa(xen_start_info->pt_base), |
| 1818 | __pa(xen_start_info->pt_base + | 1833 | __pa(xen_start_info->pt_base + |
| 1819 | xen_start_info->nr_pt_frames * PAGE_SIZE), | 1834 | xen_start_info->nr_pt_frames * PAGE_SIZE), |
| 1820 | "XEN PAGETABLES"); | 1835 | "XEN PAGETABLES"); |
| @@ -1852,7 +1867,7 @@ __init pgd_t *xen_setup_kernel_pagetable(pgd_t *pgd, | |||
| 1852 | 1867 | ||
| 1853 | pin_pagetable_pfn(MMUEXT_PIN_L3_TABLE, PFN_DOWN(__pa(swapper_pg_dir))); | 1868 | pin_pagetable_pfn(MMUEXT_PIN_L3_TABLE, PFN_DOWN(__pa(swapper_pg_dir))); |
| 1854 | 1869 | ||
| 1855 | reserve_early(__pa(xen_start_info->pt_base), | 1870 | memblock_x86_reserve_range(__pa(xen_start_info->pt_base), |
| 1856 | __pa(xen_start_info->pt_base + | 1871 | __pa(xen_start_info->pt_base + |
| 1857 | xen_start_info->nr_pt_frames * PAGE_SIZE), | 1872 | xen_start_info->nr_pt_frames * PAGE_SIZE), |
| 1858 | "XEN PAGETABLES"); | 1873 | "XEN PAGETABLES"); |
| @@ -1971,11 +1986,7 @@ static const struct pv_mmu_ops xen_mmu_ops __initdata = { | |||
| 1971 | .alloc_pmd = xen_alloc_pmd_init, | 1986 | .alloc_pmd = xen_alloc_pmd_init, |
| 1972 | .release_pmd = xen_release_pmd_init, | 1987 | .release_pmd = xen_release_pmd_init, |
| 1973 | 1988 | ||
| 1974 | #ifdef CONFIG_X86_64 | ||
| 1975 | .set_pte = xen_set_pte, | ||
| 1976 | #else | ||
| 1977 | .set_pte = xen_set_pte_init, | 1989 | .set_pte = xen_set_pte_init, |
| 1978 | #endif | ||
| 1979 | .set_pte_at = xen_set_pte_at, | 1990 | .set_pte_at = xen_set_pte_at, |
| 1980 | .set_pmd = xen_set_pmd_hyper, | 1991 | .set_pmd = xen_set_pmd_hyper, |
| 1981 | 1992 | ||
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c index 328b00305426..9729c903404b 100644 --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | #include <linux/sched.h> | 8 | #include <linux/sched.h> |
| 9 | #include <linux/mm.h> | 9 | #include <linux/mm.h> |
| 10 | #include <linux/pm.h> | 10 | #include <linux/pm.h> |
| 11 | #include <linux/memblock.h> | ||
| 11 | 12 | ||
| 12 | #include <asm/elf.h> | 13 | #include <asm/elf.h> |
| 13 | #include <asm/vdso.h> | 14 | #include <asm/vdso.h> |
| @@ -129,7 +130,7 @@ char * __init xen_memory_setup(void) | |||
| 129 | * - xen_start_info | 130 | * - xen_start_info |
| 130 | * See comment above "struct start_info" in <xen/interface/xen.h> | 131 | * See comment above "struct start_info" in <xen/interface/xen.h> |
| 131 | */ | 132 | */ |
| 132 | reserve_early(__pa(xen_start_info->mfn_list), | 133 | memblock_x86_reserve_range(__pa(xen_start_info->mfn_list), |
| 133 | __pa(xen_start_info->pt_base), | 134 | __pa(xen_start_info->pt_base), |
| 134 | "XEN START INFO"); | 135 | "XEN START INFO"); |
| 135 | 136 | ||
