[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Initialise 1:1 mapping of physical memory map early during x86/64 boot.



ChangeSet 1.1428, 2005/05/17 11:39:50+01:00, kaf24@xxxxxxxxxxxxxxxxxxxx

        Initialise 1:1 mapping of physical memory map early during x86/64 boot.
        This mapping should include all ACPI tables, so simplify the mapping
        check in the ACPI code.
        Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>



 arch/x86/acpi/boot.c   |   10 +++-------
 arch/x86/e820.c        |    7 ++++---
 arch/x86/setup.c       |   31 +++++++++++++++++++++++--------
 arch/x86/x86_64/mm.c   |    8 +-------
 common/grant_table.c   |    1 -
 include/asm-x86/e820.h |    2 +-
 6 files changed, 32 insertions(+), 27 deletions(-)


diff -Nru a/xen/arch/x86/acpi/boot.c b/xen/arch/x86/acpi/boot.c
--- a/xen/arch/x86/acpi/boot.c  2005-05-17 07:03:55 -04:00
+++ b/xen/arch/x86/acpi/boot.c  2005-05-17 07:03:55 -04:00
@@ -40,7 +40,6 @@
 #include <mach_mpparse.h>
 
 int sbf_port;
-#define end_pfn_map max_page
 #define CONFIG_ACPI_PCI
 
 #define BAD_MADT_ENTRY(entry, end) (                                       \
@@ -96,12 +95,9 @@
 char *__acpi_map_table(unsigned long phys_addr, unsigned long size)
 {
        if (!phys_addr || !size)
-       return NULL;
-
-       if (phys_addr < (end_pfn_map << PAGE_SHIFT))
-               return __va(phys_addr);
-
-       return NULL;
+               return NULL;
+       /* XEN: We map all e820 areas which should include every ACPI table. */
+       return __va(phys_addr);
 }
 
 #else
diff -Nru a/xen/arch/x86/e820.c b/xen/arch/x86/e820.c
--- a/xen/arch/x86/e820.c       2005-05-17 07:03:55 -04:00
+++ b/xen/arch/x86/e820.c       2005-05-17 07:03:55 -04:00
@@ -372,16 +372,17 @@
 }
 
 static void __init machine_specific_memory_setup(
-    struct e820entry *raw, int raw_nr)
+    struct e820entry *raw, int *raw_nr)
 {
-    char nr = (char)raw_nr;
+    char nr = (char)*raw_nr;
     sanitize_e820_map(raw, &nr);
+    *raw_nr = nr;
     (void)copy_e820_map(raw, nr);
     clip_4gb();
     clip_mem();
 }
 
-unsigned long __init init_e820(struct e820entry *raw, int raw_nr)
+unsigned long __init init_e820(struct e820entry *raw, int *raw_nr)
 {
     machine_specific_memory_setup(raw, raw_nr);
     printk(KERN_INFO "Physical RAM map:\n");
diff -Nru a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
--- a/xen/arch/x86/setup.c      2005-05-17 07:03:55 -04:00
+++ b/xen/arch/x86/setup.c      2005-05-17 07:03:55 -04:00
@@ -25,7 +25,7 @@
  * pfn_info table and allocation bitmap.
  */
 static unsigned int opt_xenheap_megabytes = XENHEAP_DEFAULT_MB;
-#if defined(__x86_64__)
+#if defined(CONFIG_X86_64)
 integer_param("xenheap_megabytes", opt_xenheap_megabytes);
 #endif
 
@@ -70,7 +70,7 @@
 
 struct cpuinfo_x86 boot_cpu_data = { 0, 0, 0, 0, -1 };
 
-#if defined(__x86_64__)
+#if defined(CONFIG_X86_64)
 unsigned long mmu_cr4_features = X86_CR4_PSE | X86_CR4_PGE | X86_CR4_PAE;
 #else
 unsigned long mmu_cr4_features = X86_CR4_PSE | X86_CR4_PGE;
@@ -312,10 +312,10 @@
 
     /* Set up and load the per-CPU TSS and LDT. */
     t->bitmap = IOBMP_INVALID_OFFSET;
-#if defined(__i386__)
+#if defined(CONFIG_X86_32)
     t->ss0  = __HYPERVISOR_DS;
     t->esp0 = get_stack_bottom();
-#elif defined(__x86_64__)
+#elif defined(CONFIG_X86_64)
     t->rsp0 = get_stack_bottom();
 #endif
     set_tss_desc(nr,t);
@@ -452,7 +452,7 @@
 
     watchdog_enable();
 
-#ifdef __x86_64__ /* x86_32 uses low mappings when building DOM0. */
+#ifdef CONFIG_X86_64 /* x86_32 uses low mappings when building DOM0. */
     zap_low_mappings();
 #endif
 }
@@ -519,7 +519,7 @@
         for ( ; ; ) ;
     }
 
-    max_page = init_e820(e820_raw, e820_raw_nr);
+    max_page = init_e820(e820_raw, &e820_raw_nr);
 
     /* Find the first high-memory RAM hole. */
     for ( i = 0; i < e820.nr_map; i++ )
@@ -537,11 +537,11 @@
         printk("Not enough memory to stash the DOM0 kernel image.\n");
         for ( ; ; ) ;
     }
-#if defined(__i386__)
+#if defined(CONFIG_X86_32)
     memmove((void *)initial_images_start,  /* use low mapping */
             (void *)mod[0].mod_start,      /* use low mapping */
             mod[mbi->mods_count-1].mod_end - mod[0].mod_start);
-#elif defined(__x86_64__)
+#elif defined(CONFIG_X86_64)
     memmove(__va(initial_images_start),
             __va(mod[0].mod_start),
             mod[mbi->mods_count-1].mod_end - mod[0].mod_start);
@@ -561,6 +561,21 @@
                             initial_images_end : e820.map[i].addr,
                             e820.map[i].addr + e820.map[i].size);
     }
+
+#if defined (CONFIG_X86_64)
+    /* On x86/64 we can 1:1 map every registered memory area. */
+    /* We use the raw_e820 map because we sometimes truncate the cooked map. */
+    for ( i = 0; i < e820_raw_nr; i++ )
+    {
+        unsigned long min, sz;
+        min = (unsigned long)e820_raw[i].addr &
+            ~(((unsigned long)L1_PAGETABLE_ENTRIES << PAGE_SHIFT) - 1);
+        sz  = ((unsigned long)e820_raw[i].size +
+               ((unsigned long)L1_PAGETABLE_ENTRIES << PAGE_SHIFT) - 1) &
+            ~(((unsigned long)L1_PAGETABLE_ENTRIES << PAGE_SHIFT) - 1);
+        map_pages(idle_pg_table, PAGE_OFFSET + min, min, sz, PAGE_HYPERVISOR);
+    }
+#endif
 
     printk("System RAM: %luMB (%lukB)\n", 
            nr_pages >> (20 - PAGE_SHIFT),
diff -Nru a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c
--- a/xen/arch/x86/x86_64/mm.c  2005-05-17 07:03:55 -04:00
+++ b/xen/arch/x86/x86_64/mm.c  2005-05-17 07:03:55 -04:00
@@ -128,17 +128,11 @@
     map_pages(idle_pg_table, fix_to_virt(idx), p, PAGE_SIZE, flags);
 }
 
-
 void __init paging_init(void)
 {
-    unsigned long i, p, max;
+    unsigned long i, p;
     l3_pgentry_t *l3rw, *l3ro;
     struct pfn_info *pg;
-
-    /* Map all of physical memory. */
-    max = ((max_page + L1_PAGETABLE_ENTRIES - 1) & 
-           ~(L1_PAGETABLE_ENTRIES - 1)) << PAGE_SHIFT;
-    map_pages(idle_pg_table, PAGE_OFFSET, 0, max, PAGE_HYPERVISOR);
 
     /*
      * Allocate and map the machine-to-phys table.
diff -Nru a/xen/common/grant_table.c b/xen/common/grant_table.c
--- a/xen/common/grant_table.c  2005-05-17 07:03:55 -04:00
+++ b/xen/common/grant_table.c  2005-05-17 07:03:55 -04:00
@@ -1227,7 +1227,6 @@
     void)
 {
     /* Nothing. */
-    DPRINTK("Grant table init\n");
 }
 
 /*
diff -Nru a/xen/include/asm-x86/e820.h b/xen/include/asm-x86/e820.h
--- a/xen/include/asm-x86/e820.h        2005-05-17 07:03:55 -04:00
+++ b/xen/include/asm-x86/e820.h        2005-05-17 07:03:55 -04:00
@@ -24,7 +24,7 @@
     struct e820entry map[E820MAX];
 };
 
-extern unsigned long init_e820(struct e820entry *, int);
+extern unsigned long init_e820(struct e820entry *, int *);
 extern struct e820map e820;
 
 #ifndef NDEBUG

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.