Browse Source

Merge 698dfba6080d00a954785538f154cf501b31e9c7 on remote branch

Change-Id: I3f28983cef832bc88859c2c62560462512c185ca
Linux Build Service Account 1 year ago
parent
commit
0285a156a7
1 changed files with 11 additions and 8 deletions
  1. 11 8
      dsp/adsprpc.c

+ 11 - 8
dsp/adsprpc.c

@@ -1178,13 +1178,6 @@ static int get_buffer_attr(struct dma_buf *buf, bool *exclusive_access, bool *hl
 		*exclusive_access = true;
 
 #if IS_ENABLED(CONFIG_MSM_ADSPRPC_TRUSTED)
-	/*
-	 * PVM (HLOS) can share buffers with TVM. In that case,
-	 * it is expected to relinquish its ownership to those buffers
-	 * before sharing. But if the PVM still retains access, then
-	 * these buffers cannot be used by TVM.
-	 */
-
 	for (int ii = 0; ii < vmids_list_len; ii++) {
 		if (vmids_list[ii] == VMID_HLOS) {
 			*hlos_access = true;
@@ -1209,8 +1202,13 @@ static int set_buffer_secure_type(struct fastrpc_mmap *map)
 		goto bail;
 	}
 #if IS_ENABLED(CONFIG_MSM_ADSPRPC_TRUSTED)
+        /*
+         * PVM (HLOS) can share buffers with TVM, in case buffers are to be shared to secure PD,
+         * PVM is expected to relinquish its ownership to those buffers before sharing.
+         * If PVM still retains access, then those buffers cannot be shared to secure PD.
+         */
 	if (hlos_access) {
-		ADSPRPC_ERR("Sharing HLOS buffer (fd %d) not allowed on TVM\n", map->fd);
+		ADSPRPC_ERR("Buffers with HLOS access (fd %d) are not allowed on TVM\n", map->fd);
 		err = -EACCES;
 		goto bail;
 	}
@@ -1225,7 +1223,12 @@ static int set_buffer_secure_type(struct fastrpc_mmap *map)
 	 *	- Since it is a secure environment by default, there are no explicit "secure" buffers
 	 *	- All buffers are marked "non-secure"
 	 */
+#if IS_ENABLED(CONFIG_MSM_ADSPRPC_TRUSTED)
+	map->secure = 0;
+#else
 	map->secure = (exclusive_access) ? 0 : 1;
+#endif
+
 bail:
 	return err;
 }