Эх сурвалжийг харах

adsprpc: tvm: wakeup waiting rpc calls when secure PD exits

When secure PD exits in case of SSR or another scenario, notify
all rpc threads waiting on kernel. This should allow rpc threads
to return failure to TVM clients.

Change-Id: Ie0e97d2cb0e378b9b1c1e558f8ed642710690d1f
Signed-off-by: Edgar Flores <[email protected]>
Edgar Flores 2 жил өмнө
parent
commit
64813776c7

+ 8 - 0
dsp/adsprpc.c

@@ -7499,6 +7499,14 @@ static void  fastrpc_print_debug_data(int cid)
 	kfree(gmsg_log_rx);
 }
 
+void fastrpc_restart_drivers(int cid)
+{
+	struct fastrpc_apps *me = &gfa;
+
+	fastrpc_notify_drivers(me, cid);
+	me->channel[cid].ssrcount++;
+}
+
 static int fastrpc_restart_notifier_cb(struct notifier_block *nb,
 					unsigned long code,
 					void *data)

+ 1 - 0
dsp/adsprpc_shared.h

@@ -670,6 +670,7 @@ void fastrpc_transport_session_init(int cid, char *subsys);
 void fastrpc_transport_session_deinit(int cid);
 int fastrpc_wait_for_transport_interrupt(int cid, unsigned int flags);
 int fastrpc_set_tvm_remote_domain(struct fastrpc_file *fl, struct fastrpc_ioctl_init *init);
+void fastrpc_restart_drivers(int cid);
 
 static inline struct smq_invoke_buf *smq_invoke_buf_start(remote_arg64_t *pra,
 							uint32_t sc)

+ 3 - 0
dsp/adsprpc_socket.c

@@ -205,6 +205,7 @@ static void fastrpc_recv_del_server(struct frpc_transport_session_control *sessi
 {
 	uint32_t remote_server_instance = session_control->remote_server_instance;
 	int32_t err = 0;
+	int32_t cid = 0;
 
 	/* Ignore EOF marker */
 	if (!node && !port) {
@@ -223,7 +224,9 @@ static void fastrpc_recv_del_server(struct frpc_transport_session_control *sessi
 	session_control->frpc_socket.remote_sock_addr.sq_port = 0;
 	session_control->remote_server_online = false;
 	mutex_unlock(&session_control->frpc_socket.socket_mutex);
+	cid = GET_CID_FROM_SERVER_INSTANCE(remote_server_instance);
 	ADSPRPC_INFO("Remote server is down: remote ID (0x%x)", remote_server_instance);
+	fastrpc_restart_drivers(cid);
 bail:
 	if (err != -EINVAL && err)
 		ADSPRPC_WARN("Ignoring ctrl packet: node %u, port %u, err %d", node, port, err);