Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
torvalds
GitHub Repository: torvalds/linux
Path: blob/master/arch/arm64/kernel/image-vars.h
50686 views
1
/* SPDX-License-Identifier: GPL-2.0-only */
2
/*
3
* Linker script variables to be set after section resolution, as
4
* ld.lld does not like variables assigned before SECTIONS is processed.
5
*/
6
#ifndef __ARM64_KERNEL_IMAGE_VARS_H
7
#define __ARM64_KERNEL_IMAGE_VARS_H
8
9
#ifndef LINKER_SCRIPT
10
#error This file should only be included in vmlinux.lds.S
11
#endif
12
13
#if defined(CONFIG_LD_IS_LLD) && CONFIG_LLD_VERSION < 210000
14
#define ASSERT(...)
15
#endif
16
17
#define PI_EXPORT_SYM(sym) \
18
__PI_EXPORT_SYM(sym, __pi_ ## sym, Cannot export BSS symbol sym to startup code)
19
#define __PI_EXPORT_SYM(sym, pisym, msg)\
20
PROVIDE(pisym = sym); \
21
ASSERT((sym - KIMAGE_VADDR) < (__bss_start - KIMAGE_VADDR), #msg)
22
23
PROVIDE(__efistub_primary_entry = primary_entry);
24
25
/*
26
* The EFI stub has its own symbol namespace prefixed by __efistub_, to
27
* isolate it from the kernel proper. The following symbols are legally
28
* accessed by the stub, so provide some aliases to make them accessible.
29
* Only include data symbols here, or text symbols of functions that are
30
* guaranteed to be safe when executed at another offset than they were
31
* linked at. The routines below are all implemented in assembler in a
32
* position independent manner
33
*/
34
PROVIDE(__efistub_caches_clean_inval_pou = __pi_caches_clean_inval_pou);
35
36
PROVIDE(__efistub__text = _text);
37
PROVIDE(__efistub__end = _end);
38
PROVIDE(__efistub___inittext_end = __inittext_end);
39
PROVIDE(__efistub__edata = _edata);
40
#if defined(CONFIG_EFI_EARLYCON) || defined(CONFIG_SYSFB)
41
PROVIDE(__efistub_sysfb_primary_display = sysfb_primary_display);
42
#endif
43
PROVIDE(__efistub__ctype = _ctype);
44
45
PROVIDE(__pi___memcpy = __pi_memcpy);
46
PROVIDE(__pi___memmove = __pi_memmove);
47
PROVIDE(__pi___memset = __pi_memset);
48
49
PI_EXPORT_SYM(id_aa64isar1_override);
50
PI_EXPORT_SYM(id_aa64isar2_override);
51
PI_EXPORT_SYM(id_aa64mmfr0_override);
52
PI_EXPORT_SYM(id_aa64mmfr1_override);
53
PI_EXPORT_SYM(id_aa64mmfr2_override);
54
PI_EXPORT_SYM(id_aa64pfr0_override);
55
PI_EXPORT_SYM(id_aa64pfr1_override);
56
PI_EXPORT_SYM(id_aa64smfr0_override);
57
PI_EXPORT_SYM(id_aa64zfr0_override);
58
PI_EXPORT_SYM(arm64_sw_feature_override);
59
PI_EXPORT_SYM(arm64_use_ng_mappings);
60
PI_EXPORT_SYM(_ctype);
61
62
PI_EXPORT_SYM(swapper_pg_dir);
63
64
PI_EXPORT_SYM(_text);
65
PI_EXPORT_SYM(_stext);
66
PI_EXPORT_SYM(_etext);
67
PI_EXPORT_SYM(__start_rodata);
68
PI_EXPORT_SYM(__inittext_begin);
69
PI_EXPORT_SYM(__inittext_end);
70
PI_EXPORT_SYM(__initdata_begin);
71
PI_EXPORT_SYM(__initdata_end);
72
PI_EXPORT_SYM(_data);
73
74
#ifdef CONFIG_KVM
75
76
/*
77
* KVM nVHE code has its own symbol namespace prefixed with __kvm_nvhe_, to
78
* separate it from the kernel proper. The following symbols are legally
79
* accessed by it, therefore provide aliases to make them linkable.
80
* Do not include symbols which may not be safely accessed under hypervisor
81
* memory mappings.
82
*/
83
84
/* Alternative callbacks for init-time patching of nVHE hyp code. */
85
KVM_NVHE_ALIAS(kvm_patch_vector_branch);
86
KVM_NVHE_ALIAS(kvm_update_va_mask);
87
KVM_NVHE_ALIAS(kvm_get_kimage_voffset);
88
KVM_NVHE_ALIAS(kvm_compute_final_ctr_el0);
89
KVM_NVHE_ALIAS(kvm_pan_patch_el2_entry);
90
KVM_NVHE_ALIAS(spectre_bhb_patch_loop_iter);
91
KVM_NVHE_ALIAS(spectre_bhb_patch_loop_mitigation_enable);
92
KVM_NVHE_ALIAS(spectre_bhb_patch_wa3);
93
KVM_NVHE_ALIAS(spectre_bhb_patch_clearbhb);
94
KVM_NVHE_ALIAS(alt_cb_patch_nops);
95
KVM_NVHE_ALIAS(kvm_compute_ich_hcr_trap_bits);
96
97
/* Global kernel state accessed by nVHE hyp code. */
98
KVM_NVHE_ALIAS(kvm_vgic_global_state);
99
100
/* Kernel symbols used to call panic() from nVHE hyp code (via ERET). */
101
KVM_NVHE_ALIAS(nvhe_hyp_panic_handler);
102
103
/* Vectors installed by hyp-init on reset HVC. */
104
KVM_NVHE_ALIAS(__hyp_stub_vectors);
105
106
/* Static keys which are set if a vGIC trap should be handled in hyp. */
107
KVM_NVHE_ALIAS(vgic_v2_cpuif_trap);
108
KVM_NVHE_ALIAS(vgic_v3_cpuif_trap);
109
110
/* Static key indicating whether GICv3 has GICv2 compatibility */
111
KVM_NVHE_ALIAS(vgic_v3_has_v2_compat);
112
113
/* Static key which is set if CNTVOFF_EL2 is unusable */
114
KVM_NVHE_ALIAS(broken_cntvoff_key);
115
116
/* EL2 exception handling */
117
KVM_NVHE_ALIAS(__start___kvm_ex_table);
118
KVM_NVHE_ALIAS(__stop___kvm_ex_table);
119
120
/* Position-independent library routines */
121
KVM_NVHE_ALIAS_HYP(clear_page, __pi_clear_page);
122
KVM_NVHE_ALIAS_HYP(copy_page, __pi_copy_page);
123
KVM_NVHE_ALIAS_HYP(memcpy, __pi_memcpy);
124
KVM_NVHE_ALIAS_HYP(memset, __pi_memset);
125
126
#ifdef CONFIG_KASAN
127
KVM_NVHE_ALIAS_HYP(__memcpy, __pi_memcpy);
128
KVM_NVHE_ALIAS_HYP(__memset, __pi_memset);
129
#endif
130
131
/* Hyp memory sections */
132
KVM_NVHE_ALIAS(__hyp_idmap_text_start);
133
KVM_NVHE_ALIAS(__hyp_idmap_text_end);
134
KVM_NVHE_ALIAS(__hyp_text_start);
135
KVM_NVHE_ALIAS(__hyp_text_end);
136
KVM_NVHE_ALIAS(__hyp_bss_start);
137
KVM_NVHE_ALIAS(__hyp_bss_end);
138
KVM_NVHE_ALIAS(__hyp_data_start);
139
KVM_NVHE_ALIAS(__hyp_data_end);
140
KVM_NVHE_ALIAS(__hyp_rodata_start);
141
KVM_NVHE_ALIAS(__hyp_rodata_end);
142
143
/* pKVM static key */
144
KVM_NVHE_ALIAS(kvm_protected_mode_initialized);
145
146
#endif /* CONFIG_KVM */
147
148
#ifdef CONFIG_EFI_ZBOOT
149
_kernel_codesize = ABSOLUTE(__inittext_end - _text);
150
#endif
151
152
/*
153
* LLD will occasionally error out with a '__init_end does not converge' error
154
* if INIT_IDMAP_DIR_SIZE is defined in terms of _end, as this results in a
155
* circular dependency. Counter this by dimensioning the initial IDMAP page
156
* tables based on kimage_limit, which is defined such that its value should
157
* not change as a result of the initdata segment being pushed over a 64k
158
* segment boundary due to changes in INIT_IDMAP_DIR_SIZE, provided that its
159
* value doesn't change by more than 2M between linker passes.
160
*/
161
kimage_limit = ALIGN(ABSOLUTE(_end + SZ_64K), SZ_2M);
162
163
#undef ASSERT
164
165
#endif /* __ARM64_KERNEL_IMAGE_VARS_H */
166
167