xref: /openbmc/linux/arch/arm64/kernel/image-vars.h (revision 1ac731c529cd4d6adbce134754b51ff7d822b145)
190776dd1SKees Cook /* SPDX-License-Identifier: GPL-2.0-only */
290776dd1SKees Cook /*
390776dd1SKees Cook  * Linker script variables to be set after section resolution, as
490776dd1SKees Cook  * ld.lld does not like variables assigned before SECTIONS is processed.
590776dd1SKees Cook  */
690776dd1SKees Cook #ifndef __ARM64_KERNEL_IMAGE_VARS_H
790776dd1SKees Cook #define __ARM64_KERNEL_IMAGE_VARS_H
890776dd1SKees Cook 
990776dd1SKees Cook #ifndef LINKER_SCRIPT
1090776dd1SKees Cook #error This file should only be included in vmlinux.lds.S
1190776dd1SKees Cook #endif
1290776dd1SKees Cook 
1361786170SArd Biesheuvel PROVIDE(__efistub_primary_entry		= primary_entry);
1490776dd1SKees Cook 
1590776dd1SKees Cook /*
1690776dd1SKees Cook  * The EFI stub has its own symbol namespace prefixed by __efistub_, to
1790776dd1SKees Cook  * isolate it from the kernel proper. The following symbols are legally
1890776dd1SKees Cook  * accessed by the stub, so provide some aliases to make them accessible.
1990776dd1SKees Cook  * Only include data symbols here, or text symbols of functions that are
2090776dd1SKees Cook  * guaranteed to be safe when executed at another offset than they were
2190776dd1SKees Cook  * linked at. The routines below are all implemented in assembler in a
2290776dd1SKees Cook  * position independent manner
2390776dd1SKees Cook  */
2461786170SArd Biesheuvel PROVIDE(__efistub_caches_clean_inval_pou = __pi_caches_clean_inval_pou);
2590776dd1SKees Cook 
26fbf6ad5eSArd Biesheuvel PROVIDE(__efistub__text			= _text);
27fbf6ad5eSArd Biesheuvel PROVIDE(__efistub__end			= _end);
2861786170SArd Biesheuvel PROVIDE(__efistub___inittext_end       	= __inittext_end);
29fbf6ad5eSArd Biesheuvel PROVIDE(__efistub__edata		= _edata);
30fbf6ad5eSArd Biesheuvel PROVIDE(__efistub_screen_info		= screen_info);
31fbf6ad5eSArd Biesheuvel PROVIDE(__efistub__ctype		= _ctype);
32aacd149bSArd Biesheuvel 
33fbf6ad5eSArd Biesheuvel PROVIDE(__pi___memcpy			= __pi_memcpy);
34fbf6ad5eSArd Biesheuvel PROVIDE(__pi___memmove			= __pi_memmove);
35fbf6ad5eSArd Biesheuvel PROVIDE(__pi___memset			= __pi_memset);
3690776dd1SKees Cook 
3776217129SDavid Brazdil #ifdef CONFIG_KVM
3876217129SDavid Brazdil 
3976217129SDavid Brazdil /*
4076217129SDavid Brazdil  * KVM nVHE code has its own symbol namespace prefixed with __kvm_nvhe_, to
4176217129SDavid Brazdil  * separate it from the kernel proper. The following symbols are legally
4276217129SDavid Brazdil  * accessed by it, therefore provide aliases to make them linkable.
4376217129SDavid Brazdil  * Do not include symbols which may not be safely accessed under hypervisor
4476217129SDavid Brazdil  * memory mappings.
4576217129SDavid Brazdil  */
4676217129SDavid Brazdil 
47b877e984SDavid Brazdil /* Alternative callbacks for init-time patching of nVHE hyp code. */
48b877e984SDavid Brazdil KVM_NVHE_ALIAS(kvm_patch_vector_branch);
49b877e984SDavid Brazdil KVM_NVHE_ALIAS(kvm_update_va_mask);
5068b824e4SMarc Zyngier KVM_NVHE_ALIAS(kvm_get_kimage_voffset);
51755db234SMarc Zyngier KVM_NVHE_ALIAS(kvm_compute_final_ctr_el0);
52558c303cSJames Morse KVM_NVHE_ALIAS(spectre_bhb_patch_loop_iter);
53558c303cSJames Morse KVM_NVHE_ALIAS(spectre_bhb_patch_loop_mitigation_enable);
54558c303cSJames Morse KVM_NVHE_ALIAS(spectre_bhb_patch_wa3);
55228a26b9SJames Morse KVM_NVHE_ALIAS(spectre_bhb_patch_clearbhb);
56d926079fSMark Rutland KVM_NVHE_ALIAS(alt_cb_patch_nops);
57b877e984SDavid Brazdil 
58b877e984SDavid Brazdil /* Global kernel state accessed by nVHE hyp code. */
5909cf57ebSDavid Brazdil KVM_NVHE_ALIAS(kvm_vgic_global_state);
60b877e984SDavid Brazdil 
61b877e984SDavid Brazdil /* Kernel symbols used to call panic() from nVHE hyp code (via ERET). */
62aec0fae6SAndrew Scull KVM_NVHE_ALIAS(nvhe_hyp_panic_handler);
63b877e984SDavid Brazdil 
64208243c7SAndrew Scull /* Vectors installed by hyp-init on reset HVC. */
65208243c7SAndrew Scull KVM_NVHE_ALIAS(__hyp_stub_vectors);
66208243c7SAndrew Scull 
6709cf57ebSDavid Brazdil /* Static keys which are set if a vGIC trap should be handled in hyp. */
6809cf57ebSDavid Brazdil KVM_NVHE_ALIAS(vgic_v2_cpuif_trap);
6909cf57ebSDavid Brazdil KVM_NVHE_ALIAS(vgic_v3_cpuif_trap);
7009cf57ebSDavid Brazdil 
7109cf57ebSDavid Brazdil #ifdef CONFIG_ARM64_PSEUDO_NMI
7233678059SAlexandru Elisei /* Static key checked in GIC_PRIO_IRQOFF. */
7333678059SAlexandru Elisei KVM_NVHE_ALIAS(gic_nonsecure_priorities);
7409cf57ebSDavid Brazdil #endif
7509cf57ebSDavid Brazdil 
76e9ee186bSJames Morse /* EL2 exception handling */
77e9ee186bSJames Morse KVM_NVHE_ALIAS(__start___kvm_ex_table);
78e9ee186bSJames Morse KVM_NVHE_ALIAS(__stop___kvm_ex_table);
79e9ee186bSJames Morse 
80f27647b5SMarc Zyngier /* PMU available static key */
81be399d82SSean Christopherson #ifdef CONFIG_HW_PERF_EVENTS
82f27647b5SMarc Zyngier KVM_NVHE_ALIAS(kvm_arm_pmu_available);
83be399d82SSean Christopherson #endif
84f27647b5SMarc Zyngier 
857b4a7b5eSWill Deacon /* Position-independent library routines */
867b4a7b5eSWill Deacon KVM_NVHE_ALIAS_HYP(clear_page, __pi_clear_page);
877b4a7b5eSWill Deacon KVM_NVHE_ALIAS_HYP(copy_page, __pi_copy_page);
887b4a7b5eSWill Deacon KVM_NVHE_ALIAS_HYP(memcpy, __pi_memcpy);
897b4a7b5eSWill Deacon KVM_NVHE_ALIAS_HYP(memset, __pi_memset);
907b4a7b5eSWill Deacon 
917b4a7b5eSWill Deacon #ifdef CONFIG_KASAN
927b4a7b5eSWill Deacon KVM_NVHE_ALIAS_HYP(__memcpy, __pi_memcpy);
937b4a7b5eSWill Deacon KVM_NVHE_ALIAS_HYP(__memset, __pi_memset);
947b4a7b5eSWill Deacon #endif
957b4a7b5eSWill Deacon 
96f320bc74SQuentin Perret /* Hyp memory sections */
97f320bc74SQuentin Perret KVM_NVHE_ALIAS(__hyp_idmap_text_start);
98f320bc74SQuentin Perret KVM_NVHE_ALIAS(__hyp_idmap_text_end);
99f320bc74SQuentin Perret KVM_NVHE_ALIAS(__hyp_text_start);
100f320bc74SQuentin Perret KVM_NVHE_ALIAS(__hyp_text_end);
101f320bc74SQuentin Perret KVM_NVHE_ALIAS(__hyp_bss_start);
102f320bc74SQuentin Perret KVM_NVHE_ALIAS(__hyp_bss_end);
103f320bc74SQuentin Perret KVM_NVHE_ALIAS(__hyp_rodata_start);
104f320bc74SQuentin Perret KVM_NVHE_ALIAS(__hyp_rodata_end);
105f320bc74SQuentin Perret 
1061025c8c0SQuentin Perret /* pKVM static key */
1071025c8c0SQuentin Perret KVM_NVHE_ALIAS(kvm_protected_mode_initialized);
1081025c8c0SQuentin Perret 
10976217129SDavid Brazdil #endif /* CONFIG_KVM */
11076217129SDavid Brazdil 
111*45dd403dSArd Biesheuvel #ifdef CONFIG_EFI_ZBOOT
112*45dd403dSArd Biesheuvel _kernel_codesize = ABSOLUTE(__inittext_end - _text);
113*45dd403dSArd Biesheuvel #endif
114*45dd403dSArd Biesheuvel 
11590776dd1SKees Cook #endif /* __ARM64_KERNEL_IMAGE_VARS_H */
116