From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4B7DFC4332F for ; Thu, 22 Dec 2022 09:32:09 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3CA9D852AA; Thu, 22 Dec 2022 10:32:07 +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="Ku5HOkj6"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DB24D852B0; Thu, 22 Dec 2022 10:32:05 +0100 (CET) Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) (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 EC56480CB0 for ; Thu, 22 Dec 2022 10:32: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=ilias.apalodimas@linaro.org Received: by mail-ej1-x62e.google.com with SMTP id jo4so3536635ejb.7 for ; Thu, 22 Dec 2022 01:32:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=0ZriHnYL5qMRNUi1iuqM4Z06Hoa32T4+MLDq6Ir1ujc=; b=Ku5HOkj6e0khJlhV31cgWKlhvId0Yppz/DHOG+xiu3WGhQ7XXCdhkduhZKdXVET/8I K3qcvrp2QuiFImnVwUKdFoDdfFt4FX1Aa2dhROfB7yDKCrfORk9Fkfc78TdQlECt5un2 0N33SxzxABbRRSXEvnEJK0KU3gZu4rl6uQiLkfgH3MG/dHgDvrp3yP1E33zoCzCSOTos 6ZDTpJqF6e3HR5dWMpLwNLJ72zo90NZoILtJG4evw3YG6BnbxLGq7scSvqSpvpIK9ZSA qJ8feuDFApkQZolhCqK1EX+wWc+Amdj8YYPSA0vj5uLXnK7UMJodMxoRYz0yS9SzNet2 u89A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=0ZriHnYL5qMRNUi1iuqM4Z06Hoa32T4+MLDq6Ir1ujc=; b=4A8FSIx21ahxZe2RhX9k3u1KMDTP8PeyI8hpnOURoMbzCIHOtPeFRiINgWsDdAo8yc ORUZ3awQ1CZXn+BeSGPPUeaoF/CuMSSDiHQyN0nq+LqtrAjwADv3qYqQITm6Nxcscg5P hu3HglqDdaV1Ty/PoD7IU0pvETQ4f17MFqfVX0QeTrBAUf10AadeyKEsmuVe/PRHMU63 6FaUcTMKkooEm8VcbrO2qlob3U4wwp2DiGlA0oGB8L6jd6t9kgWoGHdxPFYgI4BydGNM NDwFi9Fv8Hj5fuBATAQ9gQ2+gSjLbygl+CJ8GYkzd5SifXm2azSsTFgFlvFaO0NiipOf 3SHw== X-Gm-Message-State: AFqh2kpwmO7GamxvdMZ+qqTvXBcYesAGBAvEKmAiuNeeGFQALE4hWDyA I+MRSovIMN3xSZdGAP+aBeuKJA== X-Google-Smtp-Source: AMrXdXtrMhzkQ1hZQF7cA7Dyw9jT5tM147wu9tW+spfeLpVmcWyi1oyyzRnagAG2oH9d+Mo0J+NxZA== X-Received: by 2002:a17:906:311b:b0:7c1:64dc:ac25 with SMTP id 27-20020a170906311b00b007c164dcac25mr4059105ejx.23.1671701522489; Thu, 22 Dec 2022 01:32:02 -0800 (PST) Received: from hera (ppp079167090036.access.hol.gr. [79.167.90.36]) by smtp.gmail.com with ESMTPSA id g23-20020a1709064e5700b007c0a7286ac8sm43356ejw.69.2022.12.22.01.32.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Dec 2022 01:32:02 -0800 (PST) Date: Thu, 22 Dec 2022 11:31:59 +0200 From: Ilias Apalodimas To: Etienne Carriere Cc: u-boot@lists.denx.de, Jens Wiklander , Patrick Delaunay Subject: Re: [PATCH 2/2] tee: optee: discover services dependent on tee-supplicant Message-ID: References: <20221207153000.534581-1-etienne.carriere@linaro.org> <20221207153000.534581-2-etienne.carriere@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221207153000.534581-2-etienne.carriere@linaro.org> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.6 at phobos.denx.de X-Virus-Status: Clean On Wed, Dec 07, 2022 at 04:30:00PM +0100, Etienne Carriere wrote: > Makes OP-TEE to enumerate also services depending on tee-supplicant > support in U-Boot. This change allows OP-TEE services like fTPM TA > to be discovered and get a TPM device registered in U-Boot. > > Signed-off-by: Etienne Carriere > --- > drivers/tee/optee/core.c | 32 +++++++++++++++++++++++--------- > 1 file changed, 23 insertions(+), 9 deletions(-) > > diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c > index 604fd1414f..b21031d7d8 100644 > --- a/drivers/tee/optee/core.c > +++ b/drivers/tee/optee/core.c > @@ -102,13 +102,14 @@ static int bind_service_list(struct udevice *dev, struct tee_shm *service_list, > return 0; > } > > -static int __enum_services(struct udevice *dev, struct tee_shm *shm, size_t *shm_size, u32 tee_sess) > +static int __enum_services(struct udevice *dev, struct tee_shm *shm, size_t *shm_size, u32 tee_sess, > + unsigned int pta_cmd) > { > struct tee_invoke_arg arg = { }; > struct tee_param param = { }; > int ret = 0; > > - arg.func = PTA_CMD_GET_DEVICES; > + arg.func = pta_cmd; > arg.session = tee_sess; > > /* Fill invoke cmd params */ > @@ -118,7 +119,7 @@ static int __enum_services(struct udevice *dev, struct tee_shm *shm, size_t *shm > > ret = tee_invoke_func(dev, &arg, 1, ¶m); > if (ret || (arg.ret && arg.ret != TEE_ERROR_SHORT_BUFFER)) { > - dev_err(dev, "PTA_CMD_GET_DEVICES invoke function err: 0x%x\n", arg.ret); > + dev_err(dev, "Enumeration command 0x%x failed: 0x%x\n", pta_cmd, arg.ret); > return -EINVAL; > } > > @@ -127,12 +128,13 @@ static int __enum_services(struct udevice *dev, struct tee_shm *shm, size_t *shm > return 0; > } > > -static int enum_services(struct udevice *dev, struct tee_shm **shm, size_t *count, u32 tee_sess) > +static int enum_services(struct udevice *dev, struct tee_shm **shm, size_t *count, u32 tee_sess, > + unsigned int pta_cmd) > { > size_t shm_size = 0; > int ret; > > - ret = __enum_services(dev, NULL, &shm_size, tee_sess); > + ret = __enum_services(dev, NULL, &shm_size, tee_sess, pta_cmd); > if (ret) > return ret; > > @@ -142,7 +144,7 @@ static int enum_services(struct udevice *dev, struct tee_shm **shm, size_t *coun > return ret; > } > > - ret = __enum_services(dev, *shm, &shm_size, tee_sess); > + ret = __enum_services(dev, *shm, &shm_size, tee_sess, pta_cmd); > if (!ret) > *count = shm_size / sizeof(struct tee_optee_ta_uuid); > > @@ -174,20 +176,32 @@ static int bind_service_drivers(struct udevice *dev) > struct tee_shm *service_list = NULL; > size_t service_count; > u32 tee_sess; > - int ret; > + int ret, ret2; > > ret = open_enum_session(dev, &tee_sess); > if (ret) > return ret; > > - ret = enum_services(dev, &service_list, &service_count, tee_sess); > + ret = enum_services(dev, &service_list, &service_count, tee_sess, > + PTA_CMD_GET_DEVICES); > if (!ret) > ret = bind_service_list(dev, service_list, service_count); > > tee_shm_free(service_list); > + > + ret2 = enum_services(dev, &service_list, &service_count, tee_sess, > + PTA_CMD_GET_DEVICES_SUPP); > + if (!ret2) > + ret2 = bind_service_list(dev, service_list, service_count); > + > + tee_shm_free(service_list); > + > tee_close_session(dev, tee_sess); > > - return ret; > + if (ret) > + return ret; > + > + return ret2; All looks good, mind sending a v2 converting this to a ternary operator? with or without Reviewed-by: Ilias Apalodimas Regards /Ilias > } > > /** > -- > 2.25.1 >