FAILED: patch "[PATCH] optee: use driver internal tee_context for some rpc" failed to apply to 5.16-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 5.16-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From aceeafefff736057e8f93f19bbfbef26abd94604 Mon Sep 17 00:00:00 2001
From: Jens Wiklander <[email protected]>
Date: Thu, 27 Jan 2022 15:29:39 +0100
Subject: [PATCH] optee: use driver internal tee_context for some rpc
Adds a driver private tee_context by moving the tee_context in struct optee_notif to struct optee. This tee_context was previously used when doing internal calls to secure world to deliver notification.
The new driver internal tee_context is now also when allocating driver private shared memory. This decouples the shared memory object from its original tee_context. This is needed when the life time of such a memory allocation outlives the client tee_context.
This patch fixes the problem described below:
The addition of a shutdown hook by commit f25889f93184 ("optee: fix tee out of memory failure seen during kexec reboot") introduced a kernel shutdown regression that can be triggered after running the OP-TEE xtest suites.
Once the shutdown hook is called it is not possible to communicate any more with the supplicant process because the system is not scheduling task any longer. Thus if the optee driver shutdown path receives a supplicant RPC request from the OP-TEE we will deadlock the kernel's shutdown.
drivers/tee/optee/core.c +1 -0
@@ -158,6 +158,7 @@ void optee_remove_common(struct optee *optee)optee_unregister_devices ();optee_notif_uninit (optee); +teedev_close_context (optee->ctx);/* * The two devices have to be unregistered before we can free the * other resources.
drivers/tee/optee/ffa_abi.c +43 -34
165 lines not on this page · raw message
drivers/tee/optee/optee_private.h +3 -2
@@ -53,7 +53,6 @@ struct optee_call_queue {struct optee_notif {u_int max_key; -struct tee_context *ctx;/* Serializes access to the elements below in this struct */ spinlock_t lock;struct list_head db;
@@ -134,9 +133,10 @@ struct optee_ops {/** * struct optee - main service struct * @supp_teedev: supplicant device +* @teedev: client device * @ops: internal callbacks for different ways to reach secure * world -* @teedev: client device +* @ctx: driver internal TEE context * @smc: specific to SMC ABI * @ffa: specific to FF-A ABI * @call_queue: queue of threads waiting to call @invoke_fn
@@ -152,6 +152,7 @@ struct optee {struct tee_device *supp_teedev;struct tee_device *teedev;const struct optee_ops *ops; +struct tee_context *ctx;union {struct optee_smc smc;struct optee_ffa ffa;
drivers/tee/optee/smc_abi.c +17 -31
122 lines not on this page · raw message