ia64/xen-unstable

changeset 15799:1c19a3430ab1

xen: Understand the E820_UNUSABLE (type code 5) memory type.
Signed-off-by: Joseph Cihula <joseph.cihula@intel.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Thu Aug 30 11:01:39 2007 +0100 (2007-08-30)
parents c398dad9d50a
children 104aba61893e
files xen/arch/x86/domain_build.c xen/arch/x86/e820.c xen/arch/x86/mm.c xen/arch/x86/setup.c xen/include/asm-x86/e820.h
line diff
     1.1 --- a/xen/arch/x86/domain_build.c	Thu Aug 30 09:57:09 2007 +0100
     1.2 +++ b/xen/arch/x86/domain_build.c	Thu Aug 30 11:01:39 2007 +0100
     1.3 @@ -989,6 +989,16 @@ int __init construct_dom0(
     1.4              rc |= iomem_deny_access(dom0, mfn, mfn);
     1.5      }
     1.6  
     1.7 +    /* Remove access to E820_UNUSABLE I/O regions. */
     1.8 +    for ( i = 0; i < e820.nr_map; i++ )
     1.9 +    {
    1.10 +        if ( e820.map[i].type != E820_UNUSABLE)
    1.11 +            continue;
    1.12 +        mfn = paddr_to_pfn(e820.map[i].addr);
    1.13 +        nr_pages = (e820.map[i].size + PAGE_SIZE - 1) >> PAGE_SHIFT;
    1.14 +        rc |= iomem_deny_access(dom0, mfn, mfn + nr_pages - 1);
    1.15 +    }
    1.16 +
    1.17      BUG_ON(rc != 0);
    1.18  
    1.19      return 0;
     2.1 --- a/xen/arch/x86/e820.c	Thu Aug 30 09:57:09 2007 +0100
     2.2 +++ b/xen/arch/x86/e820.c	Thu Aug 30 11:01:39 2007 +0100
     2.3 @@ -41,7 +41,8 @@ static void __init print_e820_memory_map
     2.4                 (unsigned long long)(map[i].addr),
     2.5                 (unsigned long long)(map[i].addr + map[i].size));
     2.6          switch (map[i].type) {
     2.7 -        case E820_RAM:	printk("(usable)\n");
     2.8 +        case E820_RAM:
     2.9 +            printk("(usable)\n");
    2.10              break;
    2.11          case E820_RESERVED:
    2.12              printk("(reserved)\n");
    2.13 @@ -52,7 +53,11 @@ static void __init print_e820_memory_map
    2.14          case E820_NVS:
    2.15              printk("(ACPI NVS)\n");
    2.16              break;
    2.17 -        default:	printk("type %u\n", map[i].type);
    2.18 +        case E820_UNUSABLE:
    2.19 +            printk("(unusable)\n");
    2.20 +            break;
    2.21 +        default:
    2.22 +            printk("type %u\n", map[i].type);
    2.23              break;
    2.24          }
    2.25      }
     3.1 --- a/xen/arch/x86/mm.c	Thu Aug 30 09:57:09 2007 +0100
     3.2 +++ b/xen/arch/x86/mm.c	Thu Aug 30 11:01:39 2007 +0100
     3.3 @@ -213,7 +213,9 @@ void __init arch_init_memory(void)
     3.4      /* Any areas not specified as RAM by the e820 map are considered I/O. */
     3.5      for ( i = 0, pfn = 0; pfn < max_page; i++ )
     3.6      {
     3.7 -        while ( (i < e820.nr_map) && (e820.map[i].type != E820_RAM) )
     3.8 +        while ( (i < e820.nr_map) &&
     3.9 +                (e820.map[i].type != E820_RAM) &&
    3.10 +                (e820.map[i].type != E820_UNUSABLE) )
    3.11              i++;
    3.12  
    3.13          if ( i >= e820.nr_map )
     4.1 --- a/xen/arch/x86/setup.c	Thu Aug 30 09:57:09 2007 +0100
     4.2 +++ b/xen/arch/x86/setup.c	Thu Aug 30 11:01:39 2007 +0100
     4.3 @@ -610,8 +610,7 @@ void __init __start_xen(unsigned long mb
     4.4                  ((u64)map->base_addr_high << 32) | (u64)map->base_addr_low;
     4.5              e820_raw[e820_raw_nr].size = 
     4.6                  ((u64)map->length_high << 32) | (u64)map->length_low;
     4.7 -            e820_raw[e820_raw_nr].type = 
     4.8 -                (map->type > E820_NVS) ? E820_RESERVED : map->type;
     4.9 +            e820_raw[e820_raw_nr].type = map->type;
    4.10              e820_raw_nr++;
    4.11  
    4.12              bytes += map->size + 4;
     5.1 --- a/xen/include/asm-x86/e820.h	Thu Aug 30 09:57:09 2007 +0100
     5.2 +++ b/xen/include/asm-x86/e820.h	Thu Aug 30 11:01:39 2007 +0100
     5.3 @@ -8,6 +8,7 @@
     5.4  #define E820_RESERVED     2
     5.5  #define E820_ACPI         3
     5.6  #define E820_NVS          4
     5.7 +#define E820_UNUSABLE     5
     5.8  
     5.9  struct e820entry {
    5.10      uint64_t addr;