^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Copyright IBM Corp. 2005
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Author(s): Rolf Adelsberger <adelsberger@de.ibm.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #ifndef _S390_KEXEC_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #define _S390_KEXEC_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <asm/processor.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <asm/page.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <asm/setup.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) * KEXEC_SOURCE_MEMORY_LIMIT maximum page get_free_page can return.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) * I.e. Maximum page that is mapped directly into kernel memory,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) * and kmap is not required.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) /* Maximum physical address we can use pages from */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #define KEXEC_SOURCE_MEMORY_LIMIT (-1UL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) /* Maximum address we can reach in physical address mode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #define KEXEC_DESTINATION_MEMORY_LIMIT (-1UL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) /* Maximum address we can use for the control pages */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) /* Not more than 2GB */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #define KEXEC_CONTROL_MEMORY_LIMIT (1UL<<31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) /* Allocate control page with GFP_DMA */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) #define KEXEC_CONTROL_MEMORY_GFP GFP_DMA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) /* Maximum address we can use for the crash control pages */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) #define KEXEC_CRASH_CONTROL_MEMORY_LIMIT (-1UL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) /* Allocate one page for the pdp and the second for the code */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) #define KEXEC_CONTROL_PAGE_SIZE 4096
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) /* Alignment of crashkernel memory */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) #define KEXEC_CRASH_MEM_ALIGN HPAGE_SIZE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) /* The native architecture */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) #define KEXEC_ARCH KEXEC_ARCH_S390
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) /* Allow kexec_file to load a segment to 0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) #define KEXEC_BUF_MEM_UNKNOWN -1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) /* Provide a dummy definition to avoid build failures. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) static inline void crash_setup_regs(struct pt_regs *newregs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) struct pt_regs *oldregs) { }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) struct kimage;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) struct s390_load_data {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) /* Pointer to the kernel buffer. Used to register cmdline etc.. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) void *kernel_buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) /* Load address of the kernel_buf. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) unsigned long kernel_mem;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) /* Parmarea in the kernel buffer. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) struct parmarea *parm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) /* Total size of loaded segments in memory. Used as an offset. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) size_t memsz;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) struct ipl_report *report;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) int s390_verify_sig(const char *kernel, unsigned long kernel_len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) void *kexec_file_add_components(struct kimage *image,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) int (*add_kernel)(struct kimage *image,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) struct s390_load_data *data));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) int arch_kexec_do_relocs(int r_type, void *loc, unsigned long val,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) unsigned long addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) #define ARCH_HAS_KIMAGE_ARCH
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) struct kimage_arch {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) void *ipl_buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) extern const struct kexec_file_ops s390_kexec_image_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) extern const struct kexec_file_ops s390_kexec_elf_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) #endif /*_S390_KEXEC_H */