Re: [PATCH v9 23/24] KVM: s390: arm64: Implement basic page fault handler

From: Lorenzo Stoakes (ARM)

Date: Thu Oct 01 2026 - 10:55:17 EST


On Thu, Oct 01, 2026 at 03:35:37PM +0200, Arnd Bergmann wrote:
> Another ones: after 34cfa9b3af17 ("KVM: arm64: Implement
> KVM_PRE_FAULT_MEMORY"), we are now missing a kvm_arch_pre_fault_allowed()
> definition in arch/s390/kvm/arm64/mmu.c:
>
> ERROR: modpost: arch/s390/kvm/arm64/kvm-arm64.ko: symbol 'kvm_arch_pre_fault_allowed' undefined!
>
> I copied the arm64 version without the pkvm reference to make it
> build for me.
>
> Arnd
>
> diff --git a/arch/s390/kvm/arm64/mmu.c b/arch/s390/kvm/arm64/mmu.c
> index 7ee157c61d70..be16351acaae 100644
> --- a/arch/s390/kvm/arm64/mmu.c
> +++ b/arch/s390/kvm/arm64/mmu.c
> @@ -179,6 +179,14 @@ int kvm_handle_guest_abort(struct kvm_vcpu *vcpu)
> return ret;
> }
>
> +int kvm_arch_pre_fault_allowed(struct kvm_vcpu *vcpu)
> +{
> + if (!kvm_vcpu_initialized(vcpu))
> + return -ENOEXEC;
> +
> + return 0;
> +}
> +

Ah the s390 <-> kvm emulation stuff.

Yep if it's meant to behave like arm64 then that should be correct.

It's odd to me that pre-faulting was not previously implemented for actual-arm64
but was added as part of the virtualised s390/arm64 thing automatically :)

Not sure if this implementation requires what s390 does with:

+int kvm_arch_pre_fault_allowed(struct kvm_vcpu *vcpu)
+{
+ if (kvm_is_ucontrol(vcpu->kvm))
+ return -EINVAL;
+
+ return 0;
+}

Or both conditions? One for the s390 guys.

--
Cheers, Lorenzo