KVM: arm64: Use helpers to classify exception types reported via ESR
authorArd Biesheuvel <ardb@kernel.org>
Tue, 28 Nov 2023 14:04:01 +0000 (15:04 +0100)
committerMarc Zyngier <maz@kernel.org>
Thu, 30 Nov 2023 10:45:28 +0000 (10:45 +0000)
commit11e5ea5242e38d44fcede879473566bb6d68f954
tree4766a8eb3c66fbfdc5deb53ad153e03e6d4c71ca
parent10a0cc3b688fcf753ff3f6518bb15e7a6809e908
KVM: arm64: Use helpers to classify exception types reported via ESR

Currently, we rely on the fact that exceptions can be trivially
classified by applying a mask/value pair to the syndrome value reported
via the ESR register, but this will no longer be true once we enable
support for 5 level paging.

So introduce a couple of helpers that encapsulate this mask/value pair
matching, and wire them up in the code. No functional change intended,
the actual handling of translation level -1 will be added in a
subsequent patch.

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Marc Zyngier <maz@kernel.org>
Cc: Oliver Upton <oliver.upton@linux.dev>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Acked-by: Mark Rutland <mark.rutland@arm.com>
[maz: folded in changes suggested by Mark]
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20231128140400.3132145-2-ardb@google.com
arch/arm64/include/asm/esr.h
arch/arm64/include/asm/kvm_emulate.h
arch/arm64/kvm/hyp/include/hyp/fault.h
arch/arm64/kvm/hyp/include/hyp/switch.h
arch/arm64/kvm/mmu.c