kexec.h 3.1 KB

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