linaro-swg / linux

Linux kernel source tree
Other
41 stars 79 forks source link

The ION patches #91

Open jenswi-linaro opened 3 years ago

jenswi-linaro commented 3 years ago

Do we have a plan for the ION patches in the optee branch? They have been there for quite some time and I suppose they are quite painful to rebase.

jbech-linaro commented 3 years ago

I believe we have people using them for the SDP use cases. Having said that, I believe that Andrew (when he was at TI) and John Stultz and others have made significant improvements in this area. Without having enough details it sounds to me like it could be worth having a look SDP and see whether the SDP solution could be updated so it use upstream patches. If upstream patches doesn't fully support SDP, then the next step would be to see if we (someone) can contribute with the missing pieces. In short, it should be possible to have the SDP use case working without having to carry patches downstream.

jforissier commented 3 years ago

@jenswi-linaro

Do we have a plan for the ION patches in the optee branch? They have been there for quite some time and I suppose they are quite painful to rebase.

They have been painful to rebase on occasions, yes, and thanks @etienne-lms for helping with that ;-)

@jbech-linaro

In short, it should be possible to have the SDP use case working without having to carry patches downstream.

That would be good indeed.

I have not tried to rebase our branch onto upstream now, but since 5.13 seems to be close (this Sunday?) I might try to do it so that we can take it in the 3.13.0 release.

jforissier commented 3 years ago

ION has been removed from the upstream kernel in v5.10.

I have pushed https://github.com/linaro-swg/linux/commits/wip/optee-v5.12 which is a rebase of our optee branch onto v5.12 without the ION patches. I have also removed the upstream-tee-subsys-patches.txt because I think it doesn't make much sense to maintain it anymore since most of the driver updates happen upstream now.

I'd like to replace the optee branch with that, if no one objects.

jbech-linaro commented 3 years ago

edit comments appeared in the wrong order.

ION has been removed from the upstream kernel in v5.10.

That means that our SDP will not work any longer?

I'd like to replace the optee branch with that, if no one objects.

OK with me (SDP needs to be sorted in one or another way at some point).

etienne-lms commented 3 years ago

I have also removed the upstream-tee-subsys-patches.txt

I think this file is quite useful for one using an older kernel version. Getting these information from the git tree from v4.x to the several v5.x can be quite painful.

jforissier commented 3 years ago

edit comments appeared in the wrong order.

ION has been removed from the upstream kernel in v5.10.

That means that our SDP will not work any longer?

Correct, xtest depends on ION for SDP.

vchong commented 3 years ago

I think this file is quite useful for one using an older kernel version. Getting these information from the git tree from v4.x to the several v5.x can be quite painful.

+1. We only need to refer to this file and nothing else when porting TEE driver patches to older AOSP kernels that don't have it. We don't have search through git trees and, most importantly, can be sure no patches and any of their dependencies are missed.

jforissier commented 3 years ago

@etienne-lms @vchong OK fair enough. Then I suggest I re-generate this file from the following command (in this example I list all the TEE patches up to v5.12), because there are minor errors in the current file (v4.16 instead of v4.16-rc1 for example) and then I can make consistent updates:

git log --no-merges --oneline v5.12 drivers/tee | while read hash sub; do name=`git name-rev --tags --name-only $hash | sed 's/\([^~]*\)~.*/[\1]/'`; printf "%-20s %s %s\n" "$name" "$hash" "$sub"; done

The output is like so which is almost identical to the current file:

[v5.12-rc4]          6417f03132a6 module: remove never implemented MODULE_SUPPORTED_DEVICE
[v5.12-rc1-dontuse]  67bc80975279 optee: simplify i2c access
[v5.12-rc1-dontuse]  958567600517 tee: optee: remove need_resched() before cond_resched()
[v5.12-rc1-dontuse]  617d8e8b347e optee: sync OP-TEE headers
[v5.12-rc1-dontuse]  bed13b5fc4f3 tee: optee: fix 'physical' typos
[v5.12-rc1-dontuse]  fda90b29e271 drivers: optee: use flexible-array member instead of zero-length array
[v5.11-rc6]          dcb3b06d9c34 tee: optee: replace might_sleep with cond_resched
[v5.10-rc6]          853735e40424 optee: add writeback to valid memory type
[v5.11-rc1]          a24d22b225ce crypto: sha - split sha.h into sha1.h and sha2.h
[v5.10-rc5]          be353be27874 tee: amdtee: synchronize access to shm list
[v5.10-rc5]          ff1f855804cd tee: amdtee: fix memory leak due to reset of global shm list
[v5.10-rc2]          722939528a37 tee: client UUID: Skip REE kernel login method as well
[v5.11-rc1]          57222a1be27e tee: optee: Use UUID API for exporting the UUID
[v5.10-rc1]          8c05f50fe845 tee: avoid explicit sysfs_create/delete_group by initialising dev->groups
[v5.10-rc1]          ab3d8e1baaee tee: replace cdev_add + device_add with cdev_device_add
[v5.10-rc1]          539f8fc253ec drivers: optee: fix i2c build issue
[v5.10-rc1]          4300cd6374a5 tee: convert get_user_pages() --> pin_user_pages()
[v5.10-rc1]          c05210ab9757 drivers: optee: allow op-tee to access devices on the i2c bus
[v5.10-rc1]          ba171d3f0850 driver: tee: Handle NULL pointer indication from client
[v5.9-rc1]           5f178bb71e3a optee: enable support for multi-stage bus enumeration
[v5.9-rc1]           58df195cd47d optee: use uuid for sysfs driver entry
[v5.8-rc1]           d8ed45c5dcd4 mmap locking API: use coccinelle to convert mmap_sem rwsem call sites
[v5.8-rc1]           60b4000f5464 tee: fix crypto select
[v5.8-rc1]           c5b4312bea5d tee: optee: Add support for session login client UUID generation
[v5.8-rc1]           e33bcbab16d1 tee: add support for session's client UUID generation
[v5.8-rc1]           104edb94cc4b tee: add private login method for kernel clients
[v5.8-rc1]           2a6ba3f794e8 tee: enable support to register kernel memory
[v5.8-rc1]           1115899e7aad tee: remove unnecessary NULL check in tee_shm_alloc()
[v5.6]               36fa3e50085e tee: amdtee: out of bounds read in find_session()
[v5.7-rc1]           758ecf13a41a tee: tee_shm_op_mmap(): use TEE_SHM_USER_MAPPED
[v5.7-rc1]           5271b2011e44 tee: remove redundant teedev in struct tee_shm
[v5.7-rc1]           f1bbacedb0af tee: don't assign shm id for private shms
[v5.7-rc1]           c180f9bbe29a tee: remove unused tee_shm_priv_alloc()
[v5.7-rc1]           59a135f6fb66 tee: remove linked list of struct tee_shm
[v5.6-rc5]           b83685bceedb tee: amdtee: fix memory leak in amdtee_open_session()
[v5.6-rc4]           872d92dec353 tee: amdtee: amdtee depends on CRYPTO_DEV_CCP_DD
[v5.5]               9e0caab8e0f9 tee: optee: Fix compilation issue with nommu
[v5.6-rc1]           48d625e4c4ce tee: fix memory allocation failure checks on drv_data and amdtee
[v5.6-rc1]           279c075dc1d2 tee: amdtee: remove redundant NULL check for pool
[v5.6-rc1]           f9568eae9247 tee: amdtee: rename err label to err_device_unregister
[v5.6-rc1]           2929015535fa tee: amdtee: skip tee_device_unregister if tee_device_alloc fails
[v5.6-rc1]           f4c58c3758f9 tee: amdtee: print error message if tee not present
[v5.6-rc1]           5ae63958a6de tee: amdtee: remove unused variable initialization
[v5.6-rc1]           bade7e1fbd34 tee: amdtee: check TEE status during driver initialization
[v5.6-rc1]           757cc3e9ff1d tee: add AMD-TEE driver
[v5.6-rc1]           1a74fa3894e7 tee: allow compilation of tee subsystem for AMD CPUs
[v5.5-rc7]           5a769f6ff439 optee: Fix multi page dynamic shm pool alloc
[v5.6-rc1]           f349710e413a optee: model OP-TEE as a platform device/driver
[v5.6-rc1]           42aa7c6eb3eb drm/tee_shm: Drop dma_buf_k(unmap) support
[v5.5-rc1]           03212e347f94 tee: optee: fix device enumeration error handling
[v5.5-rc1]           a249dd200d03 tee: optee: Fix dynamic shm pool allocations
[v5.5-rc1]           1832f2d8ff69 compat_ioctl: move more drivers to compat_ptr_ioctl
[v5.4-rc1]           78063a9dd963 tee/shm: untag user pointers in tee_shm_register
[v5.4-rc1]           9f02b8f61f29 tee: optee: add might_sleep for RPC requests
[v5.2-rc4]           9c92ab619141 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 282
[v5.2-rc2]           ec8f24b7faaf treewide: Add SPDX license identifier - Makefile/Kconfig
[v5.2-rc1]           73b0140bf0fe mm/gup: change GUP fast to use flags rather than a write 'bool'
[v5.2-rc1]           9733b072a12a optee: allow to work without static shared memory
[v5.1-rc1]           32356d309c22 tee: optee: update optee_msg.h and optee_smc.h to dual license
[v5.1-rc1]           4f062dc1b759 tee: add cancellation support to client interface
[v5.0]               c7c0d8df0b94 tee: optee: add missing of_node_put after of_device_is_available
[v5.1-rc1]           62ade1bed27c tee: optee: Fix unsigned comparison with less than zero
[v5.1-rc1]           bb342f016862 tee: fix possible error pointer ctx dereferencing
[v5.1-rc1]           50ceca6894ad tee: optee: Initialize some structs using memset instead of braces
[v5.1-rc1]           c3fa24af9244 tee: optee: add TEE bus device enumeration support
[v5.1-rc1]           0fc1db9d1059 tee: add bus driver framework for TEE based devices
[v5.1-rc1]           42bf4152d8a7 tee: add supp_nowait flag in tee_context struct
[v5.0-rc1]           3c15ddb97c77 tee: optee: log message if dynamic shm is enabled
[v5.0-rc1]           b2d102bd0146 tee: optee: avoid possible double list_del()
[v4.20-rc1]          25559c22cef8 tee: add kernel internal client interface
[v4.20-rc1]          db878f76b9ff tee: optee: take DT status property into account
[v4.19-rc1]          f664a5269542 dma-buf: remove kmap_atomic interface
[v4.19-rc1]          3249527f19d6 tee: optee: making OPTEE_SHM_NUM_PRIV_PAGES configurable via Kconfig
[v4.19-rc1]          cf89fe88a676 tee: replace getnstimeofday64() with ktime_get_real_ts64()
[v4.17-rc6]          ab9d3db5b320 tee: check shm references are consistent in offset/size
[v4.17-rc6]          bb765d1c331f tee: shm: fix use-after-free via temporarily dropped reference
[v4.17-rc1]          5c5f80307ab2 tee: optee: report OP-TEE revision information
[v4.17-rc1]          6e112de04278 tee: optee: GET_OS_REVISION: document a2 as a build identifier
[v4.17-rc1]          7dd003aec201 tee: correct max value for id allocation
[v4.16-rc1]          2490cdf6435b tee: shm: Potential NULL dereference calling tee_shm_register()
[v4.16-rc1]          c94f31b526fe tee: shm: don't put_page on null shm->pages
[v4.16-rc1]          80ec6f5de60b tee: shm: make function __tee_shm_alloc static
[v4.16-rc1]          cdbcf83d29c1 tee: optee: check type of registered shared memory
[v4.16-rc1]          95ffe4ca4387 tee: add start argument to shm_register callback
[v4.16-rc1]          f681e08f671a tee: optee: fix header dependencies
[v4.16-rc1]          ef8e08d24ca8 tee: shm: inline tee_shm_get_id()
[v4.16-rc1]          217e0250cccb tee: use reference counting for tee_context
[v4.16-rc1]          f58e236c9d66 tee: optee: enable dynamic SHM support
[v4.16-rc1]          abd135ba215c tee: optee: add optee-specific shared pool implementation
[v4.16-rc1]          d885cc5e0759 tee: optee: store OP-TEE capabilities in private data
[v4.16-rc1]          53a107c812de tee: optee: add registered buffers handling into RPC calls
[v4.16-rc1]          64cf9d8a672e tee: optee: add registered shared parameters handling
[v4.16-rc1]          06ca79179c4e tee: optee: add shared buffer registration functions
[v4.16-rc1]          3bb48ba5cd60 tee: optee: add page list manipulation functions
[v4.16-rc1]          de5c6dfc43da tee: optee: Update protocol definitions
[v4.16-rc1]          033ddf12bcf5 tee: add register user memory
[v4.16-rc1]          e2aca5d8928a tee: flexible shared memory pool creation
[v4.16-rc1]          1647a5ac1754 optee: support asynchronous supplicant requests
[v4.16-rc1]          f2aa97240c84 tee: add TEE_IOCTL_PARAM_ATTR_META
[v4.16-rc1]          84debcc53533 tee: add tee_param_is_memref() for driver use
[v4.15-rc3]          f044113113dd optee: fix invalid of_node_put() in optee_driver_init()
[v4.14-rc8]          b24413180f56 License cleanup: add SPDX GPL-2.0 license identifier to files with no license
[v4.14-rc1]          39e6519a3f13 tee: optee: sync with new naming of interrupts
[v4.14-rc1]          059cf566e123 tee: indicate privileged dev in gen_caps
[v4.14-rc1]          a9980e947ec9 tee: optee: interruptible RPC sleep
[v4.14-rc1]          96e72ddeec45 tee: optee: add const to tee_driver_ops and tee_desc structures
[v4.14-rc1]          53e3ca5cee24 tee: tee_shm: Constify dma_buf_ops structures.
[v4.14-rc1]          efb14036bd7f tee: optee: fix uninitialized symbol 'parg'
[v4.12-rc2]          e84188852a72 tee: add ARM_SMCCC dependency
[v4.12-rc1]          4fb0a5eb364d tee: add OP-TEE driver
[v4.12-rc1]          967c9cca2cc5 tee: generic TEE subsystem

@vchong

most importantly, can be sure no patches and any of their dependencies are missed.

We can reasonably only list the patches touching drivers/tee, because there can be so many dependencies all over the kernel tree. If you cherry-pick patches to backport into an older kernel, it should be easy to figure out if something is missing, no?

jenswi-linaro commented 3 years ago

It seems a bit pointless to generate this file all the time. Wouldn't it be enough to keep these commands somewhere? Perhaps as an entry at https://optee.readthedocs.io/en/latest/faq/faq.html?

jforissier commented 3 years ago

https://github.com/OP-TEE/optee_docs/pull/116.

jforissier commented 3 years ago

edit comments appeared in the wrong order.

ION has been removed from the upstream kernel in v5.10.

That means that our SDP will not work any longer?

Correct, xtest depends on ION for SDP.

I note that IBART does run xtest --sdp-basic on HiKey so before droping ION in linaro-swg/linux optee, we either need to update the SDP implementation or disable the SDP test in IBART (not ideal).

jbech-linaro commented 3 years ago

edit comments appeared in the wrong order.

ION has been removed from the upstream kernel in v5.10.

That means that our SDP will not work any longer?

Correct, xtest depends on ION for SDP.

I note that IBART does run xtest --sdp-basic on HiKey so before droping ION in linaro-swg/linux optee, we either need to update the SDP implementation or disable the SDP test in IBART (not ideal).

I'd imagine that it'll take some time to change SDP so it's working again. So to be able to merge our downstream patches to a more recent version I see no other solution at this point than have do disable SDP in IBART.

jforissier commented 3 years ago

Branch optee is now rebased onto kernel v5.12 without ION.

jbech-linaro commented 3 years ago

Branch optee is now rebased onto kernel v5.12 without ION.

OK, I'll disable SDP test in IBART for now. Thanks Jerome!