Skip to content

Commit 4cb7915

Browse files
Ekansh Guptagregkh
authored andcommitted
misc: fastrpc: Fix DSP capabilities request
The DSP capability request call expects 2 arguments. First is the information about the total number of attributes to be copied from DSP and second is the information about the buffer where the DSP needs to copy the information. The current design is passing the information about the size to be copied from DSP which would be considered as a bad argument to the call by DSP causing a failure suggesting the same. The second argument carries the information about the buffer where the DSP needs to copy the capability information and the size to be copied. As the first entry of capability attribute is getting skipped, same should also be considered while sending the information to DSP. Add changes to pass proper arguments to DSP. Fixes: 6c16fd8 ("misc: fastrpc: Add support to get DSP capabilities") Cc: stable <stable@kernel.org> Signed-off-by: Ekansh Gupta <quic_ekangupt@quicinc.com> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Link: https://lore.kernel.org/r/20240628114501.14310-2-srinivas.kandagatla@linaro.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 0506794 commit 4cb7915

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

drivers/misc/fastrpc.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1693,14 +1693,19 @@ static int fastrpc_get_info_from_dsp(struct fastrpc_user *fl, uint32_t *dsp_attr
16931693
{
16941694
struct fastrpc_invoke_args args[2] = { 0 };
16951695

1696-
/* Capability filled in userspace */
1696+
/*
1697+
* Capability filled in userspace. This carries the information
1698+
* about the remoteproc support which is fetched from the remoteproc
1699+
* sysfs node by userspace.
1700+
*/
16971701
dsp_attr_buf[0] = 0;
1702+
dsp_attr_buf_len -= 1;
16981703

16991704
args[0].ptr = (u64)(uintptr_t)&dsp_attr_buf_len;
17001705
args[0].length = sizeof(dsp_attr_buf_len);
17011706
args[0].fd = -1;
17021707
args[1].ptr = (u64)(uintptr_t)&dsp_attr_buf[1];
1703-
args[1].length = dsp_attr_buf_len;
1708+
args[1].length = dsp_attr_buf_len * sizeof(u32);
17041709
args[1].fd = -1;
17051710
fl->pd = USER_PD;
17061711

@@ -1730,7 +1735,7 @@ static int fastrpc_get_info_from_kernel(struct fastrpc_ioctl_capability *cap,
17301735
if (!dsp_attributes)
17311736
return -ENOMEM;
17321737

1733-
err = fastrpc_get_info_from_dsp(fl, dsp_attributes, FASTRPC_MAX_DSP_ATTRIBUTES_LEN);
1738+
err = fastrpc_get_info_from_dsp(fl, dsp_attributes, FASTRPC_MAX_DSP_ATTRIBUTES);
17341739
if (err == DSP_UNSUPPORTED_API) {
17351740
dev_info(&cctx->rpdev->dev,
17361741
"Warning: DSP capabilities not supported on domain: %d\n", domain);

0 commit comments

Comments
 (0)