Release 4.14 arch/mips/kernel/machine_kexec.c
/*
* machine_kexec.c for kexec
* Created by <nschichan@corp.free.fr> on Thu Oct 12 15:15:06 2006
*
* This source code is licensed under the GNU General Public License,
* Version 2. See the file COPYING for more details.
*/
#include <linux/compiler.h>
#include <linux/kexec.h>
#include <linux/mm.h>
#include <linux/delay.h>
#include <asm/cacheflush.h>
#include <asm/page.h>
extern const unsigned char relocate_new_kernel[];
extern const size_t relocate_new_kernel_size;
extern unsigned long kexec_start_address;
extern unsigned long kexec_indirection_page;
int (*_machine_kexec_prepare)(struct kimage *) = NULL;
void (*_machine_kexec_shutdown)(void) = NULL;
void (*_machine_crash_shutdown)(struct pt_regs *regs) = NULL;
#ifdef CONFIG_SMP
void (*relocated_kexec_smp_wait) (void *);
atomic_t kexec_ready_to_reboot = ATOMIC_INIT(0);
void (*_crash_smp_send_stop)(void) = NULL;
#endif
static void kexec_image_info(const struct kimage *kimage)
{
unsigned long i;
pr_debug("kexec kimage info:\n");
pr_debug(" type: %d\n", kimage->type);
pr_debug(" start: %lx\n", kimage->start);
pr_debug(" head: %lx\n", kimage->head);
pr_debug(" nr_segments: %lu\n", kimage->nr_segments);
for (i = 0; i < kimage->nr_segments; i++) {
pr_debug(" segment[%lu]: %016lx - %016lx, 0x%lx bytes, %lu pages\n",
i,
kimage->segment[i].mem,
kimage->segment[i].mem + kimage->segment[i].memsz,
(unsigned long)kimage->segment[i].memsz,
(unsigned long)kimage->segment[i].memsz / PAGE_SIZE);
}
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Marcin Nowakowski | 136 | 100.00% | 1 | 100.00% |
Total | 136 | 100.00% | 1 | 100.00% |
int
machine_kexec_prepare(struct kimage *kimage)
{
kexec_image_info(kimage);
if (_machine_kexec_prepare)
return _machine_kexec_prepare(kimage);
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Nicolas Schichan | 13 | 46.43% | 1 | 33.33% |
Ralf Bächle | 10 | 35.71% | 1 | 33.33% |
Marcin Nowakowski | 5 | 17.86% | 1 | 33.33% |
Total | 28 | 100.00% | 3 | 100.00% |
void
machine_kexec_cleanup(struct kimage *kimage)
{
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Nicolas Schichan | 9 | 100.00% | 1 | 100.00% |
Total | 9 | 100.00% | 1 | 100.00% |
void
machine_shutdown(void)
{
if (_machine_kexec_shutdown)
_machine_kexec_shutdown();
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ralf Bächle | 9 | 64.29% | 1 | 50.00% |
Nicolas Schichan | 5 | 35.71% | 1 | 50.00% |
Total | 14 | 100.00% | 2 | 100.00% |
void
machine_crash_shutdown(struct pt_regs *regs)
{
if (_machine_crash_shutdown)
_machine_crash_shutdown(regs);
else
default_machine_crash_shutdown(regs);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ralf Bächle | 17 | 68.00% | 1 | 50.00% |
Nicolas Schichan | 8 | 32.00% | 1 | 50.00% |
Total | 25 | 100.00% | 2 | 100.00% |
typedef void (*noretfun_t)(void) __noreturn;
void
machine_kexec(struct kimage *image)
{
unsigned long reboot_code_buffer;
unsigned long entry;
unsigned long *ptr;
reboot_code_buffer =
(unsigned long)page_address(image->control_code_page);
kexec_start_address =
(unsigned long) phys_to_virt(image->start);
if (image->type == KEXEC_TYPE_DEFAULT) {
kexec_indirection_page =
(unsigned long) phys_to_virt(image->head & PAGE_MASK);
} else {
kexec_indirection_page = (unsigned long)&image->head;
}
memcpy((void*)reboot_code_buffer, relocate_new_kernel,
relocate_new_kernel_size);
/*
* The generic kexec code builds a page list with physical
* addresses. they are directly accessible through KSEG0 (or
* CKSEG0 or XPHYS if on 64bit system), hence the
* phys_to_virt() call.
*/
for (ptr = &image->head; (entry = *ptr) && !(entry &IND_DONE);
ptr = (entry & IND_INDIRECTION) ?
phys_to_virt(entry & PAGE_MASK) : ptr + 1) {
if (*ptr & IND_SOURCE || *ptr & IND_INDIRECTION ||
*ptr & IND_DESTINATION)
*ptr = (unsigned long) phys_to_virt(*ptr);
}
/*
* we do not want to be bothered.
*/
local_irq_disable();
printk("Will call new kernel at %08lx\n", image->start);
printk("Bye ...\n");
__flush_cache_all();
#ifdef CONFIG_SMP
/* All secondary cpus now may jump to kexec_wait cycle */
relocated_kexec_smp_wait = reboot_code_buffer +
(void *)(kexec_smp_wait - relocate_new_kernel);
smp_wmb();
atomic_set(&kexec_ready_to_reboot, 1);
#endif
((noretfun_t) reboot_code_buffer)();
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Nicolas Schichan | 164 | 69.20% | 2 | 40.00% |
Ralf Bächle | 49 | 20.68% | 2 | 40.00% |
Wei Yang | 24 | 10.13% | 1 | 20.00% |
Total | 237 | 100.00% | 5 | 100.00% |
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Nicolas Schichan | 234 | 40.91% | 2 | 25.00% |
Ralf Bächle | 160 | 27.97% | 2 | 25.00% |
Marcin Nowakowski | 141 | 24.65% | 1 | 12.50% |
Wei Yang | 24 | 4.20% | 1 | 12.50% |
Hidehiro Kawai | 11 | 1.92% | 1 | 12.50% |
Tobias Klauser | 2 | 0.35% | 1 | 12.50% |
Total | 572 | 100.00% | 8 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.