linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Tyler Hicks <tyhicks@linux.microsoft.com>
To: Jens Wiklander <jens.wiklander@linaro.org>
Cc: linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	op-tee@lists.trustedfirmware.org,
	Sumit Garg <sumit.garg@linaro.org>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	Sakkinen <jarkko.sakkinen@linux.intel.com>,
	Sasha Levin <sashal@kernel.org>,
	Thirupathaiah Annapureddy <thiruan@microsoft.com>,
	Vikas Gupta <vikas.gupta@broadcom.com>,
	"David S . Miller" <davem@davemloft.net>
Subject: Re: [PATCH 3/7] tee: add tee_shm_alloc_kernel_buf()
Date: Wed, 9 Jun 2021 09:51:19 -0500	[thread overview]
Message-ID: <20210609145119.GG4910@sequoia> (raw)
In-Reply-To: <20210609102324.2222332-4-jens.wiklander@linaro.org>

On 2021-06-09 12:23:20, Jens Wiklander wrote:
> Adds a new function tee_shm_alloc_kernel_buf() to allocate shared memory
> from a kernel driver. This function can later be made more lightweight
> by unnecessary dma-buf export.
> 
> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>

Reviewed-by: Tyler Hicks <tyhicks@linux.microsoft.com>

Tyler

> ---
>  drivers/tee/tee_shm.c   | 18 ++++++++++++++++++
>  include/linux/tee_drv.h |  1 +
>  2 files changed, 19 insertions(+)
> 
> diff --git a/drivers/tee/tee_shm.c b/drivers/tee/tee_shm.c
> index b9dbf4bce149..63fce8d39d8b 100644
> --- a/drivers/tee/tee_shm.c
> +++ b/drivers/tee/tee_shm.c
> @@ -192,6 +192,24 @@ struct tee_shm *tee_shm_alloc(struct tee_context *ctx, size_t size, u32 flags)
>  }
>  EXPORT_SYMBOL_GPL(tee_shm_alloc);
>  
> +/**
> + * tee_shm_alloc_kernel_buf() - Allocate shared memory for kernel buffer
> + * @ctx:	Context that allocates the shared memory
> + * @size:	Requested size of shared memory
> + *
> + * The returned memory registered in secure world and is suitable to be
> + * passed as a memory buffer in parameter argument to
> + * tee_client_invoke_func(). The memory allocated is later freed with a
> + * call to tee_shm_free().
> + *
> + * @returns a pointer to 'struct tee_shm'
> + */
> +struct tee_shm *tee_shm_alloc_kernel_buf(struct tee_context *ctx, size_t size)
> +{
> +	return tee_shm_alloc(ctx, size, TEE_SHM_MAPPED | TEE_SHM_DMA_BUF);
> +}
> +EXPORT_SYMBOL_GPL(tee_shm_alloc_kernel_buf);
> +
>  struct tee_shm *tee_shm_register(struct tee_context *ctx, unsigned long addr,
>  				 size_t length, u32 flags)
>  {
> diff --git a/include/linux/tee_drv.h b/include/linux/tee_drv.h
> index 62b7c7a55743..58b319766f8e 100644
> --- a/include/linux/tee_drv.h
> +++ b/include/linux/tee_drv.h
> @@ -282,6 +282,7 @@ void *tee_get_drvdata(struct tee_device *teedev);
>   * @returns a pointer to 'struct tee_shm'
>   */
>  struct tee_shm *tee_shm_alloc(struct tee_context *ctx, size_t size, u32 flags);
> +struct tee_shm *tee_shm_alloc_kernel_buf(struct tee_context *ctx, size_t size);
>  
>  /**
>   * tee_shm_register() - Register shared memory buffer
> -- 
> 2.31.1
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-06-09 16:04 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-09 10:23 [PATCH 0/7] tee: shared memory updates Jens Wiklander
2021-06-09 10:23 ` [PATCH 1/7] tee: remove unused tee_shm_pool_alloc_res_mem() Jens Wiklander
2021-06-09 14:03   ` Tyler Hicks
2021-06-09 10:23 ` [PATCH 2/7] tee: simplify shm pool handling Jens Wiklander
2021-06-09 14:50   ` Tyler Hicks
2021-06-10  9:01     ` Jens Wiklander
2021-06-09 10:23 ` [PATCH 3/7] tee: add tee_shm_alloc_kernel_buf() Jens Wiklander
2021-06-09 14:51   ` Tyler Hicks [this message]
2021-06-09 10:23 ` [PATCH 4/7] hwrng: optee-rng: use tee_shm_alloc_kernel_buf() Jens Wiklander
2021-06-09 14:51   ` Tyler Hicks
2021-06-09 10:23 ` [PATCH 5/7] tpm_ftpm_tee: " Jens Wiklander
2021-06-09 14:53   ` Tyler Hicks
2021-06-09 10:23 ` [PATCH 6/7] firmware: tee_bnxt: " Jens Wiklander
2021-06-09 14:58   ` Tyler Hicks
2021-06-10  9:08     ` Jens Wiklander
2021-06-09 10:23 ` [PATCH 7/7] tee: replace tee_shm_alloc() Jens Wiklander
2021-06-09 15:32   ` Tyler Hicks
2021-06-09 15:38     ` Tyler Hicks
2021-06-11  7:42     ` 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=20210609145119.GG4910@sequoia \
    --to=tyhicks@linux.microsoft.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=jarkko.sakkinen@linux.intel.com \
    --cc=jens.wiklander@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=op-tee@lists.trustedfirmware.org \
    --cc=sashal@kernel.org \
    --cc=sumit.garg@linaro.org \
    --cc=thiruan@microsoft.com \
    --cc=vikas.gupta@broadcom.com \
    --subject='Re: [PATCH 3/7] tee: add tee_shm_alloc_kernel_buf()' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).