KVM: arm64: Use a maple tree to represent the SMCCC filter
authorOliver Upton <oliver.upton@linux.dev>
Tue, 4 Apr 2023 15:40:44 +0000 (15:40 +0000)
committerMarc Zyngier <maz@kernel.org>
Wed, 5 Apr 2023 11:07:41 +0000 (12:07 +0100)
commitfb88707dd39bd1d5ec4a058776de9ee99bcc7b72
tree69568a3ffa09c4257bbf3b1195573b84a52510f4
parenta8308b3fc9494953c453480fb277e24f82f7d2b9
KVM: arm64: Use a maple tree to represent the SMCCC filter

Maple tree is an efficient B-tree implementation that is intended for
storing non-overlapping intervals. Such a data structure is a good fit
for the SMCCC filter as it is desirable to sparsely allocate the 32 bit
function ID space.

To that end, add a maple tree to kvm_arch and correctly init/teardown
along with the VM. Wire in a test against the hypercall filter for HVCs
which does nothing until the controls are exposed to userspace.

Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20230404154050.2270077-8-oliver.upton@linux.dev
arch/arm64/include/asm/kvm_host.h
arch/arm64/kvm/arm.c
arch/arm64/kvm/hypercalls.c
include/kvm/arm_hypercalls.h