ia64/xen-unstable

changeset 12874:1db125262365

[LINUX] kexec: remove patches which are not straight backports.

Their contents will be added to the sparse tree in a subsequent patch.

Changes to kernel/sys.c in kexec-generic.patch remain for now. These
will be taken care of in a later patch.

Signed-off-by: Ian Campbell <ian.campbell@xensource.com>
author Ian Campbell <ian.campbell@xensource.com>
date Fri Dec 08 11:47:09 2006 +0000 (2006-12-08)
parents 7c3dee5ff185
children d51e5a7317bb
files patches/linux-2.6.16.33/kexec-generic.patch patches/linux-2.6.16.33/linux-2.6.19-rc1-kexec-xen-i386.patch patches/linux-2.6.16.33/linux-2.6.19-rc1-kexec-xen-x86_64.patch patches/linux-2.6.16.33/series
line diff
     1.1 --- a/patches/linux-2.6.16.33/kexec-generic.patch	Fri Dec 08 11:46:48 2006 +0000
     1.2 +++ b/patches/linux-2.6.16.33/kexec-generic.patch	Fri Dec 08 11:47:09 2006 +0000
     1.3 @@ -1,216 +1,3 @@
     1.4 ---- 0001/include/linux/kexec.h
     1.5 -+++ work/include/linux/kexec.h
     1.6 -@@ -31,6 +31,13 @@
     1.7 - #error KEXEC_ARCH not defined
     1.8 - #endif
     1.9 - 
    1.10 -+#ifndef KEXEC_ARCH_HAS_PAGE_MACROS
    1.11 -+#define kexec_page_to_pfn(page)  page_to_pfn(page)
    1.12 -+#define kexec_pfn_to_page(pfn)   pfn_to_page(pfn)
    1.13 -+#define kexec_virt_to_phys(addr) virt_to_phys(addr)
    1.14 -+#define kexec_phys_to_virt(addr) phys_to_virt(addr)
    1.15 -+#endif
    1.16 -+
    1.17 - /*
    1.18 -  * This structure is used to hold the arguments that are used when loading
    1.19 -  * kernel binaries.
    1.20 -@@ -91,6 +98,13 @@ struct kimage {
    1.21 - extern NORET_TYPE void machine_kexec(struct kimage *image) ATTRIB_NORET;
    1.22 - extern int machine_kexec_prepare(struct kimage *image);
    1.23 - extern void machine_kexec_cleanup(struct kimage *image);
    1.24 -+#ifdef CONFIG_XEN
    1.25 -+extern int xen_machine_kexec_load(struct kimage *image);
    1.26 -+extern void xen_machine_kexec_unload(struct kimage *image);
    1.27 -+extern NORET_TYPE void xen_machine_kexec(struct kimage *image) ATTRIB_NORET;
    1.28 -+extern void xen_machine_kexec_setup_resources(void);
    1.29 -+extern void xen_machine_kexec_register_resources(struct resource *res);
    1.30 -+#endif
    1.31 - extern asmlinkage long sys_kexec_load(unsigned long entry,
    1.32 - 					unsigned long nr_segments,
    1.33 - 					struct kexec_segment __user *segments,
    1.34 ---- 0001/kernel/kexec.c
    1.35 -+++ work/kernel/kexec.c
    1.36 -@@ -403,7 +403,7 @@ static struct page *kimage_alloc_normal_
    1.37 - 		pages = kimage_alloc_pages(GFP_KERNEL, order);
    1.38 - 		if (!pages)
    1.39 - 			break;
    1.40 --		pfn   = page_to_pfn(pages);
    1.41 -+		pfn   = kexec_page_to_pfn(pages);
    1.42 - 		epfn  = pfn + count;
    1.43 - 		addr  = pfn << PAGE_SHIFT;
    1.44 - 		eaddr = epfn << PAGE_SHIFT;
    1.45 -@@ -437,6 +437,7 @@ static struct page *kimage_alloc_normal_
    1.46 - 	return pages;
    1.47 - }
    1.48 - 
    1.49 -+#ifndef CONFIG_XEN
    1.50 - static struct page *kimage_alloc_crash_control_pages(struct kimage *image,
    1.51 - 						      unsigned int order)
    1.52 - {
    1.53 -@@ -490,7 +491,7 @@ static struct page *kimage_alloc_crash_c
    1.54 - 		}
    1.55 - 		/* If I don't overlap any segments I have found my hole! */
    1.56 - 		if (i == image->nr_segments) {
    1.57 --			pages = pfn_to_page(hole_start >> PAGE_SHIFT);
    1.58 -+			pages = kexec_pfn_to_page(hole_start >> PAGE_SHIFT);
    1.59 - 			break;
    1.60 - 		}
    1.61 - 	}
    1.62 -@@ -517,6 +518,13 @@ struct page *kimage_alloc_control_pages(
    1.63 - 
    1.64 - 	return pages;
    1.65 - }
    1.66 -+#else /* !CONFIG_XEN */
    1.67 -+struct page *kimage_alloc_control_pages(struct kimage *image,
    1.68 -+					 unsigned int order)
    1.69 -+{
    1.70 -+	return kimage_alloc_normal_control_pages(image, order);
    1.71 -+}
    1.72 -+#endif
    1.73 - 
    1.74 - static int kimage_add_entry(struct kimage *image, kimage_entry_t entry)
    1.75 - {
    1.76 -@@ -532,7 +540,7 @@ static int kimage_add_entry(struct kimag
    1.77 - 			return -ENOMEM;
    1.78 - 
    1.79 - 		ind_page = page_address(page);
    1.80 --		*image->entry = virt_to_phys(ind_page) | IND_INDIRECTION;
    1.81 -+		*image->entry = kexec_virt_to_phys(ind_page) | IND_INDIRECTION;
    1.82 - 		image->entry = ind_page;
    1.83 - 		image->last_entry = ind_page +
    1.84 - 				      ((PAGE_SIZE/sizeof(kimage_entry_t)) - 1);
    1.85 -@@ -593,13 +601,13 @@ static int kimage_terminate(struct kimag
    1.86 - #define for_each_kimage_entry(image, ptr, entry) \
    1.87 - 	for (ptr = &image->head; (entry = *ptr) && !(entry & IND_DONE); \
    1.88 - 		ptr = (entry & IND_INDIRECTION)? \
    1.89 --			phys_to_virt((entry & PAGE_MASK)): ptr +1)
    1.90 -+			kexec_phys_to_virt((entry & PAGE_MASK)): ptr +1)
    1.91 - 
    1.92 - static void kimage_free_entry(kimage_entry_t entry)
    1.93 - {
    1.94 - 	struct page *page;
    1.95 - 
    1.96 --	page = pfn_to_page(entry >> PAGE_SHIFT);
    1.97 -+	page = kexec_pfn_to_page(entry >> PAGE_SHIFT);
    1.98 - 	kimage_free_pages(page);
    1.99 - }
   1.100 - 
   1.101 -@@ -611,6 +619,10 @@ static void kimage_free(struct kimage *i
   1.102 - 	if (!image)
   1.103 - 		return;
   1.104 - 
   1.105 -+#ifdef CONFIG_XEN
   1.106 -+	xen_machine_kexec_unload(image);
   1.107 -+#endif
   1.108 -+
   1.109 - 	kimage_free_extra_pages(image);
   1.110 - 	for_each_kimage_entry(image, ptr, entry) {
   1.111 - 		if (entry & IND_INDIRECTION) {
   1.112 -@@ -686,7 +698,7 @@ static struct page *kimage_alloc_page(st
   1.113 - 	 * have a match.
   1.114 - 	 */
   1.115 - 	list_for_each_entry(page, &image->dest_pages, lru) {
   1.116 --		addr = page_to_pfn(page) << PAGE_SHIFT;
   1.117 -+		addr = kexec_page_to_pfn(page) << PAGE_SHIFT;
   1.118 - 		if (addr == destination) {
   1.119 - 			list_del(&page->lru);
   1.120 - 			return page;
   1.121 -@@ -701,12 +713,12 @@ static struct page *kimage_alloc_page(st
   1.122 - 		if (!page)
   1.123 - 			return NULL;
   1.124 - 		/* If the page cannot be used file it away */
   1.125 --		if (page_to_pfn(page) >
   1.126 -+		if (kexec_page_to_pfn(page) >
   1.127 - 				(KEXEC_SOURCE_MEMORY_LIMIT >> PAGE_SHIFT)) {
   1.128 - 			list_add(&page->lru, &image->unuseable_pages);
   1.129 - 			continue;
   1.130 - 		}
   1.131 --		addr = page_to_pfn(page) << PAGE_SHIFT;
   1.132 -+		addr = kexec_page_to_pfn(page) << PAGE_SHIFT;
   1.133 - 
   1.134 - 		/* If it is the destination page we want use it */
   1.135 - 		if (addr == destination)
   1.136 -@@ -729,7 +741,7 @@ static struct page *kimage_alloc_page(st
   1.137 - 			struct page *old_page;
   1.138 - 
   1.139 - 			old_addr = *old & PAGE_MASK;
   1.140 --			old_page = pfn_to_page(old_addr >> PAGE_SHIFT);
   1.141 -+			old_page = kexec_pfn_to_page(old_addr >> PAGE_SHIFT);
   1.142 - 			copy_highpage(page, old_page);
   1.143 - 			*old = addr | (*old & ~PAGE_MASK);
   1.144 - 
   1.145 -@@ -779,7 +791,7 @@ static int kimage_load_normal_segment(st
   1.146 - 			result  = -ENOMEM;
   1.147 - 			goto out;
   1.148 - 		}
   1.149 --		result = kimage_add_page(image, page_to_pfn(page)
   1.150 -+		result = kimage_add_page(image, kexec_page_to_pfn(page)
   1.151 - 								<< PAGE_SHIFT);
   1.152 - 		if (result < 0)
   1.153 - 			goto out;
   1.154 -@@ -811,6 +823,7 @@ out:
   1.155 - 	return result;
   1.156 - }
   1.157 - 
   1.158 -+#ifndef CONFIG_XEN
   1.159 - static int kimage_load_crash_segment(struct kimage *image,
   1.160 - 					struct kexec_segment *segment)
   1.161 - {
   1.162 -@@ -833,7 +846,7 @@ static int kimage_load_crash_segment(str
   1.163 - 		char *ptr;
   1.164 - 		size_t uchunk, mchunk;
   1.165 - 
   1.166 --		page = pfn_to_page(maddr >> PAGE_SHIFT);
   1.167 -+		page = kexec_pfn_to_page(maddr >> PAGE_SHIFT);
   1.168 - 		if (page == 0) {
   1.169 - 			result  = -ENOMEM;
   1.170 - 			goto out;
   1.171 -@@ -881,6 +894,13 @@ static int kimage_load_segment(struct ki
   1.172 - 
   1.173 - 	return result;
   1.174 - }
   1.175 -+#else /* CONFIG_XEN */
   1.176 -+static int kimage_load_segment(struct kimage *image,
   1.177 -+				struct kexec_segment *segment)
   1.178 -+{
   1.179 -+	return kimage_load_normal_segment(image, segment);
   1.180 -+}
   1.181 -+#endif
   1.182 - 
   1.183 - /*
   1.184 -  * Exec Kernel system call: for obvious reasons only root may call it.
   1.185 -@@ -991,6 +1011,11 @@ asmlinkage long sys_kexec_load(unsigned 
   1.186 - 		if (result)
   1.187 - 			goto out;
   1.188 - 	}
   1.189 -+#ifdef CONFIG_XEN
   1.190 -+	result = xen_machine_kexec_load(image);
   1.191 -+	if (result)
   1.192 -+		goto out;
   1.193 -+#endif
   1.194 - 	/* Install the new kernel, and  Uninstall the old */
   1.195 - 	image = xchg(dest_image, image);
   1.196 - 
   1.197 -@@ -1045,7 +1070,6 @@ void crash_kexec(struct pt_regs *regs)
   1.198 - 	struct kimage *image;
   1.199 - 	int locked;
   1.200 - 
   1.201 --
   1.202 - 	/* Take the kexec_lock here to prevent sys_kexec_load
   1.203 - 	 * running on one cpu from replacing the crash kernel
   1.204 - 	 * we are using after a panic on a different cpu.
   1.205 -@@ -1061,7 +1085,11 @@ void crash_kexec(struct pt_regs *regs)
   1.206 - 			struct pt_regs fixed_regs;
   1.207 - 			crash_setup_regs(&fixed_regs, regs);
   1.208 - 			machine_crash_shutdown(&fixed_regs);
   1.209 -+#ifdef CONFIG_XEN
   1.210 -+			xen_machine_kexec(image);
   1.211 -+#else
   1.212 - 			machine_kexec(image);
   1.213 -+#endif
   1.214 - 		}
   1.215 - 		xchg(&kexec_lock, 0);
   1.216 - 	}
   1.217  --- 0002/kernel/sys.c
   1.218  +++ work/kernel/sys.c
   1.219  @@ -435,8 +435,12 @@ void kernel_kexec(void)
     2.1 --- a/patches/linux-2.6.16.33/linux-2.6.19-rc1-kexec-xen-i386.patch	Fri Dec 08 11:46:48 2006 +0000
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,108 +0,0 @@
     2.4 ---- 0001/arch/i386/kernel/crash.c
     2.5 -+++ work/arch/i386/kernel/crash.c
     2.6 -@@ -90,6 +90,7 @@ static void crash_save_self(struct pt_re
     2.7 - 	crash_save_this_cpu(regs, cpu);
     2.8 - }
     2.9 - 
    2.10 -+#ifndef CONFIG_XEN
    2.11 - #ifdef CONFIG_SMP
    2.12 - static atomic_t waiting_for_crash_ipi;
    2.13 - 
    2.14 -@@ -158,6 +159,7 @@ static void nmi_shootdown_cpus(void)
    2.15 - 	/* There are no cpus to shootdown */
    2.16 - }
    2.17 - #endif
    2.18 -+#endif /* CONFIG_XEN */
    2.19 - 
    2.20 - void machine_crash_shutdown(struct pt_regs *regs)
    2.21 - {
    2.22 -@@ -174,10 +176,12 @@ void machine_crash_shutdown(struct pt_re
    2.23 - 
    2.24 - 	/* Make a note of crashing cpu. Will be used in NMI callback.*/
    2.25 - 	crashing_cpu = smp_processor_id();
    2.26 -+#ifndef CONFIG_XEN
    2.27 - 	nmi_shootdown_cpus();
    2.28 - 	lapic_shutdown();
    2.29 - #if defined(CONFIG_X86_IO_APIC)
    2.30 - 	disable_IO_APIC();
    2.31 - #endif
    2.32 -+#endif /* CONFIG_XEN */
    2.33 - 	crash_save_self(regs);
    2.34 - }
    2.35 ---- 0007/arch/i386/kernel/machine_kexec.c
    2.36 -+++ work/arch/i386/kernel/machine_kexec.c
    2.37 -@@ -19,6 +19,10 @@
    2.38 - #include <asm/desc.h>
    2.39 - #include <asm/system.h>
    2.40 - 
    2.41 -+#ifdef CONFIG_XEN
    2.42 -+#include <xen/interface/kexec.h>
    2.43 -+#endif
    2.44 -+
    2.45 - #define PAGE_ALIGNED __attribute__ ((__aligned__(PAGE_SIZE)))
    2.46 - static u32 kexec_pgd[1024] PAGE_ALIGNED;
    2.47 - #ifdef CONFIG_X86_PAE
    2.48 -@@ -28,6 +32,40 @@ static u32 kexec_pmd1[1024] PAGE_ALIGNED
    2.49 - static u32 kexec_pte0[1024] PAGE_ALIGNED;
    2.50 - static u32 kexec_pte1[1024] PAGE_ALIGNED;
    2.51 - 
    2.52 -+#ifdef CONFIG_XEN
    2.53 -+
    2.54 -+#define __ma(x) (pfn_to_mfn(__pa((x)) >> PAGE_SHIFT) << PAGE_SHIFT)
    2.55 -+
    2.56 -+#if PAGES_NR > KEXEC_XEN_NO_PAGES
    2.57 -+#error PAGES_NR is greater than KEXEC_XEN_NO_PAGES - Xen support will break
    2.58 -+#endif
    2.59 -+
    2.60 -+#if PA_CONTROL_PAGE != 0
    2.61 -+#error PA_CONTROL_PAGE is non zero - Xen support will break
    2.62 -+#endif
    2.63 -+
    2.64 -+void machine_kexec_setup_load_arg(xen_kexec_image_t *xki, struct kimage *image)
    2.65 -+{
    2.66 -+	void *control_page;
    2.67 -+
    2.68 -+	memset(xki->page_list, 0, sizeof(xki->page_list));
    2.69 -+
    2.70 -+	control_page = page_address(image->control_code_page);
    2.71 -+	memcpy(control_page, relocate_kernel, PAGE_SIZE);
    2.72 -+
    2.73 -+	xki->page_list[PA_CONTROL_PAGE] = __ma(control_page);
    2.74 -+	xki->page_list[PA_PGD] = __ma(kexec_pgd);
    2.75 -+#ifdef CONFIG_X86_PAE
    2.76 -+	xki->page_list[PA_PMD_0] = __ma(kexec_pmd0);
    2.77 -+	xki->page_list[PA_PMD_1] = __ma(kexec_pmd1);
    2.78 -+#endif
    2.79 -+	xki->page_list[PA_PTE_0] = __ma(kexec_pte0);
    2.80 -+	xki->page_list[PA_PTE_1] = __ma(kexec_pte1);
    2.81 -+
    2.82 -+}
    2.83 -+
    2.84 -+#endif /* CONFIG_XEN */
    2.85 -+
    2.86 - /*
    2.87 -  * A architecture hook called to validate the
    2.88 -  * proposed image and prepare the control pages
    2.89 ---- 0006/include/asm-i386/kexec.h
    2.90 -+++ work/include/asm-i386/kexec.h
    2.91 -@@ -98,6 +98,20 @@ relocate_kernel(unsigned long indirectio
    2.92 - 		unsigned long start_address,
    2.93 - 		unsigned int has_pae) ATTRIB_NORET;
    2.94 - 
    2.95 -+
    2.96 -+/* Under Xen we need to work with machine addresses. These macros give the
    2.97 -+ * machine address of a certain page to the generic kexec code instead of 
    2.98 -+ * the pseudo physical address which would be given by the default macros.
    2.99 -+ */
   2.100 -+
   2.101 -+#ifdef CONFIG_XEN
   2.102 -+#define KEXEC_ARCH_HAS_PAGE_MACROS
   2.103 -+#define kexec_page_to_pfn(page)  pfn_to_mfn(page_to_pfn(page))
   2.104 -+#define kexec_pfn_to_page(pfn)   pfn_to_page(mfn_to_pfn(pfn))
   2.105 -+#define kexec_virt_to_phys(addr) virt_to_machine(addr)
   2.106 -+#define kexec_phys_to_virt(addr) phys_to_virt(machine_to_phys(addr))
   2.107 -+#endif
   2.108 -+
   2.109 - #endif /* __ASSEMBLY__ */
   2.110 - 
   2.111 - #endif /* _I386_KEXEC_H */
     3.1 --- a/patches/linux-2.6.16.33/linux-2.6.19-rc1-kexec-xen-x86_64.patch	Fri Dec 08 11:46:48 2006 +0000
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,219 +0,0 @@
     3.4 ---- 0001/arch/x86_64/kernel/crash.c
     3.5 -+++ work/arch/x86_64/kernel/crash.c
     3.6 -@@ -92,6 +92,7 @@ static void crash_save_self(struct pt_re
     3.7 - 	crash_save_this_cpu(regs, cpu);
     3.8 - }
     3.9 - 
    3.10 -+#ifndef CONFIG_XEN
    3.11 - #ifdef CONFIG_SMP
    3.12 - static atomic_t waiting_for_crash_ipi;
    3.13 - 
    3.14 -@@ -156,6 +157,7 @@ static void nmi_shootdown_cpus(void)
    3.15 - 	/* There are no cpus to shootdown */
    3.16 - }
    3.17 - #endif
    3.18 -+#endif /* CONFIG_XEN */
    3.19 - 
    3.20 - void machine_crash_shutdown(struct pt_regs *regs)
    3.21 - {
    3.22 -@@ -173,6 +175,8 @@ void machine_crash_shutdown(struct pt_re
    3.23 - 
    3.24 - 	/* Make a note of crashing cpu. Will be used in NMI callback.*/
    3.25 - 	crashing_cpu = smp_processor_id();
    3.26 -+
    3.27 -+#ifndef CONFIG_XEN
    3.28 - 	nmi_shootdown_cpus();
    3.29 - 
    3.30 - 	if(cpu_has_apic)
    3.31 -@@ -181,6 +185,6 @@ void machine_crash_shutdown(struct pt_re
    3.32 - #if defined(CONFIG_X86_IO_APIC)
    3.33 - 	disable_IO_APIC();
    3.34 - #endif
    3.35 --
    3.36 -+#endif /* CONFIG_XEN */
    3.37 - 	crash_save_self(regs);
    3.38 - }
    3.39 ---- 0010/arch/x86_64/kernel/machine_kexec.c
    3.40 -+++ work/arch/x86_64/kernel/machine_kexec.c
    3.41 -@@ -24,6 +24,104 @@ static u64 kexec_pud1[512] PAGE_ALIGNED;
    3.42 - static u64 kexec_pmd1[512] PAGE_ALIGNED;
    3.43 - static u64 kexec_pte1[512] PAGE_ALIGNED;
    3.44 - 
    3.45 -+#ifdef CONFIG_XEN
    3.46 -+
    3.47 -+/* In the case of Xen, override hypervisor functions to be able to create
    3.48 -+ * a regular identity mapping page table...
    3.49 -+ */
    3.50 -+
    3.51 -+#include <xen/interface/kexec.h>
    3.52 -+#include <xen/interface/memory.h>
    3.53 -+
    3.54 -+#define x__pmd(x) ((pmd_t) { (x) } )
    3.55 -+#define x__pud(x) ((pud_t) { (x) } )
    3.56 -+#define x__pgd(x) ((pgd_t) { (x) } )
    3.57 -+
    3.58 -+#define x_pmd_val(x)   ((x).pmd)
    3.59 -+#define x_pud_val(x)   ((x).pud)
    3.60 -+#define x_pgd_val(x)   ((x).pgd)
    3.61 -+
    3.62 -+static inline void x_set_pmd(pmd_t *dst, pmd_t val)
    3.63 -+{
    3.64 -+	x_pmd_val(*dst) = x_pmd_val(val);
    3.65 -+}
    3.66 -+
    3.67 -+static inline void x_set_pud(pud_t *dst, pud_t val)
    3.68 -+{
    3.69 -+	x_pud_val(*dst) = phys_to_machine(x_pud_val(val));
    3.70 -+}
    3.71 -+
    3.72 -+static inline void x_pud_clear (pud_t *pud)
    3.73 -+{
    3.74 -+	x_pud_val(*pud) = 0;
    3.75 -+}
    3.76 -+
    3.77 -+static inline void x_set_pgd(pgd_t *dst, pgd_t val)
    3.78 -+{
    3.79 -+	x_pgd_val(*dst) = phys_to_machine(x_pgd_val(val));
    3.80 -+}
    3.81 -+
    3.82 -+static inline void x_pgd_clear (pgd_t * pgd)
    3.83 -+{
    3.84 -+	x_pgd_val(*pgd) = 0;
    3.85 -+}
    3.86 -+
    3.87 -+#define X__PAGE_KERNEL_LARGE_EXEC \
    3.88 -+         _PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_PSE
    3.89 -+#define X_KERNPG_TABLE _PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY
    3.90 -+
    3.91 -+#define __ma(x) (pfn_to_mfn(__pa((x)) >> PAGE_SHIFT) << PAGE_SHIFT)
    3.92 -+
    3.93 -+#if PAGES_NR > KEXEC_XEN_NO_PAGES
    3.94 -+#error PAGES_NR is greater than KEXEC_XEN_NO_PAGES - Xen support will break
    3.95 -+#endif
    3.96 -+
    3.97 -+#if PA_CONTROL_PAGE != 0
    3.98 -+#error PA_CONTROL_PAGE is non zero - Xen support will break
    3.99 -+#endif
   3.100 -+
   3.101 -+void machine_kexec_setup_load_arg(xen_kexec_image_t *xki, struct kimage *image)
   3.102 -+{
   3.103 -+	void *control_page;
   3.104 -+	void *table_page;
   3.105 -+
   3.106 -+	memset(xki->page_list, 0, sizeof(xki->page_list));
   3.107 -+
   3.108 -+	control_page = page_address(image->control_code_page) + PAGE_SIZE;
   3.109 -+	memcpy(control_page, relocate_kernel, PAGE_SIZE);
   3.110 -+
   3.111 -+	table_page = page_address(image->control_code_page);
   3.112 -+
   3.113 -+	xki->page_list[PA_CONTROL_PAGE] = __ma(control_page);
   3.114 -+	xki->page_list[PA_TABLE_PAGE] = __ma(table_page);
   3.115 -+
   3.116 -+	xki->page_list[PA_PGD] = __ma(kexec_pgd);
   3.117 -+	xki->page_list[PA_PUD_0] = __ma(kexec_pud0);
   3.118 -+	xki->page_list[PA_PUD_1] = __ma(kexec_pud1);
   3.119 -+	xki->page_list[PA_PMD_0] = __ma(kexec_pmd0);
   3.120 -+	xki->page_list[PA_PMD_1] = __ma(kexec_pmd1);
   3.121 -+	xki->page_list[PA_PTE_0] = __ma(kexec_pte0);
   3.122 -+	xki->page_list[PA_PTE_1] = __ma(kexec_pte1);
   3.123 -+}
   3.124 -+
   3.125 -+#else /* CONFIG_XEN */
   3.126 -+
   3.127 -+#define x__pmd(x) __pmd(x)
   3.128 -+#define x__pud(x) __pud(x)
   3.129 -+#define x__pgd(x) __pgd(x)
   3.130 -+
   3.131 -+#define x_set_pmd(x, y) set_pmd(x, y)
   3.132 -+#define x_set_pud(x, y) set_pud(x, y)
   3.133 -+#define x_set_pgd(x, y) set_pgd(x, y)
   3.134 -+
   3.135 -+#define x_pud_clear(x) pud_clear(x)
   3.136 -+#define x_pgd_clear(x) pgd_clear(x)
   3.137 -+
   3.138 -+#define X__PAGE_KERNEL_LARGE_EXEC __PAGE_KERNEL_LARGE_EXEC
   3.139 -+#define X_KERNPG_TABLE _KERNPG_TABLE
   3.140 -+
   3.141 -+#endif /* CONFIG_XEN */
   3.142 -+
   3.143 - static void init_level2_page(pmd_t *level2p, unsigned long addr)
   3.144 - {
   3.145 - 	unsigned long end_addr;
   3.146 -@@ -31,7 +129,7 @@ static void init_level2_page(pmd_t *leve
   3.147 - 	addr &= PAGE_MASK;
   3.148 - 	end_addr = addr + PUD_SIZE;
   3.149 - 	while (addr < end_addr) {
   3.150 --		set_pmd(level2p++, __pmd(addr | __PAGE_KERNEL_LARGE_EXEC));
   3.151 -+		x_set_pmd(level2p++, x__pmd(addr | X__PAGE_KERNEL_LARGE_EXEC));
   3.152 - 		addr += PMD_SIZE;
   3.153 - 	}
   3.154 - }
   3.155 -@@ -56,12 +154,12 @@ static int init_level3_page(struct kimag
   3.156 - 		}
   3.157 - 		level2p = (pmd_t *)page_address(page);
   3.158 - 		init_level2_page(level2p, addr);
   3.159 --		set_pud(level3p++, __pud(__pa(level2p) | _KERNPG_TABLE));
   3.160 -+		x_set_pud(level3p++, x__pud(__pa(level2p) | X_KERNPG_TABLE));
   3.161 - 		addr += PUD_SIZE;
   3.162 - 	}
   3.163 - 	/* clear the unused entries */
   3.164 - 	while (addr < end_addr) {
   3.165 --		pud_clear(level3p++);
   3.166 -+		x_pud_clear(level3p++);
   3.167 - 		addr += PUD_SIZE;
   3.168 - 	}
   3.169 - out:
   3.170 -@@ -92,12 +190,12 @@ static int init_level4_page(struct kimag
   3.171 - 		if (result) {
   3.172 - 			goto out;
   3.173 - 		}
   3.174 --		set_pgd(level4p++, __pgd(__pa(level3p) | _KERNPG_TABLE));
   3.175 -+		x_set_pgd(level4p++, x__pgd(__pa(level3p) | X_KERNPG_TABLE));
   3.176 - 		addr += PGDIR_SIZE;
   3.177 - 	}
   3.178 - 	/* clear the unused entries */
   3.179 - 	while (addr < end_addr) {
   3.180 --		pgd_clear(level4p++);
   3.181 -+		x_pgd_clear(level4p++);
   3.182 - 		addr += PGDIR_SIZE;
   3.183 - 	}
   3.184 - out:
   3.185 -@@ -108,8 +206,14 @@ out:
   3.186 - static int init_pgtable(struct kimage *image, unsigned long start_pgtable)
   3.187 - {
   3.188 - 	pgd_t *level4p;
   3.189 -+	unsigned long x_end_pfn = end_pfn;
   3.190 -+
   3.191 -+#ifdef CONFIG_XEN
   3.192 -+	x_end_pfn = HYPERVISOR_memory_op(XENMEM_maximum_ram_page, NULL);
   3.193 -+#endif
   3.194 -+
   3.195 - 	level4p = (pgd_t *)__va(start_pgtable);
   3.196 -- 	return init_level4_page(image, level4p, 0, end_pfn << PAGE_SHIFT);
   3.197 -+ 	return init_level4_page(image, level4p, 0, x_end_pfn << PAGE_SHIFT);
   3.198 - }
   3.199 - 
   3.200 - int machine_kexec_prepare(struct kimage *image)
   3.201 ---- 0009/include/asm-x86_64/kexec.h
   3.202 -+++ work/include/asm-x86_64/kexec.h
   3.203 -@@ -91,6 +91,19 @@ relocate_kernel(unsigned long indirectio
   3.204 - 		unsigned long page_list,
   3.205 - 		unsigned long start_address) ATTRIB_NORET;
   3.206 - 
   3.207 -+/* Under Xen we need to work with machine addresses. These macros give the
   3.208 -+ * machine address of a certain page to the generic kexec code instead of 
   3.209 -+ * the pseudo physical address which would be given by the default macros.
   3.210 -+ */
   3.211 -+
   3.212 -+#ifdef CONFIG_XEN
   3.213 -+#define KEXEC_ARCH_HAS_PAGE_MACROS
   3.214 -+#define kexec_page_to_pfn(page)  pfn_to_mfn(page_to_pfn(page))
   3.215 -+#define kexec_pfn_to_page(pfn)   pfn_to_page(mfn_to_pfn(pfn))
   3.216 -+#define kexec_virt_to_phys(addr) virt_to_machine(addr)
   3.217 -+#define kexec_phys_to_virt(addr) phys_to_virt(machine_to_phys(addr))
   3.218 -+#endif
   3.219 -+
   3.220 - #endif /* __ASSEMBLY__ */
   3.221 - 
   3.222 - #endif /* _X86_64_KEXEC_H */
     4.1 --- a/patches/linux-2.6.16.33/series	Fri Dec 08 11:46:48 2006 +0000
     4.2 +++ b/patches/linux-2.6.16.33/series	Fri Dec 08 11:47:09 2006 +0000
     4.3 @@ -3,10 +3,8 @@ git-2efe55a9cec8418f0e0cde3dc3787a42fddc
     4.4  git-2a8a3d5b65e86ec1dfef7d268c64a909eab94af7.patch
     4.5  git-3566561bfadffcb5dbc85d576be80c0dbf2cccc9.patch
     4.6  linux-2.6.19-rc1-kexec-move_segment_code-i386.patch
     4.7 -linux-2.6.19-rc1-kexec-xen-i386.patch
     4.8  git-4bfaaef01a1badb9e8ffb0c0a37cd2379008d21f.patch
     4.9  linux-2.6.19-rc1-kexec-move_segment_code-x86_64.patch
    4.10 -linux-2.6.19-rc1-kexec-xen-x86_64.patch
    4.11  blktap-aio-16_03_06.patch
    4.12  device_bind.patch
    4.13  fix-hz-suspend.patch