All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] firmware: arm_ffa: Call ffa_rxtx_umap before calling ffa_rxtx_map
@ 2026-07-29 16:27 Nat Gurumoorthy
  2026-07-29 18:46 ` Sudeep Holla
  0 siblings, 1 reply; 2+ messages in thread
From: Nat Gurumoorthy @ 2026-07-29 16:27 UTC (permalink / raw)
  To: sudeep.holla; +Cc: linux-arm-kernel, Nat Gurumoorthy

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.

Signed-off-by: Nat Gurumoorthy <natg@google.com>
---
 drivers/firmware/arm_ffa/driver.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c
index 8654b3365c9b..44d095bc8569 100644
--- a/drivers/firmware/arm_ffa/driver.c
+++ b/drivers/firmware/arm_ffa/driver.c
@@ -2168,6 +2168,11 @@ static int ffa_probe(struct platform_device *pdev)
 		goto free_pages;
 	}
 
+	/*
+	 * Force unmap before mapping in case previous crash/kexec
+	 * has existing mapping.
+	 */
+	ffa_rxtx_unmap();
 	ret = ffa_rxtx_map(virt_to_phys(drv_info->tx_buffer),
 			   virt_to_phys(drv_info->rx_buffer),
 			   rxtx_bufsz / FFA_PAGE_SIZE);
-- 
2.55.0.487.gaf234c4eb3-goog



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

end of thread, other threads:[~2026-07-29 18:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.