KVM: arm64: Introduce an early Hyp page allocator
authorQuentin Perret <qperret@google.com>
Fri, 19 Mar 2021 10:01:18 +0000 (10:01 +0000)
committerMarc Zyngier <maz@kernel.org>
Fri, 19 Mar 2021 12:01:20 +0000 (12:01 +0000)
commite759604087231c672f91564cc805336e70d333a0
treed400fe721eb563b05e180903314a661ee6966df2
parentfa21472a316af8ad7af3114049db89678444c7ed
KVM: arm64: Introduce an early Hyp page allocator

With nVHE, the host currently creates all stage 1 hypervisor mappings at
EL1 during boot, installs them at EL2, and extends them as required
(e.g. when creating a new VM). But in a world where the host is no
longer trusted, it cannot have full control over the code mapped in the
hypervisor.

In preparation for enabling the hypervisor to create its own stage 1
mappings during boot, introduce an early page allocator, with minimal
functionality. This allocator is designed to be used only during early
bootstrap of the hyp code when memory protection is enabled, which will
then switch to using a full-fledged page allocator after init.

Acked-by: Will Deacon <will@kernel.org>
Signed-off-by: Quentin Perret <qperret@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20210319100146.1149909-11-qperret@google.com
arch/arm64/kvm/hyp/include/nvhe/early_alloc.h [new file with mode: 0644]
arch/arm64/kvm/hyp/include/nvhe/memory.h [new file with mode: 0644]
arch/arm64/kvm/hyp/nvhe/Makefile
arch/arm64/kvm/hyp/nvhe/early_alloc.c [new file with mode: 0644]
arch/arm64/kvm/hyp/nvhe/psci-relay.c