Re: [PATCH v3 10/32] KVM: arm64: Introduce an early Hyp page allocator

Will Deacon
2021-03-04T14:41:13Z

On Tue, Mar 02, 2021 at 02:59:40PM +0000, Quentin Perret wrote:
> 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.
>
> Signed-off-by: Quentin Perret <qperret@google.com>
> ---
> arch/arm64/kvm/hyp/include/nvhe/early_alloc.h | 14 +++++
> arch/arm64/kvm/hyp/include/nvhe/memory.h | 24 +++++++++
> arch/arm64/kvm/hyp/nvhe/Makefile | 2 +-
> arch/arm64/kvm/hyp/nvhe/early_alloc.c | 54 +++++++++++++++++++
> arch/arm64/kvm/hyp/nvhe/psci-relay.c | 4 +-
> 5 files changed, 94 insertions(+), 4 deletions(-)
> create mode 100644 arch/arm64/kvm/hyp/include/nvhe/early_alloc.h
> create mode 100644 arch/arm64/kvm/hyp/include/nvhe/memory.h
> create mode 100644 arch/arm64/kvm/hyp/nvhe/early_alloc.c

Acked-by: Will Deacon <will@kernel.org>

Will