ia64/xen-unstable

changeset 5298:b3907ddefba4

bitkeeper revision 1.1659 (42a010dfU0RKWV-1WrueKEs8brwyOg)

Ensure that _PAGE_GLOBAL bit is never set in any pagetable if the CPU
does not support PGE (Page Global Extension).
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Fri Jun 03 08:12:15 2005 +0000 (2005-06-03)
parents cc7982c93f34
children 35b69ed1f23b
files xen/arch/x86/setup.c xen/arch/x86/x86_32/mm.c xen/include/asm-x86/page.h xen/include/asm-x86/x86_32/page.h xen/include/asm-x86/x86_64/page.h
line diff
     1.1 --- a/xen/arch/x86/setup.c	Fri Jun 03 07:55:30 2005 +0000
     1.2 +++ b/xen/arch/x86/setup.c	Fri Jun 03 08:12:15 2005 +0000
     1.3 @@ -147,6 +147,8 @@ static void __init start_of_day(void)
     1.4  
     1.5      early_cpu_init();
     1.6  
     1.7 +    paging_init();
     1.8 +
     1.9      /* Unmap the first page of CPU0's stack. */
    1.10      memguard_guard_stack(cpu0_stack);
    1.11  
    1.12 @@ -168,8 +170,6 @@ static void __init start_of_day(void)
    1.13  
    1.14      smp_alloc_memory();
    1.15  
    1.16 -    paging_init();
    1.17 -
    1.18      dmi_scan_machine();
    1.19  
    1.20      generic_apic_probe();
     2.1 --- a/xen/arch/x86/x86_32/mm.c	Fri Jun 03 07:55:30 2005 +0000
     2.2 +++ b/xen/arch/x86/x86_32/mm.c	Fri Jun 03 08:12:15 2005 +0000
     2.3 @@ -28,6 +28,9 @@
     2.4  #include <asm/fixmap.h>
     2.5  #include <asm/domain_page.h>
     2.6  
     2.7 +unsigned int PAGE_HYPERVISOR         = __PAGE_HYPERVISOR;
     2.8 +unsigned int PAGE_HYPERVISOR_NOCACHE = __PAGE_HYPERVISOR_NOCACHE;
     2.9 +
    2.10  static unsigned long mpt_size;
    2.11  
    2.12  struct pfn_info *alloc_xen_pagetable(void)
    2.13 @@ -72,6 +75,19 @@ void __init paging_init(void)
    2.14  
    2.15      idle0_vcpu.arch.monitor_table = mk_pagetable(__pa(idle_pg_table));
    2.16  
    2.17 +    if ( cpu_has_pge )
    2.18 +    {
    2.19 +        /* Suitable Xen mapping can be GLOBAL. */
    2.20 +        PAGE_HYPERVISOR         |= _PAGE_GLOBAL;
    2.21 +        PAGE_HYPERVISOR_NOCACHE |= _PAGE_GLOBAL;
    2.22 +        /* Transform early mappings (e.g., the frametable). */
    2.23 +        for ( v = HYPERVISOR_VIRT_START; v; v += (1 << L2_PAGETABLE_SHIFT) )
    2.24 +            if ( (l2e_get_flags(idle_pg_table_l2[l2_linear_offset(v)]) &
    2.25 +                  (_PAGE_PSE|_PAGE_PRESENT)) == (_PAGE_PSE|_PAGE_PRESENT) )
    2.26 +                l2e_add_flags(idle_pg_table_l2[l2_linear_offset(v)],
    2.27 +                              _PAGE_GLOBAL);
    2.28 +    }
    2.29 +
    2.30      /*
    2.31       * Allocate and map the machine-to-phys table and create read-only mapping 
    2.32       * of MPT for guest-OS use.  Without PAE we'll end up with one 4MB page, 
    2.33 @@ -86,26 +102,12 @@ void __init paging_init(void)
    2.34          if ( (pg = alloc_domheap_pages(NULL, PAGETABLE_ORDER)) == NULL )
    2.35              panic("Not enough memory to bootstrap Xen.\n");
    2.36          idle_pg_table_l2[l2_linear_offset(RDWR_MPT_VIRT_START) + i] =
    2.37 -            l2e_from_page(pg, __PAGE_HYPERVISOR | _PAGE_PSE);
    2.38 +            l2e_from_page(pg, PAGE_HYPERVISOR | _PAGE_PSE);
    2.39          idle_pg_table_l2[l2_linear_offset(RO_MPT_VIRT_START) + i] =
    2.40              l2e_from_page(pg, (__PAGE_HYPERVISOR | _PAGE_PSE) & ~_PAGE_RW);
    2.41      }
    2.42      memset((void *)RDWR_MPT_VIRT_START, 0x55, mpt_size);
    2.43  
    2.44 -    /* Xen PSE mappings can all be GLOBAL. */
    2.45 -    if ( cpu_has_pge )
    2.46 -    {
    2.47 -        for ( v = HYPERVISOR_VIRT_START; v; v += (1 << L2_PAGETABLE_SHIFT) )
    2.48 -        {
    2.49 -            if ( (l2e_get_flags(idle_pg_table_l2[l2_linear_offset(v)]) &
    2.50 -                  (_PAGE_PSE|_PAGE_PRESENT)) != (_PAGE_PSE|_PAGE_PRESENT) )
    2.51 -                continue;
    2.52 -            if ( (v >= RO_MPT_VIRT_START) && (v < RO_MPT_VIRT_END) )
    2.53 -                continue;
    2.54 -            l2e_add_flags(idle_pg_table_l2[l2_linear_offset(v)], _PAGE_GLOBAL);
    2.55 -        }
    2.56 -    }
    2.57 -
    2.58      /* Create page tables for ioremap(). */
    2.59      for ( i = 0; i < (IOREMAP_MBYTES >> (L2_PAGETABLE_SHIFT - 20)); i++ )
    2.60      {
     3.1 --- a/xen/include/asm-x86/page.h	Fri Jun 03 07:55:30 2005 +0000
     3.2 +++ b/xen/include/asm-x86/page.h	Fri Jun 03 08:12:15 2005 +0000
     3.3 @@ -257,11 +257,6 @@ extern void paging_init(void);
     3.4  #define __PAGE_HYPERVISOR_NOCACHE \
     3.5      (_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_PCD | _PAGE_ACCESSED)
     3.6  
     3.7 -#define MAKE_GLOBAL(_x) ((_x) | _PAGE_GLOBAL)
     3.8 -
     3.9 -#define PAGE_HYPERVISOR MAKE_GLOBAL(__PAGE_HYPERVISOR)
    3.10 -#define PAGE_HYPERVISOR_NOCACHE MAKE_GLOBAL(__PAGE_HYPERVISOR_NOCACHE)
    3.11 -
    3.12  #ifndef __ASSEMBLY__
    3.13  
    3.14  static __inline__ int get_order(unsigned long size)
     4.1 --- a/xen/include/asm-x86/x86_32/page.h	Fri Jun 03 07:55:30 2005 +0000
     4.2 +++ b/xen/include/asm-x86/x86_32/page.h	Fri Jun 03 08:12:15 2005 +0000
     4.3 @@ -20,6 +20,11 @@
     4.4  #define l1_linear_offset(_a) ((_a) >> L1_PAGETABLE_SHIFT)
     4.5  #define l2_linear_offset(_a) ((_a) >> L2_PAGETABLE_SHIFT)
     4.6  
     4.7 +#ifndef __ASSEMBLY__
     4.8 +extern unsigned int PAGE_HYPERVISOR;
     4.9 +extern unsigned int PAGE_HYPERVISOR_NOCACHE;
    4.10 +#endif
    4.11 +
    4.12  #endif /* __X86_32_PAGE_H__ */
    4.13  
    4.14  /*
     5.1 --- a/xen/include/asm-x86/x86_64/page.h	Fri Jun 03 07:55:30 2005 +0000
     5.2 +++ b/xen/include/asm-x86/x86_64/page.h	Fri Jun 03 08:12:15 2005 +0000
     5.3 @@ -76,6 +76,9 @@ typedef l4_pgentry_t root_pgentry_t;
     5.4  #define L3_DISALLOW_MASK (0xFFFFF180U & ~_PAGE_NX) /* must-be-zero */
     5.5  #define L4_DISALLOW_MASK (0xFFFFF180U & ~_PAGE_NX) /* must-be-zero */
     5.6  
     5.7 +#define PAGE_HYPERVISOR         (__PAGE_HYPERVISOR         | _PAGE_GLOBAL)
     5.8 +#define PAGE_HYPERVISOR_NOCACHE (__PAGE_HYPERVISOR_NOCACHE | _PAGE_GLOBAL)
     5.9 +
    5.10  #endif /* __X86_64_PAGE_H__ */
    5.11  
    5.12  /*