Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b76e2463 authored by Himateja Reddy's avatar Himateja Reddy
Browse files

msm: adsprpc: send non-zero message PID for process kill message



Currently, since remote process kill is a kernel RPC call, a zero
pid is sent in its message. Send the actual HLOS pid for the
process kill message so that the remote subsystem can identify
which process to kill without needing to map the arguments.

Change-Id: I14c13194baa231a892ed9e8ee269a8cdb1710211
Acked-by: default avatarThyagarajan Venkatanarayanan <venkatan@qti.qualcomm.com>
Signed-off-by: default avatarHimateja Reddy <hmreddy@codeaurora.org>
parent 9c40e1ec
Loading
Loading
Loading
Loading
+26 −14
Original line number Original line Diff line number Diff line
@@ -206,6 +206,13 @@ enum fastrpc_buf_type {
	USERHEAP_BUF,
	USERHEAP_BUF,
};
};


/* Types of RPC calls to DSP */
enum fastrpc_msg_type {
	USER_MSG = 0,
	KERNEL_MSG_WITH_ZERO_PID,
	KERNEL_MSG_WITH_NONZERO_PID,
};

#define PERF_END (void)0
#define PERF_END (void)0


#define PERF(enb, cnt, ff) \
#define PERF(enb, cnt, ff) \
@@ -2686,7 +2693,7 @@ static int fastrpc_invoke_send(struct smq_invoke_ctx *ctx,
	msg->tid = current->pid;
	msg->tid = current->pid;
	if (fl->sessionid)
	if (fl->sessionid)
		msg->tid |= (1 << SESSION_ID_INDEX);
		msg->tid |= (1 << SESSION_ID_INDEX);
	if (kernel)
	if (kernel == KERNEL_MSG_WITH_ZERO_PID)
		msg->pid = 0;
		msg->pid = 0;
	msg->invoke.header.ctx = ctx->ctxid | fl->pd;
	msg->invoke.header.ctx = ctx->ctxid | fl->pd;
	msg->invoke.header.handle = handle;
	msg->invoke.header.handle = handle;
@@ -3225,7 +3232,7 @@ static int fastrpc_internal_invoke2(struct fastrpc_file *fl,
		if (err)
		if (err)
			goto bail;
			goto bail;
		VERIFY(err, 0 == (err = fastrpc_internal_invoke(fl, fl->mode,
		VERIFY(err, 0 == (err = fastrpc_internal_invoke(fl, fl->mode,
					0, &p.inv)));
					USER_MSG, &p.inv)));
		if (err)
		if (err)
			goto bail;
			goto bail;
		break;
		break;
@@ -3332,7 +3339,7 @@ static int fastrpc_init_attach_process(struct fastrpc_file *fl,
		fl->pd = 2;
		fl->pd = 2;
	}
	}


	err = fastrpc_internal_invoke(fl, FASTRPC_MODE_PARALLEL, 1, &ioctl);
	err = fastrpc_internal_invoke(fl, FASTRPC_MODE_PARALLEL, KERNEL_MSG_WITH_ZERO_PID, &ioctl);
	if (err)
	if (err)
		goto bail;
		goto bail;
bail:
bail:
@@ -3503,7 +3510,7 @@ static int fastrpc_init_create_dynamic_process(struct fastrpc_file *fl,
	ioctl.attrs = NULL;
	ioctl.attrs = NULL;
	ioctl.crc = NULL;
	ioctl.crc = NULL;
	ioctl.job = NULL;
	ioctl.job = NULL;
	err = fastrpc_internal_invoke(fl, FASTRPC_MODE_PARALLEL, 1, &ioctl);
	err = fastrpc_internal_invoke(fl, FASTRPC_MODE_PARALLEL, KERNEL_MSG_WITH_ZERO_PID, &ioctl);
	if (err)
	if (err)
		goto bail;
		goto bail;
bail:
bail:
@@ -3648,7 +3655,7 @@ static int fastrpc_init_create_static_process(struct fastrpc_file *fl,
	ioctl.attrs = NULL;
	ioctl.attrs = NULL;
	ioctl.crc = NULL;
	ioctl.crc = NULL;
	ioctl.job = NULL;
	ioctl.job = NULL;
	err = fastrpc_internal_invoke(fl, FASTRPC_MODE_PARALLEL, 1, &ioctl);
	err = fastrpc_internal_invoke(fl, FASTRPC_MODE_PARALLEL, KERNEL_MSG_WITH_ZERO_PID, &ioctl);
	if (err)
	if (err)
		goto bail;
		goto bail;
bail:
bail:
@@ -3749,7 +3756,7 @@ static int fastrpc_send_cpuinfo_to_dsp(struct fastrpc_file *fl)
	ioctl.job = NULL;
	ioctl.job = NULL;
	fl->pd = 1;
	fl->pd = 1;


	err = fastrpc_internal_invoke(fl, FASTRPC_MODE_PARALLEL, 1, &ioctl);
	err = fastrpc_internal_invoke(fl, FASTRPC_MODE_PARALLEL, KERNEL_MSG_WITH_ZERO_PID, &ioctl);
	if (!err)
	if (!err)
		me->channel[fl->cid].cpuinfo_status = true;
		me->channel[fl->cid].cpuinfo_status = true;
bail:
bail:
@@ -3788,7 +3795,7 @@ static int fastrpc_get_info_from_dsp(struct fastrpc_file *fl,
	ioctl.job = NULL;
	ioctl.job = NULL;
	fl->pd = 1;
	fl->pd = 1;


	err = fastrpc_internal_invoke(fl, FASTRPC_MODE_PARALLEL, 1, &ioctl);
	err = fastrpc_internal_invoke(fl, FASTRPC_MODE_PARALLEL, KERNEL_MSG_WITH_ZERO_PID, &ioctl);
bail:
bail:


	if (err)
	if (err)
@@ -3899,8 +3906,13 @@ static int fastrpc_release_current_dsp_process(struct fastrpc_file *fl)
	ioctl.attrs = NULL;
	ioctl.attrs = NULL;
	ioctl.crc = NULL;
	ioctl.crc = NULL;
	ioctl.job = NULL;
	ioctl.job = NULL;
	/*
	 * Pass 2 for "kernel" arg to send kernel msg to DSP
	 * with non-zero msg PID for the DSP to directly use
	 * that info to kill the remote process.
	 */
	VERIFY(err, 0 == (err = fastrpc_internal_invoke(fl,
	VERIFY(err, 0 == (err = fastrpc_internal_invoke(fl,
		FASTRPC_MODE_PARALLEL, 1, &ioctl)));
		FASTRPC_MODE_PARALLEL, KERNEL_MSG_WITH_NONZERO_PID, &ioctl)));
	if (err && fl->dsp_proc_init)
	if (err && fl->dsp_proc_init)
		ADSPRPC_ERR(
		ADSPRPC_ERR(
			"releasing DSP process failed with %d (0x%x) for %s\n",
			"releasing DSP process failed with %d (0x%x) for %s\n",
@@ -3956,7 +3968,7 @@ static int fastrpc_mem_map_to_dsp(struct fastrpc_file *fl, int fd, int offset,
	ioctl.crc = NULL;
	ioctl.crc = NULL;
	ioctl.job = NULL;
	ioctl.job = NULL;
	VERIFY(err, 0 == (err = fastrpc_internal_invoke(fl,
	VERIFY(err, 0 == (err = fastrpc_internal_invoke(fl,
		FASTRPC_MODE_PARALLEL, 1, &ioctl)));
		FASTRPC_MODE_PARALLEL, KERNEL_MSG_WITH_ZERO_PID, &ioctl)));
	if (err)
	if (err)
		goto bail;
		goto bail;
	if (raddr)
	if (raddr)
@@ -3998,7 +4010,7 @@ static int fastrpc_mem_unmap_to_dsp(struct fastrpc_file *fl, int fd,
	ioctl.crc = NULL;
	ioctl.crc = NULL;
	ioctl.job = NULL;
	ioctl.job = NULL;
	VERIFY(err, 0 == (err = fastrpc_internal_invoke(fl,
	VERIFY(err, 0 == (err = fastrpc_internal_invoke(fl,
		FASTRPC_MODE_PARALLEL, 1, &ioctl)));
		FASTRPC_MODE_PARALLEL, KERNEL_MSG_WITH_ZERO_PID, &ioctl)));
	if (err)
	if (err)
		goto bail;
		goto bail;
bail:
bail:
@@ -4038,7 +4050,7 @@ static int fastrpc_unmap_on_dsp(struct fastrpc_file *fl,
	ioctl.crc = NULL;
	ioctl.crc = NULL;
	ioctl.job = NULL;
	ioctl.job = NULL;
	VERIFY(err, 0 == (err = fastrpc_internal_invoke(fl,
	VERIFY(err, 0 == (err = fastrpc_internal_invoke(fl,
		FASTRPC_MODE_PARALLEL, 1, &ioctl)));
		FASTRPC_MODE_PARALLEL, KERNEL_MSG_WITH_ZERO_PID, &ioctl)));
	if (err)
	if (err)
		goto bail;
		goto bail;
bail:
bail:
@@ -4090,7 +4102,7 @@ static int fastrpc_mmap_on_dsp(struct fastrpc_file *fl, uint32_t flags,
	ioctl.crc = NULL;
	ioctl.crc = NULL;
	ioctl.job = NULL;
	ioctl.job = NULL;
	VERIFY(err, 0 == (err = fastrpc_internal_invoke(fl,
	VERIFY(err, 0 == (err = fastrpc_internal_invoke(fl,
		FASTRPC_MODE_PARALLEL, 1, &ioctl)));
		FASTRPC_MODE_PARALLEL, KERNEL_MSG_WITH_ZERO_PID, &ioctl)));
	*raddr = (uintptr_t)routargs.vaddrout;
	*raddr = (uintptr_t)routargs.vaddrout;
	if (err)
	if (err)
		goto bail;
		goto bail;
@@ -4154,7 +4166,7 @@ static int fastrpc_munmap_on_dsp_rh(struct fastrpc_file *fl, uint64_t phys,
		ioctl.job = NULL;
		ioctl.job = NULL;


		VERIFY(err, 0 == (err = fastrpc_internal_invoke(fl,
		VERIFY(err, 0 == (err = fastrpc_internal_invoke(fl,
				FASTRPC_MODE_PARALLEL, 1, &ioctl)));
				FASTRPC_MODE_PARALLEL, KERNEL_MSG_WITH_ZERO_PID, &ioctl)));
		if (err)
		if (err)
			goto bail;
			goto bail;
	} else if (flags == ADSP_MMAP_REMOTE_HEAP_ADDR) {
	} else if (flags == ADSP_MMAP_REMOTE_HEAP_ADDR) {
@@ -5814,7 +5826,7 @@ static long fastrpc_device_ioctl(struct file *file, unsigned int ioctl_num,
			goto bail;
			goto bail;
		}
		}
		VERIFY(err, 0 == (err = fastrpc_internal_invoke(fl, fl->mode,
		VERIFY(err, 0 == (err = fastrpc_internal_invoke(fl, fl->mode,
						0, &p.inv)));
						USER_MSG, &p.inv)));
		if (err)
		if (err)
			goto bail;
			goto bail;
		break;
		break;