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

Commit 8a44d5cb authored by Vishwanath Raju K's avatar Vishwanath Raju K Committed by Gerrit - the friendly Code Review server
Browse files

ion: msm: Restrict VMID_CP_CAMERA_ENCODE to read only



Restrict VMID_CP_CAMERA_ENCODE to read only when it is shared
with VMID_CP_CAMERA to support secure encode.

Change-Id: Ifb40cc0ae4b2bac30d683567d8e7c767ac482be3
Signed-off-by: default avatarVishwanath Raju K <vishk@codeaurora.org>
parent bf8e2cbe
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -155,6 +155,8 @@ int ion_hyp_assign_sg(struct sg_table *sgt, int *dest_vm_list,
	int *dest_perms;
	int i;
	int ret = 0;
	int j = -1;
	int k = -1;

	if (dest_nelems <= 0) {
		pr_err("%s: dest_nelems invalid\n",
@@ -173,10 +175,20 @@ int ion_hyp_assign_sg(struct sg_table *sgt, int *dest_vm_list,
		if (dest_vm_list[i] == VMID_CP_SEC_DISPLAY ||
		    dest_vm_list[i] == VMID_CP_DSP_EXT)
			dest_perms[i] = PERM_READ;
		else if (dest_vm_list[i] == VMID_CP_CAMERA_ENCODE) {
			j = i;
			dest_perms[i] = PERM_READ | PERM_WRITE;
		} else if (dest_vm_list[i] == VMID_CP_CAMERA) {
			k = i;
			dest_perms[i] = PERM_READ | PERM_WRITE;
		}
		else
			dest_perms[i] = PERM_READ | PERM_WRITE;
	}

	if ((j != -1) && (k != -1))
		dest_perms[j] = PERM_READ;

	ret = hyp_assign_table(sgt, &source_vmid, 1,
			       dest_vm_list, dest_perms, dest_nelems);