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