[PATCH v3 01/14] KVM: Allow architectures to disallow pre-fault

Oliver Upton oupton at kernel.org
Tue Sep 22 09:49:18 PDT 2026


Hi Lorenzo,

On Tue, Sep 22, 2026 at 03:17:55PM +0100, Lorenzo Stoakes (ARM) wrote:
> +bool __weak kvm_arch_vcpu_allow_pre_fault_memory(struct kvm_vcpu *vcpu)
> +{
> +	return true;
> +}
> +
>  void kvm_vcpu_on_spin(struct kvm_vcpu *me, bool yield_to_kernel_mode)
>  {
>  	int nr_vcpus, start, i, idx, yielded;
> @@ -4365,6 +4370,9 @@ static int kvm_vcpu_pre_fault_memory(struct kvm_vcpu *vcpu,
>  	    range->gpa + range->size <= range->gpa)
>  		return -EINVAL;
>  
> +	if (!kvm_arch_vcpu_allow_pre_fault_memory(vcpu))
> +		return -ENOEXEC;
> +

nit: it'd be better to let the arch hook return an error of its choosing
but in reality this is only going to be used by arm64.

Not worth a respin on its own though.

Thanks,
Oliver



More information about the linux-arm-kernel mailing list