aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/xen/enlighten.c25
-rw-r--r--arch/x86/xen/mmu.c47
-rw-r--r--arch/x86/xen/xen-ops.h1
3 files changed, 8 insertions, 65 deletions
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index fac5e4f9607c..6bf3a13e3e0f 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1100,12 +1100,6 @@ static int xen_write_msr_safe(unsigned int msr, unsigned low, unsigned high)
1100 /* Fast syscall setup is all done in hypercalls, so 1100 /* Fast syscall setup is all done in hypercalls, so
1101 these are all ignored. Stub them out here to stop 1101 these are all ignored. Stub them out here to stop
1102 Xen console noise. */ 1102 Xen console noise. */
1103 break;
1104
1105 case MSR_IA32_CR_PAT:
1106 if (smp_processor_id() == 0)
1107 xen_set_pat(((u64)high << 32) | low);
1108 break;
1109 1103
1110 default: 1104 default:
1111 ret = native_write_msr_safe(msr, low, high); 1105 ret = native_write_msr_safe(msr, low, high);
@@ -1561,10 +1555,6 @@ asmlinkage __visible void __init xen_start_kernel(void)
1561 1555
1562 /* Prevent unwanted bits from being set in PTEs. */ 1556 /* Prevent unwanted bits from being set in PTEs. */
1563 __supported_pte_mask &= ~_PAGE_GLOBAL; 1557 __supported_pte_mask &= ~_PAGE_GLOBAL;
1564#if 0
1565 if (!xen_initial_domain())
1566#endif
1567 __supported_pte_mask &= ~(_PAGE_PWT | _PAGE_PCD);
1568 1558
1569 /* 1559 /*
1570 * Prevent page tables from being allocated in highmem, even 1560 * Prevent page tables from being allocated in highmem, even
@@ -1618,14 +1608,6 @@ asmlinkage __visible void __init xen_start_kernel(void)
1618 */ 1608 */
1619 acpi_numa = -1; 1609 acpi_numa = -1;
1620#endif 1610#endif
1621#ifdef CONFIG_X86_PAT
1622 /*
1623 * For right now disable the PAT. We should remove this once
1624 * git commit 8eaffa67b43e99ae581622c5133e20b0f48bcef1
1625 * (xen/pat: Disable PAT support for now) is reverted.
1626 */
1627 pat_enabled = 0;
1628#endif
1629 /* Don't do the full vcpu_info placement stuff until we have a 1611 /* Don't do the full vcpu_info placement stuff until we have a
1630 possible map and a non-dummy shared_info. */ 1612 possible map and a non-dummy shared_info. */
1631 per_cpu(xen_vcpu, 0) = &HYPERVISOR_shared_info->vcpu_info[0]; 1613 per_cpu(xen_vcpu, 0) = &HYPERVISOR_shared_info->vcpu_info[0];
@@ -1636,6 +1618,13 @@ asmlinkage __visible void __init xen_start_kernel(void)
1636 xen_raw_console_write("mapping kernel into physical memory\n"); 1618 xen_raw_console_write("mapping kernel into physical memory\n");
1637 xen_setup_kernel_pagetable((pgd_t *)xen_start_info->pt_base, xen_start_info->nr_pages); 1619 xen_setup_kernel_pagetable((pgd_t *)xen_start_info->pt_base, xen_start_info->nr_pages);
1638 1620
1621 /*
1622 * Modify the cache mode translation tables to match Xen's PAT
1623 * configuration.
1624 */
1625
1626 pat_init_cache_modes();
1627
1639 /* keep using Xen gdt for now; no urgent need to change it */ 1628 /* keep using Xen gdt for now; no urgent need to change it */
1640 1629
1641#ifdef CONFIG_X86_32 1630#ifdef CONFIG_X86_32
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index a8a1a3d08d4d..9855eb8ee4b3 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);
diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h
index 28c7e0be56e4..4ab9298c5e17 100644
--- a/arch/x86/xen/xen-ops.h
+++ b/arch/x86/xen/xen-ops.h
@@ -33,7 +33,6 @@ extern unsigned long xen_max_p2m_pfn;
33 33
34void xen_mm_pin_all(void); 34void xen_mm_pin_all(void);
35void xen_mm_unpin_all(void); 35void xen_mm_unpin_all(void);
36void xen_set_pat(u64);
37 36
38char * __init xen_memory_setup(void); 37char * __init xen_memory_setup(void);
39char * xen_auto_xlated_memory_setup(void); 38char * xen_auto_xlated_memory_setup(void);