From 82f95877cb34fa1d94a044194c2dfdf29bf1a49a Mon Sep 17 00:00:00 2001 From: Vamsi Krishna Gattupalli Date: Fri, 28 May 2021 14:19:24 +0530 Subject: [PATCH] msm: ADSPRPC: Update unsigned pd support on cDSP from kernel Query for unsigned pd support on cDSP domain and update the unsigned_support flag during fastrpc_init process. Change-Id: I61f4c748ad08155f418422183acc8473a7b0e0a8 Signed-off-by: Vamsi Krishna Gattupalli --- drivers/char/adsprpc.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/char/adsprpc.c b/drivers/char/adsprpc.c index 28755e98ddbf..0f92eab72e68 100644 --- a/drivers/char/adsprpc.c +++ b/drivers/char/adsprpc.c @@ -142,6 +142,7 @@ #define SDSP_DOMAIN_ID (2) #define CDSP_DOMAIN_ID (3) +#define UNSIGNED_PD_SUPPORT 1 /* * ctxid of every message is OR-ed with fl->pd (0/1/2) before * it is sent to DSP. So mask 2 LSBs to retrieve actual context @@ -6149,6 +6150,28 @@ bail: return err; } +static int fastrpc_update_cdsp_support(struct fastrpc_file *fl) +{ + struct fastrpc_ioctl_capability *dsp_query; + struct fastrpc_apps *me = &gfa; + int err = 0; + + VERIFY(err, NULL != (dsp_query = kzalloc(sizeof(*dsp_query), + GFP_KERNEL))); + if (err) + goto bail; + dsp_query->domain = CDSP_DOMAIN_ID; + dsp_query->attribute_ID = UNSIGNED_PD_SUPPORT; + err = fastrpc_get_info_from_kernel(dsp_query, fl); + if (err) + goto bail; + if (!dsp_query->capability) + me->channel[CDSP_DOMAIN_ID].unsigned_support = false; +bail: + kfree(dsp_query); + return err; +} + static long fastrpc_device_ioctl(struct file *file, unsigned int ioctl_num, unsigned long ioctl_param) { @@ -6157,6 +6180,7 @@ static long fastrpc_device_ioctl(struct file *file, unsigned int ioctl_num, struct fastrpc_file *fl = (struct fastrpc_file *)file->private_data; int size = 0, err = 0; uint32_t info; + static bool isquerydone; p.inv.fds = NULL; p.inv.attrs = NULL; @@ -6255,6 +6279,10 @@ static long fastrpc_device_ioctl(struct file *file, unsigned int ioctl_num, VERIFY(err, 0 == (err = fastrpc_init_process(fl, &p.init))); if (err) goto bail; + if ((fl->cid == CDSP_DOMAIN_ID) && !isquerydone) { + if (!fastrpc_update_cdsp_support(fl)) + isquerydone = true; + } break; case FASTRPC_IOCTL_GET_DSP_INFO: err = fastrpc_get_dsp_info(&p.cap, param, fl);