[PATCH v3 02/17] KVM: arm64: nv: Allocate VNCR page when required

Oliver Upton oliver.upton at linux.dev
Fri May 9 03:11:16 PDT 2025


On Wed, Apr 23, 2025 at 04:14:53PM +0100, Marc Zyngier wrote:
> If running a NV guest on an ARMv8.4-NV capable system, let's
> allocate an additional page that will be used by the hypervisor
> to fulfill system register accesses.
> 
> Reviewed-by: Ganapatrao Kulkarni <gankulkarni at os.amperecomputing.com>
> Signed-off-by: Marc Zyngier <maz at kernel.org>
> ---
>  arch/arm64/kvm/nested.c | 9 +++++++++
>  arch/arm64/kvm/reset.c  | 1 +
>  2 files changed, 10 insertions(+)
> 
> diff --git a/arch/arm64/kvm/nested.c b/arch/arm64/kvm/nested.c
> index 4a3fc11f7ecf3..884b3e25795c4 100644
> --- a/arch/arm64/kvm/nested.c
> +++ b/arch/arm64/kvm/nested.c
> @@ -55,6 +55,12 @@ int kvm_vcpu_init_nested(struct kvm_vcpu *vcpu)
>  	    !cpus_have_final_cap(ARM64_HAS_HCR_NV1))
>  		return -EINVAL;
>  
> +	if (!vcpu->arch.ctxt.vncr_array)
> +		vcpu->arch.ctxt.vncr_array = (u64 *)__get_free_page(GFP_KERNEL | __GFP_ZERO);

Think you want GFP_KERNEL_ACCOUNT here.

Thanks,
Oliver



More information about the linux-arm-kernel mailing list