ia64/xen-unstable

changeset 5005:ba07574a5b6f

bitkeeper revision 1.1464 (428c995a_kOA184Gp70LrbrBFFfKTA)

Mark all non-RAM pages as I/O holes in the frame_table.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Thu May 19 13:49:14 2005 +0000 (2005-05-19)
parents 925c36f915af
children 0c3e919d87f4
files xen/arch/x86/mm.c xen/arch/x86/setup.c
line diff
     1.1 --- a/xen/arch/x86/mm.c	Thu May 19 13:24:18 2005 +0000
     1.2 +++ b/xen/arch/x86/mm.c	Thu May 19 13:49:14 2005 +0000
     1.3 @@ -174,7 +174,7 @@ void arch_init_memory(void)
     1.4  {
     1.5      extern void subarch_init_memory(struct domain *);
     1.6  
     1.7 -    unsigned long i, j, pfn, nr_pfns;
     1.8 +    unsigned long i, pfn, rstart_pfn, rend_pfn;
     1.9      struct pfn_info *page;
    1.10  
    1.11      memset(percpu_info, 0, sizeof(percpu_info));
    1.12 @@ -206,25 +206,26 @@ void arch_init_memory(void)
    1.13          page_set_owner(page, dom_io);
    1.14      }
    1.15   
    1.16 -    /* Any non-RAM areas in the e820 map are considered to be for I/O. */
    1.17 -    for ( i = 0; i < e820.nr_map; i++ )
    1.18 +    /* Any areas not specified as RAM by the e820 map are considered I/O. */
    1.19 +    for ( i = 0, pfn = 0; i < e820.nr_map; i++ )
    1.20      {
    1.21 -        if ( e820.map[i].type == E820_RAM )
    1.22 +        if ( e820.map[i].type != E820_RAM )
    1.23              continue;
    1.24 -        pfn = e820.map[i].addr >> PAGE_SHIFT;
    1.25 -        nr_pfns = (e820.map[i].size +
    1.26 -                   (e820.map[i].addr & ~PAGE_MASK) +
    1.27 -                   ~PAGE_MASK) >> PAGE_SHIFT;
    1.28 -        for ( j = 0; j < nr_pfns; j++ )
    1.29 +        /* Every page from cursor to start of next RAM region is I/O. */
    1.30 +        rstart_pfn = PFN_UP(e820.map[i].addr);
    1.31 +        rend_pfn   = PFN_DOWN(e820.map[i].addr + e820.map[i].size);
    1.32 +        while ( pfn < rstart_pfn )
    1.33          {
    1.34 -            if ( !pfn_valid(pfn+j) )
    1.35 -                continue;
    1.36 -            page = &frame_table[pfn+j];
    1.37 +            BUG_ON(!pfn_valid(pfn));
    1.38 +            page = &frame_table[pfn++];
    1.39              page->count_info        = PGC_allocated | 1;
    1.40              page->u.inuse.type_info = PGT_writable_page | PGT_validated | 1;
    1.41              page_set_owner(page, dom_io);
    1.42          }
    1.43 +        /* Skip the RAM region. */
    1.44 +        pfn = rend_pfn;
    1.45      }
    1.46 +    BUG_ON(pfn != max_page);
    1.47  
    1.48      subarch_init_memory(dom_xen);
    1.49  }
     2.1 --- a/xen/arch/x86/setup.c	Thu May 19 13:24:18 2005 +0000
     2.2 +++ b/xen/arch/x86/setup.c	Thu May 19 13:49:14 2005 +0000
     2.3 @@ -582,8 +582,8 @@ void __init __start_xen(multiboot_info_t
     2.4          {
     2.5              /* Calculate page-frame range, discarding partial frames. */
     2.6              unsigned long start, end;
     2.7 -            start = (e820.map[i].addr + PAGE_SIZE - 1) >> PAGE_SHIFT;
     2.8 -            end   = (e820.map[i].addr + e820.map[i].size) >> PAGE_SHIFT;
     2.9 +            start = PFN_UP(e820.map[i].addr);
    2.10 +            end   = PFN_DOWN(e820.map[i].addr + e820.map[i].size);
    2.11              /* Clip the range to above 64MB. */
    2.12              if ( end < (64UL << (20-PAGE_SHIFT)) )
    2.13                  continue;