ADSP running a compute-capable firmware image needs an additional unsigned PD device node, same as CDSP/GDSP, instead of only the signed node it gets today. The probe-time capability query now caches the DSP's attributes before device nodes are registered, so fastrpc_register_devices() can check DSP_IMAGE_CONFIG_ATTR_IDX and fall through to the CDSP/GDSP unsigned+signed registration path when the queried ADSP reports FASTRPC_DSP_COMPUTE_LITE.
Signed-off-by: Anandu Krishnan E <[email protected]> --- drivers/misc/fastrpc.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index 48ded6080ddd..28d29c768aad 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -88,6 +88,14 @@ #define FASTRPC_MAX_DSP_ATTRIBUTES (256) #define FASTRPC_MAX_DSP_ATTRIBUTES_LEN (sizeof(u32) * FASTRPC_MAX_DSP_ATTRIBUTES) +/* remote_dsp_attributes[] index reporting the DSP's image configuration */ +#define DSP_IMAGE_CONFIG_ATTR_IDX (14) + +/* enum dsp_image_config: values reported at DSP_IMAGE_CONFIG_ATTR_IDX */ +#define FASTRPC_DSP_COMPUTE (1) +#define FASTRPC_DSP_COMPUTE_LITE (2) +#define FASTRPC_DSP_AUDIO (3) + /* Retrives number of input buffers from the scalars parameter */ #define REMOTE_SCALARS_INBUFS(sc) (((sc) >> 16) & 0x0ff) @@ -2621,8 +2629,17 @@ static int fastrpc_register_devices(struct fastrpc_channel_ctx *cctx, struct rpmsg_device *rpdev) { struct device *rdev = &rpdev->dev; + bool compute_capable = false; int err, i; + /* + * ADSP running a compute-capable firmware image also needs an + * unsigned PD node, same as CDSP/GDSP. + */ + if (cctx->domain_id == ADSP_DOMAIN_ID && cctx->valid_attributes && + cctx->dsp_attributes[DSP_IMAGE_CONFIG_ATTR_IDX] == FASTRPC_DSP_COMPUTE_LITE) + compute_capable = true; + /* * Duplicate the ADSP sessions before any device node is registered * below: misc_register() lets userspace open() and allocate a @@ -2647,6 +2664,9 @@ static int fastrpc_register_devices(struct fastrpc_channel_ctx *cctx, switch (cctx->domain_id) { case ADSP_DOMAIN_ID: + if (compute_capable) + goto unsigned_capable; + fallthrough; case MDSP_DOMAIN_ID: case SDSP_DOMAIN_ID: /* Unsigned PD offloading is only supported on CDSP and GDSP */ @@ -2657,6 +2677,7 @@ static int fastrpc_register_devices(struct fastrpc_channel_ctx *cctx, break; case CDSP_DOMAIN_ID: case GDSP_DOMAIN_ID: +unsigned_capable: cctx->unsigned_support = true; /* Create both device nodes so that we can allow both Signed and Unsigned PD */ err = fastrpc_device_register(rdev, cctx, true, cctx->domain); -- 2.34.1
