xen: mask unwanted pte bits in __supported_pte_mask
authorJeremy Fitzhardinge <jeremy@goop.org>
Mon, 16 Jun 2008 22:01:53 +0000 (15:01 -0700)
committerIngo Molnar <mingo@elte.hu>
Fri, 20 Jun 2008 12:56:36 +0000 (14:56 +0200)
[ Stable: this isn't a bugfix in itself, but it's a pre-requiste
  for "xen: don't drop NX bit" ]

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Cc: Stable Kernel <stable@kernel.org>
Cc: the arch/x86 maintainers <x86@kernel.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/xen/enlighten.c
arch/x86/xen/mmu.c

index c8a56e457d61a35c21040bbe91486f9ceb9bf6bf..c048de34d6a1dad0671fc966e1f332ec3db77219 100644 (file)
@@ -1228,6 +1228,11 @@ asmlinkage void __init xen_start_kernel(void)
        if (xen_feature(XENFEAT_supervisor_mode_kernel))
                pv_info.kernel_rpl = 0;
 
+       /* Prevent unwanted bits from being set in PTEs. */
+       __supported_pte_mask &= ~_PAGE_GLOBAL;
+       if (!is_initial_xendomain())
+               __supported_pte_mask &= ~(_PAGE_PWT | _PAGE_PCD);
+
        /* set the limit of our address space */
        xen_reserve_top();
 
index 3525ef523a74c6e102954a36ab7763a40f3de444..3f2a67fe6ad6b4a1be5958d7d5df4914e15c71f6 100644 (file)
@@ -199,10 +199,8 @@ pgdval_t xen_pgd_val(pgd_t pgd)
 
 pte_t xen_make_pte(pteval_t pte)
 {
-       if (pte & _PAGE_PRESENT) {
+       if (pte & _PAGE_PRESENT)
                pte = phys_to_machine(XPADDR(pte)).maddr;
-               pte &= ~(_PAGE_PCD | _PAGE_PWT);
-       }
 
        return (pte_t){ .pte = pte };
 }