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: 408830 Delivered-To: patches@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp647888jai; Thu, 25 Mar 2021 08:44:35 -0700 (PDT) X-Received: by 2002:ac2:5970:: with SMTP id h16mr5114557lfp.108.1616687075731; Thu, 25 Mar 2021 08:44:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616687075; cv=none; d=google.com; s=arc-20160816; b=JWyNXg7qIt2cuErQudTg3MTThOsUqjEIuMF0u7ZKybbXbVk1X9NXp6kFaoZ/Vo/6pb wuQIrZoldQJq/C84G1b56iYv8koEJojSHTR+b2yQiTn4/b6MEo0T+o2i+1yzTmpIkfNY ukT0FWnpySHcDpxizCJQQK7eRBs7YSivLDbI2PRJ4Lt0B14UoAQ9e+DuH/W7hU51LLtC n2C6loILVXziRmgPZTZVMSBp/BKb+Q/4WILbcsRtc+09K0L5PXZd/jCvonz9atUlHKKH lTRGwWFQyjbiFsPofPRkEo2C6nD2sXKii2BZn5FG72O2yL9dOtA1nGEGDpZN7hbHS9Ow r0KQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=pjIa+s4yH2swmatTmtfzhFPs7yHgkDmsPtwVkJT5w6E=; b=vB3PnaWIpHT4EtxPInxfD3UTV1bCAfepTBQI8mTnlO6WIT6gRYFgKrthO5I1+EIvjw 6zSEjYBz9oZB8LkdncBZycETbjH5+Pgbk/G/2rJjV2nwTEzGa3B0NfWRQT3fw8tD2JAJ 4cD87wUlIa34dIaNEck19C43vOeDi2TAXh2Vbe0MdvNr/cjqOCfVmGDjKMAfXUEZ1S5M F7K1F61Z6j4KNLXt3Q9GamrR0jV2EsfM/za1aKdWZ+94FtoLNBJswCSoMmcVpXd0Vur7 LUAiAS7mnzmJ22PzyBR5sS0r9Ei3faY2ignh2IP2AbESdhGK8Of/Peu6uekd2t4tpVCa +lJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="H9/dj7qB"; spf=pass (google.com: domain of jens.wiklander@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=jens.wiklander@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id f17sor574155lfl.49.2021.03.25.08.44.35 for (Google Transport Security); Thu, 25 Mar 2021 08:44:35 -0700 (PDT) Received-SPF: pass (google.com: domain of jens.wiklander@linaro.org designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="H9/dj7qB"; spf=pass (google.com: domain of jens.wiklander@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=jens.wiklander@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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=pkH+F3QNpZYx55ctUA967cMHi2yR4gZ3oiaWNGsp4q9NcmfoNZpeUzAmE22oqkq6EM ZjxUYDROWqfF+9NIeUOMai8gYc2tJmsoV5QIqiTdnDLs1OeUplEzrZlhnpPrpXa8+lwa b4FXZjT2RnZTGMRk33LgMEj/0HYT0mO8e9EiyFsBBuCXBAl05ii+d3IlzHl3zdklZ1Mj RCbZW6qE9WAtvld4/kKi7hk58HVTxqLr5IlqkjfLEqStwhW2NLW89NHhrLIEk3QsLX0L gS0Ow/cAi+bDExoYb6AC5tG6rOrB8A9bTEJrO7NaRm4ffizL8xSxpmkMzZ+pzoGb3yJx S5nw== X-Gm-Message-State: AOAM531efOuxtYTf2Hz+Icdb43s0sfSXIx9qdGRVrYH0Y9hOJFf6sVQ7 84AxfujotxlVuupbyRCY7xqvgpuZ 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) Return-Path: 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 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 -- 2.25.1