arm64: dts: qcom: sm8550: add TRNG node
[linux-modified.git] / arch / powerpc / include / asm / sections.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_POWERPC_SECTIONS_H
3 #define _ASM_POWERPC_SECTIONS_H
4 #ifdef __KERNEL__
5
6 #include <linux/elf.h>
7 #include <linux/uaccess.h>
8
9 #ifdef CONFIG_HAVE_FUNCTION_DESCRIPTORS
10 typedef struct func_desc func_desc_t;
11 #endif
12
13 #include <asm-generic/sections.h>
14
15 extern char __head_end[];
16 extern char __srwx_boundary[];
17
18 /* Patch sites */
19 extern s32 patch__call_flush_branch_caches1;
20 extern s32 patch__call_flush_branch_caches2;
21 extern s32 patch__call_flush_branch_caches3;
22 extern s32 patch__flush_count_cache_return;
23 extern s32 patch__flush_link_stack_return;
24 extern s32 patch__call_kvm_flush_link_stack;
25 extern s32 patch__call_kvm_flush_link_stack_p9;
26 extern s32 patch__memset_nocache, patch__memcpy_nocache;
27
28 extern long flush_branch_caches;
29 extern long kvm_flush_link_stack;
30
31 #ifdef __powerpc64__
32
33 extern char __start_interrupts[];
34 extern char __end_interrupts[];
35
36 #ifdef CONFIG_PPC_POWERNV
37 extern char start_real_trampolines[];
38 extern char end_real_trampolines[];
39 extern char start_virt_trampolines[];
40 extern char end_virt_trampolines[];
41 #endif
42
43 /*
44  * This assumes the kernel is never compiled -mcmodel=small or
45  * the total .toc is always less than 64k.
46  */
47 static inline unsigned long kernel_toc_addr(void)
48 {
49 #ifdef CONFIG_PPC_KERNEL_PCREL
50         BUILD_BUG();
51         return -1UL;
52 #else
53         unsigned long toc_ptr;
54
55         asm volatile("mr %0, 2" : "=r" (toc_ptr));
56         return toc_ptr;
57 #endif
58 }
59
60 static inline int overlaps_interrupt_vector_text(unsigned long start,
61                                                         unsigned long end)
62 {
63         unsigned long real_start, real_end;
64         real_start = __start_interrupts - _stext;
65         real_end = __end_interrupts - _stext;
66
67         return start < (unsigned long)__va(real_end) &&
68                 (unsigned long)__va(real_start) < end;
69 }
70
71 static inline int overlaps_kernel_text(unsigned long start, unsigned long end)
72 {
73         return start < (unsigned long)__init_end &&
74                 (unsigned long)_stext < end;
75 }
76
77 #else
78 static inline unsigned long kernel_toc_addr(void) { BUILD_BUG(); return -1UL; }
79 #endif
80
81 #endif /* __KERNEL__ */
82 #endif  /* _ASM_POWERPC_SECTIONS_H */