From patchwork Thu Nov 4 14:14:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Etienne Carriere X-Patchwork-Id: 516799 Delivered-To: patch@linaro.org Received: by 2002:ad5:5208:0:0:0:0:0 with SMTP id p8csp1983465iml; Thu, 4 Nov 2021 07:15:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxP92zsMaKF1sBejrCoI/1PpozAOK2/Xqr1ol9kJQhKsGPsCDmzCEek9IHShjyzRKxtfSgW X-Received: by 2002:a05:6402:455:: with SMTP id p21mr29143084edw.384.1636035314802; Thu, 04 Nov 2021 07:15:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1636035314; cv=none; d=google.com; s=arc-20160816; b=0JZxwlPhKr81+xZm5vBMm8rs9kpTGBqw0VpTeW3FtLUhS94l0im5to8W2R3VkokbAQ JI80SfjLbl3tWi9tGDn3zTYh8zZ02JfsosxjWCnvQaYu4fVN716k/XA6gdM/oN3fvqNC 68vl78pV6+PwMZko9Nd7RNHGpG9owsdMXFUdfYQweUr5/TMFMoCYOxbTWaQ0gg2IHWxW 0E99z4DUUk5UNKV/lmDirnhXJUFVDqgON4yJhZMbTSOq0qag/0bIOJ2TkYidiBAqKnDF iOkVEwh0mVEqgSD7jNrARjAd7Y7lCVJbMWbic1YPfNTmbMRkJEWOLEQiIzYSc85uGHx+ TKEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=jAMREceLMuAVrzr292tRlH8J/41hxCy6pN3OgRzZiCQ=; b=UNitF0G7vlZ02JB5vx8lWg9u0ZkpH3zghtAje5cUVSeVty8U+uhQ+dPZsJLTq/OMdD 4BZTsGNRwK6xwWBV6N/aI29hFnlFkPV6IXmELamy36a3dp9LwsbaGE78rBDcrtSTSVFz IPS9W3hHW4ewO22fdDiauDh+hIo0jZityKlPa7+S2LVV9++arTz9A/5Y7bvMEcfIiCML 0oifDTaCSwEgSLeoWJu7/lgUyQIKKuuchwZRRYTun5P8Ckl6Kvso5F3tEj7dODfTUsC9 DyVyIzsm2Y9nU0TkOs9by/rN5XW8LQtiiYtrdcqQ9Z4T2C2amP4QHVW/kaYkdVXwfpRh /KIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=e2Dm+MMS; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id la20si7856257ejc.785.2021.11.04.07.15.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 07:15:14 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=e2Dm+MMS; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 11D37836B6; Thu, 4 Nov 2021 15:15:10 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="e2Dm+MMS"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 75368836C4; Thu, 4 Nov 2021 15:15:06 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 41D6D83661 for ; Thu, 4 Nov 2021 15:15:00 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=etienne.carriere@linaro.org Received: by mail-wm1-x334.google.com with SMTP id o29so838644wms.2 for ; Thu, 04 Nov 2021 07:15:00 -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; bh=jAMREceLMuAVrzr292tRlH8J/41hxCy6pN3OgRzZiCQ=; b=e2Dm+MMSM+KTiMg8mWvxdtn1Gq4HuJou9TneS8hmbPYJbFgynYQA/DEr7eiYAca2Pm ssz30IOHE0iFJY+GjVAltBuwfaRJRG4KMCZy7mgCsrrrLsOYMLNcOjTtus7oAzJW8Fqg O+VxX6rc+5ohuTyJV6bSDjMgPPWN7/Jy+y4XZ/MVFfkvILvpK7Ze8aE00RtAfAtqH7fv TW2yZSSCFJ1whvvxBBTi5qFinTCegZB0AI69oS9zvIyjx62/nEbwHKQQA1LUT275moVl IPmkIu/43XNr7SwNWKIpx3vn4KdalvcXWYz2YrfDN5E5AktF5IU1j1nM4PovY+iQ8/A6 pHiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=jAMREceLMuAVrzr292tRlH8J/41hxCy6pN3OgRzZiCQ=; b=zshT9dOqchBEqj3L9pdWY2kz5QusOunvWF54TVroj5oEjUSRUNgC7m1tL3uCrgsy+V y0TaxrbdJFmhNtXQBVLAcHG0vukX4qEvPsX4ZFEDvsc7RGvvE4bVZj+Gyt4Pnb5fxmKl 2KDRfEql8T9bUhG44JhFFlOdTCBxOX2h+uPi79+abZbxpQ6ivmL/VLHrYlD4nM5m/TyS zUCvWxFf1OfcI1joF9fizN2QDyIr9IQgbVKX89qs1VkVqTh9vcu8+R/u5meajYqrU2TZ n7cDFWwLUEI/CC9fWIntu7Wt/q6mLAOV+Y3vmcIHDJCj61VH2I6OTLeDyvJ6W0EridQB Eekw== X-Gm-Message-State: AOAM532ouQV+JWDiTR9LaQlB67Az4zVMZ0/aBtbSHr1eMfP7RMx31ywm g6bLY1XKJNRV7pi/mEsyAYoWzNUSekVvAA== X-Received: by 2002:a1c:8015:: with SMTP id b21mr22736953wmd.161.1636035298512; Thu, 04 Nov 2021 07:14:58 -0700 (PDT) Received: from lmecxl0524.lme.st.com ([2a04:cec0:10b3:52ee:40ee:3a6f:5eb8:bd35]) by smtp.gmail.com with ESMTPSA id l26sm5354862wms.15.2021.11.04.07.14.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 07:14:57 -0700 (PDT) From: Etienne Carriere To: u-boot@lists.denx.de Cc: Etienne Carriere , Jens Wiklander Subject: [PATCH 1/5] tee: define session login identifiers Date: Thu, 4 Nov 2021 15:14:47 +0100 Message-Id: <20211104141451.29967-1-etienne.carriere@linaro.org> X-Mailer: git-send-email 2.17.1 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Define identifiers for clnt_login field in struct tee_open_session_arg based in GlobalPlatform Device TEE IDs and on the REE_KERNEL identifier extension from OP-TEE OS. Cc: Jens Wiklander Signed-off-by: Etienne Carriere Reviewed-by: Patrick Delaunay Reviewed-by: Jens Wiklander --- This change was previously discussed in the U-Boot ML, see v2 at: https://patchwork.ozlabs.org/project/uboot/patch/20210519142613.7668-1-etienne.carriere@linaro.org/ Changes since this v2 post: - Updated the inline comment describing reserved login Ids - Rephrase 'REE kernel agent' to 'REE kernel/privileged agent' to better apply to U-Boot that is not a kernel but still runs at a privileged execution level. --- include/tee.h | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/include/tee.h b/include/tee.h index 44e9cd4321..30ea2ee164 100644 --- a/include/tee.h +++ b/include/tee.h @@ -31,6 +31,25 @@ #define TEE_PARAM_ATTR_MASK (TEE_PARAM_ATTR_TYPE_MASK | \ TEE_PARAM_ATTR_META) +/* + * Global Platform login identifiers for tee_open_session_arg::clnt_login + */ +#define TEE_LOGIN_PUBLIC 0x00000000 +#define TEE_LOGIN_USER 0x00000001 +#define TEE_LOGIN_GROUP 0x00000002 +#define TEE_LOGIN_APPLICATION 0x00000004 +#define TEE_LOGIN_APPLICATION_USER 0x00000005 +#define TEE_LOGIN_APPLICATION_GROUP 0x00000006 +/* + * Reserve use of GP implementation specific login method range + * (0x80000000 - 0xBFFFFFFF). This range is rather being used + * for REE kernel clients or TEE implementation. + */ +#define TEE_LOGIN_REE_KERNEL_MIN 0x80000000 +#define TEE_LOGIN_REE_KERNEL_MAX 0xBFFFFFFF +/* Private login method for REE kernel/privileged clients */ +#define TEE_LOGIN_REE_KERNEL 0x80000000 + /* * Some Global Platform error codes which has a meaning if the * TEE_GEN_CAP_GP bit is returned by the driver in @@ -135,8 +154,8 @@ struct tee_param { /** * struct tee_open_session_arg - extra arguments for tee_open_session() * @uuid: [in] UUID of the Trusted Application - * @clnt_uuid: [in] Normally zeroes - * @clnt_login: [in] Normally 0 + * @clnt_uuid: [in] UUID of client, zeroes for PUBLIC/REE_KERNEL + * @clnt_login: [in] Class of client TEE_LOGIN_* * @session: [out] Session id * @ret: [out] return value * @ret_origin: [out] origin of the return value From patchwork Thu Nov 4 14:14:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Etienne Carriere X-Patchwork-Id: 516800 Delivered-To: patch@linaro.org Received: by 2002:ad5:5208:0:0:0:0:0 with SMTP id p8csp1983698iml; Thu, 4 Nov 2021 07:15:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzLqyc+FvZuUBVA7zl8iIdwe0Q5YSlYxuCR/OkYmnQOsQ8tg2pLCQq0dAMiRpYHh7tMDqtk X-Received: by 2002:a7b:c08a:: with SMTP id r10mr22630032wmh.184.1636035326920; Thu, 04 Nov 2021 07:15:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1636035326; cv=none; d=google.com; s=arc-20160816; b=QDfzxbpqrffVs7zvj22O6Tm0XvpsTVMorwQqPfldnlBOOUpA0Y/5tGsnGAFXpZY4Zt jbtIN69qnmakol/kz0UVIADVKiGRGDbjATA1zwGUlQ6Wo+qx7vg7BL4AJ+mVOP7j/Vt2 YxlYzTMVqv2m9/9LxZhEnt7pGxPo33M4dV0x2g/7pkFR2W9mCzNIa7lAtYKVX2Ji6GFo R2jQbnlUvQhjq+wXs3sqYh+o0cBukC9FeTmELXvumUNoDAzl/ITwU7osQMNvDJtn/NHl EaeLaEdztsYg6XV/5DO504wkr88z9iSJHhdq0MsvgTLKxLJlzNBQrKdN5BINMged6mOt ZMqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=i0AtVjhXgRh06Cp/emcmQ3+3UE7HllINNnRyXfax+eI=; b=T4gl3bhmovQVDPXe4Bneg9aa14ZYW670DwUaQHAu+nVBwBFu2Fdwc2glBont//Udkc t3z6EM2xbnmUR/kn7joGu+5D7rZ99fLFd3IDaPIEM9hflGr0PR5RcovCgGATJWp+JHek eccZDwIHFtZXVVvT5361HoSCRLezgG3v07LgjZD2VcnnzCGkUj/KCuLQ2mYjvbTnpyJd 3gnqilPjQ2cWTm4Jg9tPnsulTAMorK8oHsEYVkjdmaDKUG4T+TjgPA9nc8/YnD1CJeBW 3yl2CICtKbdfxSMlFKJBFJef7mSzjm68TBpgOl14b5kDaSZe1Tum7JKjXKYE8wkauip0 wRJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Sr95ys0Q; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id h22si11342821ede.300.2021.11.04.07.15.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 07:15:26 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Sr95ys0Q; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6D4A9836BA; Thu, 4 Nov 2021 15:15:15 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="Sr95ys0Q"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C79C783661; Thu, 4 Nov 2021 15:15:07 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 43176836B6 for ; Thu, 4 Nov 2021 15:15:01 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=etienne.carriere@linaro.org Received: by mail-wr1-x42e.google.com with SMTP id u1so8818940wru.13 for ; Thu, 04 Nov 2021 07:15:01 -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:in-reply-to:references; bh=i0AtVjhXgRh06Cp/emcmQ3+3UE7HllINNnRyXfax+eI=; b=Sr95ys0QgtrDhv0CFA2XgA60QEfv2e/1fUhHrEeLpOrItUu/Zo2EK97d/dEsG2VmIu j9GZHSuOx0NGAWz10mw3d4EU+F4dO/k5ivB66Lzwq22MxMj748XwwFfLsdEk8Xxo26GB N4KHu5hLY8QQX1IA05tavinJXiAGUMzivp+LvmzYVPjMifS5kETL9dBk6eNkyswEV/QB MOEb6wOMy0Pg99E6Hzrl7/swLA/X8WSw2h4FhWN4UXPnemo9FGJzFLFk25arWrFCINuz DTY/RLns3PUmQTWcKA7XPhmCNt2JFuFSxKUj3YtSj+TpYfzxSVZWfhi9/5tZxesIZMji /BVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=i0AtVjhXgRh06Cp/emcmQ3+3UE7HllINNnRyXfax+eI=; b=lCjbhVWeWjOW/o2fc/0l8umn2HxEYaS7vPnrx3FK/1l46del8/H5LvhAsVb+ELX9jT W04l8OhGVmM2MhGCA1V2bGZKA7PPK0IXVI6tajHniG1VRnDuP1N85TNC8txJHXdhdRLK lDjPxfdJwNmjODo+qML8TEaxuEN4YB8GsxbwwDjtcAtOtpPaHxEFTVmxCtKpOy0GEACL 2/+ULc/JL3YtJH8/5y/UCiUVTqeah0xVWW1o09ORZsqIjAis/z/jdp7fKtrPL6onoZn0 oN2kzH5Dwhzx83llzZhpvUmbOEHL5XzFt/yuFUCRuGheful0qiHDCM4xYn3A9kj7KtXr IFpw== X-Gm-Message-State: AOAM532fq9L+5ocd2GK9DYMDH1GI9H3WVppSRz5pXO3t3+4234iVUajF 2EEoaTVavHjuCOJy6JCTEmjkwdHTrR5X4Q== X-Received: by 2002:a5d:674c:: with SMTP id l12mr4157962wrw.439.1636035300390; Thu, 04 Nov 2021 07:15:00 -0700 (PDT) Received: from lmecxl0524.lme.st.com ([2a04:cec0:10b3:52ee:40ee:3a6f:5eb8:bd35]) by smtp.gmail.com with ESMTPSA id l26sm5354862wms.15.2021.11.04.07.14.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 07:14:59 -0700 (PDT) From: Etienne Carriere To: u-boot@lists.denx.de Cc: Etienne Carriere , Jens Wiklander Subject: [PATCH 2/5] tee: optee: remove unused duplicated login Id macros Date: Thu, 4 Nov 2021 15:14:48 +0100 Message-Id: <20211104141451.29967-2-etienne.carriere@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211104141451.29967-1-etienne.carriere@linaro.org> References: <20211104141451.29967-1-etienne.carriere@linaro.org> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Remove unused OPTEE_MSG_LOGIN_* ID macros as suitable TEE_LOGIN_* ID macros are already defined tee.h. Cc: Jens Wiklander Signed-off-by: Etienne Carriere Reviewed-by: Patrick Delaunay Reviewed-by: Jens Wiklander --- This change was previously discussed in the U-Boot ML, latest is "[PATCH v2 2/2] tee: optee: support session login as REE kernel", at: https://patchwork.ozlabs.org/project/uboot/patch/20210519142613.7668-2-etienne.carriere@linaro.org/ Changes since this v2 post: - Remove sanitation of the login Id passed to OP-TEE as secure world - Rephrase header line since this change now simply remove duplicated macros. - Update OPTEE_MSG_CMD_OPEN_SESSION inline description comment with a reference to TEE_LOGIN_* macros. --- drivers/tee/optee/optee_msg.h | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) -- 2.17.1 diff --git a/drivers/tee/optee/optee_msg.h b/drivers/tee/optee/optee_msg.h index 8d40ce60c2..a8ef926a48 100644 --- a/drivers/tee/optee/optee_msg.h +++ b/drivers/tee/optee/optee_msg.h @@ -86,16 +86,6 @@ #define OPTEE_MSG_ATTR_CACHE_MASK GENMASK(2, 0) #define OPTEE_MSG_ATTR_CACHE_PREDEFINED 0 -/* - * Same values as TEE_LOGIN_* from TEE Internal API - */ -#define OPTEE_MSG_LOGIN_PUBLIC 0x00000000 -#define OPTEE_MSG_LOGIN_USER 0x00000001 -#define OPTEE_MSG_LOGIN_GROUP 0x00000002 -#define OPTEE_MSG_LOGIN_APPLICATION 0x00000004 -#define OPTEE_MSG_LOGIN_APPLICATION_USER 0x00000005 -#define OPTEE_MSG_LOGIN_APPLICATION_GROUP 0x00000006 - /* * Page size used in non-contiguous buffer entries */ @@ -279,7 +269,7 @@ struct optee_msg_arg { * parameters to pass the following information: * param[0].u.value.a-b uuid of Trusted Application * param[1].u.value.a-b uuid of Client - * param[1].u.value.c Login class of client OPTEE_MSG_LOGIN_* + * param[1].u.value.c Login class of client TEE_LOGIN_* * * OPTEE_MSG_CMD_INVOKE_COMMAND invokes a command a previously opened * session to a Trusted Application. struct optee_msg_arg::func is Trusted From patchwork Thu Nov 4 14:14:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Etienne Carriere X-Patchwork-Id: 516802 Delivered-To: patch@linaro.org Received: by 2002:ad5:5208:0:0:0:0:0 with SMTP id p8csp1984143iml; Thu, 4 Nov 2021 07:15:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxB/o1ebFe8uLcmkGir/b8to+GXzuXTrFgCFoAWIi/orU1CV2zryXSh9VGG53j1rzNtpkp/ X-Received: by 2002:a05:6402:350e:: with SMTP id b14mr17485370edd.271.1636035348303; Thu, 04 Nov 2021 07:15:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1636035348; cv=none; d=google.com; s=arc-20160816; b=M6yHArYgM8T7EzzjoXiJReOewe3bNCNcI0JlDFLoq6KF4zwqcfVAoE46jYFN4dyV8x kFLy69RRzVIoZvzcuP1noxfKhvdbaxta3obH0LkGGtinnL+7al72SQhs6W/0f7sgOOUK +QY+nmXEC0cBgAk4SsNb3XDREO5Xw2LODpQuYAwhVvoWgWKMbOST+qtA+wI666oR42Go dBWyoudS7VTIGoxT8nqza3wqLTc9lc7fBP48ub4kc1iUpCk3TDKRS7fXKnXD/DSIwK0W 6wiri8KYeCWmfJdZSqQFADD4k4Ez9FWNT0FnUdNWTokZLdG5kOtBPcXd3X4ropBbHJIj QeIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=t/9c8YlPwdiUpJXUeIXjuzdJhRHwX29nVuyu/8jcmOM=; b=hFwi0x5RjMegffgbjCziozKTaZHzdlbXUSMWadsmAg/3aSV6A3QTPv9x71KgUH58Vu t02TSxHH5oXT2MTM9VEzjr+BOxvdJ0DHJ8ydedSeQIckKxSYHv8ZCkybodVb3m/cAHL+ Fhxi4bY9GZpZeRanXP/exC9c1mQAf2sf/W4fNx70aMAFnoOAEBkfzz6YuwFu8t3MksMN ZXtJOCinx4AHiOZc4o4c9JT12RGvOJCehdFCvsJOZ/qa8ireO5OzUpcjzh9eJ78uFzfA 2k+GRNyWG0fecBcLJ69VX5CDLcGm57vqfS5Gou62eG9UAsRgCG69YnxXvRpomVqxYq1a 4zYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Wo8UUm4v; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id k9si9457673edv.52.2021.11.04.07.15.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 07:15:48 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Wo8UUm4v; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EBFFD836D7; Thu, 4 Nov 2021 15:15:24 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="Wo8UUm4v"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CDF21836CA; Thu, 4 Nov 2021 15:15:11 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 770B4836BA for ; Thu, 4 Nov 2021 15:15:02 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=etienne.carriere@linaro.org Received: by mail-wr1-x430.google.com with SMTP id d13so8852612wrf.11 for ; Thu, 04 Nov 2021 07:15:02 -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:in-reply-to:references; bh=t/9c8YlPwdiUpJXUeIXjuzdJhRHwX29nVuyu/8jcmOM=; b=Wo8UUm4vKK9OvJOpUk5r+2WdgbqgTL4bimiW1qtPUuM7VtfrOrNSAMO5Z207yOjXPI wRzzZfUWF4AqI4IT8puL0RRB0E4Zus01c/cLVsRV/KgInPlhqMeTrtslsr+T1tDVPolF bhVyuFM10kkguZhw3D+8lWY5rqyKDsPHSCorq4tbK8ojBgCq0KjHjrWRueOpdvvI8zqT i9tssuClGtF8elIfefBv8Mj4yjyHbxdvoAA16NbbxUDlzT5e/DxssUPcpwaniuSkSUVL wBcPB+yBLjOWtnfMHqKQuekPlPwNo8PdhNK3zpByX3Ftux6ZfUFs5mHZscmsO3hpsycy 0+Lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=t/9c8YlPwdiUpJXUeIXjuzdJhRHwX29nVuyu/8jcmOM=; b=p5Lw8pPRE1xJqJX678qIKm+vb6IVGlQbZ1ONxjhf4/LQKaJTFg6IGajJKB6PBDcPVH agP8Ki1rEzTYcIYmsT7O71G2jw4BFUUcVzDTHXqLNmIRG/CAycHgNPkm0enVEl/ufGEQ ssHCR15j6uOs7Xlc5bv52Ewgj1vzPT4UHvl7J/Z10T6PBwX+MmT2HMayKyW3Vjw0EJk0 LY+4CzQ+nRW6Jlc225mkK0/P7CjvGnlrVXoeK+T9zoOsXvFPloJdv6iI8rfyAuR6TKar dafyVh2dMyWlIWBmBYkPWJZ89YUMM4b/ErPwn+ZDkg2iw3ihmkV7nbl2RmxciCa0Xbnj cVyA== X-Gm-Message-State: AOAM530Ho5gKh9Gjo1v/MfHxa6U8wXLhEiIhf6ammUUmrlb0khf9PlCH R7jlDx04JImW6kHJ4XDL2WxrID4rPoaNxA== X-Received: by 2002:a5d:49c3:: with SMTP id t3mr47479232wrs.207.1636035301733; Thu, 04 Nov 2021 07:15:01 -0700 (PDT) Received: from lmecxl0524.lme.st.com ([2a04:cec0:10b3:52ee:40ee:3a6f:5eb8:bd35]) by smtp.gmail.com with ESMTPSA id l26sm5354862wms.15.2021.11.04.07.15.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 07:15:01 -0700 (PDT) From: Etienne Carriere To: u-boot@lists.denx.de Cc: Etienne Carriere , Jens Wiklander Subject: [PATCH 3/5] tee: optee: define TEE error code TEE_ERROR_SHORT_BUFFER Date: Thu, 4 Nov 2021 15:14:49 +0100 Message-Id: <20211104141451.29967-3-etienne.carriere@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211104141451.29967-1-etienne.carriere@linaro.org> References: <20211104141451.29967-1-etienne.carriere@linaro.org> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Adds TEE_ERROR_SHORT_BUFFER as TEE error code. This error code is commonly used by TEEs to inform caller that the buffer(s) it provided is too small for the desired operation. Cc: Jens Wiklander Signed-off-by: Etienne Carriere Reviewed-by: Patrick Delaunay Reviewed-by: Jens Wiklander --- include/tee.h | 1 + 1 file changed, 1 insertion(+) -- 2.17.1 diff --git a/include/tee.h b/include/tee.h index 30ea2ee164..50051496ae 100644 --- a/include/tee.h +++ b/include/tee.h @@ -64,6 +64,7 @@ #define TEE_ERROR_NOT_SUPPORTED 0xffff000a #define TEE_ERROR_COMMUNICATION 0xffff000e #define TEE_ERROR_SECURITY 0xffff000f +#define TEE_ERROR_SHORT_BUFFER 0xffff0010 #define TEE_ERROR_OUT_OF_MEMORY 0xffff000c #define TEE_ERROR_OVERFLOW 0xffff300f #define TEE_ERROR_TARGET_DEAD 0xffff3024 From patchwork Thu Nov 4 14:14:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Etienne Carriere X-Patchwork-Id: 516801 Delivered-To: patch@linaro.org Received: by 2002:ad5:5208:0:0:0:0:0 with SMTP id p8csp1983946iml; Thu, 4 Nov 2021 07:15:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxA62KDxZxRlBUevh4rEyjn3/J/KaKRKfy86VSWJIZ13jO6Vk2HwHe2I7d6cQk1H7XOjpbo X-Received: by 2002:a17:906:2295:: with SMTP id p21mr22563921eja.35.1636035337889; Thu, 04 Nov 2021 07:15:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1636035337; cv=none; d=google.com; s=arc-20160816; b=T61ksDDobzf0aqqem1l8359joSjy2Pysnrq1zkLCkpxoTPpnZGZJQeHKBQnjpidxJ/ WNFJxU8XutS/nIXXa7GeCOIgDFgYLCq3n4I0PD1P+7Gx1OALCtGT9MIwOdDc57rubix0 8oT42FC+I5ArJdOhrylrp9zLltLaWSuo66zH8ZHf6yg4QzJRoo9NCnnzi9LEUXwlhXAe UioNNdYG+B0ZS5GO2/sDgGfQqaZtSH1sP8lc56RBla46lArBvpK22QCd4s/0aVTICtBT 0dc+5QDFb9dkwIEiIHkT0kzKF6vKGErrKUJQST6FRuAWMV3Sxw3xXTX5hAKa68E6yLWe Acog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=GwukvzmJPZYXPQnkpOk3wLvayYjR0CTW51E8hAEdtOM=; b=edE3aNAMcZCyweLPycY1Hk661nXmW1YtrO2RKCulw9Cad5YaUIOZTD2/aylR//OMxY 9uvv/rXxslIAZWl//RX8/6juLlPyaIc7tPtJncqBDhoBTd+1wYB2Rh4I2S2L3qH7wFy3 jUfVJbR+17i9h3Hcqgb7tUSeUk4PexKcXcz/hIMf+nW4yF29+Tw7tK3h1Gl+Nkzxpz6s AIxYOGbQx9VKJfQlHGnQe5xkN01IL9rYklIiMzvYThN4YdYmqxfNy6dwieMUGu4ybO5P WSZXut5qm1l8yZsGBHcHsXSvUVe1ueXwxN3EzszKjPEiCLcLyP4uJKq8VimA01xWtR65 //Bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=D+OpBPYF; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id hp29si9442299ejc.80.2021.11.04.07.15.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 07:15:37 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=D+OpBPYF; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 53F2A836C0; Thu, 4 Nov 2021 15:15:19 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="D+OpBPYF"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3E1D083661; Thu, 4 Nov 2021 15:15:13 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A7CB7836BD for ; Thu, 4 Nov 2021 15:15:03 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=etienne.carriere@linaro.org Received: by mail-wr1-x436.google.com with SMTP id u1so8819119wru.13 for ; Thu, 04 Nov 2021 07:15:03 -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:in-reply-to:references; bh=GwukvzmJPZYXPQnkpOk3wLvayYjR0CTW51E8hAEdtOM=; b=D+OpBPYFVWGYj48BSUpufbLqS4cBgoOcHIsKSzAsWRTctdb6aORPnT0dT3Jmlwjfby 6SMG/Veuqaf6cOyE+uC+wxts++OtcQEb9AE+OxSlEvV6EjCUfAuNrrlWTf5epdLFKNms fQf+dy6OFkI6wAC1/+sur1FxiQHoQ4BPRe/6US8W6Dve3it0wU8dg+7AJiNEvviGPniD RZAEockmrkQtMNWU4U7MhhZTTXuQ2OToTk8TxMeUgTIzkukR6MCBO9l58e8Sh9NxnS6q zM/JJo+RO1LnbOJkZ77cdhyqF5fy7GPDEq82e1TNGTGd/VWBELUXuzU8oOj9jpdO2CPe KPnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=GwukvzmJPZYXPQnkpOk3wLvayYjR0CTW51E8hAEdtOM=; b=CF2OMo4bfqeLMjXcxX6iAqmIrD7LFdgdMWU6TNFnCAA8EN9xdeABryfxDqxzf99ZiA Iq+DwpFGQD2d3rZSgGo5kC1cXDwIrDeBhSUJ1UiwfPgxmoLDDJVYTXyq8x20xX8HcgRZ rkhrAgFEu0DyOr6RhmHAMXHl01ZFiGDj2NA8tFLZgedRXd923ye/8YqjWMaKpdWyKGLT TTRLXyZZuPW9IP0gZPuFpkXnAQaIoN7UPv556m47EEyvi5p4pZdOBN/pz/zdD+aDLKYy kFsG3Gbl6FOB/CIUJvF/PbdJvTsQjdqMurgWvwv0XeZLz30l6ojGn87UgxjNnXFkh+37 5avQ== X-Gm-Message-State: AOAM531ZMQQ5GDKMloNfwPqT4V0qK/1ujmwKxF8alMVATt3hOWcvAl3C WmpPHfUys2/h3+THgff4mJpbo0neu7SF1A== X-Received: by 2002:a5d:6151:: with SMTP id y17mr58237292wrt.275.1636035302834; Thu, 04 Nov 2021 07:15:02 -0700 (PDT) Received: from lmecxl0524.lme.st.com ([2a04:cec0:10b3:52ee:40ee:3a6f:5eb8:bd35]) by smtp.gmail.com with ESMTPSA id l26sm5354862wms.15.2021.11.04.07.15.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 07:15:02 -0700 (PDT) From: Etienne Carriere To: u-boot@lists.denx.de Cc: Etienne Carriere , Jaehoon Chung Subject: [PATCH 4/5] dt-bindings: arm: scmi: OP-TEE as transport channel for SCMI messages Date: Thu, 4 Nov 2021 15:14:50 +0100 Message-Id: <20211104141451.29967-4-etienne.carriere@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211104141451.29967-1-etienne.carriere@linaro.org> References: <20211104141451.29967-1-etienne.carriere@linaro.org> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Introduce compatible "linaro,scmi-optee" for SCMI transport channel based on an OP-TEE service invocation. Define "linaro,optee-channel-id" property to identify the OP-TEE SCMI channel used by the protocol(s). OP-TEE SCMI transport can either use shared memory or a static shared memory buffer identified by the DT. These bindings were posted to the Linux kernel DT bindings mailing list and acked by maintainer [1]. Link: [1] https://lore.kernel.org/linux-arm-kernel/20211029102118.GG6526@e120937-lin/T/ Cc: Jaehoon Chung Signed-off-by: Etienne Carriere Reviewed-by: Patrick Delaunay --- doc/device-tree-bindings/arm/arm,scmi.txt | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) -- 2.17.1 diff --git a/doc/device-tree-bindings/arm/arm,scmi.txt b/doc/device-tree-bindings/arm/arm,scmi.txt index a76124f4a3..92572eabb5 100644 --- a/doc/device-tree-bindings/arm/arm,scmi.txt +++ b/doc/device-tree-bindings/arm/arm,scmi.txt @@ -14,7 +14,8 @@ Required properties: The scmi node with the following properties shall be under the /firmware/ node. -- compatible : shall be "arm,scmi" or "arm,scmi-smc" for smc/hvc transports +- compatible : shall be "arm,scmi" or "arm,scmi-smc" for smc/hvc transports, + or "linaro,scmi-optee" for OP-TEE transport. - mboxes: List of phandle and mailbox channel specifiers. It should contain exactly one or two mailboxes, one for transmitting messages("tx") and another optional for receiving the notifications("rx") if @@ -26,6 +27,8 @@ The scmi node with the following properties shall be under the /firmware/ node. - #size-cells : should be '0' as 'reg' property doesn't have any size associated with it. - arm,smc-id : SMC id required when using smc or hvc transports +- linaro,optee-channel-id : Channel specifier required when using OP-TEE + transport. Optional properties: @@ -33,16 +36,16 @@ Optional properties: See Documentation/devicetree/bindings/mailbox/mailbox.txt for more details about the generic mailbox controller and client driver bindings. - -The mailbox is the only permitted method of calling the SCMI firmware. Mailbox doorbell is used as a mechanism to alert the presence of a messages and/or notification. Each protocol supported shall have a sub-node with corresponding compatible as described in the following sections. If the platform supports dedicated -communication channel for a particular protocol, the 3 properties namely: -mboxes, mbox-names and shmem shall be present in the sub-node corresponding -to that protocol. +communication channel for a particular protocol, properties shall be present +in the sub-node corresponding to that protocol. These properties are: +- mboxes, mbox-names and shmem for mailbox transport +- arm,smc-id and shmem for smc/hvc transport +- linaro,optee-channel-id and possibly shmem for OP-TEE transport Clock/Performance bindings for the clocks/OPPs based on SCMI Message Protocol ------------------------------------------------------------ From patchwork Thu Nov 4 14:14:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Etienne Carriere X-Patchwork-Id: 516803 Delivered-To: patch@linaro.org Received: by 2002:ad5:5208:0:0:0:0:0 with SMTP id p8csp1984385iml; Thu, 4 Nov 2021 07:15:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwGcbMZe0vQg0edVOTxuIZRUQCJD/9OBSuXagK4X7RuTk7yewru+FAf+eB6N61i5/BmkLio X-Received: by 2002:a2e:8550:: with SMTP id u16mr3736557ljj.131.1636035359546; Thu, 04 Nov 2021 07:15:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1636035359; cv=none; d=google.com; s=arc-20160816; b=XsS5529NpBw4cBzjp+mBn6iUmtREAPNZwkiLGLBBg+u4DayvotV4GtjdWbKmezgoDk 6zbmyk2fz7BrUmTZk6nIMwe/DrDewus4WzG29I25xI1A3emLbrECl4hj8nDSrERUmL3x Z09g0LGpAJA5HCZEuzsTtutUnvJKCirbafBTBrMjX/1KxZkbFLxPLrz0TO73xx1Y+HAb JO42Soy1lRTiZiN33M0UY6qrPFPqpU8TJXu6cGyJN07kY2/OcKRN6nTe6vpz3wZdiUDA XHHxvQ4m2eVTIgy3eZGPCxGc82qfTUogfLDcxcFwO6xDgZUkA65a9Df9VZlJjN41oaQ/ hMQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=7elDLwbulD5XrFc6aZHEgimFYH5dRoMQ4sAXsvNT2pk=; b=J7jeoZRQbU/J+MxPJ2d0r0GoJpapviYdPPwVbrU8g5CgPVHvlmA6mQEiLFCsjdPy9a PZpk4WNM58e/5shh2t2EOcMSDJQFP5iKFS/cuq1bwe1FfALz8kmcdwxjyB1/u4+4edlu VLwUF/IkVKABNPQAUzt6ZRLPCqSuU6VsSE3zS4FwFtlwf/6msDqKFsWOmjpknXc5jLuF IkXbKLc0m5ZJQ9hkLDedkRGiZ//+rgFqeGopJ5CSyEVS38M+YOgLhNfIywWeQex0Ce6d zjNwO0WkXtpeheuOGoPTOOepqmkMOKpBZOkkM+fySJWgH0/S61g7JQm3acmBF9+05e9o DPRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gf51SRWI; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id e2si10751727ejs.60.2021.11.04.07.15.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 07:15:59 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gf51SRWI; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0E673836BF; Thu, 4 Nov 2021 15:15:31 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="gf51SRWI"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C3190836BC; Thu, 4 Nov 2021 15:15:18 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 08220836C7 for ; Thu, 4 Nov 2021 15:15:05 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=etienne.carriere@linaro.org Received: by mail-wr1-x431.google.com with SMTP id d27so8870066wrb.6 for ; Thu, 04 Nov 2021 07:15:05 -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:in-reply-to:references; bh=7elDLwbulD5XrFc6aZHEgimFYH5dRoMQ4sAXsvNT2pk=; b=gf51SRWIUCRShaWkc7Ag1WUl4qwRqcaMRexKHPCuglFcmuugnOV2OgJIZbMA0FIR/U K1vSnP0q7EW+aOyji2YzxlY3m0IlPkFvvd6+D0NDQQNS/nujscBdrgMtxylegeOUBEb0 DrGRg60DGd6Y0CdAVb0vvq8Kv+59ZIxovHxjfaikHO7dbLUvBZLVFKhiX9TtDKZ9Qq+1 y6WXdGbyW9E0TDvENGjGNQa2T0IhFVIEpAs3Rjiu4FTHQ2os0PHWbwlMDCVonMviO/Cp +655EtFNliEJ3x7q4xv8RnyFYp4UdTR1ZP21jDRCA3BULP68XoS3oVfgauV5hmANupq0 NIRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=7elDLwbulD5XrFc6aZHEgimFYH5dRoMQ4sAXsvNT2pk=; b=iSJf1uyvoBei96qMI2CxupvPD6g6a0dvHNJ9VdupwjiVoWuSWmQy/b4i1MgEvUjdHi 5YHVkRb/m0+Xo/srchSbAMKtF3s9rJUMKMN5swLwsC3YBxRbCKEfIKGm5OUulf0f5YNv PV0JhqO3BY1ONsbFUz8HmCuc81n4u2P8qFF4Wbn9xKvv0WR2oV+is6+BvNbRlE6L7VId d9LqU1W5RQOXkFXSXaToKiY5x6xZhgmKmr8Ia1TOZnnhV5uxyc3c/9azAnNI51kyJwZZ 8TlTwoDqq/Yg3DaK4tzDfxpXJFvj8o4ZQyaKQk9D9ncWz910YlPaAG8kbI5Sai/ClScL 9vrg== X-Gm-Message-State: AOAM5306FOHcbgRJfFOKI9c6jYvsqdWQIhT6RhMUqVaxZ0EhJOgVp8iA DpE+727JvfSHecgKgCzk1F0raLqX0T96OQ== X-Received: by 2002:a5d:548f:: with SMTP id h15mr63264330wrv.99.1636035304045; Thu, 04 Nov 2021 07:15:04 -0700 (PDT) Received: from lmecxl0524.lme.st.com ([2a04:cec0:10b3:52ee:40ee:3a6f:5eb8:bd35]) by smtp.gmail.com with ESMTPSA id l26sm5354862wms.15.2021.11.04.07.15.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 07:15:03 -0700 (PDT) From: Etienne Carriere To: u-boot@lists.denx.de Cc: Etienne Carriere , Patrick Delaunay , Wolfgang Denk Subject: [PATCH 5/5] firmware: scmi: Add OP-TEE transport Date: Thu, 4 Nov 2021 15:14:51 +0100 Message-Id: <20211104141451.29967-5-etienne.carriere@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211104141451.29967-1-etienne.carriere@linaro.org> References: <20211104141451.29967-1-etienne.carriere@linaro.org> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean This change implements an SCMI transport for agent interfacing the OP-TEE SCMI service. OP-TEE provides an SCMI PTA (Pseudo-TA) for non-secure world to send SCMI messages over an identified channel. The driver implemented here uses a SMT shared memory for passing messages between client and server. The implementation opens and releases channel resources for each passed SCMI message so that resources allocated (sessions) or registered (shared memory areas) in OP-TEE firmware are released for example before relocation as the driver will likely allocate/register them back when probed after relocation. The integration of the driver using dedicated config switch CONFIG_SCMI_AGENT_OPTEE is designed on the model posted to the U-Boot ML by Patrick Delaunay [1]. Link: [1] https://lore.kernel.org/all/20211028191222.v3.4.Ib2e58ee67f4d023823d8b5404332dc4d7e847277@changeid/ Cc: Patrick Delaunay Cc: Wolfgang Denk Signed-off-by: Etienne Carriere Reviewed-by: Patrick Delaunay --- drivers/firmware/scmi/Kconfig | 14 +- drivers/firmware/scmi/Makefile | 1 + drivers/firmware/scmi/optee_agent.c | 312 ++++++++++++++++++++++++++++ 3 files changed, 324 insertions(+), 3 deletions(-) create mode 100644 drivers/firmware/scmi/optee_agent.c -- 2.17.1 diff --git a/drivers/firmware/scmi/Kconfig b/drivers/firmware/scmi/Kconfig index c3a109beac..f9c69e5352 100644 --- a/drivers/firmware/scmi/Kconfig +++ b/drivers/firmware/scmi/Kconfig @@ -2,7 +2,7 @@ config SCMI_FIRMWARE bool "Enable SCMI support" select FIRMWARE select OF_TRANSLATE - depends on SANDBOX || DM_MAILBOX || ARM_SMCCC + depends on SANDBOX || DM_MAILBOX || ARM_SMCCC || OPTEE help System Control and Management Interface (SCMI) is a communication protocol that defines standard interfaces for power, performance @@ -14,6 +14,14 @@ config SCMI_FIRMWARE or a companion host in the CPU system. Communications between agent (client) and the SCMI server are - based on message exchange. Messages can be exchange over tranport + based on message exchange. Messages can be exchanged over transport channels as a mailbox device or an Arm SMCCC service with some - piece of identified shared memory. + piece of identified shared memory, or an OP-TEE SCMI service. + +config SCMI_AGENT_OPTEE + bool "Enable SCMI agent OP-TEE" + depends on SCMI_FIRMWARE && OPTEE + default y + help + Enable the SCMI communication channel based on OP-TEE transport + for compatible "linaro,scmi-optee". diff --git a/drivers/firmware/scmi/Makefile b/drivers/firmware/scmi/Makefile index 966475ec10..f72d06a400 100644 --- a/drivers/firmware/scmi/Makefile +++ b/drivers/firmware/scmi/Makefile @@ -2,4 +2,5 @@ obj-y += scmi_agent-uclass.o obj-y += smt.o obj-$(CONFIG_ARM_SMCCC) += smccc_agent.o obj-$(CONFIG_DM_MAILBOX) += mailbox_agent.o +obj-$(CONFIG_SCMI_AGENT_OPTEE) += optee_agent.o obj-$(CONFIG_SANDBOX) += sandbox-scmi_agent.o sandbox-scmi_devices.o diff --git a/drivers/firmware/scmi/optee_agent.c b/drivers/firmware/scmi/optee_agent.c new file mode 100644 index 0000000000..8232af2f41 --- /dev/null +++ b/drivers/firmware/scmi/optee_agent.c @@ -0,0 +1,312 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2020-2021 Linaro Limited. + */ + +#define LOG_CATEGORY UCLASS_SCMI_AGENT + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "smt.h" + +#define SCMI_SHM_SIZE 128 + +/** + * struct scmi_optee_channel - Description of an SCMI OP-TEE transport + * @channel_id: Channel identifier + * @smt: Shared memory buffer with synchronisation protocol + * @dyn_shm: True if using dynamically allocated shared memory + */ +struct scmi_optee_channel { + unsigned int channel_id; + struct scmi_smt smt; + bool dyn_shm; +}; + +/** + * struct channel_session - Aggreates SCMI service session context references + * @tee: OP-TEE device to invoke + * @tee_session: OP-TEE session identifier + * @tee_shm: Dynamically allocated OP-TEE shared memory, or NULL + * @channel_hdl: Channel handle provided by OP-TEE SCMI service + */ +struct channel_session { + struct udevice *tee; + u32 tee_session; + struct tee_shm *tee_shm; + u32 channel_hdl; +}; + +#define TA_SCMI_UUID { 0xa8cfe406, 0xd4f5, 0x4a2e, \ + { 0x9f, 0x8d, 0xa2, 0x5d, 0xc7, 0x54, 0xc0, 0x99 } } + +enum optee_smci_pta_cmd { + /* + * PTA_SCMI_CMD_CAPABILITIES - Get channel capabilities + * + * [out] value[0].a: Capability bit mask (enum pta_scmi_caps) + * [out] value[0].b: Extended capabilities or 0 + */ + PTA_SCMI_CMD_CAPABILITIES = 0, + + /* + * PTA_SCMI_CMD_PROCESS_SMT_CHANNEL - Process SCMI message in SMT buffer + * + * [in] value[0].a: Channel handle + * + * Shared memory used for SCMI message/response exhange is expected + * already identified and bound to channel handle in both SCMI agent + * and SCMI server (OP-TEE) parts. + * The memory uses SMT header to carry SCMI meta-data (protocol ID and + * protocol message ID). + */ + PTA_SCMI_CMD_PROCESS_SMT_CHANNEL = 1, + + /* + * PTA_SCMI_CMD_PROCESS_SMT_CHANNEL_MESSAGE - Process SMT/SCMI message + * + * [in] value[0].a: Channel handle + * [in/out] memref[1]: Message/response buffer (SMT and SCMI payload) + * + * Shared memory used for SCMI message/response is a SMT buffer + * referenced by param[1]. It shall be 128 bytes large to fit response + * payload whatever message playload size. + * The memory uses SMT header to carry SCMI meta-data (protocol ID and + * protocol message ID). + */ + PTA_SCMI_CMD_PROCESS_SMT_CHANNEL_MESSAGE = 2, + + /* + * PTA_SCMI_CMD_GET_CHANNEL - Get channel handle + * + * SCMI shm information are 0 if agent expects to use OP-TEE regular SHM + * + * [in] value[0].a: Channel identifier + * [out] value[0].a: Returned channel handle + * [in] value[0].b: Requested capabilities mask (enum pta_scmi_caps) + */ + PTA_SCMI_CMD_GET_CHANNEL = 3, +}; + +/* + * OP-TEE SCMI service capabilities bit flags (32bit) + * + * PTA_SCMI_CAPS_SMT_HEADER + * When set, OP-TEE supports command using SMT header protocol (SCMI shmem) in + * shared memory buffers to carry SCMI protocol synchronisation information. + */ +#define PTA_SCMI_CAPS_NONE 0 +#define PTA_SCMI_CAPS_SMT_HEADER BIT(0) + +static int open_channel(struct udevice *dev, struct channel_session *sess) +{ + const struct tee_optee_ta_uuid uuid = TA_SCMI_UUID; + struct scmi_optee_channel *chan = dev_get_plat(dev); + struct tee_open_session_arg sess_arg = { }; + struct tee_invoke_arg cmd_arg = { }; + struct tee_param param[1] = { }; + int ret; + + memset(sess, 0, sizeof(sess)); + + sess->tee = tee_find_device(NULL, NULL, NULL, NULL); + if (!sess->tee) + return -ENODEV; + + sess_arg.clnt_login = TEE_LOGIN_REE_KERNEL; + tee_optee_ta_uuid_to_octets(sess_arg.uuid, &uuid); + + ret = tee_open_session(sess->tee, &sess_arg, 0, NULL); + if (ret) { + dev_err(dev, "can't open session: %d\n", ret); + return ret; + } + + cmd_arg.func = PTA_SCMI_CMD_GET_CHANNEL; + cmd_arg.session = sess_arg.session; + + param[0].attr = TEE_PARAM_ATTR_TYPE_VALUE_INOUT; + param[0].u.value.a = chan->channel_id; + param[0].u.value.b = PTA_SCMI_CAPS_SMT_HEADER; + + ret = tee_invoke_func(sess->tee, &cmd_arg, ARRAY_SIZE(param), param); + if (ret || cmd_arg.ret) { + dev_err(dev, "Invoke failed: %d, 0x%x\n", ret, cmd_arg.ret); + if (!ret) + ret = -EPROTO; + + tee_close_session(sess->tee, sess_arg.session); + return ret; + } + + sess->tee_session = sess_arg.session; + sess->channel_hdl = param[0].u.value.a; + + return 0; +} + +static void close_channel(struct channel_session *sess) +{ + tee_close_session(sess->tee, sess->tee_session); +} + +static int invoke_cmd(struct udevice *dev, struct channel_session *sess, + struct scmi_msg *msg) +{ + struct scmi_optee_channel *chan = dev_get_plat(dev); + struct tee_invoke_arg arg = { }; + struct tee_param param[2] = { }; + int ret; + + scmi_write_msg_to_smt(dev, &chan->smt, msg); + + arg.session = sess->tee_session; + param[0].attr = TEE_PARAM_ATTR_TYPE_VALUE_INPUT; + param[0].u.value.a = sess->channel_hdl; + + if (chan->dyn_shm) { + arg.func = PTA_SCMI_CMD_PROCESS_SMT_CHANNEL_MESSAGE; + param[1].attr = TEE_PARAM_ATTR_TYPE_MEMREF_INOUT; + param[1].u.memref.shm = sess->tee_shm; + param[1].u.memref.size = SCMI_SHM_SIZE; + } else { + arg.func = PTA_SCMI_CMD_PROCESS_SMT_CHANNEL; + } + + ret = tee_invoke_func(sess->tee, &arg, ARRAY_SIZE(param), param); + if (ret || arg.ret) { + if (!ret) + ret = -EPROTO; + } else { + ret = scmi_read_resp_from_smt(dev, &chan->smt, msg); + } + + scmi_clear_smt_channel(&chan->smt); + + return ret; +} + +static int prepare_shm(struct udevice *dev, struct channel_session *sess) +{ + struct scmi_optee_channel *chan = dev_get_plat(dev); + int ret; + + /* Static shm is already prepared by the firmware: nothing to do */ + if (!chan->dyn_shm) + return 0; + + chan->smt.size = SCMI_SHM_SIZE; + + ret = tee_shm_alloc(sess->tee, chan->smt.size, 0, &sess->tee_shm); + if (ret) { + dev_err(dev, "Failed to allocated shmem: %d\n", ret); + return ret; + } + + chan->smt.buf = sess->tee_shm->addr; + + /* Initialize shm buffer for message exchanges */ + scmi_clear_smt_channel(&chan->smt); + + return 0; +} + +static void release_shm(struct udevice *dev, struct channel_session *sess) +{ + struct scmi_optee_channel *chan = dev_get_plat(dev); + + if (chan->dyn_shm) + tee_shm_free(sess->tee_shm); +} + +static int scmi_optee_process_msg(struct udevice *dev, struct scmi_msg *msg) +{ + struct channel_session sess; + int ret; + + ret = open_channel(dev, &sess); + if (ret) + return ret; + + ret = prepare_shm(dev, &sess); + if (ret) + goto out; + + ret = invoke_cmd(dev, &sess, msg); + + release_shm(dev, &sess); + +out: + close_channel(&sess); + + return ret; +} + +static int scmi_optee_of_to_plat(struct udevice *dev) +{ + struct scmi_optee_channel *chan = dev_get_plat(dev); + int ret; + + if (dev_read_u32(dev, "linaro,optee-channel-id", &chan->channel_id)) { + dev_err(dev, "Missing property linaro,channel-id\n"); + return -EINVAL; + } + + if (dev_read_prop(dev, "shmem", NULL)) { + ret = scmi_dt_get_smt_buffer(dev, &chan->smt); + if (ret) { + dev_err(dev, "Failed to get smt resources: %d\n", ret); + return ret; + } + chan->dyn_shm = false; + } else { + chan->dyn_shm = true; + } + + return 0; +} + +static int scmi_optee_probe(struct udevice *dev) +{ + struct channel_session sess; + int ret; + + /* Check OP-TEE service acknowledges the SCMI channel */ + ret = open_channel(dev, &sess); + if (!ret) + close_channel(&sess); + + return ret; +} + +static const struct udevice_id scmi_optee_ids[] = { + { .compatible = "linaro,scmi-optee" }, + { } +}; + +static const struct scmi_agent_ops scmi_optee_ops = { + .process_msg = scmi_optee_process_msg, +}; + +U_BOOT_DRIVER(scmi_optee) = { + .name = "scmi-over-optee", + .id = UCLASS_SCMI_AGENT, + .of_match = scmi_optee_ids, + .plat_auto = sizeof(struct scmi_optee_channel), + .of_to_plat = scmi_optee_of_to_plat, + .probe = scmi_optee_probe, + .flags = DM_FLAG_OS_PREPARE, + .ops = &scmi_optee_ops, +};