xref: /linux/arch/arm64/include/asm/hyp_image.h (revision 415e915fdfc775ad0c6675fde1008f6f43dd6251)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright (C) 2020 Google LLC.
4  * Written by David Brazdil <dbrazdil@google.com>
5  */
6 
7 #ifndef __ARM64_HYP_IMAGE_H__
8 #define __ARM64_HYP_IMAGE_H__
9 
10 /*
11  * KVM nVHE code has its own symbol namespace prefixed with __kvm_nvhe_,
12  * to separate it from the kernel proper.
13  */
14 #define kvm_nvhe_sym(sym)	__kvm_nvhe_##sym
15 
16 #ifdef LINKER_SCRIPT
17 
18 /*
19  * KVM nVHE ELF section names are prefixed with .hyp, to separate them
20  * from the kernel proper.
21  */
22 #define HYP_SECTION_NAME(NAME)	.hyp##NAME
23 
24 /* Defines an ELF hyp section from input section @NAME and its subsections. */
25 #define HYP_SECTION(NAME) \
26 	HYP_SECTION_NAME(NAME) : { *(NAME NAME##.*) }
27 
28 /*
29  * Defines a linker script alias of a kernel-proper symbol referenced by
30  * KVM nVHE hyp code.
31  */
32 #define KVM_NVHE_ALIAS(sym)	kvm_nvhe_sym(sym) = sym;
33 
34 #endif /* LINKER_SCRIPT */
35 
36 #endif /* __ARM64_HYP_IMAGE_H__ */
37