arm64: mte: Enable swap of tagged pages
authorSteven Price <steven.price@arm.com>
Wed, 13 May 2020 15:37:50 +0000 (16:37 +0100)
committerCatalin Marinas <catalin.marinas@arm.com>
Fri, 4 Sep 2020 11:46:07 +0000 (12:46 +0100)
commit36943aba91860269abfba2e736e9534d48e90cae
tree4fb2f58ccd9e8811cad36b712738f2afc5e7ebb0
parent8a84802e2a2b1a682761a31c2685506b9f4e1840
arm64: mte: Enable swap of tagged pages

When swapping pages out to disk it is necessary to save any tags that
have been set, and restore when swapping back in. Make use of the new
page flag (PG_ARCH_2, locally named PG_mte_tagged) to identify pages
with tags. When swapping out these pages the tags are stored in memory
and later restored when the pages are brought back in. Because shmem can
swap pages back in without restoring the userspace PTE it is also
necessary to add a hook for shmem.

Signed-off-by: Steven Price <steven.price@arm.com>
[catalin.marinas@arm.com: move function prototypes to mte.h]
[catalin.marinas@arm.com: drop '_tags' from arch_swap_restore_tags()]
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Will Deacon <will@kernel.org>
arch/arm64/include/asm/mte.h
arch/arm64/include/asm/pgtable.h
arch/arm64/kernel/mte.c
arch/arm64/lib/mte.S
arch/arm64/mm/Makefile
arch/arm64/mm/mteswap.c [new file with mode: 0644]