diff -uNrp linux-3.9.11-200.fc18.x86_64/arch/x86/include/asm/pgtable.h linux-3.9.11-200.PAT.fc18.x86_64/arch/x86/include/asm/pgtable.h --- linux-3.9.11-200.fc18.x86_64/arch/x86/include/asm/pgtable.h 2013-08-13 22:35:49.372205382 +0200 +++ linux-3.9.11-200.fc18.x86_64/arch/x86/include/asm/pgtable.h 2013-08-13 22:58:23.212956533 +0200 @@ -353,6 +353,11 @@ static inline pgprot_t pgprot_modify(pgp return __pgprot(preservebits | addbits); } +static inline pgprot_t pte_attrs(pte_t pte) +{ + return __pgprot(pte_val(pte) & PTE_FLAGS_MASK); +} + #define pte_pgprot(x) __pgprot(pte_flags(x) & PTE_FLAGS_MASK) #define canon_pgprot(p) __pgprot(massage_pgprot(p)) diff -uNrp linux-3.9.11-200.fc18.x86_64/arch/x86/mm/pageattr.c linux-3.9.11-200.PAT.fc18.x86_64/arch/x86/mm/pageattr.c --- linux-3.9.11-200.fc18.x86_64/arch/x86/mm/pageattr.c 2013-08-13 22:35:49.377206198 +0200 +++ linux-3.9.11-200.fc18.x86_64/arch/x86/mm/pageattr.c 2013-08-13 22:58:23.213956696 +0200 @@ -708,7 +708,7 @@ repeat: if (level == PG_LEVEL_4K) { pte_t new_pte; - pgprot_t new_prot = pte_pgprot(old_pte); + pgprot_t new_prot = pte_attrs(old_pte); unsigned long pfn = pte_pfn(old_pte); pgprot_val(new_prot) &= ~pgprot_val(cpa->mask_clr); diff -uNrp linux-3.9.11-200.fc18.x86_64/arch/x86/xen/enlighten.c linux-3.9.11-200.PAT.fc18.x86_64/arch/x86/xen/enlighten.c --- linux-3.9.11-200.fc18.x86_64/arch/x86/xen/enlighten.c 2013-08-13 22:35:49.404210605 +0200 +++ linux-3.9.11-200.fc18.x86_64/arch/x86/xen/enlighten.c 2013-08-13 22:52:28.505074079 +0200 @@ -67,7 +67,6 @@ #include #include #include -#include #ifdef CONFIG_ACPI #include @@ -1371,9 +1370,7 @@ asmlinkage void __init xen_start_kernel( /* Prevent unwanted bits from being set in PTEs. */ __supported_pte_mask &= ~_PAGE_GLOBAL; -#if 0 if (!xen_initial_domain()) -#endif __supported_pte_mask &= ~(_PAGE_PWT | _PAGE_PCD); __supported_pte_mask |= _PAGE_IOMAP; @@ -1433,14 +1430,7 @@ asmlinkage void __init xen_start_kernel( */ acpi_numa = -1; #endif -#ifdef CONFIG_X86_PAT - /* - * For right now disable the PAT. We should remove this once - * git commit 8eaffa67b43e99ae581622c5133e20b0f48bcef1 - * (xen/pat: Disable PAT support for now) is reverted. - */ - pat_enabled = 0; -#endif + /* Don't do the full vcpu_info placement stuff until we have a possible map and a non-dummy shared_info. */ per_cpu(xen_vcpu, 0) = &HYPERVISOR_shared_info->vcpu_info[0]; diff -uNrp linux-3.9.11-200.fc18.x86_64/arch/x86/xen/mmu.c linux-3.9.11-200.PAT.fc18.x86_64/arch/x86/xen/mmu.c --- linux-3.9.11-200.fc18.x86_64/arch/x86/xen/mmu.c 2013-08-13 22:35:49.404210605 +0200 +++ linux-3.9.11-200.fc18.x86_64/arch/x86/xen/mmu.c 2013-08-13 22:47:19.885598037 +0200 @@ -434,13 +434,13 @@ static pteval_t iomap_pte(pteval_t val) static pteval_t xen_pte_val(pte_t pte) { pteval_t pteval = pte.pte; -#if 0 + /* If this is a WC pte, convert back from Xen WC to Linux WC */ if ((pteval & (_PAGE_PAT | _PAGE_PCD | _PAGE_PWT)) == _PAGE_PAT) { WARN_ON(!pat_enabled); pteval = (pteval & ~_PAGE_PAT) | _PAGE_PWT; } -#endif + if (xen_initial_domain() && (pteval & _PAGE_IOMAP)) return pteval; @@ -482,7 +482,7 @@ void xen_set_pat(u64 pat) static pte_t xen_make_pte(pteval_t pte) { phys_addr_t addr = (pte & PTE_PFN_MASK); -#if 0 + /* If Linux is trying to set a WC pte, then map to the Xen WC. * If _PAGE_PAT is set, then it probably means it is really * _PAGE_PSE, so avoid fiddling with the PAT mapping and hope @@ -495,7 +495,7 @@ static pte_t xen_make_pte(pteval_t pte) if ((pte & (_PAGE_PCD | _PAGE_PWT)) == _PAGE_PWT) pte = (pte & ~(_PAGE_PCD | _PAGE_PWT)) | _PAGE_PAT; } -#endif + /* * Unprivileged domains are allowed to do IOMAPpings for * PCI passthrough, but not map ISA space. The ISA