xref: /openbmc/linux/arch/s390/include/asm/kasan.h (revision afba8b0a)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __ASM_KASAN_H
3 #define __ASM_KASAN_H
4 
5 #ifdef CONFIG_KASAN
6 
7 #define KASAN_SHADOW_SCALE_SHIFT 3
8 #ifdef CONFIG_KASAN_S390_4_LEVEL_PAGING
9 #define KASAN_SHADOW_SIZE						       \
10 	(_AC(1, UL) << (_REGION1_SHIFT - KASAN_SHADOW_SCALE_SHIFT))
11 #else
12 #define KASAN_SHADOW_SIZE						       \
13 	(_AC(1, UL) << (_REGION2_SHIFT - KASAN_SHADOW_SCALE_SHIFT))
14 #endif
15 #define KASAN_SHADOW_OFFSET	_AC(CONFIG_KASAN_SHADOW_OFFSET, UL)
16 #define KASAN_SHADOW_START	KASAN_SHADOW_OFFSET
17 #define KASAN_SHADOW_END	(KASAN_SHADOW_START + KASAN_SHADOW_SIZE)
18 
19 extern void kasan_early_init(void);
20 extern void kasan_copy_shadow(pgd_t *dst);
21 extern void kasan_free_early_identity(void);
22 extern unsigned long kasan_vmax;
23 #else
24 static inline void kasan_early_init(void) { }
25 static inline void kasan_copy_shadow(pgd_t *dst) { }
26 static inline void kasan_free_early_identity(void) { }
27 #endif
28 
29 #endif
30