aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/xen
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/xen')
-rw-r--r--arch/x86/xen/enlighten.c25
-rw-r--r--arch/x86/xen/mmu.c53
-rw-r--r--arch/x86/xen/xen-ops.h1
3 files changed, 12 insertions, 67 deletions
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 115016347806..78a881b7fc41 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1102,12 +1102,6 @@ static int xen_write_msr_safe(unsigned int msr, unsigned low, unsigned high)
1102 /* Fast syscall setup is all done in hypercalls, so 1102 /* Fast syscall setup is all done in hypercalls, so
1103 these are all ignored. Stub them out here to stop 1103 these are all ignored. Stub them out here to stop
1104 Xen console noise. */ 1104 Xen console noise. */
1105 break;
1106
1107 case MSR_IA32_CR_PAT:
1108 if (smp_processor_id() == 0)
1109 xen_set_pat(((u64)high << 32) | low);
1110 break;
1111 1105
1112 default: 1106 default:
1113 ret = native_write_msr_safe(msr, low, high); 1107 ret = native_write_msr_safe(msr, low, high);
@@ -1581,10 +1575,6 @@ asmlinkage __visible void __init xen_start_kernel(void)
1581 1575
1582 /* Prevent unwanted bits from being set in PTEs. */ 1576 /* Prevent unwanted bits from being set in PTEs. */
1583 __supported_pte_mask &= ~_PAGE_GLOBAL; 1577 __supported_pte_mask &= ~_PAGE_GLOBAL;
1584#if 0
1585 if (!xen_initial_domain())
1586#endif
1587 __supported_pte_mask &= ~(_PAGE_PWT | _PAGE_PCD);
1588 1578
1589 /* 1579 /*
1590 * Prevent page tables from being allocated in highmem, even 1580 * Prevent page tables from being allocated in highmem, even
@@ -1638,14 +1628,6 @@ asmlinkage __visible void __init xen_start_kernel(void)
1638 */ 1628 */
1639 acpi_numa = -1; 1629 acpi_numa = -1;
1640#endif 1630#endif
1641#ifdef CONFIG_X86_PAT
1642 /*
1643 * For right now disable the PAT. We should remove this once
1644 * git commit 8eaffa67b43e99ae581622c5133e20b0f48bcef1
1645 * (xen/pat: Disable PAT support for now) is reverted.
1646 */
1647 pat_enabled = 0;
1648#endif
1649 /* Don't do the full vcpu_info placement stuff until we have a 1631 /* Don't do the full vcpu_info placement stuff until we have a
1650 possible map and a non-dummy shared_info. */ 1632 possible map and a non-dummy shared_info. */
1651 per_cpu(xen_vcpu, 0) = &HYPERVISOR_shared_info->vcpu_info[0]; 1633 per_cpu(xen_vcpu, 0) = &HYPERVISOR_shared_info->vcpu_info[0];
@@ -1656,6 +1638,13 @@ asmlinkage __visible void __init xen_start_kernel(void)
1656 xen_raw_console_write("mapping kernel into physical memory\n"); 1638 xen_raw_console_write("mapping kernel into physical memory\n");
1657 xen_setup_kernel_pagetable((pgd_t *)xen_start_info->pt_base, xen_start_info->nr_pages); 1639 xen_setup_kernel_pagetable((pgd_t *)xen_start_info->pt_base, xen_start_info->nr_pages);
1658 1640
1641 /*
1642 * Modify the cache mode translation tables to match Xen's PAT
1643 * configuration.
1644 */
1645
1646 pat_init_cache_modes();
1647
1659 /* keep using Xen gdt for now; no urgent need to change it */ 1648 /* keep using Xen gdt for now; no urgent need to change it */
1660 1649
1661#ifdef CONFIG_X86_32 1650#ifdef CONFIG_X86_32
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index a1a429a410ef..5c1f9ace7ae7 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -410,13 +410,7 @@ static pteval_t pte_pfn_to_mfn(pteval_t val)
410__visible pteval_t xen_pte_val(pte_t pte) 410__visible pteval_t xen_pte_val(pte_t pte)
411{ 411{
412 pteval_t pteval = pte.pte; 412 pteval_t pteval = pte.pte;
413#if 0 413
414 /* If this is a WC pte, convert back from Xen WC to Linux WC */
415 if ((pteval & (_PAGE_PAT | _PAGE_PCD | _PAGE_PWT)) == _PAGE_PAT) {
416 WARN_ON(!pat_enabled);
417 pteval = (pteval & ~_PAGE_PAT) | _PAGE_PWT;
418 }
419#endif
420 return pte_mfn_to_pfn(pteval); 414 return pte_mfn_to_pfn(pteval);
421} 415}
422PV_CALLEE_SAVE_REGS_THUNK(xen_pte_val); 416PV_CALLEE_SAVE_REGS_THUNK(xen_pte_val);
@@ -427,47 +421,8 @@ __visible pgdval_t xen_pgd_val(pgd_t pgd)
427} 421}
428PV_CALLEE_SAVE_REGS_THUNK(xen_pgd_val); 422PV_CALLEE_SAVE_REGS_THUNK(xen_pgd_val);
429 423
430/*
431 * Xen's PAT setup is part of its ABI, though I assume entries 6 & 7
432 * are reserved for now, to correspond to the Intel-reserved PAT
433 * types.
434 *
435 * We expect Linux's PAT set as follows:
436 *
437 * Idx PTE flags Linux Xen Default
438 * 0 WB WB WB
439 * 1 PWT WC WT WT
440 * 2 PCD UC- UC- UC-
441 * 3 PCD PWT UC UC UC
442 * 4 PAT WB WC WB
443 * 5 PAT PWT WC WP WT
444 * 6 PAT PCD UC- rsv UC-
445 * 7 PAT PCD PWT UC rsv UC
446 */
447
448void xen_set_pat(u64 pat)
449{
450 /* We expect Linux to use a PAT setting of
451 * UC UC- WC WB (ignoring the PAT flag) */
452 WARN_ON(pat != 0x0007010600070106ull);
453}
454
455__visible pte_t xen_make_pte(pteval_t pte) 424__visible pte_t xen_make_pte(pteval_t pte)
456{ 425{
457#if 0
458 /* If Linux is trying to set a WC pte, then map to the Xen WC.
459 * If _PAGE_PAT is set, then it probably means it is really
460 * _PAGE_PSE, so avoid fiddling with the PAT mapping and hope
461 * things work out OK...
462 *
463 * (We should never see kernel mappings with _PAGE_PSE set,
464 * but we could see hugetlbfs mappings, I think.).
465 */
466 if (pat_enabled && !WARN_ON(pte & _PAGE_PAT)) {
467 if ((pte & (_PAGE_PCD | _PAGE_PWT)) == _PAGE_PWT)
468 pte = (pte & ~(_PAGE_PCD | _PAGE_PWT)) | _PAGE_PAT;
469 }
470#endif
471 pte = pte_pfn_to_mfn(pte); 426 pte = pte_pfn_to_mfn(pte);
472 427
473 return native_make_pte(pte); 428 return native_make_pte(pte);
@@ -1469,8 +1424,10 @@ static int xen_pgd_alloc(struct mm_struct *mm)
1469 page->private = (unsigned long)user_pgd; 1424 page->private = (unsigned long)user_pgd;
1470 1425
1471 if (user_pgd != NULL) { 1426 if (user_pgd != NULL) {
1427#ifdef CONFIG_X86_VSYSCALL_EMULATION
1472 user_pgd[pgd_index(VSYSCALL_ADDR)] = 1428 user_pgd[pgd_index(VSYSCALL_ADDR)] =
1473 __pgd(__pa(level3_user_vsyscall) | _PAGE_TABLE); 1429 __pgd(__pa(level3_user_vsyscall) | _PAGE_TABLE);
1430#endif
1474 ret = 0; 1431 ret = 0;
1475 } 1432 }
1476 1433
@@ -2033,7 +1990,7 @@ static void xen_set_fixmap(unsigned idx, phys_addr_t phys, pgprot_t prot)
2033# ifdef CONFIG_HIGHMEM 1990# ifdef CONFIG_HIGHMEM
2034 case FIX_KMAP_BEGIN ... FIX_KMAP_END: 1991 case FIX_KMAP_BEGIN ... FIX_KMAP_END:
2035# endif 1992# endif
2036#else 1993#elif defined(CONFIG_X86_VSYSCALL_EMULATION)
2037 case VSYSCALL_PAGE: 1994 case VSYSCALL_PAGE:
2038#endif 1995#endif
2039 case FIX_TEXT_POKE0: 1996 case FIX_TEXT_POKE0:
@@ -2072,7 +2029,7 @@ static void xen_set_fixmap(unsigned idx, phys_addr_t phys, pgprot_t prot)
2072 2029
2073 __native_set_fixmap(idx, pte); 2030 __native_set_fixmap(idx, pte);
2074 2031
2075#ifdef CONFIG_X86_64 2032#ifdef CONFIG_X86_VSYSCALL_EMULATION
2076 /* Replicate changes to map the vsyscall page into the user 2033 /* Replicate changes to map the vsyscall page into the user
2077 pagetable vsyscall mapping. */ 2034 pagetable vsyscall mapping. */
2078 if (idx == VSYSCALL_PAGE) { 2035 if (idx == VSYSCALL_PAGE) {
diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h
index f92921fa54f9..5686bd9d58cc 100644
--- a/arch/x86/xen/xen-ops.h
+++ b/arch/x86/xen/xen-ops.h
@@ -32,7 +32,6 @@ void xen_reserve_top(void);
32 32
33void xen_mm_pin_all(void); 33void xen_mm_pin_all(void);
34void xen_mm_unpin_all(void); 34void xen_mm_unpin_all(void);
35void xen_set_pat(u64);
36 35
37unsigned long __ref xen_chk_extra_mem(unsigned long pfn); 36unsigned long __ref xen_chk_extra_mem(unsigned long pfn);
38void __init xen_inv_extra_mem(void); 37void __init xen_inv_extra_mem(void);