OSDN Git Service

KVM: arm64: Simplify the sanitise_mte_tags() logic
authorCatalin Marinas <catalin.marinas@arm.com>
Fri, 4 Nov 2022 01:10:36 +0000 (18:10 -0700)
committerMarc Zyngier <maz@kernel.org>
Tue, 29 Nov 2022 09:26:07 +0000 (09:26 +0000)
commit2dbf12ae132cc78048615cfa19c9be64baaf0ced
treec7c9d14c12d3cefa8c891518e5d06465bce004c2
parente059853d14ca4ed0f6a190d7109487918a22a976
KVM: arm64: Simplify the sanitise_mte_tags() logic

Currently sanitise_mte_tags() checks if it's an online page before
attempting to sanitise the tags. Such detection should be done in the
caller via the VM_MTE_ALLOWED vma flag. Since kvm_set_spte_gfn() does
not have the vma, leave the page unmapped if not already tagged. Tag
initialisation will be done on a subsequent access fault in
user_mem_abort().

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
[pcc@google.com: fix the page initializer]
Signed-off-by: Peter Collingbourne <pcc@google.com>
Reviewed-by: Steven Price <steven.price@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Marc Zyngier <maz@kernel.org>
Cc: Peter Collingbourne <pcc@google.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20221104011041.290951-4-pcc@google.com
arch/arm64/kvm/mmu.c