Pārlūkot izejas kodu

msm: adsprpc: Unique handles for different remote sub systems

Currently handles are unique only for a particular sub systems,
but they are not unique across all remote sub systems. Assign
unique handle to each session of the remote sub system.

Change-Id: I5cf0e82d87283006e719a3b24ae01a1fcb97c392
Signed-off-by: Himateja Reddy <[email protected]>
Himateja Reddy 1 gadu atpakaļ
vecāks
revīzija
be29afe6b2
1 mainītis faili ar 8 papildinājumiem un 8 dzēšanām
  1. 8 8
      dsp/adsprpc.c

+ 8 - 8
dsp/adsprpc.c

@@ -201,7 +201,7 @@
 #define MAX_PERSISTENT_HEADERS    (25)
 
 /* Max value of unique fastrpc tgid */
-#define MAX_FRPC_TGID 65
+#define MAX_FRPC_TGID 256
 
 #define PERF_CAPABILITY_SUPPORT	(1 << 1)
 #define KERNEL_ERROR_CODE_V1_SUPPORT	1
@@ -230,7 +230,7 @@
 static int md_unique_index_flag[MAX_UNIQUE_ID] = { 0, 0, 0, 0, 0 };
 
 /* Array to keep track unique tgid_frpc usage */
-static bool frpc_tgid_usage_array[NUM_CHANNELS][MAX_FRPC_TGID] = {0};
+static bool frpc_tgid_usage_array[MAX_FRPC_TGID] = {0};
 
 /* Fastrpc remote process attributes */
 enum fastrpc_proc_attr {
@@ -5824,8 +5824,8 @@ skip_dump_wait:
 	fl->is_dma_invoke_pend = false;
 	fl->dsp_process_state = PROCESS_CREATE_DEFAULT;
 	/* Reset the tgid usage to false */
-	if (VALID_FASTRPC_CID(cid) && fl->tgid_frpc != -1)
-		frpc_tgid_usage_array[cid][fl->tgid_frpc] = false;
+	if (fl->tgid_frpc != -1)
+		frpc_tgid_usage_array[fl->tgid_frpc] = false;
 	is_locked = false;
 	spin_unlock_irqrestore(&fl->apps->hlock, irq_flags);
 
@@ -6339,7 +6339,7 @@ bail:
 }
 
 // Generate a unique process ID to DSP process
-static int get_unique_hlos_process_id(uint32_t cid)
+static int get_unique_hlos_process_id(void)
 {
 	int tgid_frpc = -1, tgid_index = 1;
 	struct fastrpc_apps *me = &gfa;
@@ -6347,10 +6347,10 @@ static int get_unique_hlos_process_id(uint32_t cid)
 
 	spin_lock_irqsave(&me->hlock, irq_flags);
 	for (tgid_index = 1; tgid_index < MAX_FRPC_TGID; tgid_index++) {
-		if (!frpc_tgid_usage_array[cid][tgid_index]) {
+		if (!frpc_tgid_usage_array[tgid_index]) {
 			tgid_frpc = tgid_index;
 			/* Set the tgid usage to false */
-			frpc_tgid_usage_array[cid][tgid_index] = true;
+			frpc_tgid_usage_array[tgid_index] = true;
 			break;
 		}
 	}
@@ -6367,7 +6367,7 @@ static int fastrpc_set_process_info(struct fastrpc_file *fl, uint32_t cid)
 	memcpy(cur_comm, current->comm, TASK_COMM_LEN);
 	cur_comm[TASK_COMM_LEN-1] = '\0';
 	fl->tgid = current->tgid;
-	fl->tgid_frpc = get_unique_hlos_process_id(cid);
+	fl->tgid_frpc = get_unique_hlos_process_id();
 	VERIFY(err, fl->tgid_frpc != -1);
 	if (err) {
 		ADSPRPC_ERR("too many fastrpc clients, max %u allowed\n", MAX_FRPC_TGID);