]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
kexec: Add kimage_arch_load_normal_segment to generic code
authorDave Kleikamp <dave.kleikamp@oracle.com>
Fri, 23 May 2014 21:25:51 +0000 (16:25 -0500)
committerDave Kleikamp <dave.kleikamp@oracle.com>
Mon, 18 Apr 2016 16:42:48 +0000 (11:42 -0500)
original patch by Bob Picco

Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
Cc: Bob Picco <bob.picco@oracle.com>
include/linux/kexec.h
kernel/kexec.c

index e804306ef5e88d7b02b8b7399b4d525c16b69cd3..bd21485dafd62317a28b6f490aa80f704718fe6d 100644 (file)
@@ -222,6 +222,12 @@ extern asmlinkage long sys_kexec_load(unsigned long entry,
                                        struct kexec_segment __user *segments,
                                        unsigned long flags);
 extern int kernel_kexec(void);
+extern int kimage_arch_load_normal_segment(struct kimage *image,
+                               struct kexec_segment *segment,
+                               int *arch_status,
+                               int (*add_phys_addr)(struct kimage *image,
+                                                    unsigned long page));
+
 extern int kexec_add_buffer(struct kimage *image, char *buffer,
                            unsigned long bufsz, unsigned long memsz,
                            unsigned long buf_align, unsigned long buf_min,
index 7a36fdcca5bfb064a6709021782c98bd2a6de179..c8f1c829a7591a4e2d786c0dea0d8a9e73e471a3 100644 (file)
@@ -1062,12 +1062,21 @@ static struct page *kimage_alloc_page(struct kimage *image,
        return page;
 }
 
+int __weak kimage_arch_load_normal_segment(struct kimage *image,
+                       struct kexec_segment *segment,
+                       int *arch_status,
+                       int (*add_phys_addr)(struct kimage *image,
+                                            unsigned long page))
+{
+       return -ENOENT;
+}
+
 static int kimage_load_normal_segment(struct kimage *image,
                                         struct kexec_segment *segment)
 {
        unsigned long maddr;
        size_t ubytes, mbytes;
-       int result;
+       int result, arch_status;
        unsigned char __user *buf = NULL;
        unsigned char *kbuf = NULL;
 
@@ -1084,6 +1093,14 @@ static int kimage_load_normal_segment(struct kimage *image,
        if (result < 0)
                goto out;
 
+       /* Should the arch handle this segment load, then use the arch status.*/
+       result = kimage_arch_load_normal_segment(image, segment, &arch_status,
+                       kimage_add_page);
+       if (!result) {
+               result = arch_status;
+               goto out;
+       }
+
        while (mbytes) {
                struct page *page;
                char *ptr;