Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * Copyright IBM Corp. 2005
0004  *
0005  * Author(s): Rolf Adelsberger <adelsberger@de.ibm.com>
0006  *
0007  */
0008 
0009 #ifndef _S390_KEXEC_H
0010 #define _S390_KEXEC_H
0011 
0012 #include <linux/module.h>
0013 
0014 #include <asm/processor.h>
0015 #include <asm/page.h>
0016 #include <asm/setup.h>
0017 /*
0018  * KEXEC_SOURCE_MEMORY_LIMIT maximum page get_free_page can return.
0019  * I.e. Maximum page that is mapped directly into kernel memory,
0020  * and kmap is not required.
0021  */
0022 
0023 /* Maximum physical address we can use pages from */
0024 #define KEXEC_SOURCE_MEMORY_LIMIT (-1UL)
0025 
0026 /* Maximum address we can reach in physical address mode */
0027 #define KEXEC_DESTINATION_MEMORY_LIMIT (-1UL)
0028 
0029 /* Maximum address we can use for the control pages */
0030 /* Not more than 2GB */
0031 #define KEXEC_CONTROL_MEMORY_LIMIT (1UL<<31)
0032 
0033 /* Allocate control page with GFP_DMA */
0034 #define KEXEC_CONTROL_MEMORY_GFP (GFP_DMA | __GFP_NORETRY)
0035 
0036 /* Maximum address we can use for the crash control pages */
0037 #define KEXEC_CRASH_CONTROL_MEMORY_LIMIT (-1UL)
0038 
0039 /* Allocate one page for the pdp and the second for the code */
0040 #define KEXEC_CONTROL_PAGE_SIZE 4096
0041 
0042 /* Alignment of crashkernel memory */
0043 #define KEXEC_CRASH_MEM_ALIGN HPAGE_SIZE
0044 
0045 /* The native architecture */
0046 #define KEXEC_ARCH KEXEC_ARCH_S390
0047 
0048 /* Allow kexec_file to load a segment to 0 */
0049 #define KEXEC_BUF_MEM_UNKNOWN -1
0050 
0051 /* Provide a dummy definition to avoid build failures. */
0052 static inline void crash_setup_regs(struct pt_regs *newregs,
0053                     struct pt_regs *oldregs) { }
0054 
0055 struct kimage;
0056 struct s390_load_data {
0057     /* Pointer to the kernel buffer. Used to register cmdline etc.. */
0058     void *kernel_buf;
0059 
0060     /* Load address of the kernel_buf. */
0061     unsigned long kernel_mem;
0062 
0063     /* Parmarea in the kernel buffer. */
0064     struct parmarea *parm;
0065 
0066     /* Total size of loaded segments in memory. Used as an offset. */
0067     size_t memsz;
0068 
0069     struct ipl_report *report;
0070 };
0071 
0072 int s390_verify_sig(const char *kernel, unsigned long kernel_len);
0073 void *kexec_file_add_components(struct kimage *image,
0074                 int (*add_kernel)(struct kimage *image,
0075                           struct s390_load_data *data));
0076 int arch_kexec_do_relocs(int r_type, void *loc, unsigned long val,
0077              unsigned long addr);
0078 
0079 #define ARCH_HAS_KIMAGE_ARCH
0080 
0081 struct kimage_arch {
0082     void *ipl_buf;
0083 };
0084 
0085 extern const struct kexec_file_ops s390_kexec_image_ops;
0086 extern const struct kexec_file_ops s390_kexec_elf_ops;
0087 
0088 #ifdef CONFIG_CRASH_DUMP
0089 void crash_free_reserved_phys_range(unsigned long begin, unsigned long end);
0090 #define crash_free_reserved_phys_range crash_free_reserved_phys_range
0091 
0092 void arch_kexec_protect_crashkres(void);
0093 #define arch_kexec_protect_crashkres arch_kexec_protect_crashkres
0094 
0095 void arch_kexec_unprotect_crashkres(void);
0096 #define arch_kexec_unprotect_crashkres arch_kexec_unprotect_crashkres
0097 #endif
0098 
0099 #ifdef CONFIG_KEXEC_FILE
0100 struct purgatory_info;
0101 int arch_kexec_apply_relocations_add(struct purgatory_info *pi,
0102                      Elf_Shdr *section,
0103                      const Elf_Shdr *relsec,
0104                      const Elf_Shdr *symtab);
0105 #define arch_kexec_apply_relocations_add arch_kexec_apply_relocations_add
0106 
0107 int arch_kimage_file_post_load_cleanup(struct kimage *image);
0108 #define arch_kimage_file_post_load_cleanup arch_kimage_file_post_load_cleanup
0109 #endif
0110 #endif /*_S390_KEXEC_H */