diff options
Diffstat (limited to 'patches/linux-2.6.16.33/kexec-generic.patch')
-rw-r--r-- | patches/linux-2.6.16.33/kexec-generic.patch | 213 |
1 files changed, 0 insertions, 213 deletions
diff --git a/patches/linux-2.6.16.33/kexec-generic.patch b/patches/linux-2.6.16.33/kexec-generic.patch index 2e01a7aab0..a85d546e4d 100644 --- a/patches/linux-2.6.16.33/kexec-generic.patch +++ b/patches/linux-2.6.16.33/kexec-generic.patch @@ -1,216 +1,3 @@ ---- 0001/include/linux/kexec.h -+++ work/include/linux/kexec.h -@@ -31,6 +31,13 @@ - #error KEXEC_ARCH not defined - #endif - -+#ifndef KEXEC_ARCH_HAS_PAGE_MACROS -+#define kexec_page_to_pfn(page) page_to_pfn(page) -+#define kexec_pfn_to_page(pfn) pfn_to_page(pfn) -+#define kexec_virt_to_phys(addr) virt_to_phys(addr) -+#define kexec_phys_to_virt(addr) phys_to_virt(addr) -+#endif -+ - /* - * This structure is used to hold the arguments that are used when loading - * kernel binaries. -@@ -91,6 +98,13 @@ struct kimage { - extern NORET_TYPE void machine_kexec(struct kimage *image) ATTRIB_NORET; - extern int machine_kexec_prepare(struct kimage *image); - extern void machine_kexec_cleanup(struct kimage *image); -+#ifdef CONFIG_XEN -+extern int xen_machine_kexec_load(struct kimage *image); -+extern void xen_machine_kexec_unload(struct kimage *image); -+extern NORET_TYPE void xen_machine_kexec(struct kimage *image) ATTRIB_NORET; -+extern void xen_machine_kexec_setup_resources(void); -+extern void xen_machine_kexec_register_resources(struct resource *res); -+#endif - extern asmlinkage long sys_kexec_load(unsigned long entry, - unsigned long nr_segments, - struct kexec_segment __user *segments, ---- 0001/kernel/kexec.c -+++ work/kernel/kexec.c -@@ -403,7 +403,7 @@ static struct page *kimage_alloc_normal_ - pages = kimage_alloc_pages(GFP_KERNEL, order); - if (!pages) - break; -- pfn = page_to_pfn(pages); -+ pfn = kexec_page_to_pfn(pages); - epfn = pfn + count; - addr = pfn << PAGE_SHIFT; - eaddr = epfn << PAGE_SHIFT; -@@ -437,6 +437,7 @@ static struct page *kimage_alloc_normal_ - return pages; - } - -+#ifndef CONFIG_XEN - static struct page *kimage_alloc_crash_control_pages(struct kimage *image, - unsigned int order) - { -@@ -490,7 +491,7 @@ static struct page *kimage_alloc_crash_c - } - /* If I don't overlap any segments I have found my hole! */ - if (i == image->nr_segments) { -- pages = pfn_to_page(hole_start >> PAGE_SHIFT); -+ pages = kexec_pfn_to_page(hole_start >> PAGE_SHIFT); - break; - } - } -@@ -517,6 +518,13 @@ struct page *kimage_alloc_control_pages( - - return pages; - } -+#else /* !CONFIG_XEN */ -+struct page *kimage_alloc_control_pages(struct kimage *image, -+ unsigned int order) -+{ -+ return kimage_alloc_normal_control_pages(image, order); -+} -+#endif - - static int kimage_add_entry(struct kimage *image, kimage_entry_t entry) - { -@@ -532,7 +540,7 @@ static int kimage_add_entry(struct kimag - return -ENOMEM; - - ind_page = page_address(page); -- *image->entry = virt_to_phys(ind_page) | IND_INDIRECTION; -+ *image->entry = kexec_virt_to_phys(ind_page) | IND_INDIRECTION; - image->entry = ind_page; - image->last_entry = ind_page + - ((PAGE_SIZE/sizeof(kimage_entry_t)) - 1); -@@ -593,13 +601,13 @@ static int kimage_terminate(struct kimag - #define for_each_kimage_entry(image, ptr, entry) \ - for (ptr = &image->head; (entry = *ptr) && !(entry & IND_DONE); \ - ptr = (entry & IND_INDIRECTION)? \ -- phys_to_virt((entry & PAGE_MASK)): ptr +1) -+ kexec_phys_to_virt((entry & PAGE_MASK)): ptr +1) - - static void kimage_free_entry(kimage_entry_t entry) - { - struct page *page; - -- page = pfn_to_page(entry >> PAGE_SHIFT); -+ page = kexec_pfn_to_page(entry >> PAGE_SHIFT); - kimage_free_pages(page); - } - -@@ -611,6 +619,10 @@ static void kimage_free(struct kimage *i - if (!image) - return; - -+#ifdef CONFIG_XEN -+ xen_machine_kexec_unload(image); -+#endif -+ - kimage_free_extra_pages(image); - for_each_kimage_entry(image, ptr, entry) { - if (entry & IND_INDIRECTION) { -@@ -686,7 +698,7 @@ static struct page *kimage_alloc_page(st - * have a match. - */ - list_for_each_entry(page, &image->dest_pages, lru) { -- addr = page_to_pfn(page) << PAGE_SHIFT; -+ addr = kexec_page_to_pfn(page) << PAGE_SHIFT; - if (addr == destination) { - list_del(&page->lru); - return page; -@@ -701,12 +713,12 @@ static struct page *kimage_alloc_page(st - if (!page) - return NULL; - /* If the page cannot be used file it away */ -- if (page_to_pfn(page) > -+ if (kexec_page_to_pfn(page) > - (KEXEC_SOURCE_MEMORY_LIMIT >> PAGE_SHIFT)) { - list_add(&page->lru, &image->unuseable_pages); - continue; - } -- addr = page_to_pfn(page) << PAGE_SHIFT; -+ addr = kexec_page_to_pfn(page) << PAGE_SHIFT; - - /* If it is the destination page we want use it */ - if (addr == destination) -@@ -729,7 +741,7 @@ static struct page *kimage_alloc_page(st - struct page *old_page; - - old_addr = *old & PAGE_MASK; -- old_page = pfn_to_page(old_addr >> PAGE_SHIFT); -+ old_page = kexec_pfn_to_page(old_addr >> PAGE_SHIFT); - copy_highpage(page, old_page); - *old = addr | (*old & ~PAGE_MASK); - -@@ -779,7 +791,7 @@ static int kimage_load_normal_segment(st - result = -ENOMEM; - goto out; - } -- result = kimage_add_page(image, page_to_pfn(page) -+ result = kimage_add_page(image, kexec_page_to_pfn(page) - << PAGE_SHIFT); - if (result < 0) - goto out; -@@ -811,6 +823,7 @@ out: - return result; - } - -+#ifndef CONFIG_XEN - static int kimage_load_crash_segment(struct kimage *image, - struct kexec_segment *segment) - { -@@ -833,7 +846,7 @@ static int kimage_load_crash_segment(str - char *ptr; - size_t uchunk, mchunk; - -- page = pfn_to_page(maddr >> PAGE_SHIFT); -+ page = kexec_pfn_to_page(maddr >> PAGE_SHIFT); - if (page == 0) { - result = -ENOMEM; - goto out; -@@ -881,6 +894,13 @@ static int kimage_load_segment(struct ki - - return result; - } -+#else /* CONFIG_XEN */ -+static int kimage_load_segment(struct kimage *image, -+ struct kexec_segment *segment) -+{ -+ return kimage_load_normal_segment(image, segment); -+} -+#endif - - /* - * Exec Kernel system call: for obvious reasons only root may call it. -@@ -991,6 +1011,11 @@ asmlinkage long sys_kexec_load(unsigned - if (result) - goto out; - } -+#ifdef CONFIG_XEN -+ result = xen_machine_kexec_load(image); -+ if (result) -+ goto out; -+#endif - /* Install the new kernel, and Uninstall the old */ - image = xchg(dest_image, image); - -@@ -1045,7 +1070,6 @@ void crash_kexec(struct pt_regs *regs) - struct kimage *image; - int locked; - -- - /* Take the kexec_lock here to prevent sys_kexec_load - * running on one cpu from replacing the crash kernel - * we are using after a panic on a different cpu. -@@ -1061,7 +1085,11 @@ void crash_kexec(struct pt_regs *regs) - struct pt_regs fixed_regs; - crash_setup_regs(&fixed_regs, regs); - machine_crash_shutdown(&fixed_regs); -+#ifdef CONFIG_XEN -+ xen_machine_kexec(image); -+#else - machine_kexec(image); -+#endif - } - xchg(&kexec_lock, 0); - } --- 0002/kernel/sys.c +++ work/kernel/sys.c @@ -435,8 +435,12 @@ void kernel_kexec(void) |