All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Wiklander <jens.wiklander@linaro.org>
To: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
Cc: linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, tee-dev@lists.linaro.org,
	Volodymyr Babchuk <vlad.babchuk@gmail.com>
Subject: Re: [RESEND PATCH v2 00/14] tee: optee: add dynamic shared memory support
Date: Wed, 6 Dec 2017 15:32:42 +0100	[thread overview]
Message-ID: <20171206143241.jjk5vq23wqid3woi@jax> (raw)
In-Reply-To: <1511959718-5421-1-git-send-email-volodymyr_babchuk@epam.com>

On Wed, Nov 29, 2017 at 02:48:24PM +0200, Volodymyr Babchuk wrote:
> From: Volodymyr Babchuk <vlad.babchuk@gmail.com>
> 
> Hello all,
> 
> This is resend of OP-TEE dynamic SHM series. No changes
> from last time. Correct version is used in the subject.
> 
> ---
> Changes from v1:
> 
>  * Added support for 16K and 64K pages.  Elaborated commit messages
>  * More minor changes are described in corresponding patches.
> 
> While this patches are necessary for use OP-TEE in virualized
> environment, they are not sufficient. Stuart Yoder was right, when
> proposed to make static SHM optional. But that would be a breaking
> change, because this will render unusable older client libraries and
> supplicants.
> 
> Also, as Mark Rutland pointed, OP-TEE virtualization will need support
> from hypervisor side.
> 
> Anyways, those patches allowed me to call OP-TEE from XEN's Dom0
> without remapping static SHM region into Dom0 userspace.
> 
> Also, this patches allow me to share quite big buffers (I tried to use
> three 2M buffers at a time). This is imposible with static SHM,
> because static SHM on most platforms is only 2M.
> 
> Thanks to Yury Norov <ynorov@caviumnetworks.com> and
> Mark Rutland <mark.rutland@arm.com> for reviewing this patch series.
> 
> ---
> v1 cover letter:
> This patch series enables dynamic shared memory support in the TEE
> subsystem as a whole and in OP-TEE in particular.
> 
> Global Platform TEE specification [1] allows client applications
> to register part of own memory as a shared buffer between
> application and TEE. This allows fast zero-copy communication between
> TEE and REE. But current implementation of TEE in Linux does not support
> this feature.
> 
> Also, current implementation of OP-TEE transport uses fixed size
> pre-shared buffer for all communications with OP-TEE OS. This is okay
> in the most use cases. But this prevents use of OP-TEE in virtualized
> environments, because:
>  a) We can't share the same buffer between different virtual machines
>  b) Physically contiguous memory as seen by VM can be non-contiguous
>     in reality (and as seen by OP-TEE OS) due to second stage of
>     MMU translation.
>  c) Size of this pre-shared buffer is limited.
> 
> So, first part of this patch series adds generic register/unregister
> interface to tee subsystem. Next patches add necessary features
> into OP-TEE driver, so it can use not only static pre-shared buffer,
> but whole RAM to communicate with OP-TEE OS.
> 
> [1] https://www.globalplatform.org/specificationsdevice.asp
> 
> Jens Wiklander (2):
>   tee: flexible shared memory  pool creation
>   tee: add register user memory
> 
> Volodymyr Babchuk (12):
>   tee: shm: add accessors for buffer size and page offset
>   tee: shm: add page accessor functions
>   tee: optee: Update protocol definitions
>   tee: optee: add page list manipulation functions
>   tee: optee: add shared buffer registration functions
>   tee: optee: add registered shared parameters handling
>   tee: optee: add registered buffers handling into RPC calls
>   tee: optee: store OP-TEE capabilities in private data
>   tee: optee: add optee-specific shared pool implementation
>   tee: optee: enable dynamic SHM support
>   tee: use reference counting for tee_context
>   tee: shm: inline tee_shm_get_id()
> 
>  drivers/tee/optee/Makefile        |   1 +
>  drivers/tee/optee/call.c          | 179 +++++++++++++++++++++++++++++-
>  drivers/tee/optee/core.c          | 152 +++++++++++++++++++------
>  drivers/tee/optee/optee_msg.h     |  38 ++++++-
>  drivers/tee/optee/optee_private.h |  27 ++++-
>  drivers/tee/optee/optee_smc.h     |   7 ++
>  drivers/tee/optee/rpc.c           |  77 +++++++++++--
>  drivers/tee/optee/shm_pool.c      |  75 +++++++++++++
>  drivers/tee/optee/shm_pool.h      |  23 ++++
>  drivers/tee/tee_core.c            |  81 ++++++++++++--
>  drivers/tee/tee_private.h         |  60 +---------
>  drivers/tee/tee_shm.c             | 227 +++++++++++++++++++++++++++++++-------
>  drivers/tee/tee_shm_pool.c        | 165 ++++++++++++++++-----------
>  include/linux/tee_drv.h           | 183 +++++++++++++++++++++++++++++-
>  include/uapi/linux/tee.h          |  30 +++++
>  15 files changed, 1104 insertions(+), 221 deletions(-)
>  create mode 100644 drivers/tee/optee/shm_pool.c
>  create mode 100644 drivers/tee/optee/shm_pool.h
> 
> -- 
> 2.7.4
> 

This looks good to me. I've been testing this for quite some time now.
If there's no further comments I'll pick it up send it in a pull request
to arm-soc.

Thanks,
Jens

WARNING: multiple messages have this Message-ID (diff)
From: jens.wiklander@linaro.org (Jens Wiklander)
To: linux-arm-kernel@lists.infradead.org
Subject: [RESEND PATCH v2 00/14] tee: optee: add dynamic shared memory support
Date: Wed, 6 Dec 2017 15:32:42 +0100	[thread overview]
Message-ID: <20171206143241.jjk5vq23wqid3woi@jax> (raw)
In-Reply-To: <1511959718-5421-1-git-send-email-volodymyr_babchuk@epam.com>

On Wed, Nov 29, 2017 at 02:48:24PM +0200, Volodymyr Babchuk wrote:
> From: Volodymyr Babchuk <vlad.babchuk@gmail.com>
> 
> Hello all,
> 
> This is resend of OP-TEE dynamic SHM series. No changes
> from last time. Correct version is used in the subject.
> 
> ---
> Changes from v1:
> 
>  * Added support for 16K and 64K pages.  Elaborated commit messages
>  * More minor changes are described in corresponding patches.
> 
> While this patches are necessary for use OP-TEE in virualized
> environment, they are not sufficient. Stuart Yoder was right, when
> proposed to make static SHM optional. But that would be a breaking
> change, because this will render unusable older client libraries and
> supplicants.
> 
> Also, as Mark Rutland pointed, OP-TEE virtualization will need support
> from hypervisor side.
> 
> Anyways, those patches allowed me to call OP-TEE from XEN's Dom0
> without remapping static SHM region into Dom0 userspace.
> 
> Also, this patches allow me to share quite big buffers (I tried to use
> three 2M buffers at a time). This is imposible with static SHM,
> because static SHM on most platforms is only 2M.
> 
> Thanks to Yury Norov <ynorov@caviumnetworks.com> and
> Mark Rutland <mark.rutland@arm.com> for reviewing this patch series.
> 
> ---
> v1 cover letter:
> This patch series enables dynamic shared memory support in the TEE
> subsystem as a whole and in OP-TEE in particular.
> 
> Global Platform TEE specification [1] allows client applications
> to register part of own memory as a shared buffer between
> application and TEE. This allows fast zero-copy communication between
> TEE and REE. But current implementation of TEE in Linux does not support
> this feature.
> 
> Also, current implementation of OP-TEE transport uses fixed size
> pre-shared buffer for all communications with OP-TEE OS. This is okay
> in the most use cases. But this prevents use of OP-TEE in virtualized
> environments, because:
>  a) We can't share the same buffer between different virtual machines
>  b) Physically contiguous memory as seen by VM can be non-contiguous
>     in reality (and as seen by OP-TEE OS) due to second stage of
>     MMU translation.
>  c) Size of this pre-shared buffer is limited.
> 
> So, first part of this patch series adds generic register/unregister
> interface to tee subsystem. Next patches add necessary features
> into OP-TEE driver, so it can use not only static pre-shared buffer,
> but whole RAM to communicate with OP-TEE OS.
> 
> [1] https://www.globalplatform.org/specificationsdevice.asp
> 
> Jens Wiklander (2):
>   tee: flexible shared memory  pool creation
>   tee: add register user memory
> 
> Volodymyr Babchuk (12):
>   tee: shm: add accessors for buffer size and page offset
>   tee: shm: add page accessor functions
>   tee: optee: Update protocol definitions
>   tee: optee: add page list manipulation functions
>   tee: optee: add shared buffer registration functions
>   tee: optee: add registered shared parameters handling
>   tee: optee: add registered buffers handling into RPC calls
>   tee: optee: store OP-TEE capabilities in private data
>   tee: optee: add optee-specific shared pool implementation
>   tee: optee: enable dynamic SHM support
>   tee: use reference counting for tee_context
>   tee: shm: inline tee_shm_get_id()
> 
>  drivers/tee/optee/Makefile        |   1 +
>  drivers/tee/optee/call.c          | 179 +++++++++++++++++++++++++++++-
>  drivers/tee/optee/core.c          | 152 +++++++++++++++++++------
>  drivers/tee/optee/optee_msg.h     |  38 ++++++-
>  drivers/tee/optee/optee_private.h |  27 ++++-
>  drivers/tee/optee/optee_smc.h     |   7 ++
>  drivers/tee/optee/rpc.c           |  77 +++++++++++--
>  drivers/tee/optee/shm_pool.c      |  75 +++++++++++++
>  drivers/tee/optee/shm_pool.h      |  23 ++++
>  drivers/tee/tee_core.c            |  81 ++++++++++++--
>  drivers/tee/tee_private.h         |  60 +---------
>  drivers/tee/tee_shm.c             | 227 +++++++++++++++++++++++++++++++-------
>  drivers/tee/tee_shm_pool.c        | 165 ++++++++++++++++-----------
>  include/linux/tee_drv.h           | 183 +++++++++++++++++++++++++++++-
>  include/uapi/linux/tee.h          |  30 +++++
>  15 files changed, 1104 insertions(+), 221 deletions(-)
>  create mode 100644 drivers/tee/optee/shm_pool.c
>  create mode 100644 drivers/tee/optee/shm_pool.h
> 
> -- 
> 2.7.4
> 

This looks good to me. I've been testing this for quite some time now.
If there's no further comments I'll pick it up send it in a pull request
to arm-soc.

Thanks,
Jens

  parent reply	other threads:[~2017-12-06 14:33 UTC|newest]

Thread overview: 128+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-28 18:03 [PATCH v1 00/14] tee: optee: add dynamic shared memory support Volodymyr Babchuk
2017-09-28 18:03 ` Volodymyr Babchuk
2017-09-28 18:03 ` [PATCH v1 01/14] tee: flexible shared memory pool creation Volodymyr Babchuk
2017-09-28 18:03   ` Volodymyr Babchuk
2017-09-28 18:03 ` [PATCH v1 02/14] tee: add register user memory Volodymyr Babchuk
2017-09-28 18:03   ` Volodymyr Babchuk
2017-09-29 10:53   ` Mark Rutland
2017-09-29 10:53     ` Mark Rutland
2017-09-29 15:19     ` Volodymyr Babchuk
2017-09-29 15:19       ` Volodymyr Babchuk
2017-09-28 18:04 ` [PATCH v1 03/14] tee: shm: add accessors for buffer size and page offset Volodymyr Babchuk
2017-09-28 18:04   ` Volodymyr Babchuk
2017-09-28 18:04 ` [PATCH v1 04/14] tee: shm: add page accessor functions Volodymyr Babchuk
2017-09-28 18:04   ` Volodymyr Babchuk
2017-09-28 22:14   ` Yury Norov
2017-09-28 22:14     ` Yury Norov
2017-09-29 10:17     ` Volodymyr Babchuk
2017-09-29 10:17       ` Volodymyr Babchuk
2017-09-28 18:04 ` [PATCH v1 05/14] tee: optee: Update protocol definitions Volodymyr Babchuk
2017-09-28 18:04   ` Volodymyr Babchuk
2017-09-28 18:04 ` [PATCH v1 06/14] tee: optee: add page list manipulation functions Volodymyr Babchuk
2017-09-28 18:04   ` Volodymyr Babchuk
2017-09-29  0:23   ` Yury Norov
2017-09-29  0:23     ` Yury Norov
2017-09-29 10:34     ` Volodymyr Babchuk
2017-09-29 10:34       ` Volodymyr Babchuk
2017-09-29 16:23       ` Yury Norov
2017-09-29 16:23         ` Yury Norov
2017-09-29 13:00   ` Mark Rutland
2017-09-29 13:00     ` Mark Rutland
2017-09-28 18:04 ` [PATCH v1 07/14] tee: optee: add shared buffer registration functions Volodymyr Babchuk
2017-09-28 18:04   ` Volodymyr Babchuk
2017-09-29 13:06   ` Mark Rutland
2017-09-29 13:06     ` Mark Rutland
2017-09-29 15:37     ` Volodymyr Babchuk
2017-09-29 15:37       ` Volodymyr Babchuk
2017-09-28 18:04 ` [PATCH v1 08/14] tee: optee: add registered shared parameters handling Volodymyr Babchuk
2017-09-28 18:04   ` Volodymyr Babchuk
2017-09-28 18:04 ` [PATCH v1 09/14] tee: optee: add registered buffers handling into RPC calls Volodymyr Babchuk
2017-09-28 18:04   ` Volodymyr Babchuk
2017-09-28 18:04 ` [PATCH v1 10/14] tee: optee: store OP-TEE capabilities in private data Volodymyr Babchuk
2017-09-28 18:04   ` Volodymyr Babchuk
2017-09-28 18:04 ` [PATCH v1 11/14] tee: optee: add optee-specific shared pool implementation Volodymyr Babchuk
2017-09-28 18:04   ` Volodymyr Babchuk
2017-09-28 18:04 ` [PATCH v1 12/14] tee: optee: enable dynamic SHM support Volodymyr Babchuk
2017-09-28 18:04   ` Volodymyr Babchuk
2017-10-03 16:06   ` [Tee-dev] " Stuart Yoder
2017-10-03 16:06     ` Stuart Yoder
2017-10-04 11:49     ` Jens Wiklander
2017-10-04 11:49       ` Jens Wiklander
2017-09-28 18:04 ` [PATCH v1 13/14] tee: use reference counting for tee_context Volodymyr Babchuk
2017-09-28 18:04   ` Volodymyr Babchuk
2017-09-28 18:04 ` [PATCH v1 14/14] tee: shm: inline tee_shm getter functions Volodymyr Babchuk
2017-09-28 18:04   ` Volodymyr Babchuk
2017-09-29  0:50   ` Yury Norov
2017-09-29  0:50     ` Yury Norov
2017-09-29 10:31 ` [PATCH v1 00/14] tee: optee: add dynamic shared memory support Mark Rutland
2017-09-29 10:31   ` Mark Rutland
2017-09-29 10:51   ` Volodymyr Babchuk
2017-09-29 10:51     ` Volodymyr Babchuk
2017-10-03 16:05 ` [Tee-dev] " Stuart Yoder
2017-10-03 16:05   ` Stuart Yoder
2017-10-04 17:23   ` Volodymyr Babchuk
2017-10-04 17:23     ` Volodymyr Babchuk
2017-10-13 19:32 ` Volodymyr Babchuk
2017-10-13 19:32   ` Volodymyr Babchuk
2017-10-13 19:32   ` [PATCH v1 01/14] tee: flexible shared memory pool creation Volodymyr Babchuk
2017-10-13 19:32     ` Volodymyr Babchuk
2017-10-13 19:32   ` [PATCH v1 02/14] tee: add register user memory Volodymyr Babchuk
2017-10-13 19:32     ` Volodymyr Babchuk
2017-10-13 19:32   ` [PATCH v1 03/14] tee: shm: add accessors for buffer size and page offset Volodymyr Babchuk
2017-10-13 19:32     ` Volodymyr Babchuk
2017-10-13 19:32   ` [PATCH v1 04/14] tee: shm: add page accessor functions Volodymyr Babchuk
2017-10-13 19:32     ` Volodymyr Babchuk
2017-10-13 19:32   ` [PATCH v1 05/14] tee: optee: Update protocol definitions Volodymyr Babchuk
2017-10-13 19:32     ` Volodymyr Babchuk
2017-10-13 19:32   ` [PATCH v1 06/14] tee: optee: add page list manipulation functions Volodymyr Babchuk
2017-10-13 19:32     ` Volodymyr Babchuk
2017-10-13 19:32   ` [PATCH v1 07/14] tee: optee: add shared buffer registration functions Volodymyr Babchuk
2017-10-13 19:32     ` Volodymyr Babchuk
2017-10-13 19:32   ` [PATCH v1 08/14] tee: optee: add registered shared parameters handling Volodymyr Babchuk
2017-10-13 19:32     ` Volodymyr Babchuk
2017-10-13 19:32   ` [PATCH v1 09/14] tee: optee: add registered buffers handling into RPC calls Volodymyr Babchuk
2017-10-13 19:32     ` Volodymyr Babchuk
2017-10-13 19:32   ` [PATCH v1 10/14] tee: optee: store OP-TEE capabilities in private data Volodymyr Babchuk
2017-10-13 19:32     ` Volodymyr Babchuk
2017-10-13 19:32   ` [PATCH v1 11/14] tee: optee: add optee-specific shared pool implementation Volodymyr Babchuk
2017-10-13 19:32     ` Volodymyr Babchuk
2017-10-13 19:32   ` [PATCH v1 12/14] tee: optee: enable dynamic SHM support Volodymyr Babchuk
2017-10-13 19:32     ` Volodymyr Babchuk
2017-10-13 19:32   ` [PATCH v1 13/14] tee: use reference counting for tee_context Volodymyr Babchuk
2017-10-13 19:32     ` Volodymyr Babchuk
2017-10-13 19:32   ` [PATCH v1 14/14] tee: shm: inline tee_shm_get_id() Volodymyr Babchuk
2017-10-13 19:32     ` Volodymyr Babchuk
2017-10-13 19:40   ` [PATCH v1 00/14] tee: optee: add dynamic shared memory support Volodymyr Babchuk
2017-10-13 19:40     ` Volodymyr Babchuk
2017-11-29 12:48   ` [RESEND PATCH v2 " Volodymyr Babchuk
2017-11-29 12:48     ` Volodymyr Babchuk
2017-11-29 12:48     ` [RESEND PATCH v2 01/14] tee: flexible shared memory pool creation Volodymyr Babchuk
2017-11-29 12:48       ` Volodymyr Babchuk
2017-11-29 12:48     ` [RESEND PATCH v2 02/14] tee: add register user memory Volodymyr Babchuk
2017-11-29 12:48       ` Volodymyr Babchuk
2017-11-29 12:48     ` [RESEND PATCH v2 03/14] tee: shm: add accessors for buffer size and page offset Volodymyr Babchuk
2017-11-29 12:48       ` Volodymyr Babchuk
2017-11-29 12:48     ` [RESEND PATCH v2 04/14] tee: shm: add page accessor functions Volodymyr Babchuk
2017-11-29 12:48       ` Volodymyr Babchuk
2017-11-29 12:48     ` [RESEND PATCH v2 05/14] tee: optee: Update protocol definitions Volodymyr Babchuk
2017-11-29 12:48       ` Volodymyr Babchuk
2017-11-29 12:48     ` [RESEND PATCH v2 06/14] tee: optee: add page list manipulation functions Volodymyr Babchuk
2017-11-29 12:48       ` Volodymyr Babchuk
2017-11-29 12:48     ` [RESEND PATCH v2 07/14] tee: optee: add shared buffer registration functions Volodymyr Babchuk
2017-11-29 12:48       ` Volodymyr Babchuk
2017-11-29 12:48     ` [RESEND PATCH v2 08/14] tee: optee: add registered shared parameters handling Volodymyr Babchuk
2017-11-29 12:48       ` Volodymyr Babchuk
2017-11-29 12:48     ` [RESEND PATCH v2 09/14] tee: optee: add registered buffers handling into RPC calls Volodymyr Babchuk
2017-11-29 12:48       ` Volodymyr Babchuk
2017-11-29 12:48     ` [RESEND PATCH v2 10/14] tee: optee: store OP-TEE capabilities in private data Volodymyr Babchuk
2017-11-29 12:48       ` Volodymyr Babchuk
2017-11-29 12:48     ` [RESEND PATCH v2 11/14] tee: optee: add optee-specific shared pool implementation Volodymyr Babchuk
2017-11-29 12:48       ` Volodymyr Babchuk
2017-11-29 12:48     ` [RESEND PATCH v2 12/14] tee: optee: enable dynamic SHM support Volodymyr Babchuk
2017-11-29 12:48       ` Volodymyr Babchuk
2017-11-29 12:48     ` [RESEND PATCH v2 13/14] tee: use reference counting for tee_context Volodymyr Babchuk
2017-11-29 12:48       ` Volodymyr Babchuk
2017-11-29 12:48     ` [RESEND PATCH v2 14/14] tee: shm: inline tee_shm_get_id() Volodymyr Babchuk
2017-11-29 12:48       ` Volodymyr Babchuk
2017-12-06 14:32     ` Jens Wiklander [this message]
2017-12-06 14:32       ` [RESEND PATCH v2 00/14] tee: optee: add dynamic shared memory support Jens Wiklander

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171206143241.jjk5vq23wqid3woi@jax \
    --to=jens.wiklander@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tee-dev@lists.linaro.org \
    --cc=vlad.babchuk@gmail.com \
    --cc=volodymyr_babchuk@epam.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.