From patchwork Wed Nov 29 12:48:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Volodymyr Babchuk X-Patchwork-Id: 10082089 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 151AA6020B for ; Wed, 29 Nov 2017 12:53:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 06B8E2976C for ; Wed, 29 Nov 2017 12:53:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ECECF2976D; Wed, 29 Nov 2017 12:53:31 +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 68DDA29768 for ; Wed, 29 Nov 2017 12:53:31 +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=8ODSASPteG3M+V/7/MHXzE011TeZ19zR9VHCqAa2Gnk=; b=Y7H0kzVKvgnxno i30vN0RmB3jyVooPuEOH1LsHyopiMNHfG2Sozo9Ea28yGdxSmtsh7MDVPksDixMvHz04P9eWOHBtI wKle4xx0yN5bhWgP7ctBuV1iNuiUc2sTrmpwlEd/qOnTrJDDRRkdLTvDD8J9fYkRXfpeIm153vMsa NqyOjPpakSoKESFlLdADkhYOnhIXHelqT4obBsjhQ1ZAPFPOOgu0M71euYQW2Q7JaKcdT50Nm/oIV vTUGPI42kQnHzpHiN6m4wTiXJzn7aJFHptdQA9BZi4Atcu2o2HyaFijriu3DwkFRfQDj1sJhuDPTQ G5AKu17tIJ9bpp+mXDAQ==; 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 1eK1rm-00085Q-Ay; Wed, 29 Nov 2017 12:53:30 +0000 Received: from mail-he1eur01on0045.outbound.protection.outlook.com ([104.47.0.45] helo=EUR01-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eK1or-0004s9-3N for linux-arm-kernel@lists.infradead.org; Wed, 29 Nov 2017 12:50:39 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=epam.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=02Z3Eg+g5k8UbLiTPgobvRPAKHTwdsoC9R26trZkvkQ=; b=a7ggHcZL+24NYHcS341+fL4UqWKlmtGgE5793bln/1waTSCUj9Nz6Vo5f6vICMa41BCSy8Jq14V1t3LgtrKtH2Sk2ujqPIX01gvk3cY5J5EjmySq2kCBwNQL8iv8j4/DEXpuiqAnF70goqR2AlVIJsxFx8aN+9hSRPeMWg8XAVY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Volodymyr_Babchuk@epam.com; Received: from EPUAKYIW2556.kyiv.epam.com (85.223.209.56) by DB5PR03MB1766.eurprd03.prod.outlook.com (2a01:111:e400:c580::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.260.4; Wed, 29 Nov 2017 12:50:03 +0000 Received: by EPUAKYIW2556.kyiv.epam.com (sSMTP sendmail emulation); Wed, 29 Nov 2017 14:49:59 +0200 From: Volodymyr Babchuk To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, tee-dev@lists.linaro.org, Jens Wiklander Subject: [RESEND PATCH v2 12/14] tee: optee: enable dynamic SHM support Date: Wed, 29 Nov 2017 14:48:36 +0200 Message-Id: <1511959718-5421-13-git-send-email-volodymyr_babchuk@epam.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511959718-5421-1-git-send-email-volodymyr_babchuk@epam.com> References: <1507923164-12796-1-git-send-email-volodymyr_babchuk@epam.com> <1511959718-5421-1-git-send-email-volodymyr_babchuk@epam.com> MIME-Version: 1.0 X-Originating-IP: [85.223.209.56] X-ClientProxiedBy: HE1PR0402CA0050.eurprd04.prod.outlook.com (2603:10a6:7:7c::39) To DB5PR03MB1766.eurprd03.prod.outlook.com (2a01:111:e400:c580::7) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: dcb5d0e5-e03b-48ed-4b3c-08d53727b65e X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600026)(4604075)(4534020)(4602075)(7168020)(4627115)(201703031133081)(201702281549075)(2017052603199); SRVR:DB5PR03MB1766; X-Microsoft-Exchange-Diagnostics: 1; DB5PR03MB1766; 3:9wFI9QxjIGKG+YVs9CYsdDnB8w2FzhW5gD5jd1MhCU/VEfle2BeKo5W3sNLhNre8N0Wbl6S0aQD4qg1VpT87PjjooE1qIFvsOJdwnofUPQyPJIDUNDY9xTvj5VAyjwAweJWqUtLrLBybni7ESXr7UK9eLQFauSYIZ8y0TVqLc9gEkPSjGDCgHZRf7Sxmu5R9ZM6tNzOWHfKLwPvmG0yJB1pOihGA9QbbBHvJqn5FGpjlN2WXtG6cW+GGyB+srtP0; 25:xn70B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aZNGURQbNaROqS5dIDBh/ahbcg1+gVtYDTxFJPTvFjgPb6hmq7PZ+yfu5PxoPHyzcsC3AgoQE1IEyAFWz8U+Ni9f0d126xEC4CZH; 4:sNRk98/gXyt5Jkg5ySEdN7t1AHpJ8IbctuO2jKZykb37oPPKzuxiXsMsHE3HjVcmW5QrCMe/bD29+40DF7SU+eYikpaolEt24TROVEYZbf6wqX0EA4xTGNYY8G+0UYa1Qo0mBkisuY0Rh0+2BdlNxQ18/1YoDdGHotT7BFItrg7BMsz7Idn+8llNgOZxgkAYvyU0hhEd7rTRKBlwsiRn/7/YwgTGZWTuZIHt3GRlx0y3KZRAbR53RPwqlhe002BzEfWlQ47/xE+4A0B73RgPRA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(2401047)(5005006)(8121501046)(3002001)(3231022)(93006095)(93001095)(10201501046)(6041248)(20161123564025)(20161123558100)(20161123555025)(20161123560025)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:DB5PR03MB1766; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:DB5PR03MB1766; X-Forefront-PRVS: 05066DEDBB X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(366004)(346002)(376002)(199003)(189002)(51416003)(80792005)(36756003)(50466002)(106356001)(33646002)(50986999)(105586002)(76176999)(39060400002)(72206003)(478600001)(107886003)(52116002)(4326008)(66066001)(55236003)(101416001)(53936002)(122856001)(16586007)(316002)(42186006)(48376002)(47776003)(8936002)(5660300001)(6666003)(6916009)(2950100002)(189998001)(6116002)(2906002)(3846002)(68736007)(50226002)(8676002)(7736002)(305945005)(97736004)(86362001)(81156014)(81166006)(217873001); DIR:OUT; SFP:1101; SCL:1; SRVR:DB5PR03MB1766; 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; DB5PR03MB1766; 23:y/7fU0SKUAAm/ZI47kOh/9T5Zhxor8C7ad8dM883W?= =?us-ascii?Q?EJ0E8ipDgpb69KBVkRBsbqD9j8vPVIWUPjtNxt+jo0IcHBjSFyM7ZoDaKkq1?= =?us-ascii?Q?KADusQoBUpF/xcK/1FAT7tjD1uk34TQcK8ce4gZxZt2OsNNIZ6kU2llfLzcb?= =?us-ascii?Q?diVBnEMGYfjY5b7qrzusdB90fjf+JsVxN5R10pYAS/VjxUHvFY4BfEtFxvAW?= =?us-ascii?Q?BjbDyR+yV/EaN/Kr50be9sDmlcyFzZz0eR/zJC1VUs0Mai33XlltGN3lcee+?= =?us-ascii?Q?UksJyZfk4hfIcAXVnyxrrSn2x9NoWKLjEMQSLBoutoEjD8eUGXUnr/kcukXP?= =?us-ascii?Q?u1OKVNGzYDrHWxinhD4O51Eq4pIsCOZ8oxrZDvxnfztk8NblWCbIOjAnPqQd?= =?us-ascii?Q?5AsO16nKEIZLq2SAKKlublwb+ZtFb6k0wY9pFsVdSaJP1RPVv9G3L5uKeMM0?= =?us-ascii?Q?pdzB/uq0vBe5jeyVAVx+M9Acp3wZE8GeD+9yUG5bBQYtIuPqH8NnJX7ng0JT?= =?us-ascii?Q?SkcrEYzqfO+ynzYrJ/LV0DzpRzkETT+QKZF35MDdetacD9tsTnXkDI+D/AMi?= =?us-ascii?Q?YqUv5g99xAeiC2BPq5ozAq2A7bMyo2qmG/QCR4cD0jyDTOHh3EgDHuVGYXcT?= =?us-ascii?Q?c9CD4cL+s2LbhjyFy4qH1te7mQjQuoAhpWWmsBoo4YNo39hFcE9j/4GaRsAg?= =?us-ascii?Q?Cd4ZeYGLv2JHxBOvysWsepsOv0/tkKmdUxktCA7UY4oujcQOxAjhybqFvzc7?= =?us-ascii?Q?232DcTDzr1S0iTbcLGdUSPHAgoQEzqR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5ObKv8/nq49gD+g1PG5V6RkxIELFDoB+I2f2FWxPcNaOsCkoAp0nIBrRo3flkrPBuL76akg7rfg/hzWEs9KnSGIM0=; 7:ZCR9xUwTtq/QX1o14x4rSgTd3EE1wwwLOC2xOJskjbtorfRxIh0DjaGGbEpZYReLau6aTVzpqpHcdd698dlRe8MMnU1oADzZACM5yZW5g2Vfp+22pwDWjjy4p08OGw2ACebIuTQa8HAZwridRNggUF5djaXPaaUDkATV0WEI56K5H4q7cHRhswuN8tYVT1GhqQUx0mX/G0MUA+r92PLDB19jq4sULDTs3xzV+jk6EeQO1xLD1q+a3HOamAfZdYzH SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: epam.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Nov 2017 12:50:03.6771 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dcb5d0e5-e03b-48ed-4b3c-08d53727b65e X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b41b72d0-4e9f-4c26-8a69-f949f367c91d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR03MB1766 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171129_045029_903730_77FAB7FE X-CRM114-Status: GOOD ( 15.72 ) 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 Previous patches added various features that are needed for dynamic SHM. Dynamic SHM allows Normal World to share any buffers with OP-TEE. While original design suggested to use pre-allocated region (usually of 1M to 2M of size), this new approach allows to use all non-secure RAM for command buffers, RPC allocations and TA parameters. This patch checks capability OPTEE_SMC_SEC_CAP_DYNAMIC_SHM. If it was set by OP-TEE, then kernel part of OP-TEE will use kernel page allocator to allocate command buffers. Also it will set TEE_GEN_CAP_REG_MEM capability to tell userspace that it supports shared memory registration. Signed-off-by: Volodymyr Babchuk --- drivers/tee/optee/core.c | 69 +++++++++++++++++++++++++++++++++++------------- 1 file changed, 51 insertions(+), 18 deletions(-) diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c index dbe5a61..51d5575 100644 --- a/drivers/tee/optee/core.c +++ b/drivers/tee/optee/core.c @@ -28,6 +28,7 @@ #include #include "optee_private.h" #include "optee_smc.h" +#include "shm_pool.h" #define DRIVER_NAME "optee" @@ -219,6 +220,10 @@ static void optee_get_version(struct tee_device *teedev, .impl_caps = TEE_OPTEE_CAP_TZ, .gen_caps = TEE_GEN_CAP_GP, }; + struct optee *optee = tee_get_drvdata(teedev); + + if (optee->sec_caps & OPTEE_SMC_SEC_CAP_DYNAMIC_SHM) + v.gen_caps |= TEE_GEN_CAP_REG_MEM; *vers = v; } @@ -397,21 +402,22 @@ static bool optee_msg_exchange_capabilities(optee_invoke_fn *invoke_fn, } static struct tee_shm_pool * -optee_config_shm_memremap(optee_invoke_fn *invoke_fn, void **memremaped_shm) +optee_config_shm_memremap(optee_invoke_fn *invoke_fn, void **memremaped_shm, + u32 sec_caps) { union { struct arm_smccc_res smccc; struct optee_smc_get_shm_config_result result; } res; - struct tee_shm_pool *pool; unsigned long vaddr; phys_addr_t paddr; size_t size; phys_addr_t begin; phys_addr_t end; void *va; - struct tee_shm_pool_mem_info priv_info; - struct tee_shm_pool_mem_info dmabuf_info; + struct tee_shm_pool_mgr *priv_mgr; + struct tee_shm_pool_mgr *dmabuf_mgr; + void *rc; invoke_fn(OPTEE_SMC_GET_SHM_CONFIG, 0, 0, 0, 0, 0, 0, 0, &res.smccc); if (res.result.status != OPTEE_SMC_RETURN_OK) { @@ -441,22 +447,49 @@ optee_config_shm_memremap(optee_invoke_fn *invoke_fn, void **memremaped_shm) } vaddr = (unsigned long)va; - priv_info.vaddr = vaddr; - priv_info.paddr = paddr; - priv_info.size = OPTEE_SHM_NUM_PRIV_PAGES * PAGE_SIZE; - dmabuf_info.vaddr = vaddr + OPTEE_SHM_NUM_PRIV_PAGES * PAGE_SIZE; - dmabuf_info.paddr = paddr + OPTEE_SHM_NUM_PRIV_PAGES * PAGE_SIZE; - dmabuf_info.size = size - OPTEE_SHM_NUM_PRIV_PAGES * PAGE_SIZE; - - pool = tee_shm_pool_alloc_res_mem(&priv_info, &dmabuf_info); - if (IS_ERR(pool)) { - memunmap(va); - goto out; + /* + * If OP-TEE can work with unregistered SHM, we will use own pool + * for private shm + */ + if (sec_caps & OPTEE_SMC_SEC_CAP_DYNAMIC_SHM) { + rc = optee_shm_pool_alloc_pages(); + if (IS_ERR(rc)) + goto err_memunmap; + priv_mgr = rc; + } else { + const size_t sz = OPTEE_SHM_NUM_PRIV_PAGES * PAGE_SIZE; + + rc = tee_shm_pool_mgr_alloc_res_mem(vaddr, paddr, sz, + 3 /* 8 bytes aligned */); + if (IS_ERR(rc)) + goto err_memunmap; + priv_mgr = rc; + + vaddr += sz; + paddr += sz; + size -= sz; } + rc = tee_shm_pool_mgr_alloc_res_mem(vaddr, paddr, size, PAGE_SHIFT); + if (IS_ERR(rc)) + goto err_free_priv_mgr; + dmabuf_mgr = rc; + + rc = tee_shm_pool_alloc(priv_mgr, dmabuf_mgr); + if (IS_ERR(rc)) + goto err_free_dmabuf_mgr; + *memremaped_shm = va; -out: - return pool; + + return rc; + +err_free_dmabuf_mgr: + tee_shm_pool_mgr_destroy(dmabuf_mgr); +err_free_priv_mgr: + tee_shm_pool_mgr_destroy(priv_mgr); +err_memunmap: + memunmap(va); + return rc; } /* Simple wrapper functions to be able to use a function pointer */ @@ -534,7 +567,7 @@ static struct optee *optee_probe(struct device_node *np) if (!(sec_caps & OPTEE_SMC_SEC_CAP_HAVE_RESERVED_SHM)) return ERR_PTR(-EINVAL); - pool = optee_config_shm_memremap(invoke_fn, &memremaped_shm); + pool = optee_config_shm_memremap(invoke_fn, &memremaped_shm, sec_caps); if (IS_ERR(pool)) return (void *)pool;