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

Commit 72c9025d authored by Tharun Kumar Merugu's avatar Tharun Kumar Merugu
Browse files

adsprpc: Modify Remote scalars call apprioriatly to get TZ security key



Add proper remote scalar calls to get TZ security key, which compatible
with dsp process group TZ secure channel call.

Change-Id: I442a7c440deaf1ff8e850894bc3faf9596c7b004
Signed-off-by: default avatarTharun Kumar Merugu <mtharu@codeaurora.org>
parent 4eae21c3
Loading
Loading
Loading
Loading
+14 −10
Original line number Diff line number Diff line
@@ -744,15 +744,14 @@ static void fastrpc_mmap_free(struct fastrpc_mmap *map, uint32_t flags)
	}
	if (map->flags == ADSP_MMAP_HEAP_ADDR ||
				map->flags == ADSP_MMAP_REMOTE_HEAP_ADDR) {
		unsigned long dma_attrs = 0;

		if (me->dev == NULL) {
			pr_err("failed to free remote heap allocation\n");
			return;
		}
		if (map->phys) {
			dma_attrs |=
			DMA_ATTR_SKIP_ZEROING | DMA_ATTR_NO_KERNEL_MAPPING;
			unsigned long dma_attrs = DMA_ATTR_SKIP_ZEROING |
						DMA_ATTR_NO_KERNEL_MAPPING;
			dma_free_attrs(me->dev, map->size, (void *)map->va,
					(dma_addr_t)map->phys, dma_attrs);
		}
@@ -2451,29 +2450,34 @@ static int fastrpc_munmap_on_dsp_rh(struct fastrpc_file *fl, uint64_t phys,
{
	int err = 0;
	struct fastrpc_apps *me = &gfa;
	int tgid = 0;
	int destVM[1] = {VMID_HLOS};
	int destVMperm[1] = {PERM_READ | PERM_WRITE | PERM_EXEC};

	if (flags == ADSP_MMAP_HEAP_ADDR) {
		struct fastrpc_ioctl_invoke_crc ioctl;
		struct scm_desc desc = {0};
		remote_arg_t ra[1];
		int err = 0;
		remote_arg_t ra[2];

		struct {
			uint8_t skey;
		} routargs;

		ra[0].buf.pv = (void *)&routargs;
		ra[0].buf.len = sizeof(routargs);
		if (fl == NULL)
			goto bail;
		tgid = fl->tgid;
		ra[0].buf.pv = (void *)&tgid;
		ra[0].buf.len = sizeof(tgid);
		ra[1].buf.pv = (void *)&routargs;
		ra[1].buf.len = sizeof(routargs);

		ioctl.inv.handle = FASTRPC_STATIC_HANDLE_KERNEL;
		ioctl.inv.sc = REMOTE_SCALARS_MAKE(7, 0, 1);
		ioctl.inv.sc = REMOTE_SCALARS_MAKE(9, 1, 1);
		ioctl.inv.pra = ra;
		ioctl.fds = NULL;
		ioctl.attrs = NULL;
		ioctl.crc = NULL;
		if (fl == NULL)
			goto bail;


		VERIFY(err, 0 == (err = fastrpc_internal_invoke(fl,
				FASTRPC_MODE_PARALLEL, 1, &ioctl)));