[PATCH v5 6/7] firmware: arm_ffa: Setup in-kernel users of FFA partitions
Marc Bonnici
Marc.Bonnici at arm.com
Fri Apr 9 16:45:13 BST 2021
Hi Sudeep,
> -----Original Message-----
> From: Sudeep Holla <sudeep.holla at arm.com>
> Sent: 25 March 2021 14:33
> To: linux-arm-kernel at lists.infradead.org; devicetree at vger.kernel.org
> Cc: Sudeep Holla <Sudeep.Holla at arm.com>; Trilok Soni
> <tsoni at codeaurora.org>; arve at android.com; Andrew Walbran
> <qwandor at google.com>; David Hartley <dhh at qti.qualcomm.com>; Achin
> Gupta <Achin.Gupta at arm.com>; Jens Wiklander
> <jens.wiklander at linaro.org>; Arunachalam Ganapathy
> <Arunachalam.Ganapathy at arm.com>; Marc Bonnici <Marc.Bonnici at arm.com>
> Subject: [PATCH v5 6/7] firmware: arm_ffa: Setup in-kernel users of
> FFA partitions
>
> Parse the FFA nodes from the device-tree and register all the
> partitions whose services will be used in the kernel.
>
> In order to also enable in-kernel users of FFA interface, let us add
> simple set of operations for such devices.
>
> The in-kernel users are registered without the character device
> interface.
>
> Reviewed-by: Jens Wiklander <jens.wiklander at linaro.org>
> Tested-by: Jens Wiklander <jens.wiklander at linaro.org>
> Signed-off-by: Sudeep Holla <sudeep.holla at arm.com>
> ---
> drivers/firmware/arm_ffa/common.h | 2 +
> drivers/firmware/arm_ffa/driver.c | 188
> ++++++++++++++++++++++++++++++
> include/linux/arm_ffa.h | 38 +++++-
> 3 files changed, 227 insertions(+), 1 deletion(-)
>
[snip]
>
> +static int ffa_msg_send_direct_req(u16 src_id, u16 dst_id, bool
> mode_32bit,
> + struct ffa_send_direct_data *data) {
> + u32 req_id, resp_id, src_dst_ids = PACK_TARGET_INFO(src_id,
> dst_id);
> + ffa_res_t ret;
> +
> + if (mode_32bit) {
> + req_id = FFA_MSG_SEND_DIRECT_REQ;
> + resp_id = FFA_MSG_SEND_DIRECT_RESP;
> + } else {
> + req_id = FFA_FN_NATIVE(MSG_SEND_DIRECT_REQ);
> + resp_id = FFA_FN_NATIVE(MSG_SEND_DIRECT_RESP);
> + }
> +
> + ret = invoke_ffa_fn(req_id, src_dst_ids, 0, data->data0, data-
> >data1,
> + data->data2, data->data3, data->data4);
> +
> + while (ret.a0 == FFA_INTERRUPT)
> + ret = invoke_ffa_fn(FFA_RUN, ret.a1, 0, 0, 0, 0, 0, 0);
> + if (ret.a0 == FFA_ERROR)
> + return ffa_to_linux_errno((int)ret.a2);
> +
> + if (ret.a0 == resp_id) {
> + data->data0 = ret.a3;
> + data->data1 = ret.a4;
> + data->data2 = ret.a5;
> + data->data3 = ret.a6;
> + data->data4 = ret.a7;
> + }
> +
> + return 0;
> +}
> +
If the returned function ID is not FFA_ERROR but still not what we're
expecting here we should return an error to the calling code rather
than success.
Kind Regards
Marc Bonnici
More information about the linux-arm-kernel
mailing list