Browse Source

Merge "msm: ipa: Fix to protect odl pipe operations"

qctecmdr 1 year ago
parent
commit
7a7d7d81af

+ 15 - 1
drivers/platform/msm/ipa/ipa_v3/ipa_odl.c

@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
  * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
  */
 
 #include "ipa_i.h"
@@ -470,6 +470,20 @@ static int ipa_adpl_release(struct inode *inode, struct file *filp)
 	return ret;
 }
 
+void ipa3_odl_pipe_open_from_ssr(void)
+{
+	mutex_lock(&ipa3_odl_ctx->pipe_lock);
+	ipa3_odl_pipe_open();
+	mutex_unlock(&ipa3_odl_ctx->pipe_lock);
+}
+
+void ipa3_odl_pipe_cleanup_from_ssr(void)
+{
+	mutex_lock(&ipa3_odl_ctx->pipe_lock);
+	ipa3_odl_pipe_cleanup(true);
+	mutex_unlock(&ipa3_odl_ctx->pipe_lock);
+}
+
 void ipa3_odl_pipe_cleanup(bool is_ssr)
 {
 	bool ipa_odl_opened = false;

+ 3 - 1
drivers/platform/msm/ipa/ipa_v3/ipa_odl.h

@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
  */
 
 #ifndef _IPA3_ODL_H_
@@ -73,5 +74,6 @@ int ipa_odl_init(void);
 void ipa_odl_cleanup(void);
 void ipa3_odl_pipe_cleanup(bool is_ssr);
 int ipa3_odl_pipe_open(void);
-
+void ipa3_odl_pipe_open_from_ssr(void);
+void ipa3_odl_pipe_cleanup_from_ssr(void);
 #endif /* _IPA3_ODL_H_ */

+ 2 - 2
drivers/platform/msm/ipa/ipa_v3/rmnet_ipa.c

@@ -3991,7 +3991,7 @@ static int ipa3_lcl_mdm_ssr_notifier_cb(struct notifier_block *this,
 		if (atomic_read(&rmnet_ipa3_ctx->is_ssr) &&
 			ipa3_ctx_get_type(IPA_HW_TYPE) >= IPA_HW_v4_0)
 			ipa3_q6_post_shutdown_cleanup();
-		ipa3_odl_pipe_cleanup(true);
+		ipa3_odl_pipe_cleanup_from_ssr();
 		IPAWANINFO("IPA BEFORE_SHUTDOWN handling is complete\n");
 		break;
 #if IS_ENABLED(CONFIG_DEEPSLEEP)
@@ -4074,7 +4074,7 @@ static int ipa3_lcl_mdm_ssr_notifier_cb(struct notifier_block *this,
 		if (!atomic_read(&rmnet_ipa3_ctx->is_initialized) &&
 		       atomic_read(&rmnet_ipa3_ctx->is_ssr))
 			platform_driver_register(&rmnet_ipa_driver);
-		ipa3_odl_pipe_open();
+		ipa3_odl_pipe_open_from_ssr();
 		IPAWANINFO("IPA AFTER_POWERUP handling is complete\n");
 		break;
 	default: