On Tue, May 05, 2026 at 10:54:07AM +0100, Yeoreum Yun wrote: > This patch is a preparatory change to address dependency issues > between the FF-A driver and pKVM. > > kvm_init() should be invoked from finalise_pkvm(), > as this is the point where pKVM initialisation is finalised and > the system transitions into the protected mode. > > Deferring kvm_init() ensures that KVM is initialised only after pKVM has > fully established its protected environment. > > Signed-off-by: Yeoreum Yun <[email protected]> > --- > arch/arm64/kvm/arm.c | 8 +++++--- > arch/arm64/kvm/pkvm.c | 15 ++++++++++++++- > 2 files changed, 19 insertions(+), 4 deletions(-) > > diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c > index 8bb2c7422cc8..663b1d447a9b 100644 > --- a/arch/arm64/kvm/arm.c > +++ b/arch/arm64/kvm/arm.c > @@ -3025,9 +3025,11 @@ static __init int kvm_arm_init(void) > * FIXME: Do something reasonable if kvm_init() fails after pKVM > * hypervisor protection is finalized. > */ > - err = kvm_init(sizeof(struct kvm_vcpu), 0, THIS_MODULE); > - if (err) > - goto out_subs; > + if (!is_protected_kvm_enabled()) { > + err = kvm_init(sizeof(struct kvm_vcpu), 0, THIS_MODULE); > + if (err) > + goto out_subs; > + } > > /* > * This should be called after initialization is done and failure isn't > diff --git a/arch/arm64/kvm/pkvm.c b/arch/arm64/kvm/pkvm.c > index 053e4f733e4b..48b06d384570 100644 > --- a/arch/arm64/kvm/pkvm.c > +++ b/arch/arm64/kvm/pkvm.c > @@ -17,6 +17,7 @@ > #include "hyp_constants.h" > > DEFINE_STATIC_KEY_FALSE(kvm_protected_mode_initialized); > +EXPORT_SYMBOL_GPL(kvm_protected_mode_initialized); >
I am not sure if this is needed when FF-A is built as module. If others are OK with it, I am fine. But I am thinking if we need to use this in FF-A driver which can be built-in or a module, we can add IS_BUILTIN(CONFIG_ARM_FFA_*) -- Regards, Sudeep

