Revert "tee: optee: interrupt an RPC depend on shutdown flag"

This reverts commit b0b2892b93.

Replaced by commit ec18520f5e ("tee: optee: Fix supplicant wait loop").

Signed-off-by: Tao Huang <huangtao@rock-chips.com>
This commit is contained in:
Tao Huang
2025-06-06 16:45:25 +08:00
parent 03ccc5e01f
commit 9d9ce2cb47
3 changed files with 8 additions and 12 deletions

View File

@@ -92,7 +92,6 @@ struct optee_supp {
struct list_head reqs;
struct idr idr;
struct completion reqs_c;
bool shutdown;
};
struct optee_smc {

View File

@@ -7,7 +7,6 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/arm-smccc.h>
#include <linux/delay.h>
#include <linux/errno.h>
#include <linux/interrupt.h>
#include <linux/io.h>
@@ -1353,11 +1352,6 @@ static void optee_shutdown(struct platform_device *pdev)
{
struct optee *optee = platform_get_drvdata(pdev);
/* Tell requesting thread to interrupt an RPC */
smp_store_mb(optee->supp.shutdown, true);
/* Wait requesting thread to release resources */
mdelay(200);
if (!optee->rpc_param_count)
optee_disable_shm_cache(optee);
}

View File

@@ -82,6 +82,7 @@ u32 optee_supp_thrd_req(struct tee_context *ctx, u32 func, size_t num_params,
struct optee_supp_req *req;
bool interruptable;
u32 ret;
unsigned long timeleft;
int id;
struct optee_supp_req *get_req;
@@ -116,12 +117,14 @@ u32 optee_supp_thrd_req(struct tee_context *ctx, u32 func, size_t num_params,
* exclusive access again.
*/
while (wait_for_completion_interruptible(&req->c)) {
if (supp->shutdown) {
/* Reboot happen, tee-supplicant is dead, interrupt an RPC */
interruptable = true;
pr_err("Warning, Interrupting an RPC to supplicant!\n");
timeleft = wait_for_completion_timeout(&req->c, msecs_to_jiffies(2000));
if (timeleft) {
/* get completion, it means tee-supplicant is alive. */
break;
} else {
/* Deep sleep, tee-supplicant is freeze, wait tee-supplicant */
continue;
/* timeout, it means tee-supplicant is dead, interrupting an RPC. */
interruptable = true;
}
mutex_lock(&supp->mutex);