Skip to contentSkip to conversation

firmware: arm_ffa: Align RxTx buffer size before mapping

PATCH Gyokhan Kochmarla 2 participants 2 messages Jun 1

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

From: Sudeep Holla <[email protected]>

commit 0399e3f872ca3d78044bb715a73ea645806d2c7b upstream.

Commit 83210251fd70 ("firmware: arm_ffa: Use the correct buffer size during RXTX_MAP") advertises PAGE_ALIGN(rxtx_bufsz) to firmware when mapping the buffers but the driver continues to stores the minimum FF-A buffer size in drv_info->rxtx_bufsz which is used elsewhere in the driver.

Align the size before storing it so that the allocation, validation and FFA_RXTX_MAP all use the same buffer size.

Fixes 83210251fd70 ("firmware: arm_ffa: Use the correct buffer size during RXTX_MAP")
Cc Sebastian Ene <[email protected]>
drivers/firmware/arm_ffa/driver.c +2 -1
@@ -2059,6 +2059,7 @@ static int __init ffa_init(void)
 			rxtx_bufsz = SZ_4K;
 	}
 
+	rxtx_bufsz = PAGE_ALIGN(rxtx_bufsz);
 	drv_info->rxtx_bufsz = rxtx_bufsz;
 	drv_info->rx_buffer = alloc_pages_exact(rxtx_bufsz, GFP_KERNEL);
 	if (!drv_info->rx_buffer) {
@@ -2074,7 +2075,7 @@ static int __init ffa_init(void)
 
 	ret = ffa_rxtx_map(virt_to_phys(drv_info->tx_buffer),
 			   virt_to_phys(drv_info->rx_buffer),
-			   PAGE_ALIGN(rxtx_bufsz) / FFA_PAGE_SIZE);
+			   rxtx_bufsz / FFA_PAGE_SIZE);
 	if (ret) {
 		pr_err("failed to register FFA RxTx buffers\n");
 		goto free_pages;

Amazon Web Services Development Center Germany GmbH Tamara-Danz-Str. 13
10243 Berlin
Geschaeftsfuehrung: Christof Hellmis, Andreas Stieger Eingetragen am Amtsgericht Charlottenburg unter HRB 257764 B
Sitz: Berlin
Ust-ID: DE 365 538 597

maintainer
#1 lore raw
Quoted 9 lines · Gyokhan Kochmarla

From: Sudeep Holla <[email protected]>

commit 0399e3f872ca3d78044bb715a73ea645806d2c7b upstream.

Commit 83210251fd70 ("firmware: arm_ffa: Use the correct buffer size during RXTX_MAP") advertises PAGE_ALIGN(rxtx_bufsz) to firmware when mapping the buffers but the driver continues to stores the minimum FF-A buffer size in drv_info->rxtx_bufsz which is used elsewhere in the driver.

Quoted 4 lines

Align the size before storing it so that the allocation, validation and FFA_RXTX_MAP all use the same buffer size.

Fixes 83210251fd70 ("firmware: arm_ffa: Use the correct buffer size during RXTX_MAP")

Because of the fixes tag, it was already backported/queued to v7.0, v6.18 and v6.12. May I ask what was the intention of posting ?

Signature · 2 lines
Regards,
Sudeep