* Re: [PATCH] firmware: arm_ffa: Call ffa_rxtx_umap before calling ffa_rxtx_map
2026-07-29 16:27 [PATCH] firmware: arm_ffa: Call ffa_rxtx_umap before calling ffa_rxtx_map Nat Gurumoorthy
@ 2026-07-29 18:46 ` Sudeep Holla
0 siblings, 0 replies; 2+ messages in thread
From: Sudeep Holla @ 2026-07-29 18:46 UTC (permalink / raw)
To: Nat Gurumoorthy; +Cc: linux-arm-kernel, Sudeep Holla
On Wed, Jul 29, 2026 at 09:27:31AM -0700, Nat Gurumoorthy wrote:
> In ffa_probe call ffa_rxtx_unmap before calling ffa_rxtx_map. It is
> possible that crash or a kexec can leave crb_ffa with old mappings.
> A call to ffa_rxtx_map will fail and leave crb_ffa interface unavalable.
> The unmap makes crb_ffa forget old mappings and allows new mappings
> to be set up. In kernels where arm_ffa is built in, module exit
> routine ffa_exit will never get called during kexec operation. This
> leaves behind stale mapping. New kernel's ffa_probe call to ffa_rxtx_map
> will fail and crb_ffa driver will not be available.
>
This is not a proper solution, what about the notifications and other
states.
Now that we have proper probe and remove, just assign or call remove
from shutdown callback which IIRC gets called in kexec. So something like
below is a proper fix IMO(not compiled or tested)
Regards,
Sudeep
-->8
firmware: arm_ffa: Tear down driver during shutdown
The platform core invokes a driver's shutdown callback, rather than its
remove callback, while preparing devices for a normal kexec. Without a
shutdown callback, the FF-A driver leaves notifications, partition devices,
and the RX/TX mapping active before the replacement kernel is booted.
Use ffa_remove() for shutdown so the existing cleanup runs before a normal
kexec and other orderly system shutdowns.
Signed-off-by: Sudeep Holla <sudeep.holla@kernel.org>
---
drivers/firmware/arm_ffa/driver.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c
index 8654b3365c9b..28abc808fd32 100644
--- a/drivers/firmware/arm_ffa/driver.c
+++ b/drivers/firmware/arm_ffa/driver.c
@@ -2225,6 +2225,7 @@ static void ffa_remove(struct platform_device *pdev)
static struct platform_driver ffa_driver = {
.probe = ffa_probe,
.remove = ffa_remove,
+ .shutdown = ffa_remove,
.driver = {
.name = FFA_PLATFORM_NAME,
},
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread