]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
firmware: arm_ffa: Respect firmware advertised RX/TX buffer size limits
authorSeth Forshee <sforshee@nvidia.com>
Tue, 2 Jun 2026 21:54:06 +0000 (21:54 +0000)
committerSudeep Holla <sudeep.holla@arm.com>
Mon, 29 Jun 2026 09:42:56 +0000 (10:42 +0100)
commit53716a4d745f1dac7aff33f3d1494b701eb2f888
tree76eadbb93e9054ea7eb8ad11145b56c4991f2791
parentdc59e4fea9d83f03bad6bddf3fa2e52491777482
firmware: arm_ffa: Respect firmware advertised RX/TX buffer size limits

FFA_FEATURES reports the minimum size and alignment boundary required
for RXTX_MAP. In FF-A v1.2 and later it can also report a maximum buffer
size, with zero meaning that no maximum is enforced.

The driver only used the minimum value and then rounded it up to PAGE_SIZE
before invoking RXTX_MAP after commit 83210251fd70 ("firmware: arm_ffa:
Use the correct buffer size during RXTX_MAP"). On systems where PAGE_SIZE
is larger than the advertised minimum, this can exceed a non-zero maximum
reported by firmware. Older implementations do not advertise a maximum and
may also reject the rounded-up size.

Decode the maximum size and clamp the page-aligned minimum to it when it
is present. If no maximum is advertised and RXTX_MAP rejects the rounded
size with INVALID_PARAMETERS, retry with the advertised minimum size.
Record drv_info->rxtx_bufsz only after RXTX_MAP succeeds so it reflects
the size registered with firmware.

While there, also update RXTX_MAP_MIN_BUFSZ() to use FIELD_GET() for
consistency.

Fixes: 83210251fd70 ("firmware: arm_ffa: Use the correct buffer size during RXTX_MAP")
Suggested-by: Sudeep Holla <sudeep.holla@kernel.org>
Signed-off-by: Seth Forshee <sforshee@nvidia.com>
Link: https://patch.msgid.link/20260602-b4-ffa-rxtx-map-fixes-v2-1-7cb06508da84@nvidia.com
(sudeep.holla: Minor rewording subject and commit message)
Signed-off-by: Sudeep Holla <sudeep.holla@kernel.org>
drivers/firmware/arm_ffa/driver.c