image-vars.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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. #ifndef LINKER_SCRIPT
  9. #error This file should only be included in vmlinux.lds.S
  10. #endif
  11. PROVIDE(__efistub_primary_entry = primary_entry);
  12. /*
  13. * The EFI stub has its own symbol namespace prefixed by __efistub_, to
  14. * isolate it from the kernel proper. The following symbols are legally
  15. * accessed by the stub, so provide some aliases to make them accessible.
  16. * Only include data symbols here, or text symbols of functions that are
  17. * guaranteed to be safe when executed at another offset than they were
  18. * linked at. The routines below are all implemented in assembler in a
  19. * position independent manner
  20. */
  21. PROVIDE(__efistub_caches_clean_inval_pou = __pi_caches_clean_inval_pou);
  22. PROVIDE(__efistub__text = _text);
  23. PROVIDE(__efistub__end = _end);
  24. PROVIDE(__efistub___inittext_end = __inittext_end);
  25. PROVIDE(__efistub__edata = _edata);
  26. #if defined(CONFIG_EFI_EARLYCON) || defined(CONFIG_SYSFB)
  27. PROVIDE(__efistub_screen_info = screen_info);
  28. #endif
  29. PROVIDE(__efistub__ctype = _ctype);
  30. PROVIDE(__pi___memcpy = __pi_memcpy);
  31. PROVIDE(__pi___memmove = __pi_memmove);
  32. PROVIDE(__pi___memset = __pi_memset);
  33. PROVIDE(__pi_id_aa64isar1_override = id_aa64isar1_override);
  34. PROVIDE(__pi_id_aa64isar2_override = id_aa64isar2_override);
  35. PROVIDE(__pi_id_aa64mmfr0_override = id_aa64mmfr0_override);
  36. PROVIDE(__pi_id_aa64mmfr1_override = id_aa64mmfr1_override);
  37. PROVIDE(__pi_id_aa64mmfr2_override = id_aa64mmfr2_override);
  38. PROVIDE(__pi_id_aa64pfr0_override = id_aa64pfr0_override);
  39. PROVIDE(__pi_id_aa64pfr1_override = id_aa64pfr1_override);
  40. PROVIDE(__pi_id_aa64smfr0_override = id_aa64smfr0_override);
  41. PROVIDE(__pi_id_aa64zfr0_override = id_aa64zfr0_override);
  42. PROVIDE(__pi_arm64_sw_feature_override = arm64_sw_feature_override);
  43. PROVIDE(__pi_arm64_use_ng_mappings = arm64_use_ng_mappings);
  44. #ifdef CONFIG_CAVIUM_ERRATUM_27456
  45. PROVIDE(__pi_cavium_erratum_27456_cpus = cavium_erratum_27456_cpus);
  46. #endif
  47. PROVIDE(__pi__ctype = _ctype);
  48. PROVIDE(__pi_memstart_offset_seed = memstart_offset_seed);
  49. PROVIDE(__pi_init_idmap_pg_dir = init_idmap_pg_dir);
  50. PROVIDE(__pi_init_idmap_pg_end = init_idmap_pg_end);
  51. PROVIDE(__pi_init_pg_dir = init_pg_dir);
  52. PROVIDE(__pi_init_pg_end = init_pg_end);
  53. PROVIDE(__pi_swapper_pg_dir = swapper_pg_dir);
  54. PROVIDE(__pi__text = _text);
  55. PROVIDE(__pi__stext = _stext);
  56. PROVIDE(__pi__etext = _etext);
  57. PROVIDE(__pi___start_rodata = __start_rodata);
  58. PROVIDE(__pi___inittext_begin = __inittext_begin);
  59. PROVIDE(__pi___inittext_end = __inittext_end);
  60. PROVIDE(__pi___initdata_begin = __initdata_begin);
  61. PROVIDE(__pi___initdata_end = __initdata_end);
  62. PROVIDE(__pi__data = _data);
  63. PROVIDE(__pi___bss_start = __bss_start);
  64. PROVIDE(__pi__end = _end);
  65. #ifdef CONFIG_KVM
  66. /*
  67. * KVM nVHE code has its own symbol namespace prefixed with __kvm_nvhe_, to
  68. * separate it from the kernel proper. The following symbols are legally
  69. * accessed by it, therefore provide aliases to make them linkable.
  70. * Do not include symbols which may not be safely accessed under hypervisor
  71. * memory mappings.
  72. */
  73. /* Alternative callbacks for init-time patching of nVHE hyp code. */
  74. KVM_NVHE_ALIAS(kvm_patch_vector_branch);
  75. KVM_NVHE_ALIAS(kvm_update_va_mask);
  76. KVM_NVHE_ALIAS(kvm_get_kimage_voffset);
  77. KVM_NVHE_ALIAS(kvm_compute_final_ctr_el0);
  78. KVM_NVHE_ALIAS(spectre_bhb_patch_loop_iter);
  79. KVM_NVHE_ALIAS(spectre_bhb_patch_loop_mitigation_enable);
  80. KVM_NVHE_ALIAS(spectre_bhb_patch_wa3);
  81. KVM_NVHE_ALIAS(spectre_bhb_patch_clearbhb);
  82. KVM_NVHE_ALIAS(alt_cb_patch_nops);
  83. /* Global kernel state accessed by nVHE hyp code. */
  84. KVM_NVHE_ALIAS(kvm_vgic_global_state);
  85. /* Kernel symbols used to call panic() from nVHE hyp code (via ERET). */
  86. KVM_NVHE_ALIAS(nvhe_hyp_panic_handler);
  87. /* Vectors installed by hyp-init on reset HVC. */
  88. KVM_NVHE_ALIAS(__hyp_stub_vectors);
  89. /* Static keys which are set if a vGIC trap should be handled in hyp. */
  90. KVM_NVHE_ALIAS(vgic_v2_cpuif_trap);
  91. KVM_NVHE_ALIAS(vgic_v3_cpuif_trap);
  92. /* EL2 exception handling */
  93. KVM_NVHE_ALIAS(__start___kvm_ex_table);
  94. KVM_NVHE_ALIAS(__stop___kvm_ex_table);
  95. /* PMU available static key */
  96. #ifdef CONFIG_HW_PERF_EVENTS
  97. KVM_NVHE_ALIAS(kvm_arm_pmu_available);
  98. #endif
  99. /* Position-independent library routines */
  100. KVM_NVHE_ALIAS_HYP(clear_page, __pi_clear_page);
  101. KVM_NVHE_ALIAS_HYP(copy_page, __pi_copy_page);
  102. KVM_NVHE_ALIAS_HYP(memcpy, __pi_memcpy);
  103. KVM_NVHE_ALIAS_HYP(memset, __pi_memset);
  104. #ifdef CONFIG_KASAN
  105. KVM_NVHE_ALIAS_HYP(__memcpy, __pi_memcpy);
  106. KVM_NVHE_ALIAS_HYP(__memset, __pi_memset);
  107. #endif
  108. /* Hyp memory sections */
  109. KVM_NVHE_ALIAS(__hyp_idmap_text_start);
  110. KVM_NVHE_ALIAS(__hyp_idmap_text_end);
  111. KVM_NVHE_ALIAS(__hyp_text_start);
  112. KVM_NVHE_ALIAS(__hyp_text_end);
  113. KVM_NVHE_ALIAS(__hyp_bss_start);
  114. KVM_NVHE_ALIAS(__hyp_bss_end);
  115. KVM_NVHE_ALIAS(__hyp_rodata_start);
  116. KVM_NVHE_ALIAS(__hyp_rodata_end);
  117. /* pKVM static key */
  118. KVM_NVHE_ALIAS(kvm_protected_mode_initialized);
  119. #endif /* CONFIG_KVM */
  120. #ifdef CONFIG_EFI_ZBOOT
  121. _kernel_codesize = ABSOLUTE(__inittext_end - _text);
  122. #endif
  123. #endif /* __ARM64_KERNEL_IMAGE_VARS_H */