From patchwork Fri Oct 13 19:32:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Volodymyr Babchuk X-Patchwork-Id: 10005901 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 752D860325 for ; Fri, 13 Oct 2017 20:52:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6457C2884B for ; Fri, 13 Oct 2017 20:52:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5902E2913A; Fri, 13 Oct 2017 20:52:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BEDDC2884B for ; Fri, 13 Oct 2017 20:52:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=tbqcHv03aT9RKn5sw82BMsR1TvUwxWnEF0hU5xkStUo=; b=nx/fwwR9ttc92Y kIO9vhoRo/zZY7opvl2oQAspjgYOP703ke+GvNXOhsEx7JqoqBA4nd9/sKCZanBf9hO8VtcnIIC+X 8xGJVkmnde7edsorONtZU/nTDDwjicnW9UcpC1+dxZs0iDdMeBFZgD9Zj9Gr6qRve8dY13kSO3RdR 4avNoF4yeZXERutBFQmU+t0xuJ+sWRhCwZFu7i69LGP5n327kMEJ4BlicEF8mtBLKO0lJ4zrZTUmZ g0T6bRAPBpP36Zgnbn0yQQUX/kB3Jf1BcbrzO0Unzobek0swdNJ0kAw3cYVQOnYs9RiHUcS397yC1 JYmK3NVnM9ssuebqkFxg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1e36wW-00079R-6q; Fri, 13 Oct 2017 20:52:28 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e36tT-0004kf-Sh for linux-arm-kernel@bombadil.infradead.org; Fri, 13 Oct 2017 20:49:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Type:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=/y+Dxe5/kAv72LmW5t5pKqqRIOjFvWlr9VABR7yNikc=; b=PHTCoPixnuQquFPP5wo/RpHu/ FtABd/9kxaiP2JLSAQnpe2mkXaWo5Mjxu6hE18vcYKYOtLhNdfNYbKtQmS0Yh0vnGkyhdLIhPvUsa Tw5d7m9rSSPe+fn1urwxlfqNs38/jCdun8kxd4dHZzliiKgcVhYc0SzFhP1PGyEaa9lK+uyT4FqWw GaPaRm0IrBqap/08iYopjQCD38YtnfI8onDKV1NiOYJ0OXBoHNpSI731RbDiB0tSbf+g443e3sZ0O fBVxLR+QwWtR98rTJLpgOj3hDnadebVmeCcqqV1aREDe+X17N7FeiXY/yhgG01544hycwQ5UuIM3O FhquORnGg==; Received: from mail-eopbgr40074.outbound.protection.outlook.com ([40.107.4.74] helo=EUR03-DB5-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e35iv-00047o-7Y for linux-arm-kernel@lists.infradead.org; Fri, 13 Oct 2017 19:34:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=EPAM.onmicrosoft.com; s=selector1-epam-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=/y+Dxe5/kAv72LmW5t5pKqqRIOjFvWlr9VABR7yNikc=; b=NZU6j/+d1dDOAQ5o3MaHsl3EdkSZfFvzFFQr73EU6u3wp8X5lZIqjntXC6Mjfl8ZFCdfRbwvVB0B548uM3FLukjcMIraM61GbQnSW70xSuz6kiAOQfsSZjcE0m7sDiVHGUUa/s0UIyTBcqv70cGzxyRSgH9OKqkoukv/y6Od/3I= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Volodymyr_Babchuk@epam.com; Received: from EPUAKYIW2556.kyiv.epam.com (85.223.209.52) by AM4PR0301MB2132.eurprd03.prod.outlook.com (2603:10a6:200:4d::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Fri, 13 Oct 2017 19:33:53 +0000 Received: by EPUAKYIW2556.kyiv.epam.com (sSMTP sendmail emulation); Fri, 13 Oct 2017 22:33:49 +0300 From: Volodymyr Babchuk To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, tee-dev@lists.linaro.org, Jens Wiklander Subject: [PATCH v1 07/14] tee: optee: add shared buffer registration functions Date: Fri, 13 Oct 2017 22:32:37 +0300 Message-Id: <1507923164-12796-8-git-send-email-volodymyr_babchuk@epam.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1507923164-12796-1-git-send-email-volodymyr_babchuk@epam.com> References: <1506621851-6929-1-git-send-email-volodymyr_babchuk@epam.com> <1507923164-12796-1-git-send-email-volodymyr_babchuk@epam.com> MIME-Version: 1.0 X-Originating-IP: [85.223.209.52] X-ClientProxiedBy: VI1PR08CA0110.eurprd08.prod.outlook.com (2603:10a6:800:d4::12) To AM4PR0301MB2132.eurprd03.prod.outlook.com (2603:10a6:200:4d::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2c310cae-2002-4059-3092-08d512715721 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254152)(2017052603199)(201703131423075)(201703031133081)(201702281549075); SRVR:AM4PR0301MB2132; X-Microsoft-Exchange-Diagnostics: 1; AM4PR0301MB2132; 3:m9pe8bTOO8S7rugJruYFWD7Ee3K5rwFCtzEIsNWPJBv0TVL93jcYf9qApCrL3mX+mHpQQNeD2Ow4+snvYK/Emyvwca7IjmxP23XjCP70o6OE5KR5dx/IF0AIu0+nl12V9O52LzNUXlsSaNeFhnWE8O2wgJfv7agXyZJgD1UAx37C0zIGEETOCCjT/sTOfTAI4Ti9PxgfSpLoiWJkstnFqLfHr1niBabM00m+ooXxW9vO3bxO+XM9z/LNxj88XMFg; 25:XC6kQkfc1b23PnWpd6EuRniMhjg7oLLnpMJwsjVeFkZPHlWWk+6QlQjyNu8QJ88y9YpbE9pGxzMaXNkXIsCmZKZiS5KkVmZU5UMDwxvV/V0X3apjAjfhqRIVr9iPZeSlV9m9BrA4WIsPzv29/IKIyS4h8xSMHFIaJpW0G/layrH2u/0QWhoDworLOH9I74KmNtbmGcmXvE04sdyi78RKJZiJQPHu8gPVSL3fzx0bzAFGEKEPOVW4LCCmM6zHK/O3k7bLsQLCW1YBfasfM8N706i+IUVYAQxBJWhliKlG3M3iBHJea9xUjBpK+h2OvKPwKNAHHL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ldxBPk6KBNx9fj+ X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(10201501046)(3002001)(100000703101)(100105400095)(93006095)(93001095)(6041248)(20161123564025)(20161123560025)(20161123562025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:AM4PR0301MB2132; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:AM4PR0301MB2132; X-Forefront-PRVS: 04599F3534 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(376002)(346002)(199003)(189002)(16586007)(6666003)(39060400002)(42186006)(8936002)(81156014)(8676002)(36756003)(48376002)(50466002)(6116002)(3846002)(478600001)(107886003)(4326008)(316002)(86362001)(81166006)(53936002)(50226002)(97736004)(33646002)(101416001)(105586002)(76176999)(47776003)(122856001)(7736002)(66066001)(6916009)(305945005)(68736007)(80792005)(2906002)(5003940100001)(106356001)(72206003)(2950100002)(50986999)(189998001)(5660300001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR0301MB2132; H:EPUAKYIW2556.kyiv.epam.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: epam.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM4PR0301MB2132; 23:yETuQ+b9ILY5zRRqOUIvmSfNa2ftYMGmrZLWSES?= =?us-ascii?Q?STOcCqKLIxBzEdDIhMxblZumv8JTHSPFvvQXgGnpV/n0aPuI/jU8s6P0v7cn?= =?us-ascii?Q?w9Thq8lauh+xYH0KcJE6KbatWryX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VZcOsLhxTTAGAlaarGDksrljDymtLttYZOpPo3UkRFkmy4jADoqQLDiojEkh?= =?us-ascii?Q?GIUc/PPAVomv2QU4bL5UPOtsh2KccuyzPhM/gUJdWApzPCo5thg=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; AM4PR0301MB2132; 6:jkY6ch0p310R6htmLwYWHeOcrtb4wO4UK/yfAcKK753vl+5kebI1+txem68dHyvh7UYAlMSdwHbuQPUKSTxbIm1QsrBLEhSjwjt6ZskvNtQodhawv5+7zGsXEtvJEvJ+68jbQhv7ImaVk5ZGf81kRElBWbj4ICVWGRyoK6zmCtLj4vDs+3cjULau4lu33RnjmrcToQSV1DBjXmWHR2NX+0cB2tc2cHfNwy1dlXpfoqcTwb85eVHfsU5kecdSOsSKNd9mKeAuGpU1e2e7IK/SSgnqYvfSorcrbnDmi3TX9ozODWpS8uA79BgZBQPaB4n49uLD2JlJ4gbeKSLtSIzEwQ==; 5:PgweBFelhOEz7U/Ur8V5BT0FCHI/J5fpQje8TgwAiZCbnyFhRhicav1uW5Ln3dPvqE3SFtvWH/wrxEdo3HawNsJ7hi6y10mRlUHWpXL+h0GQCaAJKjunC+UaAD+HYPO25APKwf67yDpMnnpqq94H8L2C4Aq8VNJBomL19gDAQTY=; 24:aoG4yj9OYgwnGYSO2ifYxKcQGSJjIZU6suunBcPSD6+qVYEH+0Y1331THj+86cSU+j56gybthJusH3kLeQDdUDe0sCMWQWjV3uaRASJ914E=; 7:V3tm/pv/9wxXukOYuGG+lJP3qSZd8SVCkoZmnHQbzStA99YHVOKNr8qvnxeezZl0LFXzsc3+v4+bm6qo709FRwt+Y4ny0sPKHgmQslT2uVos6nEyysMRU03lC3omQAbMTatT6vjAXYQLoG55ueBvrgiFfDOcCmeo9oXMxOmzOmHDdblLfZxdMEwh5b0nI1Dhfvx4Il+wG1jnyCSqu/bb8XgH1Jjd2N0sqAfoNCcu8wU= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: epam.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2017 19:33:53.9565 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b41b72d0-4e9f-4c26-8a69-f949f367c91d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR0301MB2132 X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Volodymyr Babchuk , volodymyr_babchuk@epam.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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. Of course user can ignore presence of TEE_GEN_CAP_REG_MEM flag and try do call those functions. This is okay, driver will register shared buffer in OP-TEE, but any attempts to use this shared buffer will fail. Signed-off-by: Volodymyr Babchuk --- * Extended commit message. Now it describes what will happen if user will call optee_shm_register() exactly at this patch (without next ones) * Added comment that describesx desctibe why we abuse least bits of msg_arg->params->u.tmem.buf_ptr --- drivers/tee/optee/call.c | 69 +++++++++++++++++++++++++++++++++++++++ drivers/tee/optee/core.c | 2 ++ drivers/tee/optee/optee_private.h | 4 +++ 3 files changed, 75 insertions(+) diff --git a/drivers/tee/optee/call.c b/drivers/tee/optee/call.c index 4873666..a22f5f0 100644 --- a/drivers/tee/optee/call.c +++ b/drivers/tee/optee/call.c @@ -533,3 +533,72 @@ void optee_free_pages_list(void *array, size_t num_entries) free_pages_exact(array, get_pages_list_size(num_entries)); } +int optee_shm_register(struct tee_context *ctx, struct tee_shm *shm, + struct page **pages, size_t num_pages) +{ + struct tee_shm *shm_arg = NULL; + struct optee_msg_arg *msg_arg; + u64 *pages_list; + phys_addr_t msg_parg; + int rc = 0; + + if (!num_pages) + return -EINVAL; + + pages_list = optee_allocate_pages_list(num_pages); + if (!pages_list) + return -ENOMEM; + + shm_arg = get_msg_arg(ctx, 1, &msg_arg, &msg_parg); + if (IS_ERR(shm_arg)) { + rc = PTR_ERR(shm_arg); + goto out; + } + + optee_fill_pages_list(pages_list, pages, num_pages, + tee_shm_get_page_offset(shm)); + + msg_arg->cmd = OPTEE_MSG_CMD_REGISTER_SHM; + msg_arg->params->attr = OPTEE_MSG_ATTR_TYPE_TMEM_OUTPUT | + OPTEE_MSG_ATTR_NONCONTIG; + msg_arg->params->u.tmem.shm_ref = (unsigned long)shm; + msg_arg->params->u.tmem.size = tee_shm_get_size(shm); + /* + * In the least bits of msg_arg->params->u.tmem.buf_ptr we + * store buffer offset from 4k page, as described in OP-TEE ABI. + */ + msg_arg->params->u.tmem.buf_ptr = virt_to_phys(pages_list) | + (tee_shm_get_page_offset(shm) & (OPTEE_MSG_NONCONTIG_PAGE_SIZE - 1)); + + if (optee_do_call_with_arg(ctx, msg_parg) || + msg_arg->ret != TEEC_SUCCESS) + rc = -EINVAL; + + tee_shm_free(shm_arg); +out: + optee_free_pages_list(pages_list, num_pages); + return rc; +} + +int optee_shm_unregister(struct tee_context *ctx, struct tee_shm *shm) +{ + struct tee_shm *shm_arg; + struct optee_msg_arg *msg_arg; + phys_addr_t msg_parg; + int rc = 0; + + shm_arg = get_msg_arg(ctx, 1, &msg_arg, &msg_parg); + if (IS_ERR(shm_arg)) + return PTR_ERR(shm_arg); + + msg_arg->cmd = OPTEE_MSG_CMD_UNREGISTER_SHM; + + msg_arg->params[0].attr = OPTEE_MSG_ATTR_TYPE_RMEM_INPUT; + msg_arg->params[0].u.rmem.shm_ref = (unsigned long)shm; + + if (optee_do_call_with_arg(ctx, msg_parg) || + msg_arg->ret != TEEC_SUCCESS) + rc = -EINVAL; + tee_shm_free(shm_arg); + return rc; +} diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c index 7952357..4d448bf 100644 --- a/drivers/tee/optee/core.c +++ b/drivers/tee/optee/core.c @@ -267,6 +267,8 @@ static const struct tee_driver_ops optee_ops = { .close_session = optee_close_session, .invoke_func = optee_invoke_func, .cancel_req = optee_cancel_req, + .shm_register = optee_shm_register, + .shm_unregister = optee_shm_unregister, }; static const struct tee_desc optee_desc = { diff --git a/drivers/tee/optee/optee_private.h b/drivers/tee/optee/optee_private.h index b63213d..d7bc77d 100644 --- a/drivers/tee/optee/optee_private.h +++ b/drivers/tee/optee/optee_private.h @@ -160,6 +160,10 @@ int optee_cancel_req(struct tee_context *ctx, u32 cancel_id, u32 session); void optee_enable_shm_cache(struct optee *optee); void optee_disable_shm_cache(struct optee *optee); +int optee_shm_register(struct tee_context *ctx, struct tee_shm *shm, + struct page **pages, size_t num_pages); +int optee_shm_unregister(struct tee_context *ctx, struct tee_shm *shm); + int optee_from_msg_param(struct tee_param *params, size_t num_params, const struct optee_msg_param *msg_params); int optee_to_msg_param(struct optee_msg_param *msg_params, size_t num_params,