diff --git a/dsp/adsprpc.c b/dsp/adsprpc.c old mode 100755 new mode 100644 index 8806003209..310e3e6433 --- a/dsp/adsprpc.c +++ b/dsp/adsprpc.c @@ -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; diff --git a/dsp/adsprpc_shared.h b/dsp/adsprpc_shared.h index c49d491144..02ce55cfc6 100644 --- a/dsp/adsprpc_shared.h +++ b/dsp/adsprpc_shared.h @@ -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 {