From: Greg Kroah-Hartman Date: Tue, 22 Feb 2022 08:56:33 +0000 (+0100) Subject: drop tee patches from 5.4, 5.10, and 5.15 trees X-Git-Tag: v4.9.303~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1de628be88f1bfb700f0161751d6ed8c66d8d5f1;p=thirdparty%2Fkernel%2Fstable-queue.git drop tee patches from 5.4, 5.10, and 5.15 trees --- diff --git a/queue-5.10/optee-use-driver-internal-tee_context-for-some-rpc.patch b/queue-5.10/optee-use-driver-internal-tee_context-for-some-rpc.patch deleted file mode 100644 index 05aa271555f..00000000000 --- a/queue-5.10/optee-use-driver-internal-tee_context-for-some-rpc.patch +++ /dev/null @@ -1,130 +0,0 @@ -From aceeafefff736057e8f93f19bbfbef26abd94604 Mon Sep 17 00:00:00 2001 -From: Jens Wiklander -Date: Thu, 27 Jan 2022 15:29:39 +0100 -Subject: optee: use driver internal tee_context for some rpc - -From: Jens Wiklander - -commit aceeafefff736057e8f93f19bbfbef26abd94604 upstream. - -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. - -Fixes: f25889f93184 ("optee: fix tee out of memory failure seen during kexec reboot") -Fixes: 217e0250cccb ("tee: use reference counting for tee_context") -Reported-by: Lars Persson -Cc: stable@vger.kernel.org -Reviewed-by: Sumit Garg -[JW: backport to 5.10-stable] -Signed-off-by: Jens Wiklander -Signed-off-by: Greg Kroah-Hartman ---- - drivers/tee/optee/core.c | 8 ++++++++ - drivers/tee/optee/optee_private.h | 2 ++ - drivers/tee/optee/rpc.c | 8 +++++--- - 3 files changed, 15 insertions(+), 3 deletions(-) - ---- a/drivers/tee/optee/core.c -+++ b/drivers/tee/optee/core.c -@@ -588,6 +588,7 @@ static int optee_remove(struct platform_ - /* Unregister OP-TEE specific client devices on TEE bus */ - optee_unregister_devices(); - -+ teedev_close_context(optee->ctx); - /* - * Ask OP-TEE to free all cached shared memory objects to decrease - * reference counters and also avoid wild pointers in secure world -@@ -633,6 +634,7 @@ static int optee_probe(struct platform_d - struct optee *optee = NULL; - void *memremaped_shm = NULL; - struct tee_device *teedev; -+ struct tee_context *ctx; - u32 sec_caps; - int rc; - -@@ -719,6 +721,12 @@ static int optee_probe(struct platform_d - optee_supp_init(&optee->supp); - optee->memremaped_shm = memremaped_shm; - optee->pool = pool; -+ ctx = teedev_open(optee->teedev); -+ if (IS_ERR(ctx)) { -+ rc = rc = PTR_ERR(ctx); -+ goto err; -+ } -+ optee->ctx = ctx; - - /* - * Ensure that there are no pre-existing shm objects before enabling ---- a/drivers/tee/optee/optee_private.h -+++ b/drivers/tee/optee/optee_private.h -@@ -70,6 +70,7 @@ struct optee_supp { - * struct optee - main service struct - * @supp_teedev: supplicant device - * @teedev: client device -+ * @ctx: driver internal TEE context - * @invoke_fn: function to issue smc or hvc - * @call_queue: queue of threads waiting to call @invoke_fn - * @wait_queue: queue of threads from secure world waiting for a -@@ -87,6 +88,7 @@ struct optee { - struct tee_device *supp_teedev; - struct tee_device *teedev; - optee_invoke_fn *invoke_fn; -+ struct tee_context *ctx; - struct optee_call_queue call_queue; - struct optee_wait_queue wait_queue; - struct optee_supp supp; ---- a/drivers/tee/optee/rpc.c -+++ b/drivers/tee/optee/rpc.c -@@ -284,6 +284,7 @@ static struct tee_shm *cmd_alloc_suppl(s - } - - static void handle_rpc_func_cmd_shm_alloc(struct tee_context *ctx, -+ struct optee *optee, - struct optee_msg_arg *arg, - struct optee_call_ctx *call_ctx) - { -@@ -313,7 +314,8 @@ static void handle_rpc_func_cmd_shm_allo - shm = cmd_alloc_suppl(ctx, sz); - break; - case OPTEE_MSG_RPC_SHM_TYPE_KERNEL: -- shm = tee_shm_alloc(ctx, sz, TEE_SHM_MAPPED | TEE_SHM_PRIV); -+ shm = tee_shm_alloc(optee->ctx, sz, -+ TEE_SHM_MAPPED | TEE_SHM_PRIV); - break; - default: - arg->ret = TEEC_ERROR_BAD_PARAMETERS; -@@ -470,7 +472,7 @@ static void handle_rpc_func_cmd(struct t - break; - case OPTEE_MSG_RPC_CMD_SHM_ALLOC: - free_pages_list(call_ctx); -- handle_rpc_func_cmd_shm_alloc(ctx, arg, call_ctx); -+ handle_rpc_func_cmd_shm_alloc(ctx, optee, arg, call_ctx); - break; - case OPTEE_MSG_RPC_CMD_SHM_FREE: - handle_rpc_func_cmd_shm_free(ctx, arg); -@@ -501,7 +503,7 @@ void optee_handle_rpc(struct tee_context - - switch (OPTEE_SMC_RETURN_GET_RPC_FUNC(param->a0)) { - case OPTEE_SMC_RPC_FUNC_ALLOC: -- shm = tee_shm_alloc(ctx, param->a1, -+ shm = tee_shm_alloc(optee->ctx, param->a1, - TEE_SHM_MAPPED | TEE_SHM_PRIV); - if (!IS_ERR(shm) && !tee_shm_get_pa(shm, 0, &pa)) { - reg_pair_from_64(¶m->a1, ¶m->a2, pa); diff --git a/queue-5.10/series b/queue-5.10/series index ba5c0e213f9..7217caa409a 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -75,8 +75,6 @@ asoc-ops-fix-stereo-change-notifications-in-snd_soc_put_volsw_range.patch powerpc-lib-sstep-fix-ptesync-build-error.patch mtd-rawnand-gpmi-don-t-leak-pm-reference-in-error-path.patch kvm-svm-never-reject-emulation-due-to-smap-errata-for-sev-guests.patch -tee-export-teedev_open-and-teedev_close_context.patch -optee-use-driver-internal-tee_context-for-some-rpc.patch asoc-tas2770-insert-post-reset-delay.patch block-wbt-fix-negative-inflight-counter-when-remove-scsi-device.patch nfs-lookup_directory-is-also-ok-with-symlinks.patch diff --git a/queue-5.10/tee-export-teedev_open-and-teedev_close_context.patch b/queue-5.10/tee-export-teedev_open-and-teedev_close_context.patch deleted file mode 100644 index 6c8401ed1b3..00000000000 --- a/queue-5.10/tee-export-teedev_open-and-teedev_close_context.patch +++ /dev/null @@ -1,76 +0,0 @@ -From 1e2c3ef0496e72ba9001da5fd1b7ed56ccb30597 Mon Sep 17 00:00:00 2001 -From: Jens Wiklander -Date: Mon, 4 Oct 2021 16:11:52 +0200 -Subject: tee: export teedev_open() and teedev_close_context() - -From: Jens Wiklander - -commit 1e2c3ef0496e72ba9001da5fd1b7ed56ccb30597 upstream. - -Exports the two functions teedev_open() and teedev_close_context() in -order to make it easier to create a driver internal struct tee_context. - -Reviewed-by: Sumit Garg -Signed-off-by: Jens Wiklander -Signed-off-by: Greg Kroah-Hartman ---- - drivers/tee/tee_core.c | 6 ++++-- - include/linux/tee_drv.h | 14 ++++++++++++++ - 2 files changed, 18 insertions(+), 2 deletions(-) - ---- a/drivers/tee/tee_core.c -+++ b/drivers/tee/tee_core.c -@@ -43,7 +43,7 @@ static DEFINE_SPINLOCK(driver_lock); - static struct class *tee_class; - static dev_t tee_devt; - --static struct tee_context *teedev_open(struct tee_device *teedev) -+struct tee_context *teedev_open(struct tee_device *teedev) - { - int rc; - struct tee_context *ctx; -@@ -70,6 +70,7 @@ err: - return ERR_PTR(rc); - - } -+EXPORT_SYMBOL_GPL(teedev_open); - - void teedev_ctx_get(struct tee_context *ctx) - { -@@ -96,13 +97,14 @@ void teedev_ctx_put(struct tee_context * - kref_put(&ctx->refcount, teedev_ctx_release); - } - --static void teedev_close_context(struct tee_context *ctx) -+void teedev_close_context(struct tee_context *ctx) - { - struct tee_device *teedev = ctx->teedev; - - teedev_ctx_put(ctx); - tee_device_put(teedev); - } -+EXPORT_SYMBOL_GPL(teedev_close_context); - - static int tee_open(struct inode *inode, struct file *filp) - { ---- a/include/linux/tee_drv.h -+++ b/include/linux/tee_drv.h -@@ -582,4 +582,18 @@ struct tee_client_driver { - #define to_tee_client_driver(d) \ - container_of(d, struct tee_client_driver, driver) - -+/** -+ * teedev_open() - Open a struct tee_device -+ * @teedev: Device to open -+ * -+ * @return a pointer to struct tee_context on success or an ERR_PTR on failure. -+ */ -+struct tee_context *teedev_open(struct tee_device *teedev); -+ -+/** -+ * teedev_close_context() - closes a struct tee_context -+ * @ctx: The struct tee_context to close -+ */ -+void teedev_close_context(struct tee_context *ctx); -+ - #endif /*__TEE_DRV_H*/ diff --git a/queue-5.15/optee-use-driver-internal-tee_context-for-some-rpc.patch b/queue-5.15/optee-use-driver-internal-tee_context-for-some-rpc.patch deleted file mode 100644 index b939f262faf..00000000000 --- a/queue-5.15/optee-use-driver-internal-tee_context-for-some-rpc.patch +++ /dev/null @@ -1,130 +0,0 @@ -From aceeafefff736057e8f93f19bbfbef26abd94604 Mon Sep 17 00:00:00 2001 -From: Jens Wiklander -Date: Thu, 27 Jan 2022 15:29:39 +0100 -Subject: optee: use driver internal tee_context for some rpc - -From: Jens Wiklander - -commit aceeafefff736057e8f93f19bbfbef26abd94604 upstream. - -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. - -Fixes: f25889f93184 ("optee: fix tee out of memory failure seen during kexec reboot") -Fixes: 217e0250cccb ("tee: use reference counting for tee_context") -Reported-by: Lars Persson -Cc: stable@vger.kernel.org -Reviewed-by: Sumit Garg -[JW: backport to 5.15-stable + update commit message] -Signed-off-by: Jens Wiklander -Signed-off-by: Greg Kroah-Hartman ---- - drivers/tee/optee/core.c | 8 ++++++++ - drivers/tee/optee/optee_private.h | 2 ++ - drivers/tee/optee/rpc.c | 8 +++++--- - 3 files changed, 15 insertions(+), 3 deletions(-) - ---- a/drivers/tee/optee/core.c -+++ b/drivers/tee/optee/core.c -@@ -588,6 +588,7 @@ static int optee_remove(struct platform_ - /* Unregister OP-TEE specific client devices on TEE bus */ - optee_unregister_devices(); - -+ teedev_close_context(optee->ctx); - /* - * Ask OP-TEE to free all cached shared memory objects to decrease - * reference counters and also avoid wild pointers in secure world -@@ -633,6 +634,7 @@ static int optee_probe(struct platform_d - struct optee *optee = NULL; - void *memremaped_shm = NULL; - struct tee_device *teedev; -+ struct tee_context *ctx; - u32 sec_caps; - int rc; - -@@ -719,6 +721,12 @@ static int optee_probe(struct platform_d - optee_supp_init(&optee->supp); - optee->memremaped_shm = memremaped_shm; - optee->pool = pool; -+ ctx = teedev_open(optee->teedev); -+ if (IS_ERR(ctx)) { -+ rc = rc = PTR_ERR(ctx); -+ goto err; -+ } -+ optee->ctx = ctx; - - /* - * Ensure that there are no pre-existing shm objects before enabling ---- a/drivers/tee/optee/optee_private.h -+++ b/drivers/tee/optee/optee_private.h -@@ -70,6 +70,7 @@ struct optee_supp { - * struct optee - main service struct - * @supp_teedev: supplicant device - * @teedev: client device -+ * @ctx: driver internal TEE context - * @invoke_fn: function to issue smc or hvc - * @call_queue: queue of threads waiting to call @invoke_fn - * @wait_queue: queue of threads from secure world waiting for a -@@ -87,6 +88,7 @@ struct optee { - struct tee_device *supp_teedev; - struct tee_device *teedev; - optee_invoke_fn *invoke_fn; -+ struct tee_context *ctx; - struct optee_call_queue call_queue; - struct optee_wait_queue wait_queue; - struct optee_supp supp; ---- a/drivers/tee/optee/rpc.c -+++ b/drivers/tee/optee/rpc.c -@@ -285,6 +285,7 @@ static struct tee_shm *cmd_alloc_suppl(s - } - - static void handle_rpc_func_cmd_shm_alloc(struct tee_context *ctx, -+ struct optee *optee, - struct optee_msg_arg *arg, - struct optee_call_ctx *call_ctx) - { -@@ -314,7 +315,8 @@ static void handle_rpc_func_cmd_shm_allo - shm = cmd_alloc_suppl(ctx, sz); - break; - case OPTEE_RPC_SHM_TYPE_KERNEL: -- shm = tee_shm_alloc(ctx, sz, TEE_SHM_MAPPED | TEE_SHM_PRIV); -+ shm = tee_shm_alloc(optee->ctx, sz, -+ TEE_SHM_MAPPED | TEE_SHM_PRIV); - break; - default: - arg->ret = TEEC_ERROR_BAD_PARAMETERS; -@@ -471,7 +473,7 @@ static void handle_rpc_func_cmd(struct t - break; - case OPTEE_RPC_CMD_SHM_ALLOC: - free_pages_list(call_ctx); -- handle_rpc_func_cmd_shm_alloc(ctx, arg, call_ctx); -+ handle_rpc_func_cmd_shm_alloc(ctx, optee, arg, call_ctx); - break; - case OPTEE_RPC_CMD_SHM_FREE: - handle_rpc_func_cmd_shm_free(ctx, arg); -@@ -502,7 +504,7 @@ void optee_handle_rpc(struct tee_context - - switch (OPTEE_SMC_RETURN_GET_RPC_FUNC(param->a0)) { - case OPTEE_SMC_RPC_FUNC_ALLOC: -- shm = tee_shm_alloc(ctx, param->a1, -+ shm = tee_shm_alloc(optee->ctx, param->a1, - TEE_SHM_MAPPED | TEE_SHM_PRIV); - if (!IS_ERR(shm) && !tee_shm_get_pa(shm, 0, &pa)) { - reg_pair_from_64(¶m->a1, ¶m->a2, pa); diff --git a/queue-5.15/series b/queue-5.15/series index e6b80046737..55992902ace 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -66,8 +66,6 @@ drm-i915-opregion-check-port-number-bounds-for-swsci-display-power-state.patch drm-i915-fix-dbuf-slice-config-lookup.patch drm-i915-fix-mbus-join-config-lookup.patch vsock-remove-vsock-from-connected-table-when-connect-is-interrupted-by-a-signal.patch -tee-export-teedev_open-and-teedev_close_context.patch -optee-use-driver-internal-tee_context-for-some-rpc.patch drm-cma-helper-set-vm_dontexpand-for-mmap.patch drm-i915-gvt-make-drm_i915_gvt-depend-on-x86.patch drm-i915-ttm-tweak-priority-hint-selection.patch diff --git a/queue-5.15/tee-export-teedev_open-and-teedev_close_context.patch b/queue-5.15/tee-export-teedev_open-and-teedev_close_context.patch deleted file mode 100644 index 25099ded455..00000000000 --- a/queue-5.15/tee-export-teedev_open-and-teedev_close_context.patch +++ /dev/null @@ -1,83 +0,0 @@ -From a2af942bc1bd5b17171c53341907fa2bec695ebc Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Mon, 4 Oct 2021 16:11:52 +0200 -Subject: tee: export teedev_open() and teedev_close_context() - -From: Jens Wiklander - -[ Upstream commit 1e2c3ef0496e72ba9001da5fd1b7ed56ccb30597 ] - -Exports the two functions teedev_open() and teedev_close_context() in -order to make it easier to create a driver internal struct tee_context. - -Reviewed-by: Sumit Garg -Signed-off-by: Jens Wiklander -Signed-off-by: Sasha Levin ---- - drivers/tee/tee_core.c | 6 ++++-- - include/linux/tee_drv.h | 14 ++++++++++++++ - 2 files changed, 18 insertions(+), 2 deletions(-) - -diff --git a/drivers/tee/tee_core.c b/drivers/tee/tee_core.c -index 85102d12d7169..3fc426dad2df3 100644 ---- a/drivers/tee/tee_core.c -+++ b/drivers/tee/tee_core.c -@@ -43,7 +43,7 @@ static DEFINE_SPINLOCK(driver_lock); - static struct class *tee_class; - static dev_t tee_devt; - --static struct tee_context *teedev_open(struct tee_device *teedev) -+struct tee_context *teedev_open(struct tee_device *teedev) - { - int rc; - struct tee_context *ctx; -@@ -70,6 +70,7 @@ static struct tee_context *teedev_open(struct tee_device *teedev) - return ERR_PTR(rc); - - } -+EXPORT_SYMBOL_GPL(teedev_open); - - void teedev_ctx_get(struct tee_context *ctx) - { -@@ -96,13 +97,14 @@ void teedev_ctx_put(struct tee_context *ctx) - kref_put(&ctx->refcount, teedev_ctx_release); - } - --static void teedev_close_context(struct tee_context *ctx) -+void teedev_close_context(struct tee_context *ctx) - { - struct tee_device *teedev = ctx->teedev; - - teedev_ctx_put(ctx); - tee_device_put(teedev); - } -+EXPORT_SYMBOL_GPL(teedev_close_context); - - static int tee_open(struct inode *inode, struct file *filp) - { -diff --git a/include/linux/tee_drv.h b/include/linux/tee_drv.h -index feda1dc7f98ee..38b701b7af4cf 100644 ---- a/include/linux/tee_drv.h -+++ b/include/linux/tee_drv.h -@@ -582,4 +582,18 @@ struct tee_client_driver { - #define to_tee_client_driver(d) \ - container_of(d, struct tee_client_driver, driver) - -+/** -+ * teedev_open() - Open a struct tee_device -+ * @teedev: Device to open -+ * -+ * @return a pointer to struct tee_context on success or an ERR_PTR on failure. -+ */ -+struct tee_context *teedev_open(struct tee_device *teedev); -+ -+/** -+ * teedev_close_context() - closes a struct tee_context -+ * @ctx: The struct tee_context to close -+ */ -+void teedev_close_context(struct tee_context *ctx); -+ - #endif /*__TEE_DRV_H*/ --- -2.34.1 - diff --git a/queue-5.4/optee-use-driver-internal-tee_context-for-some-rpc.patch b/queue-5.4/optee-use-driver-internal-tee_context-for-some-rpc.patch deleted file mode 100644 index 58071fb66c7..00000000000 --- a/queue-5.4/optee-use-driver-internal-tee_context-for-some-rpc.patch +++ /dev/null @@ -1,131 +0,0 @@ -From aceeafefff736057e8f93f19bbfbef26abd94604 Mon Sep 17 00:00:00 2001 -From: Jens Wiklander -Date: Thu, 27 Jan 2022 15:29:39 +0100 -Subject: optee: use driver internal tee_context for some rpc - -From: Jens Wiklander - -commit aceeafefff736057e8f93f19bbfbef26abd94604 upstream. - -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. - -Fixes: f25889f93184 ("optee: fix tee out of memory failure seen during kexec reboot") -Fixes: 217e0250cccb ("tee: use reference counting for tee_context") -Reported-by: Lars Persson -Cc: stable@vger.kernel.org -Reviewed-by: Sumit Garg -Signed-off-by: Jens Wiklander -[JW: backport to 5.4-stable] -Signed-off-by: Jens Wiklander -Signed-off-by: Greg Kroah-Hartman ---- - drivers/tee/optee/core.c | 8 ++++++++ - drivers/tee/optee/optee_private.h | 2 ++ - drivers/tee/optee/rpc.c | 8 +++++--- - 3 files changed, 15 insertions(+), 3 deletions(-) - ---- a/drivers/tee/optee/core.c -+++ b/drivers/tee/optee/core.c -@@ -552,6 +552,7 @@ static struct optee *optee_probe(struct - struct optee *optee = NULL; - void *memremaped_shm = NULL; - struct tee_device *teedev; -+ struct tee_context *ctx; - u32 sec_caps; - int rc; - -@@ -631,6 +632,12 @@ static struct optee *optee_probe(struct - optee_supp_init(&optee->supp); - optee->memremaped_shm = memremaped_shm; - optee->pool = pool; -+ ctx = teedev_open(optee->teedev); -+ if (IS_ERR(ctx)) { -+ rc = rc = PTR_ERR(ctx); -+ goto err; -+ } -+ optee->ctx = ctx; - - /* - * Ensure that there are no pre-existing shm objects before enabling -@@ -667,6 +674,7 @@ err: - - static void optee_remove(struct optee *optee) - { -+ teedev_close_context(optee->ctx); - /* - * Ask OP-TEE to free all cached shared memory objects to decrease - * reference counters and also avoid wild pointers in secure world ---- a/drivers/tee/optee/optee_private.h -+++ b/drivers/tee/optee/optee_private.h -@@ -69,6 +69,7 @@ struct optee_supp { - * struct optee - main service struct - * @supp_teedev: supplicant device - * @teedev: client device -+ * @ctx: driver internal TEE context - * @invoke_fn: function to issue smc or hvc - * @call_queue: queue of threads waiting to call @invoke_fn - * @wait_queue: queue of threads from secure world waiting for a -@@ -83,6 +84,7 @@ struct optee { - struct tee_device *supp_teedev; - struct tee_device *teedev; - optee_invoke_fn *invoke_fn; -+ struct tee_context *ctx; - struct optee_call_queue call_queue; - struct optee_wait_queue wait_queue; - struct optee_supp supp; ---- a/drivers/tee/optee/rpc.c -+++ b/drivers/tee/optee/rpc.c -@@ -191,6 +191,7 @@ static struct tee_shm *cmd_alloc_suppl(s - } - - static void handle_rpc_func_cmd_shm_alloc(struct tee_context *ctx, -+ struct optee *optee, - struct optee_msg_arg *arg, - struct optee_call_ctx *call_ctx) - { -@@ -220,7 +221,8 @@ static void handle_rpc_func_cmd_shm_allo - shm = cmd_alloc_suppl(ctx, sz); - break; - case OPTEE_MSG_RPC_SHM_TYPE_KERNEL: -- shm = tee_shm_alloc(ctx, sz, TEE_SHM_MAPPED | TEE_SHM_PRIV); -+ shm = tee_shm_alloc(optee->ctx, sz, -+ TEE_SHM_MAPPED | TEE_SHM_PRIV); - break; - default: - arg->ret = TEEC_ERROR_BAD_PARAMETERS; -@@ -377,7 +379,7 @@ static void handle_rpc_func_cmd(struct t - break; - case OPTEE_MSG_RPC_CMD_SHM_ALLOC: - free_pages_list(call_ctx); -- handle_rpc_func_cmd_shm_alloc(ctx, arg, call_ctx); -+ handle_rpc_func_cmd_shm_alloc(ctx, optee, arg, call_ctx); - break; - case OPTEE_MSG_RPC_CMD_SHM_FREE: - handle_rpc_func_cmd_shm_free(ctx, arg); -@@ -405,7 +407,7 @@ void optee_handle_rpc(struct tee_context - - switch (OPTEE_SMC_RETURN_GET_RPC_FUNC(param->a0)) { - case OPTEE_SMC_RPC_FUNC_ALLOC: -- shm = tee_shm_alloc(ctx, param->a1, -+ shm = tee_shm_alloc(optee->ctx, param->a1, - TEE_SHM_MAPPED | TEE_SHM_PRIV); - if (!IS_ERR(shm) && !tee_shm_get_pa(shm, 0, &pa)) { - reg_pair_from_64(¶m->a1, ¶m->a2, pa); diff --git a/queue-5.4/series b/queue-5.4/series index 4665e609aed..04e8bd81908 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -49,8 +49,6 @@ asoc-ops-fix-stereo-change-notifications-in-snd_soc_put_volsw.patch asoc-ops-fix-stereo-change-notifications-in-snd_soc_put_volsw_range.patch powerpc-lib-sstep-fix-ptesync-build-error.patch mtd-rawnand-gpmi-don-t-leak-pm-reference-in-error-path.patch -tee-export-teedev_open-and-teedev_close_context.patch -optee-use-driver-internal-tee_context-for-some-rpc.patch block-wbt-fix-negative-inflight-counter-when-remove-scsi-device.patch nfs-lookup_directory-is-also-ok-with-symlinks.patch nfs-do-not-report-writeback-errors-in-nfs_getattr.patch diff --git a/queue-5.4/tee-export-teedev_open-and-teedev_close_context.patch b/queue-5.4/tee-export-teedev_open-and-teedev_close_context.patch deleted file mode 100644 index aaf3c979ff6..00000000000 --- a/queue-5.4/tee-export-teedev_open-and-teedev_close_context.patch +++ /dev/null @@ -1,76 +0,0 @@ -From 1e2c3ef0496e72ba9001da5fd1b7ed56ccb30597 Mon Sep 17 00:00:00 2001 -From: Jens Wiklander -Date: Mon, 4 Oct 2021 16:11:52 +0200 -Subject: tee: export teedev_open() and teedev_close_context() - -From: Jens Wiklander - -commit 1e2c3ef0496e72ba9001da5fd1b7ed56ccb30597 upstream. - -Exports the two functions teedev_open() and teedev_close_context() in -order to make it easier to create a driver internal struct tee_context. - -Reviewed-by: Sumit Garg -Signed-off-by: Jens Wiklander -Signed-off-by: Greg Kroah-Hartman ---- - drivers/tee/tee_core.c | 6 ++++-- - include/linux/tee_drv.h | 14 ++++++++++++++ - 2 files changed, 18 insertions(+), 2 deletions(-) - ---- a/drivers/tee/tee_core.c -+++ b/drivers/tee/tee_core.c -@@ -28,7 +28,7 @@ static DEFINE_SPINLOCK(driver_lock); - static struct class *tee_class; - static dev_t tee_devt; - --static struct tee_context *teedev_open(struct tee_device *teedev) -+struct tee_context *teedev_open(struct tee_device *teedev) - { - int rc; - struct tee_context *ctx; -@@ -56,6 +56,7 @@ err: - return ERR_PTR(rc); - - } -+EXPORT_SYMBOL_GPL(teedev_open); - - void teedev_ctx_get(struct tee_context *ctx) - { -@@ -82,13 +83,14 @@ void teedev_ctx_put(struct tee_context * - kref_put(&ctx->refcount, teedev_ctx_release); - } - --static void teedev_close_context(struct tee_context *ctx) -+void teedev_close_context(struct tee_context *ctx) - { - struct tee_device *teedev = ctx->teedev; - - teedev_ctx_put(ctx); - tee_device_put(teedev); - } -+EXPORT_SYMBOL_GPL(teedev_close_context); - - static int tee_open(struct inode *inode, struct file *filp) - { ---- a/include/linux/tee_drv.h -+++ b/include/linux/tee_drv.h -@@ -579,4 +579,18 @@ struct tee_client_driver { - #define to_tee_client_driver(d) \ - container_of(d, struct tee_client_driver, driver) - -+/** -+ * teedev_open() - Open a struct tee_device -+ * @teedev: Device to open -+ * -+ * @return a pointer to struct tee_context on success or an ERR_PTR on failure. -+ */ -+struct tee_context *teedev_open(struct tee_device *teedev); -+ -+/** -+ * teedev_close_context() - closes a struct tee_context -+ * @ctx: The struct tee_context to close -+ */ -+void teedev_close_context(struct tee_context *ctx); -+ - #endif /*__TEE_DRV_H*/