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 393567fa63SArd Biesheuvel PROVIDE(__pi_vabits_actual = vabits_actual); 40e223a449SArd Biesheuvel PROVIDE(__pi_id_aa64isar1_override = id_aa64isar1_override); 41e223a449SArd Biesheuvel PROVIDE(__pi_id_aa64isar2_override = id_aa64isar2_override); 42e223a449SArd Biesheuvel PROVIDE(__pi_id_aa64mmfr1_override = id_aa64mmfr1_override); 43e223a449SArd Biesheuvel PROVIDE(__pi_id_aa64pfr0_override = id_aa64pfr0_override); 44e223a449SArd Biesheuvel PROVIDE(__pi_id_aa64pfr1_override = id_aa64pfr1_override); 45e223a449SArd Biesheuvel PROVIDE(__pi_id_aa64smfr0_override = id_aa64smfr0_override); 46e223a449SArd Biesheuvel PROVIDE(__pi_id_aa64zfr0_override = id_aa64zfr0_override); 47e223a449SArd Biesheuvel PROVIDE(__pi_arm64_sw_feature_override = arm64_sw_feature_override); 48e223a449SArd Biesheuvel PROVIDE(__pi__ctype = _ctype); 49*aa6a52b2SArd Biesheuvel PROVIDE(__pi_memstart_offset_seed = memstart_offset_seed); 503567fa63SArd Biesheuvel 5176217129SDavid Brazdil #ifdef CONFIG_KVM 5276217129SDavid Brazdil 5376217129SDavid Brazdil /* 5476217129SDavid Brazdil * KVM nVHE code has its own symbol namespace prefixed with __kvm_nvhe_, to 5576217129SDavid Brazdil * separate it from the kernel proper. The following symbols are legally 5676217129SDavid Brazdil * accessed by it, therefore provide aliases to make them linkable. 5776217129SDavid Brazdil * Do not include symbols which may not be safely accessed under hypervisor 5876217129SDavid Brazdil * memory mappings. 5976217129SDavid Brazdil */ 6076217129SDavid Brazdil 61b877e984SDavid Brazdil /* Alternative callbacks for init-time patching of nVHE hyp code. */ 62b877e984SDavid Brazdil KVM_NVHE_ALIAS(kvm_patch_vector_branch); 63b877e984SDavid Brazdil KVM_NVHE_ALIAS(kvm_update_va_mask); 6468b824e4SMarc Zyngier KVM_NVHE_ALIAS(kvm_get_kimage_voffset); 65755db234SMarc Zyngier KVM_NVHE_ALIAS(kvm_compute_final_ctr_el0); 66558c303cSJames Morse KVM_NVHE_ALIAS(spectre_bhb_patch_loop_iter); 67558c303cSJames Morse KVM_NVHE_ALIAS(spectre_bhb_patch_loop_mitigation_enable); 68558c303cSJames Morse KVM_NVHE_ALIAS(spectre_bhb_patch_wa3); 69228a26b9SJames Morse KVM_NVHE_ALIAS(spectre_bhb_patch_clearbhb); 70d926079fSMark Rutland KVM_NVHE_ALIAS(alt_cb_patch_nops); 71b877e984SDavid Brazdil 72b877e984SDavid Brazdil /* Global kernel state accessed by nVHE hyp code. */ 7309cf57ebSDavid Brazdil KVM_NVHE_ALIAS(kvm_vgic_global_state); 74b877e984SDavid Brazdil 75b877e984SDavid Brazdil /* Kernel symbols used to call panic() from nVHE hyp code (via ERET). */ 76aec0fae6SAndrew Scull KVM_NVHE_ALIAS(nvhe_hyp_panic_handler); 77b877e984SDavid Brazdil 78208243c7SAndrew Scull /* Vectors installed by hyp-init on reset HVC. */ 79208243c7SAndrew Scull KVM_NVHE_ALIAS(__hyp_stub_vectors); 80208243c7SAndrew Scull 8109cf57ebSDavid Brazdil /* Static keys which are set if a vGIC trap should be handled in hyp. */ 8209cf57ebSDavid Brazdil KVM_NVHE_ALIAS(vgic_v2_cpuif_trap); 8309cf57ebSDavid Brazdil KVM_NVHE_ALIAS(vgic_v3_cpuif_trap); 8409cf57ebSDavid Brazdil 8509cf57ebSDavid Brazdil #ifdef CONFIG_ARM64_PSEUDO_NMI 8633678059SAlexandru Elisei /* Static key checked in GIC_PRIO_IRQOFF. */ 8733678059SAlexandru Elisei KVM_NVHE_ALIAS(gic_nonsecure_priorities); 8809cf57ebSDavid Brazdil #endif 8909cf57ebSDavid Brazdil 90e9ee186bSJames Morse /* EL2 exception handling */ 91e9ee186bSJames Morse KVM_NVHE_ALIAS(__start___kvm_ex_table); 92e9ee186bSJames Morse KVM_NVHE_ALIAS(__stop___kvm_ex_table); 93e9ee186bSJames Morse 94f27647b5SMarc Zyngier /* PMU available static key */ 95be399d82SSean Christopherson #ifdef CONFIG_HW_PERF_EVENTS 96f27647b5SMarc Zyngier KVM_NVHE_ALIAS(kvm_arm_pmu_available); 97be399d82SSean Christopherson #endif 98f27647b5SMarc Zyngier 997b4a7b5eSWill Deacon /* Position-independent library routines */ 1007b4a7b5eSWill Deacon KVM_NVHE_ALIAS_HYP(clear_page, __pi_clear_page); 1017b4a7b5eSWill Deacon KVM_NVHE_ALIAS_HYP(copy_page, __pi_copy_page); 1027b4a7b5eSWill Deacon KVM_NVHE_ALIAS_HYP(memcpy, __pi_memcpy); 1037b4a7b5eSWill Deacon KVM_NVHE_ALIAS_HYP(memset, __pi_memset); 1047b4a7b5eSWill Deacon 1057b4a7b5eSWill Deacon #ifdef CONFIG_KASAN 1067b4a7b5eSWill Deacon KVM_NVHE_ALIAS_HYP(__memcpy, __pi_memcpy); 1077b4a7b5eSWill Deacon KVM_NVHE_ALIAS_HYP(__memset, __pi_memset); 1087b4a7b5eSWill Deacon #endif 1097b4a7b5eSWill Deacon 110f320bc74SQuentin Perret /* Hyp memory sections */ 111f320bc74SQuentin Perret KVM_NVHE_ALIAS(__hyp_idmap_text_start); 112f320bc74SQuentin Perret KVM_NVHE_ALIAS(__hyp_idmap_text_end); 113f320bc74SQuentin Perret KVM_NVHE_ALIAS(__hyp_text_start); 114f320bc74SQuentin Perret KVM_NVHE_ALIAS(__hyp_text_end); 115f320bc74SQuentin Perret KVM_NVHE_ALIAS(__hyp_bss_start); 116f320bc74SQuentin Perret KVM_NVHE_ALIAS(__hyp_bss_end); 117f320bc74SQuentin Perret KVM_NVHE_ALIAS(__hyp_rodata_start); 118f320bc74SQuentin Perret KVM_NVHE_ALIAS(__hyp_rodata_end); 119f320bc74SQuentin Perret 1201025c8c0SQuentin Perret /* pKVM static key */ 1211025c8c0SQuentin Perret KVM_NVHE_ALIAS(kvm_protected_mode_initialized); 1221025c8c0SQuentin Perret 12376217129SDavid Brazdil #endif /* CONFIG_KVM */ 12476217129SDavid Brazdil 12545dd403dSArd Biesheuvel #ifdef CONFIG_EFI_ZBOOT 12645dd403dSArd Biesheuvel _kernel_codesize = ABSOLUTE(__inittext_end - _text); 12745dd403dSArd Biesheuvel #endif 12845dd403dSArd Biesheuvel 12990776dd1SKees Cook #endif /* __ARM64_KERNEL_IMAGE_VARS_H */ 130