]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - kernel/kexec.c
ARM: dts: imx6ul: disable PWMs by default
[karo-tx-linux.git] / kernel / kexec.c
index d873b64fbddcdd9e1666738f2b6192c6c5dc0029..b44cb3f5a15ce0faef496b948d039bdf73b21f74 100644 (file)
@@ -63,16 +63,16 @@ static int kimage_alloc_init(struct kimage **rimage, unsigned long entry,
        if (ret)
                goto out_free_image;
 
-       ret = sanity_check_segment_list(image);
-       if (ret)
-               goto out_free_image;
-
-        /* Enable the special crash kernel control page allocation policy. */
        if (kexec_on_panic) {
+               /* Enable special crash kernel control page alloc policy. */
                image->control_page = crashk_res.start;
                image->type = KEXEC_TYPE_CRASH;
        }
 
+       ret = sanity_check_segment_list(image);
+       if (ret)
+               goto out_free_image;
+
        /*
         * Find a location for the control code buffer, and add it
         * the vector of segments so that it's pages will also be
@@ -167,8 +167,12 @@ SYSCALL_DEFINE4(kexec_load, unsigned long, entry, unsigned long, nr_segments,
                return -EBUSY;
 
        dest_image = &kexec_image;
-       if (flags & KEXEC_ON_CRASH)
+       if (flags & KEXEC_ON_CRASH) {
                dest_image = &kexec_crash_image;
+               if (kexec_crash_image)
+                       arch_kexec_unprotect_crashkres();
+       }
+
        if (nr_segments > 0) {
                unsigned long i;
 
@@ -211,6 +215,9 @@ SYSCALL_DEFINE4(kexec_load, unsigned long, entry, unsigned long, nr_segments,
        image = xchg(dest_image, image);
 
 out:
+       if ((flags & KEXEC_ON_CRASH) && kexec_crash_image)
+               arch_kexec_protect_crashkres();
+
        mutex_unlock(&kexec_mutex);
        kimage_free(image);