From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1941C48BCF for ; Wed, 9 Jun 2021 16:04:21 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A5E1F610F8 for ; Wed, 9 Jun 2021 16:04:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A5E1F610F8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=VtjM/Wn/JYyYkUvro9YQrQHnhhQigJarMqNsTAEDkeE=; b=ItioCeuSiWEVKZ bw/P7n/EizeVV0cVA3Lsk4VU72NFRQKGv7aMJ3iUZzpmGmDzl2pEA4MGRC32PF6D1NQLYcScMLVyv 2mlRw2eyYwlvWHEqhjvgmkfQoxki3sEzVmqcUZTAa3qsH3XME9UT0D59rseA9Z1riuHm40itAIvcs pm0ybxGwKeGVvjpywj4IDI1xl7ONJzGzolANkzIJAbi4mxSldIl79YaUG6PbCOorrkqfGoUZ5e1+4 agbeuTDQAcF6CZapxZQXNIFDczwKNiLYEC+WfyBsi3VXFF7u9syfEcj+/kydjeP7o5jQlBEjJcfFl uFz2SLpicJMq/lbHVCTg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lr0ey-00Elf6-C6; Wed, 09 Jun 2021 16:02:29 +0000 Received: from linux.microsoft.com ([13.77.154.182]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqzYB-00EPnT-48 for linux-arm-kernel@lists.infradead.org; Wed, 09 Jun 2021 14:51:24 +0000 Received: from sequoia (162-237-133-238.lightspeed.rcsntx.sbcglobal.net [162.237.133.238]) by linux.microsoft.com (Postfix) with ESMTPSA id C2EF320B7188; Wed, 9 Jun 2021 07:51:21 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com C2EF320B7188 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1623250282; bh=NeJm9Sv8T7FXNiunLp/bvLL/Ts+yZdRrx9+3BOizJYo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Im2bNCAoGQsV+pp/wA4+jYTFrlKIeZ6z1AjrrfXLMo9fbn8UkuXcZsaZt/7NqA6kk 5W+qebRTmAATVGPnKzrs+AbgmxQwjhJNowWhVpojhYeUoa/B+S771VpBTh30b8Dkwe MODYzUioElbeF29xxAUMLJCQcdrY3Mv9konmw/qQ= Date: Wed, 9 Jun 2021 09:51:19 -0500 From: Tyler Hicks To: Jens Wiklander Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, op-tee@lists.trustedfirmware.org, Sumit Garg , Herbert Xu , Sakkinen , Sasha Levin , Thirupathaiah Annapureddy , Vikas Gupta , "David S . Miller" Subject: Re: [PATCH 3/7] tee: add tee_shm_alloc_kernel_buf() Message-ID: <20210609145119.GG4910@sequoia> References: <20210609102324.2222332-1-jens.wiklander@linaro.org> <20210609102324.2222332-4-jens.wiklander@linaro.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210609102324.2222332-4-jens.wiklander@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210609_075123_234354_7C273998 X-CRM114-Status: GOOD ( 17.86 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 Reviewed-by: Tyler Hicks 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