Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752155AbdI2NIN (ORCPT ); Fri, 29 Sep 2017 09:08:13 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:43472 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751349AbdI2NIL (ORCPT ); Fri, 29 Sep 2017 09:08:11 -0400 Date: Fri, 29 Sep 2017 14:06:43 +0100 From: Mark Rutland To: Volodymyr Babchuk Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, tee-dev@lists.linaro.org, Jens Wiklander , Volodymyr Babchuk Subject: Re: [PATCH v1 07/14] tee: optee: add shared buffer registration functions Message-ID: <20170929130643.GE5781@leverpostej> References: <1506621851-6929-1-git-send-email-volodymyr_babchuk@epam.com> <1506621851-6929-8-git-send-email-volodymyr_babchuk@epam.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1506621851-6929-8-git-send-email-volodymyr_babchuk@epam.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1397 Lines: 38 On Thu, Sep 28, 2017 at 09:04:04PM +0300, Volodymyr Babchuk wrote: > From: Volodymyr Babchuk > > This change adds ops for shm_(un)register functions in tee interface. > Client application can use these functions to (un)register an own shared > buffer in OP-TEE address space. This allows zero copy data sharing between > Normal and Secure Worlds. > > Please note that while those functions were added to optee code, > it does not report to userspace that those functions are available. > OP-TEE code does not set TEE_GEN_CAP_REG_MEM flag. This flag will be > enabled only after all other features of dynamic shared memory will be > implemented in subsequent patches. While it's not adveritsed to the user, AFAICT the user could still invoke these via ioctls, right? Is there a problem if the user were to do so, or is it simply not useful without the other features? [...] > +int optee_shm_register(struct tee_context *ctx, struct tee_shm *shm, > + struct page **pages, size_t num_pages) > +{ > + pages_array = optee_allocate_pages_array(num_pages); > + if (!pages_array) > + return -ENOMEM; > + msg_arg->params->u.tmem.buf_ptr = virt_to_phys(pages_array) | > + tee_shm_get_page_offset(shm); This doesn't look right. Why is the shm page offset being orred-in to the pages_array physical address? They're completely separate objects. Thanks, Mark.