-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tee: optee: Fix RPC call break system sleep operation. #84
base: optee
Are you sure you want to change the base?
Conversation
Adds upstream-tee-subsys-patches.txt describing all upstream patches related to the TEE subsystem. Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> [jf: rebase on top of v4.18] Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
This change allows userland to create a tee_shm object that refers to a dmabuf reference. Userland provides a dmabuf file descriptor as buffer reference. The created tee_shm object exported as a brand new dmabuf reference used to provide a clean fd to userland. Userland shall closed this new fd to release the tee_shm object resources. The initial dmabuf resources are tracked independently through original dmabuf file descriptor. Once the buffer is registered and until it is released, TEE driver keeps a refcount on the registered dmabuf structure. This change only support dmabuf references that relates to physically contiguous memory buffers. New tee_shm flag to identify tee_shm objects built from a registered dmabuf: TEE_SHM_EXT_DMA_BUF. Such tee_shm structures are flagged both TEE_SHM_DMA_BUF and TEE_SHM_EXT_DMA_BUF. Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> [jf: squash fixup commit ("tee: fix unbalanced context refcount in register shm from fd")] [jf: rebase onto v5.9-rc8] Signed-off-by: Jerome Forissier <jerome@forissier.org>
From the commit below, the mt8173-evb failed to boot to console due to changes in the mt8173 device tree files. commit c0d6fe2 Merge: b44a3d2 3e4dda7 Author: Linus Torvalds <torvalds@linux-foundation.org> Date: Tue Nov 10 15:06:26 2015 -0800 Merge tag 'armsoc-dt' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc Until properly solved, let's just remove the section in the device tree blob that causes this. Signed-off-by: Joakim Bech <joakim.bech@linaro.org> Reviewed-by: Pascal Brand <pascal.brand@linaro.org>
Configures foundation-v8 with OP-TEE. Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> [jf: rebase onto v5.9-rc7] Signed-off-by: Jerome Forissier <jerome@forissier.org>
Configures Juno with OP-TEE. Reviewed-by: Pascal Brand <pascal.brand@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> [jf: rebase onto v5.9-rc7] Signed-off-by: Jerome Forissier <jerome@forissier.org>
…dation-v8 **not for mainline** All the platforms that reserve memory for OP-TEE statically via the DT (i.e., not those that reserve it via UEFI or that patch the DT dynamically thanks to OP-TEE's CFG_DT option) have to mark it 'no-map' so that only the TEE driver may map it. Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
… **not for mainline** All the platforms that reserve memory for OP-TEE statically via the DT (i.e., not those that reserve it via UEFI or that patch the DT dynamically thanks to OP-TEE's CFG_DT option) have to mark it 'no-map' so that only the TEE driver may map it. Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Signed-off-by: Joakim Bech <joakim.bech@linaro.org> Reviewed-by: Pascal Brand <pascal.brand@linaro.org> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Add Benchmark support Reviewed-by: Joakim Bech <joakim.bech@linaro.org> Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org> [jf: squash fixup commit "tee: optee: optee_bench.h: remove useless include **not for mainline**"] [jf: rebase onto v5.9-rc7] Signed-off-by: Jerome Forissier <jerome@forissier.org>
Add support of allocating DMA shared buffers via RPC calls. The main difference with OPTEE_MSG_RPC_SHM_TYPE_KERNEL is that SHM pool manager for shared memory exported to user space is explicitly chosen. As dma-buf is used for exporting buffers to userspace, it provides a possiblity to mmap an allocated SHM buffer into multiple TEE client applications (unlike OPTEE_MSG_RPC_SHM_TYPE_APPL, which leverages tee-supplicant for private allocations). Such buffers should be used only for internal purposes, when there is a need to share meta data between different OP-TEE components (for debugging/profiling purposes). Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org> [jf: squash fixup commit] Signed-off-by: Jerome Forissier <jerome@forissier.org>
Records patches available upstream up to v4.20-rc1. Acked-by: Joakim Bech <joakim.bech@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Records patches available upstream up to v5.0. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Records patches available upstream up to v5.1. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Dumped from: https://github.com/loboris/OrangePI-Kernel/tree/master/linux-3.4 0cc8d855adb457d1860d6e25cb93b6cc75d5a09d Author: Sunny <sunny@allwinnertech.com> for Allwinner. Changes made on original "secure heap" implementation: - minor coding style: fix includes, empty lines and overlong lines, indentation, comment layout. - Original path modified the ion uapi. We do not attempt to modify uapi/ion.h. "secure" (or "domain") heaps are under ID ION_HEAP_TYPE_CUSTOM + 1 (legacy 'secure heap type' value). Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
OP-TEE/SDP (Secure Data Path) memory pools are created through ION secure type heap" from Allwinner. This change renames "secure" into "unmapped" as, from Linux point of view, the heap constraint is manipulating unampped memory pools/buffers. "Unmapped" heap support is integrated in ION UAPI (actually this was the Allwinner initial proposal) and ION DT parsing support. Based in work from Sunny <sunny@allwinnertech.com> for Allwinner. Changes: - rename "secure_heap" into "unmapped_heap" - define ION_HEAP_TYPE_UNMAPPED in ION UAPI (sic!) - add structure "struct unmapped_buffer_priv" to hold allocated buffer private data (currently only the buffer physical address. - adapt to recent ION (i.e ion_phys_addr_t => phys_addr_t) - Support dummy heap configuration: one can hard code into the Linux kernel configuration the location of a "unmapped heap". It will be created during ION device inits: see CONFIG_ION_DUMMY_UNMAPPED_HEAP. Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Condition ION unmapped heap implementation to architectures that currently support it. ARM is one of these. Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Ion unmapped heap aims at not being mapped. This change prevents Ion from calling dma-mapping support on dma_buf_attach for buffers in an unmapped heap. This change is a bit intrusive in the Ion driver. Maybe there is another way to deal with the dma-mapping resources used for the unmapped heap. Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org> [jf: rebase onto v5.9-rc7] Signed-off-by: Jerome Forissier <jerome@forissier.org>
Since commit 54ef5b9 (staging: android: ion: Initialize dma_address of new sg list") (Linux v4.17), the helper function dup_sg_table() called by ion_dma_buf_attach() does not preserve the dma_address from the original SG list. It is a problem for the unmapped heap, because dma_buf_attach() followed by dma_buf_map_attachment() now returns a SG table with NULL dma_address, which breaks tee_shm_register_fd(). This commit avoids the dma_address reset for the unmapped heap. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Tested-by: Jerome Forissier <jerome.forissier@linaro.org> (HiKey960, SDP) Tested-by: Etienne Carriere <etienne.carriere@linaro.org> (Qemu_v7/v8, SDP)
Records patches available upstream up to v5.4-rc7. Signed-off-by: Jerome Forissier <jerome@forissier.org>
Records patches available upstream up to v5.5. Signed-off-by: Jerome Forissier <jerome@forissier.org>
TEE Client introduce a new capability "TEE_GEN_CAP_MEMREF_NULL" to handle the support of the shared memory buffer with a NULL pointer. This capability depends on TEE Capabilities and driver support. Driver and TEE exchange capabilities at driver initialization. Signed-off-by: Michael Whitfield <michael.whitfield@nxp.com> Signed-off-by: Cedric Neveux <cedric.neveux@nxp.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Joakim Bech <joakim.bech@linaro.org> Tested-by: Joakim Bech <joakim.bech@linaro.org> (QEMU)
Reserve memory for bootloader purposes. Acked-by: Jerome Forissier <jerome@forissier.org> Signed-off-by: Igor Opaniuk <igor.opaniuk@gmail.com>
Add optee node, so OP-TEE driver is probed properly. Acked-by: Jerome Forissier <jerome@forissier.org> Signed-off-by: Igor Opaniuk <igor.opaniuk@gmail.com>
Define OP-TEE firmware node for stm32mp15 based platforms. The node if disable by default. Enable the OP-TEE node and define OP-TEE reserved memory for stm32mp157c-dk2. Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org> [jf: rebase onto v5.9] Signed-off-by: Jerome Forissier <jerome@forissier.org>
Records patches available upstream up to v5.9. Signed-off-by: Jerome Forissier <jerome@forissier.org>
Since the addition of session's client UUID generation via commit [1], login via REE kernel method was disallowed. So fix that via passing nill UUID in case of TEE_IOCTL_LOGIN_REE_KERNEL method as well. Fixes: e33bcba ("tee: add support for session's client UUID generation") [1] Signed-off-by: Sumit Garg <sumit.garg@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Kconfig allows to customize the CONFIG_ prefix via the $CONFIG_ environment variable. Out-of-tree projects may therefore use Kconfig with a different prefix, or they may use a custom configuration tool which does not use the CONFIG_ prefix at all. Such projects may still want to adhere to the Linux kernel coding style and run checkpatch.pl. One example is OP-TEE [1] which does not use Kconfig but does have configuration options prefixed with CFG_. It also mostly follows the kernel coding style and therefore being able to use checkpatch is quite valuable. To make this possible, add the --kconfig-prefix command line option. [1] https://github.com/OP-TEE/optee_os Signed-off-by: Jerome Forissier <jerome@forissier.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Acked-by: Joe Perches <joe@perches.com> Link: http://lkml.kernel.org/r/20200818081732.800449-1-jerome@forissier.org Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> [jf: commit 3e89ad8 from upstream] Signed-off-by: Jerome Forissier <jerome@forissier.org>
The ID for commit b83685b ("tee: amdtee: fix memory leak in amdtee_open_session()") is wrong in upstream-tee-subsys-patches.txt. Fix it. Reported-by: Victor Chong <victor.chong@linaro.org> Signed-off-by: Jerome Forissier <jerome@forissier.org>
Please add a bit more background. Why does it help to ignore a task? What will happen when a task is ignored? |
Sure, will add it.
Yes, the new case scenario that I can imaging is TA#1 put itself into wait queue and wait another TA#2 wake it up, but TA#2 somehow(may be block in other request) doesn't wake up TA#1 in time, TA#1 will break system sleep. |
The system sleep can be break when freezer try to freeze tasks who are waitting for unreachable conditions. All RPC calls waiting on tee-supplicant results are unreachable conditions when tee-supplicant be frozen. And TEE wait queue sleep becomes to unreachable condition on the corresponding wakeup process be frozen. By introduce freezer help functions tell to freezer ignoring tasks which can help to avoid freezer wakeup those tasks and wait them call into try_to_freeze(), the wait of those tasks are constantly timeout because they are waitting on unreachable conditions. This patch utilize freezer help functions to enclose those potential unreachable conditions boundaries to avoid breaking system sleep. Signed-off-by: Shown Han <Shown.Han@armchina.com>
Utilize freezer help functions to tell freezer to ignoring tasks
which wait on RPC result, because tee-supplicant may already be
frozen.
Signed-off-by: Shown Han Shown.Han@armchina.com