blob: 1716b3d02489072c2974dba61ee3b9a8d63d4eea [file] [log] [blame]
Vincenzo Frascino637ec832019-09-16 11:51:17 +01001/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Copyright (C) 2020 ARM Ltd.
4 */
5#ifndef __ASM_MTE_H
6#define __ASM_MTE_H
7
8#ifndef __ASSEMBLY__
9
Catalin Marinas34bfeea2020-05-04 14:42:36 +010010#include <linux/page-flags.h>
11
12#include <asm/pgtable-types.h>
13
14void mte_clear_page_tags(void *addr);
15
Vincenzo Frascino637ec832019-09-16 11:51:17 +010016#ifdef CONFIG_ARM64_MTE
17
Catalin Marinas34bfeea2020-05-04 14:42:36 +010018/* track which pages have valid allocation tags */
19#define PG_mte_tagged PG_arch_2
20
21void mte_sync_tags(pte_t *ptep, pte_t pte);
Vincenzo Frascino637ec832019-09-16 11:51:17 +010022void flush_mte_state(void);
23
24#else
25
Catalin Marinas34bfeea2020-05-04 14:42:36 +010026/* unused if !CONFIG_ARM64_MTE, silence the compiler */
27#define PG_mte_tagged 0
28
29static inline void mte_sync_tags(pte_t *ptep, pte_t pte)
30{
31}
Vincenzo Frascino637ec832019-09-16 11:51:17 +010032static inline void flush_mte_state(void)
33{
34}
35
36#endif
37
38#endif /* __ASSEMBLY__ */
39#endif /* __ASM_MTE_H */