kexec.h 3.1 KB
Newer Older
1
/* SPDX-License-Identifier: GPL-2.0 */
H
Heiko Carstens 已提交
2
/*
3
 * Copyright IBM Corp. 2005
H
Heiko Carstens 已提交
4 5 6 7 8 9 10 11
 *
 * Author(s): Rolf Adelsberger <adelsberger@de.ibm.com>
 *
 */

#ifndef _S390_KEXEC_H
#define _S390_KEXEC_H

12 13
#include <linux/module.h>

H
Heiko Carstens 已提交
14
#include <asm/processor.h>
15
#include <asm/page.h>
16
#include <asm/setup.h>
H
Heiko Carstens 已提交
17 18 19 20 21 22 23 24 25 26 27 28 29 30
/*
 * KEXEC_SOURCE_MEMORY_LIMIT maximum page get_free_page can return.
 * I.e. Maximum page that is mapped directly into kernel memory,
 * and kmap is not required.
 */

/* Maximum physical address we can use pages from */
#define KEXEC_SOURCE_MEMORY_LIMIT (-1UL)

/* Maximum address we can reach in physical address mode */
#define KEXEC_DESTINATION_MEMORY_LIMIT (-1UL)

/* Maximum address we can use for the control pages */
/* Not more than 2GB */
31
#define KEXEC_CONTROL_MEMORY_LIMIT (1UL<<31)
H
Heiko Carstens 已提交
32

33
/* Allocate control page with GFP_DMA */
34
#define KEXEC_CONTROL_MEMORY_GFP (GFP_DMA | __GFP_NORETRY)
35

M
Michael Holzheu 已提交
36 37 38
/* Maximum address we can use for the crash control pages */
#define KEXEC_CRASH_CONTROL_MEMORY_LIMIT (-1UL)

H
Heiko Carstens 已提交
39
/* Allocate one page for the pdp and the second for the code */
40
#define KEXEC_CONTROL_PAGE_SIZE 4096
H
Heiko Carstens 已提交
41

42 43 44
/* Alignment of crashkernel memory */
#define KEXEC_CRASH_MEM_ALIGN HPAGE_SIZE

H
Heiko Carstens 已提交
45 46 47
/* The native architecture */
#define KEXEC_ARCH KEXEC_ARCH_S390

48 49 50
/* Allow kexec_file to load a segment to 0 */
#define KEXEC_BUF_MEM_UNKNOWN -1

51 52 53 54
/* Provide a dummy definition to avoid build failures. */
static inline void crash_setup_regs(struct pt_regs *newregs,
					struct pt_regs *oldregs) { }

P
Philipp Rudo 已提交
55 56 57 58 59
struct kimage;
struct s390_load_data {
	/* Pointer to the kernel buffer. Used to register cmdline etc.. */
	void *kernel_buf;

60 61 62
	/* Load address of the kernel_buf. */
	unsigned long kernel_mem;

63 64 65
	/* Parmarea in the kernel buffer. */
	struct parmarea *parm;

P
Philipp Rudo 已提交
66 67
	/* Total size of loaded segments in memory. Used as an offset. */
	size_t memsz;
68 69

	struct ipl_report *report;
P
Philipp Rudo 已提交
70 71
};

72
int s390_verify_sig(const char *kernel, unsigned long kernel_len);
73 74 75
void *kexec_file_add_components(struct kimage *image,
				int (*add_kernel)(struct kimage *image,
						  struct s390_load_data *data));
76 77
int arch_kexec_do_relocs(int r_type, void *loc, unsigned long val,
			 unsigned long addr);
P
Philipp Rudo 已提交
78

79 80 81 82 83 84
#define ARCH_HAS_KIMAGE_ARCH

struct kimage_arch {
	void *ipl_buf;
};

P
Philipp Rudo 已提交
85
extern const struct kexec_file_ops s390_kexec_image_ops;
P
Philipp Rudo 已提交
86
extern const struct kexec_file_ops s390_kexec_elf_ops;
P
Philipp Rudo 已提交
87

88 89 90 91 92 93 94 95 96 97 98
#ifdef CONFIG_CRASH_DUMP
void crash_free_reserved_phys_range(unsigned long begin, unsigned long end);
#define crash_free_reserved_phys_range crash_free_reserved_phys_range

void arch_kexec_protect_crashkres(void);
#define arch_kexec_protect_crashkres arch_kexec_protect_crashkres

void arch_kexec_unprotect_crashkres(void);
#define arch_kexec_unprotect_crashkres arch_kexec_unprotect_crashkres
#endif

99 100 101 102 103 104 105
#ifdef CONFIG_KEXEC_FILE
struct purgatory_info;
int arch_kexec_apply_relocations_add(struct purgatory_info *pi,
				     Elf_Shdr *section,
				     const Elf_Shdr *relsec,
				     const Elf_Shdr *symtab);
#define arch_kexec_apply_relocations_add arch_kexec_apply_relocations_add
106 107 108

int arch_kimage_file_post_load_cleanup(struct kimage *image);
#define arch_kimage_file_post_load_cleanup arch_kimage_file_post_load_cleanup
109
#endif
H
Heiko Carstens 已提交
110
#endif /*_S390_KEXEC_H */