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

[Xen-changelog] [xen-unstable] Merge



# HG changeset patch
# User Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
# Date 1280331153 -3600
# Node ID 2007fd03f53d9a3e8774a6df06beef7c74801b07
# Parent  bf4d0eb3643d7c86a42ad5265208e6fdf08b01fb
# Parent  4207549948a4c34b9e192635ec5b3b75a09dbf30
Merge
---
 xen/include/xen/multiboot2.h |   97 -------------------------------------------
 xen/arch/x86/boot/reloc.c    |    9 +++
 xen/arch/x86/domain.c        |    4 +
 xen/arch/x86/mm/mem_event.c  |    7 +++
 xen/arch/x86/mm/p2m.c        |    8 ++-
 xen/arch/x86/numa.c          |    2 
 xen/arch/x86/setup.c         |   30 +++++++++++--
 xen/arch/x86/tboot.c         |    2 
 xen/include/xen/multiboot.h  |   34 +++++++++++----
 9 files changed, 79 insertions(+), 114 deletions(-)

diff -r bf4d0eb3643d -r 2007fd03f53d xen/arch/x86/boot/reloc.c
--- a/xen/arch/x86/boot/reloc.c Wed Jul 28 16:18:44 2010 +0100
+++ b/xen/arch/x86/boot/reloc.c Wed Jul 28 16:32:33 2010 +0100
@@ -106,12 +106,17 @@ multiboot_info_t *reloc(multiboot_info_t
         mbi->mmap_addr = (u32)reloc_mbi_struct(
             (memory_map_t *)mbi->mmap_addr, mbi->mmap_length);
 
+    if ( mbi->flags & MBI_LOADERNAME )
+        mbi->boot_loader_name = (u32)reloc_mbi_string(
+            (char *)mbi->boot_loader_name);
+
     /* Mask features we don't understand or don't relocate. */
     mbi->flags &= (MBI_MEMLIMITS |
-                   MBI_DRIVES |
+                   MBI_BOOTDEV |
                    MBI_CMDLINE |
                    MBI_MODULES |
-                   MBI_MEMMAP);
+                   MBI_MEMMAP |
+                   MBI_LOADERNAME);
 
     return mbi;
 }
diff -r bf4d0eb3643d -r 2007fd03f53d xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c     Wed Jul 28 16:18:44 2010 +0100
+++ b/xen/arch/x86/domain.c     Wed Jul 28 16:32:33 2010 +0100
@@ -139,12 +139,14 @@ void dump_pageframe_info(struct domain *
     }
     else
     {
+        spin_lock(&d->page_alloc_lock);
         page_list_for_each ( page, &d->page_list )
         {
             printk("    DomPage %p: caf=%08lx, taf=%" PRtype_info "\n",
                    _p(page_to_mfn(page)),
                    page->count_info, page->u.inuse.type_info);
         }
+        spin_unlock(&d->page_alloc_lock);
     }
 
     if ( is_hvm_domain(d) )
@@ -152,12 +154,14 @@ void dump_pageframe_info(struct domain *
         p2m_pod_dump_data(d);
     }
 
+    spin_lock(&d->page_alloc_lock);
     page_list_for_each ( page, &d->xenpage_list )
     {
         printk("    XenPage %p: caf=%08lx, taf=%" PRtype_info "\n",
                _p(page_to_mfn(page)),
                page->count_info, page->u.inuse.type_info);
     }
+    spin_unlock(&d->page_alloc_lock);
 }
 
 struct domain *alloc_domain_struct(void)
diff -r bf4d0eb3643d -r 2007fd03f53d xen/arch/x86/mm/mem_event.c
--- a/xen/arch/x86/mm/mem_event.c       Wed Jul 28 16:18:44 2010 +0100
+++ b/xen/arch/x86/mm/mem_event.c       Wed Jul 28 16:32:33 2010 +0100
@@ -21,6 +21,7 @@
  */
 
 
+#include <asm/domain.h>
 #include <xen/event.h>
 #include <asm/p2m.h>
 #include <asm/mem_event.h>
@@ -225,6 +226,12 @@ int mem_event_domctl(struct domain *d, x
             mfn_t ring_mfn;
             mfn_t shared_mfn;
 
+            /* Currently only EPT is supported */
+            rc = -ENODEV;
+            if ( !(hap_enabled(d) &&
+                  (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)) )
+                break;
+
             /* Get MFN of ring page */
             guest_get_eff_l1e(v, ring_addr, &l1e);
             gfn = l1e_get_pfn(l1e);
diff -r bf4d0eb3643d -r 2007fd03f53d xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c     Wed Jul 28 16:18:44 2010 +0100
+++ b/xen/arch/x86/mm/p2m.c     Wed Jul 28 16:32:33 2010 +0100
@@ -1833,6 +1833,7 @@ int p2m_alloc_table(struct domain *d,
         goto error;
 
     /* Copy all existing mappings from the page list and m2p */
+    spin_lock(&d->page_alloc_lock);
     page_list_for_each(page, &d->page_list)
     {
         mfn = page_to_mfn(page);
@@ -1848,13 +1849,16 @@ int p2m_alloc_table(struct domain *d,
 #endif
              && gfn != INVALID_M2P_ENTRY
             && !set_p2m_entry(d, gfn, mfn, 0, p2m_ram_rw) )
-            goto error;
-    }
+            goto error_unlock;
+    }
+    spin_unlock(&d->page_alloc_lock);
 
     P2M_PRINTK("p2m table initialised (%u pages)\n", page_count);
     p2m_unlock(p2m);
     return 0;
 
+error_unlock:
+    spin_unlock(&d->page_alloc_lock);
  error:
     P2M_PRINTK("failed to initialize p2m table, gfn=%05lx, mfn=%"
                PRI_mfn "\n", gfn, mfn_x(mfn));
diff -r bf4d0eb3643d -r 2007fd03f53d xen/arch/x86/numa.c
--- a/xen/arch/x86/numa.c       Wed Jul 28 16:18:44 2010 +0100
+++ b/xen/arch/x86/numa.c       Wed Jul 28 16:32:33 2010 +0100
@@ -385,11 +385,13 @@ static void dump_numa(unsigned char key)
                for_each_online_node(i)
                        page_num_node[i] = 0;
 
+               spin_lock(&d->page_alloc_lock);
                page_list_for_each(page, &d->page_list)
                {
                        i = phys_to_nid((paddr_t)page_to_mfn(page) << 
PAGE_SHIFT);
                        page_num_node[i]++;
                }
+               spin_unlock(&d->page_alloc_lock);
 
                for_each_online_node(i)
                        printk("    Node %u: %u\n", i, page_num_node[i]);
diff -r bf4d0eb3643d -r 2007fd03f53d xen/arch/x86/setup.c
--- a/xen/arch/x86/setup.c      Wed Jul 28 16:18:44 2010 +0100
+++ b/xen/arch/x86/setup.c      Wed Jul 28 16:32:33 2010 +0100
@@ -363,22 +363,38 @@ void init_done(void)
     startup_cpu_idle_loop();
 }
 
-static char * __init cmdline_cook(char *p)
+static bool_t __init loader_is_grub2(const char *loader_name)
+{
+    /* GRUB1="GNU GRUB 0.xx"; GRUB2="GRUB 1.xx" */
+    const char *p = strstr(loader_name, "GRUB ");
+    return (p != NULL) && (p[5] != '0');
+}
+
+static char * __init cmdline_cook(char *p, char *loader_name)
 {
     p = p ? : "";
+
+    /* Strip leading whitespace. */
     while ( *p == ' ' )
         p++;
+
+    /* GRUB2 does not include image name as first item on command line. */
+    if ( loader_is_grub2(loader_name) )
+        return p;
+
+    /* Strip image name plus whitespace. */
     while ( (*p != ' ') && (*p != '\0') )
         p++;
     while ( *p == ' ' )
         p++;
+
     return p;
 }
 
 void __init __start_xen(unsigned long mbi_p)
 {
     char *memmap_type = NULL;
-    char *cmdline, *kextra;
+    char *cmdline, *kextra, *loader;
     unsigned long _initrd_start = 0, _initrd_len = 0;
     unsigned int initrdidx = 1;
     multiboot_info_t *mbi = __va(mbi_p);
@@ -396,9 +412,13 @@ void __init __start_xen(unsigned long mb
 
     set_intr_gate(TRAP_page_fault, &early_page_fault);
 
+    loader = (mbi->flags & MBI_LOADERNAME)
+        ? (char *)__va(mbi->boot_loader_name) : "unknown";
+
     /* Parse the command-line options. */
     cmdline = cmdline_cook((mbi->flags & MBI_CMDLINE) ?
-                           __va(mbi->cmdline) : NULL);
+                           __va(mbi->cmdline) : NULL,
+                           loader);
     if ( (kextra = strstr(cmdline, " -- ")) != NULL )
     {
         /*
@@ -431,6 +451,8 @@ void __init __start_xen(unsigned long mb
     ns16550.irq     = 3;
     ns16550_init(1, &ns16550);
     console_init_preirq();
+
+    printk("Bootloader: %s\n", loader);
 
     printk("Command line: %s\n", cmdline);
 
@@ -1032,7 +1054,7 @@ void __init __start_xen(unsigned long mb
     {
         static char dom0_cmdline[MAX_GUEST_CMDLINE];
 
-        cmdline = cmdline_cook(cmdline);
+        cmdline = cmdline_cook(cmdline, loader);
         safe_strcpy(dom0_cmdline, cmdline);
 
         if ( kextra != NULL )
diff -r bf4d0eb3643d -r 2007fd03f53d xen/arch/x86/tboot.c
--- a/xen/arch/x86/tboot.c      Wed Jul 28 16:18:44 2010 +0100
+++ b/xen/arch/x86/tboot.c      Wed Jul 28 16:32:33 2010 +0100
@@ -211,12 +211,14 @@ static void tboot_gen_domain_integrity(c
             continue;
         printk("MACing Domain %u\n", d->domain_id);
 
+        spin_lock(&d->page_alloc_lock);
         page_list_for_each(page, &d->page_list)
         {
             void *pg = __map_domain_page(page);
             vmac_update(pg, PAGE_SIZE, &ctx);
             unmap_domain_page(pg);
         }
+        spin_unlock(&d->page_alloc_lock);
 
         if ( !is_idle_domain(d) )
         {
diff -r bf4d0eb3643d -r 2007fd03f53d xen/include/xen/multiboot.h
--- a/xen/include/xen/multiboot.h       Wed Jul 28 16:18:44 2010 +0100
+++ b/xen/include/xen/multiboot.h       Wed Jul 28 16:32:33 2010 +0100
@@ -31,14 +31,17 @@
 /* The magic number passed by a Multiboot-compliant boot loader. */
 #define MULTIBOOT_BOOTLOADER_MAGIC     0x2BADB002
 
-#define MBI_MEMLIMITS  (1<<0)
-#define MBI_DRIVES     (1<<1)
-#define MBI_CMDLINE    (1<<2)
-#define MBI_MODULES    (1<<3)
-#define MBI_AOUT_SYMS  (1<<4)
-#define MBI_ELF_SYMS   (1<<5)
-#define MBI_MEMMAP     (1<<6)
-#define MBI_LOADERNAME (1<<9)
+#define MBI_MEMLIMITS  (1u<< 0)
+#define MBI_BOOTDEV    (1u<< 1)
+#define MBI_CMDLINE    (1u<< 2)
+#define MBI_MODULES    (1u<< 3)
+#define MBI_AOUT_SYMS  (1u<< 4)
+#define MBI_ELF_SYMS   (1u<< 5)
+#define MBI_MEMMAP     (1u<< 6)
+#define MBI_DRIVES     (1u<< 7)
+#define MBI_BIOSCONFIG (1u<< 8)
+#define MBI_LOADERNAME (1u<< 9)
+#define MBI_APM        (1u<<10)
 
 #ifndef __ASSEMBLY__
 
@@ -66,7 +69,7 @@ typedef struct {
     u32 mem_lower;
     u32 mem_upper;
 
-    /* Valid if flags sets MBI_DRIVES */
+    /* Valid if flags sets MBI_BOOTDEV */
     u32 boot_device;
 
     /* Valid if flags sets MBI_CMDLINE */
@@ -85,6 +88,19 @@ typedef struct {
     /* Valid if flags sets MBI_MEMMAP */
     u32 mmap_length;
     u32 mmap_addr;
+
+    /* Valid if flags sets MBI_DRIVES */
+    u32 drives_length;
+    u32 drives_addr;
+
+    /* Valid if flags sets MBI_BIOSCONFIG */
+    u32 config_table;
+
+    /* Valid if flags sets MBI_LOADERNAME */
+    u32 boot_loader_name;
+
+    /* Valid if flags sets MBI_APM */
+    u32 apm_table;
 } multiboot_info_t;
 
 /* The module structure.  */
diff -r bf4d0eb3643d -r 2007fd03f53d xen/include/xen/multiboot2.h
--- a/xen/include/xen/multiboot2.h      Wed Jul 28 16:18:44 2010 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- * Copyright IBM Corp. 2006, 2007
- *
- * Authors: Hollis Blanchard <hollisb@xxxxxxxxxx>
- *          
- */
-
-#ifndef _MULTIBOOT2_H_
-#define _MULTIBOOT2_H_
-
-/* How many bytes from the start of the file we search for the header.  */
-#define MB2_HEADER_SEARCH           8192
-
-/* The magic field should contain this.  */
-#define MB2_HEADER_MAGIC            0xe85250d6
-
-/* Passed from the bootloader to the kernel.  */
-#define MB2_BOOTLOADER_MAGIC        0x36d76289
-
-#define for_each_tag(_tag, _tags) \
-    for ((_tag) = (_tags); \
-            ((_tag)->key != MB2_TAG_END && (_tag)->key != 0); \
-            (_tag) = (void *)(_tag) + (_tag)->len)
-
-typedef uint32_t mb2_word;
-
-struct mb2_header
-{
-  uint32_t magic;
-};
-
-struct mb2_tag_header
-{
-  uint32_t key;
-  uint32_t len;
-};
-
-#define MB2_TAG_START     1
-struct mb2_tag_start
-{
-  struct mb2_tag_header header;
-  mb2_word size; /* Total size of all mb2 tags. */
-};
-
-#define MB2_TAG_NAME      2
-struct mb2_tag_name
-{
-  struct mb2_tag_header header;
-  char name[1];
-};
-
-#define MB2_TAG_MODULE    3
-struct mb2_tag_module
-{
-  struct mb2_tag_header header;
-  mb2_word addr;
-  mb2_word size;
-  unsigned char type[36];
-  unsigned char cmdline[1];
-};
-
-#define MB2_TAG_MEMORY    4
-struct mb2_tag_memory
-{
-  struct mb2_tag_header header;
-  mb2_word addr;
-  mb2_word size;
-  mb2_word type;
-};
-
-#define MB2_TAG_UNUSED    5
-struct mb2_tag_unused
-{
-  struct mb2_tag_header header;
-};
-
-#define MB2_TAG_END       0xffff
-struct mb2_tag_end
-{
-  struct mb2_tag_header header;
-};
-
-#endif

_______________________________________________
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®.