Commit | Line | Data |
---|---|---|
34bfeea4 CM |
1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
2 | /* | |
3 | * Copyright (C) 2020 ARM Ltd. | |
4 | */ | |
5 | #include <linux/linkage.h> | |
6 | ||
7 | #include <asm/assembler.h> | |
8 | #include <asm/sysreg.h> | |
9 | ||
10 | .arch armv8.5-a+memtag | |
11 | ||
12 | /* | |
13 | * multitag_transfer_size - set \reg to the block size that is accessed by the | |
14 | * LDGM/STGM instructions. | |
15 | */ | |
16 | .macro multitag_transfer_size, reg, tmp | |
17 | mrs_s \reg, SYS_GMID_EL1 | |
18 | ubfx \reg, \reg, #SYS_GMID_EL1_BS_SHIFT, #SYS_GMID_EL1_BS_SIZE | |
19 | mov \tmp, #4 | |
20 | lsl \reg, \tmp, \reg | |
21 | .endm | |
22 | ||
23 | /* | |
24 | * Clear the tags in a page | |
25 | * x0 - address of the page to be cleared | |
26 | */ | |
27 | SYM_FUNC_START(mte_clear_page_tags) | |
28 | multitag_transfer_size x1, x2 | |
29 | 1: stgm xzr, [x0] | |
30 | add x0, x0, x1 | |
31 | tst x0, #(PAGE_SIZE - 1) | |
32 | b.ne 1b | |
33 | ret | |
34 | SYM_FUNC_END(mte_clear_page_tags) |