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

Commit 5b17b911 authored by Vamsi Krishna Gattupalli's avatar Vamsi Krishna Gattupalli
Browse files

msm: adsprpc: Fix for hyp_assign_phys double call



A check is introduced to restrict  the double call of
hyp_assign_phys for the same address.

Change-Id: I0ac984af9fe456d317c7c2d99d6d1290f86830e8
Acked-by: default avatarAnsa Ahmed <ansaahme@qti.qualcomm.com>
Signed-off-by: default avatarVamsi Krishna Gattupalli <quic_vgattupa@quicinc.com>
parent 24624df1
Loading
Loading
Loading
Loading
+10 −5
Original line number Diff line number Diff line
@@ -3986,6 +3986,11 @@ static int fastrpc_init_create_static_process(struct fastrpc_file *fl,
		err = fastrpc_mmap_remove_pdr(fl);
		if (err)
			goto bail;
	} else {
		ADSPRPC_ERR(
			"Create static process is failed for proc_name %s",
			proc_name);
		goto bail;
	}

	if (!me->staticpd_flags && !me->legacy_remote_heap) {
@@ -4009,7 +4014,7 @@ static int fastrpc_init_create_static_process(struct fastrpc_file *fl,
		 * If remote-heap VMIDs are defined in DTSI, then do
		 * hyp_assign from HLOS to those VMs (LPASS, ADSP).
		 */
		if (rhvm->vmid && mem && !mem->is_persistent) {
		if (rhvm->vmid && mem && !mem->is_persistent && mem->refs == 1 && size) {
			err = hyp_assign_phys(phys, (uint64_t)size,
				hlosvm, 1,
				rhvm->vmid, rhvm->vmperm, rhvm->vmcount);
@@ -4503,7 +4508,7 @@ static int fastrpc_unmap_on_dsp(struct fastrpc_file *fl,

static int fastrpc_mmap_on_dsp(struct fastrpc_file *fl, uint32_t flags,
					uintptr_t va, uint64_t phys,
					size_t size, uintptr_t *raddr)
					size_t size, int refs, uintptr_t *raddr)
{
	struct fastrpc_ioctl_invoke_async ioctl;
	struct fastrpc_apps *me = &gfa;
@@ -4568,7 +4573,7 @@ static int fastrpc_mmap_on_dsp(struct fastrpc_file *fl, uint32_t flags,
		}
	}
	if (flags == ADSP_MMAP_REMOTE_HEAP_ADDR
				&& me->channel[cid].rhvm.vmid) {
				&& me->channel[cid].rhvm.vmid && refs == 1) {
		err = hyp_assign_phys(phys, (uint64_t)size,
				hlosvm, 1, me->channel[cid].rhvm.vmid,
				me->channel[cid].rhvm.vmperm,
@@ -5053,7 +5058,7 @@ static int fastrpc_internal_mmap(struct fastrpc_file *fl,
		if (err)
			goto bail;
		err = fastrpc_mmap_on_dsp(fl, ud->flags, 0,
				rbuf->phys, rbuf->size, &raddr);
				rbuf->phys, rbuf->size, 0, &raddr);
		if (err)
			goto bail;
		rbuf->raddr = raddr;
@@ -5074,7 +5079,7 @@ static int fastrpc_internal_mmap(struct fastrpc_file *fl,
		else
			va_to_dsp = (uintptr_t)map->va;
		VERIFY(err, 0 == (err = fastrpc_mmap_on_dsp(fl, ud->flags,
			va_to_dsp, map->phys, map->size, &raddr)));
			va_to_dsp, map->phys, map->size, map->refs, &raddr)));
		if (err)
			goto bail;
		map->raddr = raddr;