18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef __ASM_KASAN_H
38c2ecf20Sopenharmony_ci#define __ASM_KASAN_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#ifdef CONFIG_KASAN
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#define KASAN_SHADOW_SCALE_SHIFT 3
88c2ecf20Sopenharmony_ci#ifdef CONFIG_KASAN_S390_4_LEVEL_PAGING
98c2ecf20Sopenharmony_ci#define KASAN_SHADOW_SIZE						       \
108c2ecf20Sopenharmony_ci	(_AC(1, UL) << (_REGION1_SHIFT - KASAN_SHADOW_SCALE_SHIFT))
118c2ecf20Sopenharmony_ci#else
128c2ecf20Sopenharmony_ci#define KASAN_SHADOW_SIZE						       \
138c2ecf20Sopenharmony_ci	(_AC(1, UL) << (_REGION2_SHIFT - KASAN_SHADOW_SCALE_SHIFT))
148c2ecf20Sopenharmony_ci#endif
158c2ecf20Sopenharmony_ci#define KASAN_SHADOW_OFFSET	_AC(CONFIG_KASAN_SHADOW_OFFSET, UL)
168c2ecf20Sopenharmony_ci#define KASAN_SHADOW_START	KASAN_SHADOW_OFFSET
178c2ecf20Sopenharmony_ci#define KASAN_SHADOW_END	(KASAN_SHADOW_START + KASAN_SHADOW_SIZE)
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ciextern void kasan_early_init(void);
208c2ecf20Sopenharmony_ciextern void kasan_copy_shadow(pgd_t *dst);
218c2ecf20Sopenharmony_ciextern void kasan_free_early_identity(void);
228c2ecf20Sopenharmony_ciextern unsigned long kasan_vmax;
238c2ecf20Sopenharmony_ci#else
248c2ecf20Sopenharmony_cistatic inline void kasan_early_init(void) { }
258c2ecf20Sopenharmony_cistatic inline void kasan_copy_shadow(pgd_t *dst) { }
268c2ecf20Sopenharmony_cistatic inline void kasan_free_early_identity(void) { }
278c2ecf20Sopenharmony_ci#endif
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci#endif
30