From patchwork Thu May 27 08:13:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Wiklander X-Patchwork-Id: 12283675 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=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT 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 9312BC47089 for ; Thu, 27 May 2021 08:16:17 +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 4DFCF613AA for ; Thu, 27 May 2021 08:16:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4DFCF613AA 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=+345NW+lnrMRNrRk2nT9sNMf1ZcD53umrasaNRdASXg=; b=ePM/LoruuNDE7c izhOipGxU3CqWs2e69ehVSdsZhakbVJyzgxHzaUb2H72luhuEYNIzGmqwDt9VL5tt+jg1/y4XoTti Dm9LoYGKbsnpjnOqK7nlXlvYCfDcSW82qdu5ShU4o0i5zZ/YpGxxjXb7OvKoyprzRKJzEYEMppwOU /zVw6aOHp0dYKRRUu5xoYikJLhJa69nrEeMAdbU8oOS/auABZBSI1u19dE8xqa2yQnKk6k1j367ma /a0htwfprKYYzq6UWyTaYkDcfPz3vKSpkjF+tZf4NfXl1dO+7rSqYRxhFH7DbyLTQrDdrfojqKSWE iTNwzWMq7AGl2jj+SXjg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lmB9v-003kt1-Ci; Thu, 27 May 2021 08:14:27 +0000 Received: from mail-lf1-x12c.google.com ([2a00:1450:4864:20::12c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lmB9p-003koV-Lw for linux-arm-kernel@lists.infradead.org; Thu, 27 May 2021 08:14:23 +0000 Received: by mail-lf1-x12c.google.com with SMTP id v8so6704448lft.8 for ; Thu, 27 May 2021 01:14:19 -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=JDGsr0U4UtFbfy6pCEyWwnWchkdCO7T0vgGbUXWCyRg=; b=x3cAUnU79NNxvjxeEWLk4ICt9sTWNhW+w604z+y/8JXOJ9GzZM2Vnl5Mhp0uk+tKAr qBeK3zhuEkF5sr0RJvZObHZTgNIaZP1sT0uoVxOFuDepK5F5nGUAob2jFzSDYClTg2RB PBplDABMCEeZQzjRZKM/eqnVMYsOMATbC7Xlp570wDEyKb5Qi74FgqjTqQlGqsGDpHRW QuSububR795TYW5Y+SwPzV8v/v7FHO+QlkShLK04qWp4VFeQqmMHkaFziB9ZTBBnyRaS 2I6LM+dUtb0EoJn9jlvBCD8BfARQvdY0HbeVdc9p5jWhrdQXW11xtvdMyynC/G2uIYKR eBpg== 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=JDGsr0U4UtFbfy6pCEyWwnWchkdCO7T0vgGbUXWCyRg=; b=o45A4yTkAwCjGZXpHM5TT0a+gjCNAON+h9QGEX5SeP0t6POSvTJpdHzWrGJn+hvwgY 70z5fYZvtOnNv1FywDp7uynzYRsGK32DNVq77WTQdBmlyeY1jb++rXuR6kpXuacpcegq qlBkNtQcgs+8HnpvUzEW35nZlq56L8n8ZuSnrae0za4ThImYZU5g/Ckd1aizlz0Qk+5Z hWixhvCP7w6X5h1sPn8kQaUNf74/fOHzWOgh4eybMAjRcNBxtT18Z2ihUwiR3hWElTwU g2BuIF3TZLRylh4nDAxY+q+QdWm83Hq0DKJSci+qUtYwG7uCRg52PvwadW03uQTtgPLf Zk0Q== X-Gm-Message-State: AOAM532eggB8p6pzYHJK/nBn+CJnwpb0CZHs47TJ586ytsCoBf1pZRk5 XiAmVvile096q9TZ3gnWxDH7xQ== X-Google-Smtp-Source: ABdhPJx8w8Q7nbjMppCGZsyDerHBswss6+er8da62g4Np1Gsg8vZOyripxpDkfD1jzmNXpXtnqUDAw== X-Received: by 2002:a19:4307:: with SMTP id q7mr1570617lfa.262.1622103258102; Thu, 27 May 2021 01:14:18 -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 z10sm133186lfe.228.2021.05.27.01.14.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 May 2021 01:14:17 -0700 (PDT) From: Jens Wiklander To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, op-tee@lists.trustedfirmware.org Cc: Sudeep Holla , Marc Bonnici , Jerome Forissier , Jens Wiklander Subject: [PATCH v2 0/5] Add FF-A support in OP-TEE driver Date: Thu, 27 May 2021 10:13:59 +0200 Message-Id: <20210527081404.1433177-1-jens.wiklander@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210527_011421_740942_4B2E5787 X-CRM114-Status: GOOD ( 17.61 ) 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, This adds supports for the OP-TEE driver to communicate with secure world using FF-A [1] as transport. These patches are based on the FF-A v7 patch set by Sudeep Holla [2] [3]. There is one change to the TEE subsystem with "tee: add sec_world_id to struct tee_shm" to add support for holding globally unique handle assigned by the FF-A. This is a field that I believe could useful for the AMDTEE driver too. For communication the OP-TEE message protocol is still used, but with a new type of memory reference, struct optee_msg_param_fmem, to carry the information needed by FF-A. The OP-TEE driver is refactored internally with to sets of callbacks, one for the old SMC based communication and another set with FF-A as transport. There is also a difference in how the drivers are instantiated. With the SMC based transport we have a platform driver, module_platform_driver(), today which we're keeping as is for this configuration. In a FF-A system we have a FF-A driver, module_ffa_driver(), instead. The OP-TEE driver can be compiled for both targets at the same time and it's up to runtime configuration (device tree or ACPI) to decide how it's initialized. Thanks, Jens [1] https://developer.arm.com/documentation/den0077/latest [2] https://lore.kernel.org/linux-arm-kernel/20210521151033.181846-1-sudeep.holla@arm.com/ [3] git://git.kernel.org/pub/scm/linux/kernel/git/sudeep.holla/linux.git v5.13/ffa v1->v2: - Rebased to the FF-A v7 patch - Fixed a couple of reports from kernel test robot Jens Wiklander (5): tee: add sec_world_id to struct tee_shm optee: simplify optee_release() optee: refactor driver with internal callbacks optee: add a FF-A memory pool optee: add FF-A support drivers/tee/optee/call.c | 325 +++++++++++--- drivers/tee/optee/core.c | 689 ++++++++++++++++++++++++++---- drivers/tee/optee/optee_ffa.h | 153 +++++++ drivers/tee/optee/optee_msg.h | 27 +- drivers/tee/optee/optee_private.h | 88 +++- drivers/tee/optee/rpc.c | 137 +++++- drivers/tee/optee/shm_pool.c | 65 ++- drivers/tee/optee/shm_pool.h | 1 + include/linux/tee_drv.h | 7 +- 9 files changed, 1326 insertions(+), 166 deletions(-) create mode 100644 drivers/tee/optee/optee_ffa.h