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

Commit 905c96e5 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 avatarSandheep Balasubramanian <sandheep@qti.qualcomm.com>
Signed-off-by: default avatarVamsi Krishna Gattupalli <quic_vgattupa@quicinc.com>
parent 2c69c780
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -3091,7 +3091,7 @@ static int fastrpc_unmap_on_dsp(struct fastrpc_file *fl,


static int fastrpc_mmap_on_dsp(struct fastrpc_file *fl, uint32_t flags,
static int fastrpc_mmap_on_dsp(struct fastrpc_file *fl, uint32_t flags,
					uintptr_t va, uint64_t phys,
					uintptr_t va, uint64_t phys,
					size_t size, uintptr_t *raddr)
					size_t size, int refs, uintptr_t *raddr)
{
{
	struct fastrpc_ioctl_invoke_crc ioctl;
	struct fastrpc_ioctl_invoke_crc ioctl;
	struct fastrpc_apps *me = &gfa;
	struct fastrpc_apps *me = &gfa;
@@ -3153,7 +3153,7 @@ static int fastrpc_mmap_on_dsp(struct fastrpc_file *fl, uint32_t flags,
		}
		}
	}
	}
	if (flags == ADSP_MMAP_REMOTE_HEAP_ADDR
	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,
		err = hyp_assign_phys(phys, (uint64_t)size,
				hlosvm, 1, me->channel[cid].rhvm.vmid,
				hlosvm, 1, me->channel[cid].rhvm.vmid,
				me->channel[cid].rhvm.vmperm,
				me->channel[cid].rhvm.vmperm,
@@ -3527,7 +3527,7 @@ static int fastrpc_internal_mmap(struct fastrpc_file *fl,
		if (err)
		if (err)
			goto bail;
			goto bail;
		err = fastrpc_mmap_on_dsp(fl, ud->flags, 0,
		err = fastrpc_mmap_on_dsp(fl, ud->flags, 0,
				rbuf->phys, rbuf->size, &raddr);
				rbuf->phys, rbuf->size, 0, &raddr);
		if (err)
		if (err)
			goto bail;
			goto bail;
		rbuf->raddr = raddr;
		rbuf->raddr = raddr;
@@ -3548,7 +3548,7 @@ static int fastrpc_internal_mmap(struct fastrpc_file *fl,
		else
		else
			va_to_dsp = (uintptr_t)map->va;
			va_to_dsp = (uintptr_t)map->va;
		VERIFY(err, 0 == fastrpc_mmap_on_dsp(fl, ud->flags, va_to_dsp,
		VERIFY(err, 0 == fastrpc_mmap_on_dsp(fl, ud->flags, va_to_dsp,
				map->phys, map->size, &raddr));
				map->phys, map->size, map->refs, &raddr));
		if (err)
		if (err)
			goto bail;
			goto bail;
		map->raddr = raddr;
		map->raddr = raddr;