From patchwork Wed Jun 9 10:23:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Wiklander X-Patchwork-Id: 12309539 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=-12.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham 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 196D0C48BCD for ; Wed, 9 Jun 2021 10:32:14 +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 D91BD61185 for ; Wed, 9 Jun 2021 10:32:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D91BD61185 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org 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:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=OttTzqzkDh+Xd2eNTWruP0m3yUYJdaSkrdcDqqs7gPk=; b=gWG1ugkClpAaUe zpSPEfs1HDx9Ua1t5IK6rvmBikHX1h6sX54HczmeZRs95zGn+wmsjw5Yo/9ZrTwB0kD1M5P1qLXS+ b1+S2rFXyrY2XouLv/g/Kj7sGCEkCXWi1ZRbGTs+if/B2wmDUsL5If6B/0uBoe3xLvHd3SF8lF0Z/ aUyxU3YJF5ob3ku2yn59Oo7wXW/yjE5J5/ZGXBtdnd6otUOw+0FOMteHjlwlcCtIps1gSqx3T1kiP kf3onEuQWkfx7ZbFY/nTB8YdyTuXHBpQOeYNeoXkZz0xOl/+eFATyN+ss5il3iA/5228ob2YYjPyI m9kUl3GZwZnVyBoBkZ4Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqvTN-00D0Uf-Ab; Wed, 09 Jun 2021 10:30:09 +0000 Received: from mail-lj1-f170.google.com ([209.85.208.170]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqvO3-00CyjJ-7Y for linux-arm-kernel@lists.infradead.org; Wed, 09 Jun 2021 10:24:40 +0000 Received: by mail-lj1-f170.google.com with SMTP id n17so13849300ljg.2 for ; Wed, 09 Jun 2021 03:24:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=7k+X7CK1t92BiWhgV+56w9YZbTfNSIvP69C+r0N5nUY=; b=riiSaDwlPrILoa+dn8LTnJirS6z5UNlmyDKkq2oKKjtMmB31qolaw+BY1nmmHbi5ab KqI2buyeebORN25DkSI5Lsl7AprFGdHE9154XH3UrPr+ric6p3Jpx+6ZJvUtZXUhCHJw 4/WudfP65VmzqICS6U2X6RNPW/rxNTUchORslSSMmxQPapeMETvt02LYig0G38Rd1YDV Qhy3hHgI8SnUqneyMVMMw2yqGy0CcRIRK+JcRlAApOoR85eK+HEt3xUL++cj6KOyWFQI t8PPaGKYQl2+UAyzGExBjcGqyppVzUFf/n+7tOjcP4ZTBk/uRXgBIataPATeNdisidJ7 BFpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=7k+X7CK1t92BiWhgV+56w9YZbTfNSIvP69C+r0N5nUY=; b=b8jmDMVWOIR7SCrIm0hbZLqPsgktMzqpxUpoMkXUwEEiZM60vxpUmqJjHhTrGeFUrm 7UnAlLAS8GnWuxpQk2NCAPJZsWyMEKHjcdwCcMfblcrWJUMsLFWxNTSIt/En+dIP3pq+ 80CGyVre/ZmekJEdDQMuhX+8oj/4BHjgfzM/qHHfPaTus9YliFy2deZ+uANGnzVtZqAU XcMVpRw20zB6zFIzyqD95EwIK5viIDuL66R9KRsez8x5EYgP/0bUzgNy2Kn4NccETnLm dVNwZ4b8+kchHOYE0fJJjZSjRyCLrV2D4ymo9U4ZIAoxZ/tHAkoWQgYsMFvGMDm3yEMa 5Ahg== X-Gm-Message-State: AOAM531rAYtQ6w3mqtEX34kuJSKpd9+K/2TEig0wZActCjwL44vjQiKS gYn9kFkrC5mADTMLWjuLrob3sA== X-Google-Smtp-Source: ABdhPJxab+7rKOPjvqtNoCA/sS6DcDEEV6CnuWiKYFXW+QhxpI6x8xsC6wkvE77QD5kBxEvAIi8NHQ== X-Received: by 2002:a2e:94d7:: with SMTP id r23mr22199127ljh.380.1623234217100; Wed, 09 Jun 2021 03:23:37 -0700 (PDT) Received: from jade.urgonet (h-79-136-85-3.A175.priv.bahnhof.se. [79.136.85.3]) by smtp.gmail.com with ESMTPSA id m4sm302966ljp.9.2021.06.09.03.23.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Jun 2021 03:23:36 -0700 (PDT) From: Jens Wiklander To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, op-tee@lists.trustedfirmware.org Cc: Sumit Garg , Herbert Xu , Sakkinen , Sasha Levin , Thirupathaiah Annapureddy , Vikas Gupta , "David S . Miller" , Tyler Hicks , Jens Wiklander Subject: [PATCH 0/7] tee: shared memory updates Date: Wed, 9 Jun 2021 12:23:17 +0200 Message-Id: <20210609102324.2222332-1-jens.wiklander@linaro.org> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210609_032439_325590_F7349369 X-CRM114-Status: GOOD ( 11.39 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi all, Until now has the in-kernel tee clients, tpm_ftpm_tee, hwrng: optee-rng and firmware: tee_bnxt used shared memory objects which has been exported by dma-buf. Dma-buf isn't needed here since it's only an interaction between the kernel and secure world. This patchset fixes this by intruducing three new function tee_shm_alloc_user_buf(), tee_shm_alloc_kernel_buf() and tee_shm_alloc_anon_kernel_buf() to be used instead of the old tee_shm_alloc(). This should make the API a bit easier to use both within the TEE subsystem and for the tee clients in various drivers. The patch set starts with simplifying the shared memory pool handling, an internal matter for the two TEE drivers OP-TEE and AMDTEE. Thanks, Jens Jens Wiklander (7): tee: remove unused tee_shm_pool_alloc_res_mem() tee: simplify shm pool handling tee: add tee_shm_alloc_kernel_buf() hwrng: optee-rng: use tee_shm_alloc_kernel_buf() tpm_ftpm_tee: use tee_shm_alloc_kernel_buf() firmware: tee_bnxt: use tee_shm_alloc_kernel_buf() tee: replace tee_shm_alloc() drivers/char/hw_random/optee-rng.c | 6 +- drivers/char/tpm/tpm_ftpm_tee.c | 8 +- drivers/firmware/broadcom/tee_bnxt_fw.c | 5 +- drivers/tee/amdtee/shm_pool.c | 55 ++----- drivers/tee/optee/Kconfig | 8 - drivers/tee/optee/call.c | 16 +- drivers/tee/optee/core.c | 76 +-------- drivers/tee/optee/device.c | 5 +- drivers/tee/optee/rpc.c | 8 +- drivers/tee/optee/shm_pool.c | 51 +++--- drivers/tee/optee/shm_pool.h | 2 +- drivers/tee/tee_core.c | 2 +- drivers/tee/tee_private.h | 11 -- drivers/tee/tee_shm.c | 209 ++++++++++++++++++------ drivers/tee/tee_shm_pool.c | 160 ++++-------------- include/linux/tee_drv.h | 106 +++--------- 16 files changed, 291 insertions(+), 437 deletions(-)