On Wed, Sep 23, 2026, Lorenzo Stoakes (ARM) wrote: > All existing architectures which implement KVM pre-fault (x86, s390) have > mechanisms for disallowing pre-faulting. > > Currently these are open coded as part of kvm_arch_vcpu_pre_fault_memory(). > > Formalise this by moving them into a new kvm_arch_pre_fault_allowed() hook, > which every architecture selecting CONFIG_KVM_GENERIC_PRE_FAULT_MEMORY must > implement, returning an error code if the operation is disallowed or 0 > otherwise. > > The hook is called early in the generic code, allowing architectures to > disallow the operation prior to vCPU load. > > This is important, as kvm_vcpu_pre_fault_memory() is the only place where > generic code can call vcpu_load() on a vCPU that has not yet been > initialised. > > This lays the foundation for a future change which implements pre-faulting > for arm64 which needs to disallow the mechanism for uninitialised vCPUs. > > Suggested-by: Oliver Upton <[email protected]> > Signed-off-by: Lorenzo Stoakes (ARM) <[email protected]> > ---
Acked-by: Sean Christopherson <[email protected]>

