[PATCH] firmware: arm_ffa: Call ffa_rxtx_umap before calling ffa_rxtx_map

Nat Gurumoorthy natg at google.com
Wed Jul 29 09:27:31 PDT 2026


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 at 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




More information about the linux-arm-kernel mailing list