msm: adsprpc: add ioctl control for thread exit

Add ioctl control support to exit notif and async
threads.

Change-Id: Ifc7212fd84bdba46724252e00e1d479865cefc64
Signed-off-by: nishant chaubey <quic_chaubey@quicinc.com>
This commit is contained in:
nishant chaubey
2023-02-13 11:08:37 +05:30
parent 0821b24a81
commit 4fef948448
2 changed files with 31 additions and 0 deletions

25
dsp/adsprpc.c Executable file → Normal file
View File

@@ -3230,6 +3230,10 @@ read_async_job:
err = -EBADF;
goto bail;
}
if (fl->exit_async) {
err = -EFAULT;
goto bail;
}
VERIFY(err, 0 == (err = interrupted));
if (err)
goto bail;
@@ -3312,6 +3316,10 @@ read_notif_status:
err = -EBADF;
goto bail;
}
if (fl->exit_notif) {
err = -EFAULT;
goto bail;
}
VERIFY(err, 0 == (err = interrupted));
if (err)
goto bail;
@@ -5900,6 +5908,8 @@ static int fastrpc_device_open(struct inode *inode, struct file *filp)
fl->dsp_process_state = PROCESS_CREATE_DEFAULT;
fl->is_unsigned_pd = false;
fl->is_compat = false;
fl->exit_notif = false;
fl->exit_async = false;
init_completion(&fl->work);
fl->file_close = FASTRPC_PROCESS_DEFAULT_STATE;
filp->private_data = fl;
@@ -6109,6 +6119,7 @@ int fastrpc_internal_control(struct fastrpc_file *fl,
struct fastrpc_apps *me = &gfa;
int sessionid = 0;
u32 silver_core_count = me->silvercores.corecount, ii = 0, cpu;
unsigned long flags = 0;
VERIFY(err, !IS_ERR_OR_NULL(fl) && !IS_ERR_OR_NULL(fl->apps));
if (err) {
@@ -6209,6 +6220,20 @@ int fastrpc_internal_control(struct fastrpc_file *fl,
case FASTRPC_CONTROL_SMMU:
fl->sharedcb = cp->smmu.sharedcb;
break;
case FASTRPC_CONTROL_ASYNC_WAKE:
fl->exit_async = true;
spin_lock_irqsave(&fl->aqlock, flags);
atomic_add(1, &fl->async_queue_job_count);
wake_up_interruptible(&fl->async_wait_queue);
spin_unlock_irqrestore(&fl->aqlock, flags);
break;
case FASTRPC_CONTROL_NOTIF_WAKE:
fl->exit_notif = true;
spin_lock_irqsave(&fl->proc_state_notif.nqlock, flags);
atomic_add(1, &fl->proc_state_notif.notif_queue_count);
wake_up_interruptible(&fl->proc_state_notif.notif_wait_queue);
spin_unlock_irqrestore(&fl->proc_state_notif.nqlock, flags);
break;
default:
err = -EBADRQC;
break;

View File

@@ -491,6 +491,8 @@ enum fastrpc_control_type {
/* Clean process on DSP */
FASTRPC_CONTROL_DSPPROCESS_CLEAN = 6,
FASTRPC_CONTROL_RPC_POLL = 7,
FASTRPC_CONTROL_ASYNC_WAKE = 8,
FASTRPC_CONTROL_NOTIF_WAKE = 9,
};
struct fastrpc_ctrl_latency {
@@ -1098,6 +1100,10 @@ struct fastrpc_file {
spinlock_t dspsignals_lock;
struct mutex signal_create_mutex;
struct completion shutdown;
/* Flag to indicate notif thread exit requested*/
bool exit_notif;
/* Flag to indicate async thread exit requested*/
bool exit_async;
};
union fastrpc_ioctl_param {