public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/3] initalise ff-a after finalising pKVM
@ 2026-05-05  9:54 Yeoreum Yun
  2026-05-05  9:54 ` [RFC PATCH 1/3] arm64: KVM: defer kvm_init() to finalise_pkvm() when pKVM is enabled Yeoreum Yun
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Yeoreum Yun @ 2026-05-05  9:54 UTC (permalink / raw)
  To: linux-integrity, keyrings, linux-security-module, linux-kernel,
	linux-arm-kernel, kvmarm
  Cc: jarkko, zohar, roberto.sassu, dmitry.kasatkin, eric.snowberg,
	paul, jmorris, serge, maz, oupton, joey.gouly, suzuki.poulose,
	yuzenghui, catalin.marinas, will, sudeep.holla, Yeoreum Yun

This patch is split out from the patchset [0] --
fix FF-A call failure with pKVM when the FF-A driver is built-in,
specifically the IMA-related part.

When pKVM is enabled, the FF-A driver must be initialised after pKVM.
Otherwise, pKVM cannot negotiate the FF-A version or obtain the RX/TX
buffer information, leading to failures in FF-A calls.

Currently, pKVM initialisation completes at device_initcall_sync,
while ffa_init() runs at the device_initcall level.

So far, linker deployes kvm_arm_init() before ffa_init(), and SMCs can
still be trapped even before finalise_pkvm() is invoked.
As a result, this issue has not been observed.

However, relying on above stuff is fragile.
Therefore, when pKVM is enabled, the FF-A infrastructure should be
initialised only after pKVM initialisation has been fully finalised.

To achieve this, introduce an ffa_root_dev ("arm-ffa") and
a corresponding driver to defer initialisation of the FF-A infrastructure
until pKVM initialisation is complete, and to defer probing of all FF-A devices until then
when pKVM is enabled.

This patch is based on v7.1-rc2

Question:

FF-A initialisation can occur at late_initcall. Because it may be deferred,
some FF-A requests cannot be serviced at that stage.
A typical example is the EFI runtime variable service using DIRECT_MSG_REQ.

Depending on the platform, the EFI runtime variable service runs with StandaloneMm
and uses FF-A DIRECT_REQ. However, when pKVM is enabled, FF-A initialisation
may be deferred to late_initcall. In this case, load_uefi_certs()
can fail if it is invoked before the FF-A driver is initialised
via deferred_probe_initcall().

Moving load_uefi_certs() to late_initcall_sync, as in the third patch,
seems not to have any problem since late_initcall and
late_initcall_sync are both of do_basic_setup() and it's before loading
init process. However, it is still unclear whether
it would be better to allow DIRECT_MSG_REQ in kvm_host_ffa_handler()
even before FF-A version negotiation since handler’s purpose seems to hook
certain memory operations, and DIRECT_MSG_REQ has been available
since FF-A specification v1.0.

Any feedback or alternative suggestions would be appreciated!

Link: https://lore.kernel.org/all/20260422162449.1814615-1-yeoreum.yun@arm.com/ [0]

Yeoreum Yun (3):
  arm64: KVM: defer kvm_init() to finalise_pkvm() when pKVM is enabled
  firmware: arm_ffa: initialise ff-a after finalising pKVM
    initialisation
  security: integrity: call load_uefi_certs() at late_initcall_sync

 arch/arm64/kvm/arm.c                          |   8 +-
 arch/arm64/kvm/pkvm.c                         |  15 ++-
 drivers/firmware/arm_ffa/bus.c                | 125 +++++++++++++++++-
 drivers/firmware/arm_ffa/common.h             |  13 +-
 drivers/firmware/arm_ffa/driver.c             |  21 ++-
 drivers/firmware/arm_ffa/smccc.c              |   2 +-
 security/integrity/platform_certs/load_uefi.c |   2 +-
 7 files changed, 166 insertions(+), 20 deletions(-)


base-commit: 7fd2df204f342fc17d1a0bfcd474b24232fb0f32
-- 
LEVI:{C3F47F37-75D8-414A-A8BA-3980EC8A46D7}



^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2026-05-05 16:58 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-05  9:54 [RFC PATCH 0/3] initalise ff-a after finalising pKVM Yeoreum Yun
2026-05-05  9:54 ` [RFC PATCH 1/3] arm64: KVM: defer kvm_init() to finalise_pkvm() when pKVM is enabled Yeoreum Yun
2026-05-05  9:54 ` [RFC PATCH 2/3] firmware: arm_ffa: initialise ff-a after finalising pKVM initialisation Yeoreum Yun
2026-05-05 14:39   ` Sudeep Holla
2026-05-05 15:06     ` Yeoreum Yun
2026-05-05 16:32       ` Sudeep Holla
2026-05-05 16:58         ` Yeoreum Yun
2026-05-05  9:54 ` [RFC PATCH 3/3] security: integrity: call load_uefi_certs() at late_initcall_sync Yeoreum Yun
2026-05-05 10:45 ` [RFC PATCH 0/3] initalise ff-a after finalising pKVM Ben Horgan
2026-05-05 10:51   ` Yeoreum Yun
2026-05-05 11:16     ` Yeoreum Yun
2026-05-05 11:24       ` Ben Horgan
2026-05-05 11:33         ` Yeoreum Yun

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox