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); 30b8466fe8SArnd Bergmann #if defined(CONFIG_EFI_EARLYCON) || defined(CONFIG_SYSFB) 31fbf6ad5eSArd Biesheuvel PROVIDE(__efistub_screen_info = screen_info); 32b8466fe8SArnd Bergmann #endif 33fbf6ad5eSArd Biesheuvel PROVIDE(__efistub__ctype = _ctype); 34aacd149bSArd Biesheuvel 35fbf6ad5eSArd Biesheuvel PROVIDE(__pi___memcpy = __pi_memcpy); 36fbf6ad5eSArd Biesheuvel PROVIDE(__pi___memmove = __pi_memmove); 37fbf6ad5eSArd Biesheuvel PROVIDE(__pi___memset = __pi_memset); 3890776dd1SKees Cook 39e223a449SArd Biesheuvel PROVIDE(__pi_id_aa64isar1_override = id_aa64isar1_override); 40e223a449SArd Biesheuvel PROVIDE(__pi_id_aa64isar2_override = id_aa64isar2_override); 4168aec33fSArd Biesheuvel PROVIDE(__pi_id_aa64mmfr0_override = id_aa64mmfr0_override); 42e223a449SArd Biesheuvel PROVIDE(__pi_id_aa64mmfr1_override = id_aa64mmfr1_override); 4368aec33fSArd Biesheuvel PROVIDE(__pi_id_aa64mmfr2_override = id_aa64mmfr2_override); 44e223a449SArd Biesheuvel PROVIDE(__pi_id_aa64pfr0_override = id_aa64pfr0_override); 45e223a449SArd Biesheuvel PROVIDE(__pi_id_aa64pfr1_override = id_aa64pfr1_override); 46e223a449SArd Biesheuvel PROVIDE(__pi_id_aa64smfr0_override = id_aa64smfr0_override); 47e223a449SArd Biesheuvel PROVIDE(__pi_id_aa64zfr0_override = id_aa64zfr0_override); 48e223a449SArd Biesheuvel PROVIDE(__pi_arm64_sw_feature_override = arm64_sw_feature_override); 4997a6f43bSArd Biesheuvel PROVIDE(__pi_arm64_use_ng_mappings = arm64_use_ng_mappings); 5097a6f43bSArd Biesheuvel #ifdef CONFIG_CAVIUM_ERRATUM_27456 5197a6f43bSArd Biesheuvel PROVIDE(__pi_cavium_erratum_27456_cpus = cavium_erratum_27456_cpus); 5297a6f43bSArd Biesheuvel #endif 53e223a449SArd Biesheuvel PROVIDE(__pi__ctype = _ctype); 54aa6a52b2SArd Biesheuvel PROVIDE(__pi_memstart_offset_seed = memstart_offset_seed); 553567fa63SArd Biesheuvel 5684b04d3eSArd Biesheuvel PROVIDE(__pi_init_idmap_pg_dir = init_idmap_pg_dir); 57*9684ec18SArd Biesheuvel PROVIDE(__pi_init_idmap_pg_end = init_idmap_pg_end); 5897a6f43bSArd Biesheuvel PROVIDE(__pi_init_pg_dir = init_pg_dir); 5997a6f43bSArd Biesheuvel PROVIDE(__pi_init_pg_end = init_pg_end); 60ba5b0333SArd Biesheuvel PROVIDE(__pi_swapper_pg_dir = swapper_pg_dir); 6197a6f43bSArd Biesheuvel 6297a6f43bSArd Biesheuvel PROVIDE(__pi__text = _text); 6397a6f43bSArd Biesheuvel PROVIDE(__pi__stext = _stext); 6497a6f43bSArd Biesheuvel PROVIDE(__pi__etext = _etext); 6597a6f43bSArd Biesheuvel PROVIDE(__pi___start_rodata = __start_rodata); 6697a6f43bSArd Biesheuvel PROVIDE(__pi___inittext_begin = __inittext_begin); 6797a6f43bSArd Biesheuvel PROVIDE(__pi___inittext_end = __inittext_end); 6897a6f43bSArd Biesheuvel PROVIDE(__pi___initdata_begin = __initdata_begin); 6997a6f43bSArd Biesheuvel PROVIDE(__pi___initdata_end = __initdata_end); 7097a6f43bSArd Biesheuvel PROVIDE(__pi__data = _data); 7197a6f43bSArd Biesheuvel PROVIDE(__pi___bss_start = __bss_start); 7297a6f43bSArd Biesheuvel PROVIDE(__pi__end = _end); 7397a6f43bSArd Biesheuvel 7476217129SDavid Brazdil #ifdef CONFIG_KVM 7576217129SDavid Brazdil 7676217129SDavid Brazdil /* 7776217129SDavid Brazdil * KVM nVHE code has its own symbol namespace prefixed with __kvm_nvhe_, to 7876217129SDavid Brazdil * separate it from the kernel proper. The following symbols are legally 7976217129SDavid Brazdil * accessed by it, therefore provide aliases to make them linkable. 8076217129SDavid Brazdil * Do not include symbols which may not be safely accessed under hypervisor 8176217129SDavid Brazdil * memory mappings. 8276217129SDavid Brazdil */ 8376217129SDavid Brazdil 84b877e984SDavid Brazdil /* Alternative callbacks for init-time patching of nVHE hyp code. */ 85b877e984SDavid Brazdil KVM_NVHE_ALIAS(kvm_patch_vector_branch); 86b877e984SDavid Brazdil KVM_NVHE_ALIAS(kvm_update_va_mask); 8768b824e4SMarc Zyngier KVM_NVHE_ALIAS(kvm_get_kimage_voffset); 88755db234SMarc Zyngier KVM_NVHE_ALIAS(kvm_compute_final_ctr_el0); 89558c303cSJames Morse KVM_NVHE_ALIAS(spectre_bhb_patch_loop_iter); 90558c303cSJames Morse KVM_NVHE_ALIAS(spectre_bhb_patch_loop_mitigation_enable); 91558c303cSJames Morse KVM_NVHE_ALIAS(spectre_bhb_patch_wa3); 92228a26b9SJames Morse KVM_NVHE_ALIAS(spectre_bhb_patch_clearbhb); 93d926079fSMark Rutland KVM_NVHE_ALIAS(alt_cb_patch_nops); 94b877e984SDavid Brazdil 95b877e984SDavid Brazdil /* Global kernel state accessed by nVHE hyp code. */ 9609cf57ebSDavid Brazdil KVM_NVHE_ALIAS(kvm_vgic_global_state); 97b877e984SDavid Brazdil 98b877e984SDavid Brazdil /* Kernel symbols used to call panic() from nVHE hyp code (via ERET). */ 99aec0fae6SAndrew Scull KVM_NVHE_ALIAS(nvhe_hyp_panic_handler); 100b877e984SDavid Brazdil 101208243c7SAndrew Scull /* Vectors installed by hyp-init on reset HVC. */ 102208243c7SAndrew Scull KVM_NVHE_ALIAS(__hyp_stub_vectors); 103208243c7SAndrew Scull 10409cf57ebSDavid Brazdil /* Static keys which are set if a vGIC trap should be handled in hyp. */ 10509cf57ebSDavid Brazdil KVM_NVHE_ALIAS(vgic_v2_cpuif_trap); 10609cf57ebSDavid Brazdil KVM_NVHE_ALIAS(vgic_v3_cpuif_trap); 10709cf57ebSDavid Brazdil 108e9ee186bSJames Morse /* EL2 exception handling */ 109e9ee186bSJames Morse KVM_NVHE_ALIAS(__start___kvm_ex_table); 110e9ee186bSJames Morse KVM_NVHE_ALIAS(__stop___kvm_ex_table); 111e9ee186bSJames Morse 112f27647b5SMarc Zyngier /* PMU available static key */ 113be399d82SSean Christopherson #ifdef CONFIG_HW_PERF_EVENTS 114f27647b5SMarc Zyngier KVM_NVHE_ALIAS(kvm_arm_pmu_available); 115be399d82SSean Christopherson #endif 116f27647b5SMarc Zyngier 1177b4a7b5eSWill Deacon /* Position-independent library routines */ 1187b4a7b5eSWill Deacon KVM_NVHE_ALIAS_HYP(clear_page, __pi_clear_page); 1197b4a7b5eSWill Deacon KVM_NVHE_ALIAS_HYP(copy_page, __pi_copy_page); 1207b4a7b5eSWill Deacon KVM_NVHE_ALIAS_HYP(memcpy, __pi_memcpy); 1217b4a7b5eSWill Deacon KVM_NVHE_ALIAS_HYP(memset, __pi_memset); 1227b4a7b5eSWill Deacon 1237b4a7b5eSWill Deacon #ifdef CONFIG_KASAN 1247b4a7b5eSWill Deacon KVM_NVHE_ALIAS_HYP(__memcpy, __pi_memcpy); 1257b4a7b5eSWill Deacon KVM_NVHE_ALIAS_HYP(__memset, __pi_memset); 1267b4a7b5eSWill Deacon #endif 1277b4a7b5eSWill Deacon 128f320bc74SQuentin Perret /* Hyp memory sections */ 129f320bc74SQuentin Perret KVM_NVHE_ALIAS(__hyp_idmap_text_start); 130f320bc74SQuentin Perret KVM_NVHE_ALIAS(__hyp_idmap_text_end); 131f320bc74SQuentin Perret KVM_NVHE_ALIAS(__hyp_text_start); 132f320bc74SQuentin Perret KVM_NVHE_ALIAS(__hyp_text_end); 133f320bc74SQuentin Perret KVM_NVHE_ALIAS(__hyp_bss_start); 134f320bc74SQuentin Perret KVM_NVHE_ALIAS(__hyp_bss_end); 135f320bc74SQuentin Perret KVM_NVHE_ALIAS(__hyp_rodata_start); 136f320bc74SQuentin Perret KVM_NVHE_ALIAS(__hyp_rodata_end); 137f320bc74SQuentin Perret 1381025c8c0SQuentin Perret /* pKVM static key */ 1391025c8c0SQuentin Perret KVM_NVHE_ALIAS(kvm_protected_mode_initialized); 1401025c8c0SQuentin Perret 14176217129SDavid Brazdil #endif /* CONFIG_KVM */ 14276217129SDavid Brazdil 14345dd403dSArd Biesheuvel #ifdef CONFIG_EFI_ZBOOT 14445dd403dSArd Biesheuvel _kernel_codesize = ABSOLUTE(__inittext_end - _text); 14545dd403dSArd Biesheuvel #endif 14645dd403dSArd Biesheuvel 14790776dd1SKees Cook #endif /* __ARM64_KERNEL_IMAGE_VARS_H */ 148