Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/961290/?format=api
{ "id": 961290, "url": "http://patchwork.ozlabs.org/api/patches/961290/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/20180823104334.16083-10-jens.wiklander@linaro.org/", "project": { "id": 18, "url": "http://patchwork.ozlabs.org/api/projects/18/?format=api", "name": "U-Boot", "link_name": "uboot", "list_id": "u-boot.lists.denx.de", "list_email": "u-boot@lists.denx.de", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20180823104334.16083-10-jens.wiklander@linaro.org>", "list_archive_url": null, "date": "2018-08-23T10:43:28", "name": "[U-Boot,v2,09/15] test: tee: test TEE uclass", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "2f86a91b277ded9c3bc91edacf14e86bdbe93e50", "submitter": { "id": 66201, "url": "http://patchwork.ozlabs.org/api/people/66201/?format=api", "name": "Jens Wiklander", "email": "jens.wiklander@linaro.org" }, "delegate": { "id": 3651, "url": "http://patchwork.ozlabs.org/api/users/3651/?format=api", "username": "trini", "first_name": "Tom", "last_name": "Rini", "email": "trini@ti.com" }, "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/20180823104334.16083-10-jens.wiklander@linaro.org/mbox/", "series": [ { "id": 62144, "url": "http://patchwork.ozlabs.org/api/series/62144/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/list/?series=62144", "date": "2018-08-23T10:43:19", "name": "AVB using OP-TEE", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/62144/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/961290/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/961290/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<u-boot-bounces@lists.denx.de>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org", "Authentication-Results": [ "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)", "ozlabs.org;\n\tdmarc=fail (p=none dis=none) header.from=linaro.org", "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=linaro.org header.i=@linaro.org\n\theader.b=\"EW5ggUQ6\"; dkim-atps=neutral" ], "Received": [ "from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 41x1X21YkCz9s3C\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 23 Aug 2018 20:54:58 +1000 (AEST)", "by lists.denx.de (Postfix, from userid 105)\n\tid D533FC21F1B; Thu, 23 Aug 2018 10:53:41 +0000 (UTC)", "from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 7E726C21F74;\n\tThu, 23 Aug 2018 10:44:20 +0000 (UTC)", "by lists.denx.de (Postfix, from userid 105)\n\tid A1FFAC21E9F; Thu, 23 Aug 2018 10:43:58 +0000 (UTC)", "from mail-lf1-f65.google.com (mail-lf1-f65.google.com\n\t[209.85.167.65])\n\tby lists.denx.de (Postfix) with ESMTPS id 9BB8FC21F31\n\tfor <u-boot@lists.denx.de>; Thu, 23 Aug 2018 10:43:53 +0000 (UTC)", "by mail-lf1-f65.google.com with SMTP id g6-v6so3689297lfb.11\n\tfor <u-boot@lists.denx.de>; Thu, 23 Aug 2018 03:43:53 -0700 (PDT)", "from jax.ideon.se ([85.235.10.227])\n\tby smtp.gmail.com with ESMTPSA id\n\ty5-v6sm679771ljj.75.2018.08.23.03.43.51\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tThu, 23 Aug 2018 03:43:52 -0700 (PDT)" ], "X-Spam-Checker-Version": "SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de", "X-Spam-Level": "", "X-Spam-Status": "No, score=0.0 required=5.0 tests=RCVD_IN_MSPIKE_H2,\n\tT_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=R8wsh0/e6a4BeUAQHHKEJ3CQyeqFAddJuZgJMMwghlI=;\n\tb=EW5ggUQ6eyW6znDQgGwNCG723mnziAMZ0cmlNDUrIPywUp92xQk9tzo6K0XW/G5auj\n\tWJO/eeT8/EGP3wo2+Bb7mM9Q+WknLE7ZYmZPddwYHf5YCB3kRDAXAxBwk5U/w/AFh4SA\n\tnQRMqUMy5iwu4oy995N1QpUd416Kkua2B3WrQ=", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=R8wsh0/e6a4BeUAQHHKEJ3CQyeqFAddJuZgJMMwghlI=;\n\tb=NyIkfHlFX4MfqnpRHRG7iC7UWi4WuY8vFV3qD9dPfGfuX9JOR4Ms0TeCkndNuGkEzc\n\tk7qiNlG6jLOQjW5vP54ThyiN3P4D7kXUi2lu/GXGtkFNbf97BcITe0CGC+u/NqS0meWj\n\td7m7R/tk284WDDXIJWEC+guYPc7c47FE2c1+fphGYefsvqQt+F36UjZcFkzIeHaM0kQN\n\tCWZ3wJD0ysoQVldpcuGc0DkB68Fb/zHoBYEg2pDcFHfPpojhQbN+CxsohyYoYGVd1l6+\n\tPFOEWDshnKagRtcQly9nHRrBXzQe6VV90RBxiLg2sgHUlU4SRjEVjzt/kMZblI5zIAmD\n\th5hg==", "X-Gm-Message-State": "AOUpUlFTjPAfxsX2yWfLghm27cskyZYBo2MelFeJJQ8q+jveBnM7x9rm\n\toEp+E/DaycWPvWXIFHPiiyDEmYb0i/k=", "X-Google-Smtp-Source": "AA+uWPyBB+StZV+6nZE7n/Xlrhv90vkefjRO8LFteiOb6PPDrl76SdRJ3QNqit1GYNFCChz+Wtwo3A==", "X-Received": "by 2002:a19:c94a:: with SMTP id\n\tz71-v6mr16759634lff.34.1535021032742; \n\tThu, 23 Aug 2018 03:43:52 -0700 (PDT)", "From": "Jens Wiklander <jens.wiklander@linaro.org>", "To": "u-boot@lists.denx.de", "Date": "Thu, 23 Aug 2018 12:43:28 +0200", "Message-Id": "<20180823104334.16083-10-jens.wiklander@linaro.org>", "X-Mailer": "git-send-email 2.17.1", "In-Reply-To": "<20180823104334.16083-1-jens.wiklander@linaro.org>", "References": "<20180823104334.16083-1-jens.wiklander@linaro.org>", "Cc": "Tom Rini <trini@konsulko.com>, Pierre Aubert <p.aubert@staubli.com>", "Subject": "[U-Boot] [PATCH v2 09/15] test: tee: test TEE uclass", "X-BeenThere": "u-boot@lists.denx.de", "X-Mailman-Version": "2.1.18", "Precedence": "list", "List-Id": "U-Boot discussion <u-boot.lists.denx.de>", "List-Unsubscribe": "<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>", "List-Archive": "<http://lists.denx.de/pipermail/u-boot/>", "List-Post": "<mailto:u-boot@lists.denx.de>", "List-Help": "<mailto:u-boot-request@lists.denx.de?subject=help>", "List-Subscribe": "<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "base64", "Errors-To": "u-boot-bounces@lists.denx.de", "Sender": "\"U-Boot\" <u-boot-bounces@lists.denx.de>" }, "content": "Tests the TEE uclass with a sandbox tee driver.\n\nSigned-off-by: Jens Wiklander <jens.wiklander@linaro.org>\n---\n drivers/tee/Kconfig | 5 +-\n test/dm/Makefile | 1 +\n test/dm/tee.c | 182 ++++++++++++++++++++++++++++++++++++++++++++\n 3 files changed, 185 insertions(+), 3 deletions(-)\n create mode 100644 test/dm/tee.c", "diff": "diff --git a/drivers/tee/Kconfig b/drivers/tee/Kconfig\nindex 3e7fe6ddcc5d..032aff4777c6 100644\n--- a/drivers/tee/Kconfig\n+++ b/drivers/tee/Kconfig\n@@ -1,8 +1,8 @@\n # Generic Trusted Execution Environment Configuration\n config TEE\n \tbool \"Trusted Execution Environment support\"\n-\tdepends on ARM && (ARM64 || CPU_V7A)\n-\tselect ARM_SMCCC\n+\tdepends on (ARM && (ARM64 || CPU_V7A)) || SANDBOX\n+\tselect ARM_SMCCC if ARM\n \thelp\n \t This implements a generic interface towards a Trusted Execution\n \t Environment (TEE).\n@@ -14,5 +14,4 @@ menu \"TEE drivers\"\n source \"drivers/tee/optee/Kconfig\"\n \n endmenu\n-\n endif\ndiff --git a/test/dm/Makefile b/test/dm/Makefile\nindex d2ed96c61533..272374b92fb0 100644\n--- a/test/dm/Makefile\n+++ b/test/dm/Makefile\n@@ -44,4 +44,5 @@ obj-$(CONFIG_DM_VIDEO) += video.o\n obj-$(CONFIG_ADC) += adc.o\n obj-$(CONFIG_SPMI) += spmi.o\n obj-$(CONFIG_WDT) += wdt.o\n+obj-$(CONFIG_TEE) += tee.o\n endif\ndiff --git a/test/dm/tee.c b/test/dm/tee.c\nnew file mode 100644\nindex 000000000000..bf9db0c130ac\n--- /dev/null\n+++ b/test/dm/tee.c\n@@ -0,0 +1,182 @@\n+// SPDX-License-Identifier: GPL-2.0+\n+/*\n+ * Copyright (C) 2018 Linaro Limited\n+ */\n+\n+#include <common.h>\n+#include <dm.h>\n+#include <dm/test.h>\n+#include <tee.h>\n+#include <test/ut.h>\n+\n+struct sandbox_tee_state {\n+\tu32 session;\n+\tint num_shms;\n+};\n+\n+static void sandbox_tee_get_version(struct udevice *dev,\n+\t\t\t\t struct tee_version_data *vers)\n+{\n+\tmemset(vers, 0, sizeof(*vers));\n+}\n+\n+static int sandbox_tee_close_session(struct udevice *dev, u32 session)\n+{\n+\tstruct sandbox_tee_state *state = dev_get_priv(dev);\n+\n+\tif (!state->session || state->session != session)\n+\t\treturn -EINVAL;\n+\n+\tstate->session = 0;\n+\n+\treturn 0;\n+}\n+\n+static int sandbox_tee_open_session(struct udevice *dev,\n+\t\t\t\t struct tee_open_session_arg *arg,\n+\t\t\t\t ulong num_params, struct tee_param *params)\n+{\n+\tstruct sandbox_tee_state *state = dev_get_priv(dev);\n+\n+\tif (state->session)\n+\t\treturn -EBUSY;\n+\n+\tstate->session = 1;\n+\targ->session = state->session;\n+\n+\treturn 0;\n+}\n+\n+static int sandbox_tee_invoke_func(struct udevice *dev,\n+\t\t\t\t struct tee_invoke_arg *arg,\n+\t\t\t\t ulong num_params, struct tee_param *params)\n+{\n+\tstruct sandbox_tee_state *state = dev_get_priv(dev);\n+\n+\tif (!arg->session)\n+\t\treturn -EINVAL;\n+\n+\tif (arg->session != state->session)\n+\t\treturn -EINVAL;\n+\n+\tif (arg->func != 1)\n+\t\treturn -ENOENT;\n+\n+\treturn 0;\n+}\n+\n+static int sandbox_tee_shm_register(struct udevice *dev, struct tee_shm *shm)\n+{\n+\tstruct sandbox_tee_state *state = dev_get_priv(dev);\n+\n+\tstate->num_shms++;\n+\n+\treturn 0;\n+}\n+\n+static int sandbox_tee_shm_unregister(struct udevice *dev, struct tee_shm *shm)\n+{\n+\tstruct sandbox_tee_state *state = dev_get_priv(dev);\n+\n+\tstate->num_shms--;\n+\n+\treturn 0;\n+}\n+\n+static const struct tee_driver_ops sandbox_tee_ops = {\n+\t.get_version = sandbox_tee_get_version,\n+\t.open_session = sandbox_tee_open_session,\n+\t.close_session = sandbox_tee_close_session,\n+\t.invoke_func = sandbox_tee_invoke_func,\n+\t.shm_register = sandbox_tee_shm_register,\n+\t.shm_unregister = sandbox_tee_shm_unregister,\n+};\n+\n+static const struct udevice_id sandbox_tee_match[] = {\n+\t{ .compatible = \"sandbox,tee\" },\n+\t{},\n+};\n+\n+U_BOOT_DRIVER(sandbox_tee) = {\n+\t.name = \"sandbox_tee\",\n+\t.id = UCLASS_TEE,\n+\t.of_match = sandbox_tee_match,\n+\t.ops = &sandbox_tee_ops,\n+\t.priv_auto_alloc_size = sizeof(struct sandbox_tee_state),\n+};\n+\n+static int open_session(struct udevice *dev, u32 *session)\n+{\n+\tstruct tee_open_session_arg arg;\n+\tint rc;\n+\n+\tmemset(&arg, 0, sizeof(arg));\n+\trc = tee_open_session(dev, &arg, 0, NULL);\n+\tif (rc)\n+\t\treturn rc;\n+\tif (arg.ret)\n+\t\treturn -EIO;\n+\t*session = arg.session;\n+\n+\treturn 0;\n+}\n+\n+static int invoke_func(struct udevice *dev, u32 session, u32 func)\n+{\n+\tstruct tee_invoke_arg arg = { .session = session, .func = func };\n+\n+\treturn tee_invoke_func(dev, &arg, 0, NULL);\n+}\n+\n+static int match(struct tee_version_data *vers, const void *data)\n+{\n+\treturn !vers->gen_caps;\n+}\n+\n+static int dm_test_tee(struct unit_test_state *uts)\n+{\n+\tstruct tee_version_data vers;\n+\tstruct udevice *dev;\n+\tstruct sandbox_tee_state *state;\n+\tu32 session;\n+\tint rc;\n+\tu8 data[128];\n+\tstruct tee_shm *reg_shm;\n+\tstruct tee_shm *alloc_shm;\n+\n+\tdev = tee_find_device(NULL, match, NULL, &vers);\n+\tut_assert(dev);\n+\tstate = dev_get_priv(dev);\n+\tut_assert(!state->session);\n+\n+\trc = open_session(dev, &session);\n+\tut_assert(!rc);\n+\tut_assert(session == state->session);\n+\n+\trc = invoke_func(dev, session, 1);\n+\tut_assert(!rc);\n+\n+\trc = tee_close_session(dev, session);\n+\tut_assert(!rc);\n+\tut_assert(!state->session);\n+\n+\tut_assert(!state->num_shms);\n+\treg_shm = tee_shm_register(dev, data, sizeof(data), 0);\n+\tut_assert(reg_shm);\n+\tut_assert(state->num_shms == 1);\n+\n+\talloc_shm = tee_shm_alloc(dev, 256, 0);\n+\tut_assert(alloc_shm);\n+\tut_assert(state->num_shms == 2);\n+\n+\tut_assert(tee_shm_is_registered(reg_shm, dev));\n+\tut_assert(tee_shm_is_registered(alloc_shm, dev));\n+\n+\ttee_shm_free(reg_shm);\n+\ttee_shm_free(alloc_shm);\n+\tut_assert(!state->num_shms);\n+\n+\treturn 0;\n+}\n+\n+DM_TEST(dm_test_tee, DM_TESTF_SCAN_FDT);\n", "prefixes": [ "U-Boot", "v2", "09/15" ] }