Skip to contentSkip to conversation

firmware: arm_ffa: Use the correct buffer size during RXTX_MAP

PATCH Applied Sebastian Ene 2 participants 2 messages Apr 2 – Apr 7 Firmware framework for ARMV8-a

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 firmware: arm_ffa: Use the correct buffer size during RXTX_MAP

Don't use the discovered buffer size from an FFA_FEATURES call directly since we can run on a system that has the PAGE_SIZE larger than the returned size which makes the alloc_pages_exact for the buffer to be rounded up.

Fixes 61824feae5c0 ("firmware: arm_ffa: Fetch the Rx/Tx buffer size using ffa_features()")

---
v1 -> v2:
* use the correct macro PAGE_ALIGN when calculating the size of the buffer

---
 drivers/firmware/arm_ffa/driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/arm_ffa/driver.c +1 -1
index f2f94d4d533e..eb2782848283 100644
@@ -2078,7 +2078,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),
-			   rxtx_bufsz / FFA_PAGE_SIZE);
+			   PAGE_ALIGN(rxtx_bufsz) / FFA_PAGE_SIZE);
 	if (ret) {
 		pr_err("failed to register FFA RxTx buffers\n");
 		goto free_pages;
Signature · 1 line
2.53.0.1213.gd9a14994de-goog
maintainer Applied
#1 lore raw
Quoted 4 lines · Sebastian Ene

Don't use the discovered buffer size from an FFA_FEATURES call directly since we can run on a system that has the PAGE_SIZE larger than the returned size which makes the alloc_pages_exact for the buffer to be rounded up.

Applied to sudeep.holla/linux (for-next/ffa/fixes), thanks!

[1/1] firmware: arm_ffa: Use the correct buffer size during RXTX_MAP

      https://git.kernel.org/sudeep.holla/c/83210251fd70

--
Regards,
Sudeep