162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright (C) 2020 ARM Ltd.
462306a36Sopenharmony_ci */
562306a36Sopenharmony_ci#ifndef __ASM_MTE_DEF_H
662306a36Sopenharmony_ci#define __ASM_MTE_DEF_H
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#define MTE_GRANULE_SIZE	UL(16)
962306a36Sopenharmony_ci#define MTE_GRANULE_MASK	(~(MTE_GRANULE_SIZE - 1))
1062306a36Sopenharmony_ci#define MTE_GRANULES_PER_PAGE	(PAGE_SIZE / MTE_GRANULE_SIZE)
1162306a36Sopenharmony_ci#define MTE_TAG_SHIFT		56
1262306a36Sopenharmony_ci#define MTE_TAG_SIZE		4
1362306a36Sopenharmony_ci#define MTE_TAG_MASK		GENMASK((MTE_TAG_SHIFT + (MTE_TAG_SIZE - 1)), MTE_TAG_SHIFT)
1462306a36Sopenharmony_ci#define MTE_PAGE_TAG_STORAGE	(MTE_GRANULES_PER_PAGE * MTE_TAG_SIZE / 8)
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci#define __MTE_PREAMBLE		ARM64_ASM_PREAMBLE ".arch_extension memtag\n"
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci#endif /* __ASM_MTE_DEF_H  */
19