From patchwork Thu Mar 25 15:44:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Wiklander X-Patchwork-Id: 12164465 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.0 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,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 A1BE0C433E0 for ; Thu, 25 Mar 2021 15:46:15 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 3B42B619EE for ; Thu, 25 Mar 2021 15:46:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3B42B619EE 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=desiato.20200630; 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=hjCL/Ct7ud0sOz3Rc4qdrGUXNBoeqVR9i+/vWheWSJ4=; b=ffY/+lCEek1JUXS5IgacAwUpJS LSELu6hrcsGS3rYn179xwOCtjvs/szOz1wrJXMKBA6sezr0DvGuQjn5Uuf4jjEktJp4zsiyN7UDPd MOvDurR6QG2istN8gj1+zmkBZdDJmMRfDFb2bv/VcWmwgE2hqmu8FZQDA3TwieB8rFb10CGvRhi3g t0iBHnLR2lmJ/m8vgMAoONRyOhiH5lpEC+UXGymAetWDCLPk+StoaWELBmdr/9cTk5J+jpJQHzxLr lS6UsbKaE8Pi6JmI1fIMIHF73Sic0ub8Jb3H6nTr6F7R6NUO2DuP6M6m/WyQhAEBmbHBhhTx6pNxJ QoDXQ9ug==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lPSA6-001kRk-Nm; Thu, 25 Mar 2021 15:44:42 +0000 Received: from mail-lf1-x12c.google.com ([2a00:1450:4864:20::12c]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lPS9z-001kQG-Ue for linux-arm-kernel@lists.infradead.org; Thu, 25 Mar 2021 15:44:38 +0000 Received: by mail-lf1-x12c.google.com with SMTP id v15so3200160lfq.5 for ; Thu, 25 Mar 2021 08:44:35 -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=pjIa+s4yH2swmatTmtfzhFPs7yHgkDmsPtwVkJT5w6E=; b=H9/dj7qBCh29estNC3da7gGEoHzLC7mTj8GhYRQbAL2cz9EQ+ql5VxGZ+ledBA5Hjo I0OaqscxiJetkfdI1htNRbqAzEMvcQZ1/bIoY5lF5WDec2U2/6zsSKCL3AiYXAyhyJv+ 6CMCU0Z9+OdbqS5lSAfXvqP4t81iuDEe4tKvRem/ozuTIb7ZjFKSOoN6H6OC5VrHOKBY IkZX2i9edyvAHIHx64Gad3UPc1x5MZC9g0Gs37+Nmov0QaY2Wej1O3ncdS1uenCSgQgr WH3NM1IBDNHu6yHmGV7PHqsSoATpv+1vU75prP5x6XhlB7VCb38utOtBadUlnXQ+KLxm mi5w== 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=pjIa+s4yH2swmatTmtfzhFPs7yHgkDmsPtwVkJT5w6E=; b=bAnguP1XSlJFlxCicLNcraouZwJv4IBqXgDA/xLh1VBMilj0iYHtfUlcWcsouv7jZ4 8n7StIL6cv9z7GMok2/24uPWJQw7V73+NWUJte+bnHd5icQAOvZoGZJ3D9H+JPFl2/Vb cDjcn7uYmKHD0diXV/AzwX6cRAsBe3GHvCaYX5I6zeD2EDIssVRHZ4E0AHnG5pCYqizM JQT1bitmaB9ndi8bbT1Uoc4GEjYoLKjctWSLAoZ5nAyM3hwUKcgTdRxLpcPMH0B469za 1d3FM01rqRL9gsABHRDXWXwm7kYWmIr28IGfyBV4RluSRXn9LgfFkXNoLkxA9fkmeOv+ tsHQ== X-Gm-Message-State: AOAM530TOtJXY89haUYsKUgL1KwV9KNlsJsXQXxdK5OBJOlSrgOc6ez9 LLMNo7zMIj4qXlnEpIjq8meMBA== X-Google-Smtp-Source: ABdhPJwZ2GyiIIv40BYxMxL4qiTToJU3nCnDovQLghlO8k5n3u2EB3ALjKdG72K2ZOrGMshBPlHT0A== X-Received: by 2002:ac2:4857:: with SMTP id 23mr5480784lfy.136.1616687075229; Thu, 25 Mar 2021 08:44:35 -0700 (PDT) Received: from jade.urgonet (h-249-223.A175.priv.bahnhof.se. [98.128.249.223]) by smtp.gmail.com with ESMTPSA id m27sm770916ljc.109.2021.03.25.08.44.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Mar 2021 08:44:34 -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 0/6] Add FF-A support in OP-TEE driver Date: Thu, 25 Mar 2021 16:44:20 +0100 Message-Id: <20210325154426.3520148-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-20210325_154436_083853_99E76863 X-CRM114-Status: GOOD ( 17.06 ) 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 v4 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/20210212154614.38604-1-sudeep.holla@arm.com/ [3] git://git.kernel.org/pub/scm/linux/kernel/git/sudeep.holla/linux.git v5.11/ffa Jens Wiklander (6): tee: add sec_world_id to struct tee_shm optee: simplify optee_release() optee: sync optee_msg.h and optee_rpc_cmd.h optee: refactor driver with internal callbacks optee: add a FF-A memory pool optee: add FF-A support drivers/tee/optee/call.c | 327 +++++++++++--- drivers/tee/optee/core.c | 698 +++++++++++++++++++++++++----- drivers/tee/optee/optee_ffa.h | 153 +++++++ drivers/tee/optee/optee_msg.h | 168 ++----- drivers/tee/optee/optee_private.h | 88 +++- drivers/tee/optee/optee_rpc_cmd.h | 333 ++++++++++++++ drivers/tee/optee/rpc.c | 169 +++++++- drivers/tee/optee/shm_pool.c | 65 ++- drivers/tee/optee/shm_pool.h | 1 + include/linux/tee_drv.h | 7 +- 10 files changed, 1685 insertions(+), 324 deletions(-) create mode 100644 drivers/tee/optee/optee_ffa.h create mode 100644 drivers/tee/optee/optee_rpc_cmd.h base-commit: 31ef391700953fb59ea8755ea38c6085bdec380e