Path: blob/master/arch/s390/kernel/machine_kexec.c
10817 views
/*1* arch/s390/kernel/machine_kexec.c2*3* Copyright IBM Corp. 2005,20064*5* Author(s): Rolf Adelsberger,6* Heiko Carstens <[email protected]>7*/89#include <linux/device.h>10#include <linux/mm.h>11#include <linux/kexec.h>12#include <linux/delay.h>13#include <linux/reboot.h>14#include <linux/ftrace.h>15#include <asm/cio.h>16#include <asm/setup.h>17#include <asm/pgtable.h>18#include <asm/pgalloc.h>19#include <asm/system.h>20#include <asm/smp.h>21#include <asm/reset.h>22#include <asm/ipl.h>2324typedef void (*relocate_kernel_t)(kimage_entry_t *, unsigned long);2526extern const unsigned char relocate_kernel[];27extern const unsigned long long relocate_kernel_len;2829int machine_kexec_prepare(struct kimage *image)30{31void *reboot_code_buffer;3233/* Can't replace kernel image since it is read-only. */34if (ipl_flags & IPL_NSS_VALID)35return -ENOSYS;3637/* We don't support anything but the default image type for now. */38if (image->type != KEXEC_TYPE_DEFAULT)39return -EINVAL;4041/* Get the destination where the assembler code should be copied to.*/42reboot_code_buffer = (void *) page_to_phys(image->control_code_page);4344/* Then copy it */45memcpy(reboot_code_buffer, relocate_kernel, relocate_kernel_len);46return 0;47}4849void machine_kexec_cleanup(struct kimage *image)50{51}5253void machine_shutdown(void)54{55}5657static void __machine_kexec(void *data)58{59relocate_kernel_t data_mover;60struct kimage *image = data;6162pfault_fini();63s390_reset_system();6465data_mover = (relocate_kernel_t) page_to_phys(image->control_code_page);6667/* Call the moving routine */68(*data_mover)(&image->head, image->start);69for (;;);70}7172void machine_kexec(struct kimage *image)73{74tracer_disable();75smp_send_stop();76smp_switch_to_ipl_cpu(__machine_kexec, image);77}787980