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

[Xen-changelog] [xen-unstable] Merge



# HG changeset patch
# User Tim Deegan <Tim.Deegan@xxxxxxxxxxxxx>
# Date 1170942199 0
# Node ID 9c88b5f3b4ebeed872c2395cd83f738e77592c10
# Parent  6e74932c9a64298ef31af28ad0b53c0e7d2e6781
# Parent  9d103e5fd471a90db6ac9e813d8d96dadcbfe130
Merge
---
 xen/include/asm-ia64/kexec.h       |   25 -------
 xen/include/asm-powerpc/kexec.h    |   25 -------
 xen/include/asm-x86/kexec.h        |   20 -----
 xen/include/asm-x86/x86_32/kexec.h |   39 -----------
 xen/include/asm-x86/x86_64/kexec.h |   38 -----------
 xen/arch/powerpc/machine_kexec.c   |    5 +
 xen/arch/x86/crash.c               |    1 
 xen/arch/x86/machine_kexec.c       |   53 ++++++++++++++-
 xen/arch/x86/x86_64/Makefile       |    1 
 xen/arch/x86/x86_64/compat_kexec.S |  126 +++++++++++++++++++++++++++++++++++++
 xen/common/kexec.c                 |    1 
 xen/include/asm-x86/config.h       |    4 -
 xen/include/xen/kexec.h            |    1 
 13 files changed, 185 insertions(+), 154 deletions(-)

diff -r 6e74932c9a64 -r 9c88b5f3b4eb xen/arch/powerpc/machine_kexec.c
--- a/xen/arch/powerpc/machine_kexec.c  Thu Feb 08 13:42:49 2007 +0000
+++ b/xen/arch/powerpc/machine_kexec.c  Thu Feb 08 13:43:19 2007 +0000
@@ -19,6 +19,11 @@ void machine_reboot_kexec(xen_kexec_imag
     printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__);
 }
 
+void machine_kexec(xen_kexec_image_t *image)
+{
+    printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__);
+}
+
 /*
  * Local variables:
  * mode: C
diff -r 6e74932c9a64 -r 9c88b5f3b4eb xen/arch/x86/crash.c
--- a/xen/arch/x86/crash.c      Thu Feb 08 13:42:49 2007 +0000
+++ b/xen/arch/x86/crash.c      Thu Feb 08 13:43:19 2007 +0000
@@ -11,7 +11,6 @@
 #include <asm/atomic.h>
 #include <asm/elf.h>
 #include <asm/percpu.h>
-#include <asm/kexec.h>
 #include <xen/types.h>
 #include <xen/irq.h>
 #include <asm/ipi.h>
diff -r 6e74932c9a64 -r 9c88b5f3b4eb xen/arch/x86/machine_kexec.c
--- a/xen/arch/x86/machine_kexec.c      Thu Feb 08 13:42:49 2007 +0000
+++ b/xen/arch/x86/machine_kexec.c      Thu Feb 08 13:43:19 2007 +0000
@@ -15,10 +15,14 @@
 #include <xen/types.h>
 #include <xen/console.h>
 #include <xen/kexec.h>
-#include <asm/kexec.h>
 #include <xen/domain_page.h>
 #include <asm/fixmap.h>
 #include <asm/hvm/hvm.h>
+
+typedef void (*relocate_new_kernel_t)(
+                unsigned long indirection_page,
+                unsigned long *page_list,
+                unsigned long start_address);
 
 int machine_kexec_load(int type, int slot, xen_kexec_image_t *image)
 {
@@ -40,8 +44,26 @@ int machine_kexec_load(int type, int slo
         else
         {
             /* Odd pages: va for previous ma. */
-            set_fixmap(fix_base + (k >> 1), prev_ma);
-            image->page_list[k] = fix_to_virt(fix_base + (k >> 1));
+            if ( IS_COMPAT(dom0) )
+            {
+
+                /*
+                 * The compatability bounce code sets up a page table
+                 * with a 1-1 mapping of the first 1G of memory so
+                 * VA==PA here.
+                 *
+                 * This Linux purgatory code still sets up separate
+                 * high and low mappings on the control page (entries
+                 * 0 and 1) but it is harmless if they are equal since
+                 * that PT is not live at the time.
+                 */
+                image->page_list[k] = prev_ma;
+            }
+            else
+            {
+                set_fixmap(fix_base + (k >> 1), prev_ma);
+                image->page_list[k] = fix_to_virt(fix_base + (k >> 1));
+            }
         }
     }
 
@@ -94,6 +116,31 @@ void machine_reboot_kexec(xen_kexec_imag
     BUG();
 }
 
+void machine_kexec(xen_kexec_image_t *image)
+{
+#ifdef CONFIG_COMPAT
+    if ( IS_COMPAT(dom0) )
+    {
+        extern void compat_machine_kexec(unsigned long rnk,
+                                         unsigned long indirection_page,
+                                         unsigned long *page_list,
+                                         unsigned long start_address);
+        compat_machine_kexec(image->page_list[1],
+                             image->indirection_page,
+                             image->page_list,
+                             image->start_address);
+    }
+    else
+#endif
+    {
+        relocate_new_kernel_t rnk;
+
+        rnk = (relocate_new_kernel_t) image->page_list[1];
+        (*rnk)(image->indirection_page, image->page_list,
+               image->start_address);
+    }
+}
+
 /*
  * Local variables:
  * mode: C
diff -r 6e74932c9a64 -r 9c88b5f3b4eb xen/arch/x86/x86_64/Makefile
--- a/xen/arch/x86/x86_64/Makefile      Thu Feb 08 13:42:49 2007 +0000
+++ b/xen/arch/x86/x86_64/Makefile      Thu Feb 08 13:43:19 2007 +0000
@@ -1,4 +1,5 @@ obj-y += entry.o
 obj-y += entry.o
+obj-y += compat_kexec.o
 obj-y += gpr_switch.o
 obj-y += mm.o
 obj-y += traps.o
diff -r 6e74932c9a64 -r 9c88b5f3b4eb xen/arch/x86/x86_64/compat_kexec.S
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/arch/x86/x86_64/compat_kexec.S        Thu Feb 08 13:43:19 2007 +0000
@@ -0,0 +1,126 @@
+/*
+ * Compatibility kexec handler.
+ */
+
+#include <xen/config.h>
+
+#include <asm/asm_defns.h>
+#include <asm/msr.h>
+#include <asm/page.h>
+
+.text
+
+        .code64
+
+ENTRY(compat_machine_kexec)
+        /* x86/64                        x86/32  */
+        /* %rdi - relocate_new_kernel_t  CALL    */
+        /* %rsi - indirection page       4(%esp) */
+        /* %rdx - page_list              8(%esp) */
+        /* %rcx - start address         12(%esp) */
+        /*        cpu has pae           16(%esp) */
+
+        /* Shim the 64 bit page_list into a 32 bit page_list. */
+        mov $12,%r9
+        lea compat_page_list(%rip), %rbx
+1:      dec %r9
+        movl (%rdx,%r9,8),%eax
+        movl %eax,(%rbx,%r9,4)
+        test %r9,%r9
+        jnz 1b
+
+        movq %rbx,%rdx
+        mov $__PAGE_OFFSET,%rbx
+        sub %rbx, %rdx
+
+        /*
+         * Setup an identity mapped region in PML4[0] of idle page
+         * table.
+         */
+        lea idle_pg_table_l3(%rip),%rax
+        sub %rbx,%rax
+        or  $0x63,%rax
+        mov %rax, idle_pg_table(%rip)
+
+        /* Switch to idle page table. */
+        movq $(idle_pg_table - __PAGE_OFFSET), %rax
+        movq %rax, %cr3
+
+        /* Jump to low identity mapping in compatibility mode. */
+        ljmp *compatibility_mode_far(%rip)
+        ud2
+
+compatibility_mode_far:
+        .long compatibility_mode - __PAGE_OFFSET
+        .long __HYPERVISOR_CS32
+
+        .code32
+
+compatibility_mode:
+        /* Setup some sane segments. */
+        movl $__HYPERVISOR_DS32, %eax
+        movl %eax, %ds
+        movl %eax, %es
+        movl %eax, %fs
+        movl %eax, %gs
+        movl %eax, %ss
+
+        /* Push arguments onto stack. */
+        pushl $1   /* 16(%esp) - cpu has pae */
+        pushl %ecx /* 12(%esp) - start address */
+        pushl %edx /*  8(%esp) - page list */
+        pushl %esi /*  4(%esp) - indirection page */
+        pushl %edi /*  0(%esp) - CALL */
+
+        /* Disable paging and therefore leave 64 bit mode. */
+        movl %cr0, %eax
+        andl $~X86_CR0_PG, %eax
+        movl %eax, %cr0
+
+        /* Switch to 32 bit page table. */
+        movl  $compat_pg_table - __PAGE_OFFSET, %eax
+        movl  %eax, %cr3
+
+        /* Clear MSR_EFER[LME], disabling long mode */
+        movl    $MSR_EFER,%ecx
+        rdmsr
+        btcl    $_EFER_LME,%eax
+        wrmsr
+
+        /* Re-enable paging, but only 32 bit mode now. */
+        movl %cr0, %eax
+        orl $X86_CR0_PG, %eax
+        movl %eax, %cr0
+
+        popl %eax
+        call *%eax
+        ud2
+
+compat_page_list:
+        .fill 12,4,0
+
+        .align 32,0
+
+        /*
+         * These compat page tables contain an identity mapping of the
+         * first 1G of the physical address space.
+         */
+compat_pg_table:
+        .long compat_pg_table_l2 + 0*PAGE_SIZE + 0x01 - __PAGE_OFFSET, 0
+        .long 0, 0
+        .long 0, 0
+        .long 0, 0
+
+        .align 4096,0
+
+compat_pg_table_l2:
+        .macro identmap from=0, count=512
+        .if \count-1
+        identmap "(\from+0)","(\count/2)"
+        identmap "(\from+(0x200000*(\count/2)))","(\count/2)"
+        .else
+        .quad 0x00000000000000e3 + \from
+        .endif
+        .endm
+
+        identmap
diff -r 6e74932c9a64 -r 9c88b5f3b4eb xen/common/kexec.c
--- a/xen/common/kexec.c        Thu Feb 08 13:42:49 2007 +0000
+++ b/xen/common/kexec.c        Thu Feb 08 13:43:19 2007 +0000
@@ -6,7 +6,6 @@
  * - Magnus Damm <magnus@xxxxxxxxxxxxx>
  */
 
-#include <asm/kexec.h>
 #include <xen/lib.h>
 #include <xen/ctype.h>
 #include <xen/errno.h>
diff -r 6e74932c9a64 -r 9c88b5f3b4eb xen/include/asm-ia64/kexec.h
--- a/xen/include/asm-ia64/kexec.h      Thu Feb 08 13:42:49 2007 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-#ifndef __IA64_KEXEC_H__
-#define __IA64_KEXEC_H__
-
-#include <xen/lib.h>       /* for printk() used in stub */
-#include <xen/types.h>
-#include <public/xen.h>
-#include <xen/kexec.h>
-
-static inline void machine_kexec(xen_kexec_image_t *image)
-{
-    printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__);
-}
-
-#endif /* __IA64_KEXEC_H__ */
-
-/*
- * Local variables:
- * mode: C
- * c-set-style: "BSD"
- * c-basic-offset: 4
- * tab-width: 4
- * indent-tabs-mode: nil
- * End:
- */
-
diff -r 6e74932c9a64 -r 9c88b5f3b4eb xen/include/asm-powerpc/kexec.h
--- a/xen/include/asm-powerpc/kexec.h   Thu Feb 08 13:42:49 2007 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-#ifndef _ASM_KEXEC_H__
-#define _ASM_KEXEC_H__
-
-#include <xen/lib.h>       /* for printk() used in stub */
-#include <xen/types.h>
-#include <public/xen.h>
-#include <xen/kexec.h>
-
-static inline void machine_kexec(xen_kexec_image_t *image)
-{
-    printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__);
-}
-
-#endif /* _ASM_KEXEC_H__ */
-
-/*
- * Local variables:
- * mode: C
- * c-set-style: "BSD"
- * c-basic-offset: 4
- * tab-width: 4
- * indent-tabs-mode: nil
- * End:
- */
-
diff -r 6e74932c9a64 -r 9c88b5f3b4eb xen/include/asm-x86/config.h
--- a/xen/include/asm-x86/config.h      Thu Feb 08 13:42:49 2007 +0000
+++ b/xen/include/asm-x86/config.h      Thu Feb 08 13:43:19 2007 +0000
@@ -145,9 +145,9 @@
  * Compatibility guest area layout:
  *  0x0000000000000000 - 0x00000000f57fffff [3928MB,            PML4:0]
  *    Guest-defined use.
- *  0x0000000f58000000 - 0x00000000ffffffff [168MB,             PML4:0]
+ *  0x00000000f5800000 - 0x00000000ffffffff [168MB,             PML4:0]
  *    Read-only machine-to-phys translation table (GUEST ACCESSIBLE).
- *  0x0000000000000000 - 0x00000000ffffffff [508GB,             PML4:0]
+ *  0x0000000100000000 - 0x0000007fffffffff [508GB,             PML4:0]
  *    Unused.
  *  0x0000008000000000 - 0x000000ffffffffff [512GB, 2^39 bytes, PML4:1]
  *    Hypercall argument translation area.
diff -r 6e74932c9a64 -r 9c88b5f3b4eb xen/include/asm-x86/kexec.h
--- a/xen/include/asm-x86/kexec.h       Thu Feb 08 13:42:49 2007 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-#ifndef __X86_KEXEC_H__
-#define __X86_KEXEC_H__
-
-#ifdef __x86_64__
-#include <asm/x86_64/kexec.h>
-#else
-#include <asm/x86_32/kexec.h>
-#endif
-
-#endif /* __X86_KEXEC_H__ */
-
-/*
- * Local variables:
- * mode: C
- * c-set-style: "BSD"
- * c-basic-offset: 4
- * tab-width: 4
- * indent-tabs-mode: nil
- * End:
- */
diff -r 6e74932c9a64 -r 9c88b5f3b4eb xen/include/asm-x86/x86_32/kexec.h
--- a/xen/include/asm-x86/x86_32/kexec.h        Thu Feb 08 13:42:49 2007 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-/******************************************************************************
- * kexec.h
- * 
- * Based heavily on machine_kexec.c and kexec.h from Linux 2.6.19-rc1
- *
- */
-  
-#ifndef __X86_KEXEC_X86_32_H__
-#define __X86_KEXEC_X86_32_H__
-
-#include <xen/types.h>
-#include <xen/kexec.h>
-
-typedef asmlinkage void (*relocate_new_kernel_t)(
-               unsigned long indirection_page,
-               unsigned long page_list,
-               unsigned long start_address,
-               unsigned int has_pae);
-
-static inline void machine_kexec(xen_kexec_image_t *image)
-{
-    relocate_new_kernel_t rnk;
-
-    rnk = (relocate_new_kernel_t) image->page_list[1];
-    (*rnk)(image->indirection_page, (unsigned long)image->page_list, 
-           image->start_address, (unsigned long)cpu_has_pae);
-}
-
-#endif /* __X86_KEXEC_X86_32_H__ */
-
-/*
- * Local variables:
- * mode: C
- * c-set-style: "BSD"
- * c-basic-offset: 4
- * tab-width: 4
- * indent-tabs-mode: nil
- * End:
- */
diff -r 6e74932c9a64 -r 9c88b5f3b4eb xen/include/asm-x86/x86_64/kexec.h
--- a/xen/include/asm-x86/x86_64/kexec.h        Thu Feb 08 13:42:49 2007 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-/******************************************************************************
- * kexec.h
- * 
- * Based heavily on machine_kexec.c and kexec.h from Linux 2.6.19-rc1
- *
- */
-
-#ifndef __X86_64_KEXEC_H__
-#define __X86_64_KEXEC_H__
-  
-#include <xen/types.h>
-#include <xen/kexec.h>
-
-typedef void (*relocate_new_kernel_t)(
-                unsigned long indirection_page,
-                unsigned long page_list,
-                unsigned long start_address);
-
-static inline void machine_kexec(xen_kexec_image_t *image)
-{
-    relocate_new_kernel_t rnk;
-
-    rnk = (relocate_new_kernel_t) image->page_list[1];
-    (*rnk)(image->indirection_page, (unsigned long)image->page_list, 
-           image->start_address);
-}
-
-#endif /* __X86_64_KEXEC_H__ */
-
-/*
- * Local variables:
- * mode: C
- * c-set-style: "BSD"
- * c-basic-offset: 4
- * tab-width: 4
- * indent-tabs-mode: nil
- * End:
- */
diff -r 6e74932c9a64 -r 9c88b5f3b4eb xen/include/xen/kexec.h
--- a/xen/include/xen/kexec.h   Thu Feb 08 13:42:49 2007 +0000
+++ b/xen/include/xen/kexec.h   Thu Feb 08 13:43:19 2007 +0000
@@ -25,6 +25,7 @@ void machine_kexec_unload(int type, int 
 void machine_kexec_unload(int type, int slot, xen_kexec_image_t *image);
 void machine_kexec_reserved(xen_kexec_reserve_t *reservation);
 void machine_reboot_kexec(xen_kexec_image_t *image);
+void machine_kexec(xen_kexec_image_t *image);
 void kexec_crash(void);
 void kexec_crash_save_cpu(void);
 crash_xen_info_t *kexec_crash_save_info(void);

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