v3: - support tee-suppicant restart (Jens Wiklander)
- description and comments ( Jarkko Sakkinen)
- do not name optee drivers by index in sysfs (Sumit Garg)
v2: - write TEE with capital letters.
- declare __optee_enumerate_device() as static.
Hello,
This patchset fixes issues with probing() tee, optee and optee driver
if they were compiled into kernel, built as modules or any mixed
combination.
These changes require optee-os changes which already were merged.
Main corresponding commits are:
https://github.com/OP-TEE/optee_os/commit/9389d8030ef198c9d7b8ab7ea8e877e0a…https://github.com/OP-TEE/optee_os/commit/bc5921cdab538c8ae48422f5ffd600f1c…
optee_enumerate_devices() which discovers Trusted Applications on tee
bus is split up on 2 changes. Do probe of drivers which do not require
userspace support of tee-supplicant and stage two to run drivers with
support of tee-supplicant only after tee supplicant run.
Best regards,
Maxim.
Maxim Uvarov (3):
optee: do drivers initialization before and after tee-supplicant run
optee: use uuid for sysfs driver entry
tpm_ftpm_tee: register driver on TEE bus
drivers/char/tpm/tpm_ftpm_tee.c | 70 ++++++++++++++++++++++++++-----
drivers/tee/optee/core.c | 28 +++++++++++--
drivers/tee/optee/device.c | 23 ++++++----
drivers/tee/optee/optee_private.h | 10 ++++-
4 files changed, 108 insertions(+), 23 deletions(-)
--
2.17.1
v4: - sysfs entry is optee-ta-uuid (Jerome Forissier, Sumit Garg)
- added Documentation/ABI/testing/sysfs-bus-optee-devices (Greg Kroah-Hartman)
v3: - support tee-suppicant restart (Jens Wiklander)
- description and comments (Jarkko Sakkinen)
- do not name optee drivers by index in sysfs (Sumit Garg)
v2: - write TEE with capital letters.
- declare __optee_enumerate_device() as static.
Maxim Uvarov (3):
optee: do drivers initialization before and after tee-supplicant run
optee: use uuid for sysfs driver entry
tpm_ftpm_tee: register driver on TEE bus
.../ABI/testing/sysfs-bus-optee-devices | 8 +++
MAINTAINERS | 2 +
drivers/char/tpm/tpm_ftpm_tee.c | 70 ++++++++++++++++---
drivers/tee/optee/core.c | 28 +++++++-
drivers/tee/optee/device.c | 23 +++---
drivers/tee/optee/optee_private.h | 10 ++-
6 files changed, 118 insertions(+), 23 deletions(-)
create mode 100644 Documentation/ABI/testing/sysfs-bus-optee-devices
--
2.17.1
Hello,
This patchset fixes issues with probing() tee, optee and optee driver
if they were compiled into kernel, built as modules or any mixed
combination.
These changes require optee-os changes which already were merged.
Main corresponding commits are:
https://github.com/OP-TEE/optee_os/commit/9389d8030ef198c9d7b8ab7ea8e877e0a…https://github.com/OP-TEE/optee_os/commit/bc5921cdab538c8ae48422f5ffd600f1c…
optee_enumerate_devices() which discovers Trusted Applications on tee
bus is split up on 2 changes. Do probe of drivers which do not require
userspace support of tee-supplicant and stage two to run drivers with
support of tee-supplicant only after tee supplicant run.
Best regards,
Maxim.
Maxim Uvarov (2):
optee: do drivers initialization before and after tee-supplicant run
tpm_ftpm_tee: register driver on tee bus
drivers/char/tpm/tpm_ftpm_tee.c | 69 ++++++++++++++++++++++++++-----
drivers/tee/optee/core.c | 25 +++++++++--
drivers/tee/optee/device.c | 17 +++++---
drivers/tee/optee/optee_private.h | 8 +++-
4 files changed, 99 insertions(+), 20 deletions(-)
--
2.17.1
This code was using get_user_pages*(), in a "Case 2" scenario
(DMA/RDMA), using the categorization from [1]. That means that it's
time to convert the get_user_pages*() + put_page() calls to
pin_user_pages*() + unpin_user_pages() calls.
There is some helpful background in [2]: basically, this is a small
part of fixing a long-standing disconnect between pinning pages, and
file systems' use of those pages.
[1] Documentation/core-api/pin_user_pages.rst
[2] "Explicit pinning of user-space pages":
https://lwn.net/Articles/807108/
Cc: Jens Wiklander <jens.wiklander(a)linaro.org>
Cc: Sumit Semwal <sumit.semwal(a)linaro.org>
Cc: tee-dev(a)lists.linaro.org
Cc: linux-media(a)vger.kernel.org
Cc: dri-devel(a)lists.freedesktop.org
Cc: linaro-mm-sig(a)lists.linaro.org
Signed-off-by: John Hubbard <jhubbard(a)nvidia.com>
---
Note that I have only compile-tested this patch, although that does
also include cross-compiling for a few other arches.
thanks,
John Hubbard
NVIDIA
drivers/tee/tee_shm.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/drivers/tee/tee_shm.c b/drivers/tee/tee_shm.c
index bd679b72bd05..7dffc42d8d5a 100644
--- a/drivers/tee/tee_shm.c
+++ b/drivers/tee/tee_shm.c
@@ -31,16 +31,13 @@ static void tee_shm_release(struct tee_shm *shm)
poolm->ops->free(poolm, shm);
} else if (shm->flags & TEE_SHM_REGISTER) {
- size_t n;
int rc = teedev->desc->ops->shm_unregister(shm->ctx, shm);
if (rc)
dev_err(teedev->dev.parent,
"unregister shm %p failed: %d", shm, rc);
- for (n = 0; n < shm->num_pages; n++)
- put_page(shm->pages[n]);
-
+ unpin_user_pages(shm->pages, shm->num_pages);
kfree(shm->pages);
}
@@ -226,7 +223,7 @@ struct tee_shm *tee_shm_register(struct tee_context *ctx, unsigned long addr,
goto err;
}
- rc = get_user_pages_fast(start, num_pages, FOLL_WRITE, shm->pages);
+ rc = pin_user_pages_fast(start, num_pages, FOLL_WRITE, shm->pages);
if (rc > 0)
shm->num_pages = rc;
if (rc != num_pages) {
@@ -271,16 +268,13 @@ struct tee_shm *tee_shm_register(struct tee_context *ctx, unsigned long addr,
return shm;
err:
if (shm) {
- size_t n;
-
if (shm->id >= 0) {
mutex_lock(&teedev->mutex);
idr_remove(&teedev->idr, shm->id);
mutex_unlock(&teedev->mutex);
}
if (shm->pages) {
- for (n = 0; n < shm->num_pages; n++)
- put_page(shm->pages[n]);
+ unpin_user_pages(shm->pages, shm->num_pages);
kfree(shm->pages);
}
}
--
2.26.2
Hi Volodymyr,
On Wed, May 13, 2020 at 2:36 AM Volodymyr Babchuk
<vlad.babchuk(a)gmail.com> wrote:
>
> optee_enumerate_devices() can fail for multiple of reasons. For
> example, I encountered issue when Xen OP-TEE mediator NACKed
> PTA_CMD_GET_DEVICES call. This should not result in driver
> initialization error because this is an optional feature.
>
> Thus, it is better to print warning, instead of termination driver
> initialization.
>
> Signed-off-by: Volodymyr Babchuk <vlad.babchuk(a)gmail.com>
> ---
Looks good. Didn't apply directly at latest, but the conflict was easy
enough to resolve.
I'll pick up this in a day unless someone objects.
I'll add a
Fixes: c3fa24af9244 ("tee: optee: add TEE bus device enumeration support")
Line.
Thanks,
Jens
>
> resend: fixed email in s-o-b tag. Sorry for the noise
>
> drivers/tee/optee/core.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
> index 34409c916882..a053930032f2 100644
> --- a/drivers/tee/optee/core.c
> +++ b/drivers/tee/optee/core.c
> @@ -728,10 +728,8 @@ static int __init optee_driver_init(void)
> return PTR_ERR(optee);
>
> rc = optee_enumerate_devices();
> - if (rc) {
> - optee_remove(optee);
> - return rc;
> - }
> + if (rc)
> + pr_warn("can't enumerate optee devices: %d\n", rc);
>
> pr_info("initialized driver\n");
>
> --
> 2.26.2
>
[BCC all OP-TEE maintainers]
Hi OP-TEE maintainers & contributors,
We're about to make another OP-TEE release, namely: 3.9.0. Target is
Friday, May 22th which leaves us almost 3 weeks to finalize the
release.
Please start testing your favorite platform(s) and report any issue in
this pull request [1]. I will create a release candidate tag one week
before the release date, at which point we will do some more testing and
I will collect Tested-by tags in the same pull request.
[1] https://github.com/OP-TEE/optee_os/pull/3833
Thanks!
Regards,
Jens
Hello arm-soc maintainers,
Please pull these patches enabling Global Platform client UUID generation
for the OP-TEE driver.
Thanks,
Jens
The following changes since commit ae83d0b416db002fe95601e7f97f64b59514d936:
Linux 5.7-rc2 (2020-04-19 14:35:30 -0700)
are available in the Git repository at:
git://git.linaro.org/people/jens.wiklander/linux-tee.git tags/tee-login-for-5.8
for you to fetch changes up to c5b4312bea5d5e5e3d4f0af640e2ef8a1c1bb167:
tee: optee: Add support for session login client UUID generation (2020-05-11 14:11:33 +0200)
----------------------------------------------------------------
Adds utility function in TEE subsystem for client UUID generation. This
function is also used in the optee driver.
----------------------------------------------------------------
Vesa Jääskeläinen (2):
tee: add support for session's client UUID generation
tee: optee: Add support for session login client UUID generation
drivers/tee/Kconfig | 1 +
drivers/tee/optee/call.c | 6 +-
drivers/tee/tee_core.c | 152 +++++++++++++++++++++++++++++++++++++++++++++++
include/linux/tee_drv.h | 16 +++++
4 files changed, 174 insertions(+), 1 deletion(-)