[PATCH 2/4] firmware: arm_ffa: Check if receiving direct requests are supported before sending
Jens Wiklander
jens.wiklander at linaro.org
Tue Apr 16 00:18:58 PDT 2024
On Mon, Apr 15, 2024 at 6:05 PM Sudeep Holla <sudeep.holla at arm.com> wrote:
>
> Add check to see if the target partition can receive the direct requests
> before sending any message to the partition.
>
> Signed-off-by: Sudeep Holla <sudeep.holla at arm.com>
> ---
> drivers/firmware/arm_ffa/driver.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c
> index d258d04c1eda..52379885a403 100644
> --- a/drivers/firmware/arm_ffa/driver.c
> +++ b/drivers/firmware/arm_ffa/driver.c
> @@ -875,9 +875,15 @@ static bool ffa_partition_check_property(struct ffa_device *dev, u32 property)
> return partition->properties & property;
> }
>
> +#define ffa_partition_supports_direct_recv(dev) \
> + ffa_partition_check_property(dev, FFA_PARTITION_DIRECT_RECV)
> +
> static int ffa_sync_send_receive(struct ffa_device *dev,
> struct ffa_send_direct_data *data)
> {
> + if (!ffa_partition_supports_direct_recv(dev))
> + return -EOPNOTSUPP;
This is done in the critical path of a direct request. Checking that a
partition supports direct requests makes sense before using it, but
doing it for each call in the critical path is excessive. There are
checks in the other layers to catch unsupported requests. Can we let
the caller do this check if desired? Omitting the check shouldn't lead
to any bad things.
Cheers,
Jens
> +
> return ffa_msg_send_direct_req(drv_info->vm_id, dev->vm_id,
> dev->mode_32bit, data);
> }
>
> --
> 2.43.2
>
More information about the linux-arm-kernel
mailing list