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 155D5C6379F for ; Tue, 21 Feb 2023 13:03:47 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id F3E73859DA; Tue, 21 Feb 2023 14:03:44 +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="oub4cyEA"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2D904859DF; Tue, 21 Feb 2023 14:03:43 +0100 (CET) Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) (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 68A24859DA for ; Tue, 21 Feb 2023 14:03:40 +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-ed1-x534.google.com with SMTP id x10so16099341edd.13 for ; Tue, 21 Feb 2023 05:03:40 -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=+x2Dw2XrDWRn2r5NJ+vSA3+oClesFRaiZBvN2WbK5rY=; b=oub4cyEAcVH0hRLU/ioh+yMj/fxBVL2L1NjIPpnWLeoZoqvKUUH0vdUeqvxdP53N// IILBkiJGRtuwPwtS+eboZVuqBKiXW3oCFcsEG1OfyspmIxelC9p3kaIliHNdd0LA/c1A 0o73Sl1idoWZI6IFagy99DiNUlPZuepDvem9yA1uylv1M0Jm39e0ctQzV3X1PM9r+vdF fPTfsKSe4ZQurZCfbHfI3ZI7BZvep50IN9cEWv+pbZqhS0F2qOU/Lo1aRxMfyGnbb/7S 77BbQP7EiWcvemJf4xslwckfgX9ebuq8hHNsrcG9EVhtbcz/mJTrZenYuih50tLclkGe JjQw== 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=+x2Dw2XrDWRn2r5NJ+vSA3+oClesFRaiZBvN2WbK5rY=; b=O+rX67tET+3fT+SUeSqF3AC62XHZJmO3GaHcSVAQjq1BkpwR6G+GrgkvUUB/5U23J+ 3ciuk32VeYBfsrFSbFfrnfYKQbfpF00z1InTBpLkNHSI9FPSyBvsco+fsLgxEKjZPcbA Zr2bCR9HHXYI6X0YAuJXjbI9CVDa5VUTNS1lEsssGdR/OiQoqErOqlrCP7DFjdEu83aY NC3k0LoGzUOndDx8cz154ZewpcSSxsiN2IDlN4eVviViyV1gRDe5k0HeW0w9Ia7f6IpA evPCO2+ivQJBCe1CwuKABfPMNW3GfzO1RqXwrn88hX/PuQMJFfAuLKFCUvP3p5MR1uDT zr9A== X-Gm-Message-State: AO0yUKXMpbm9pyrHNDAg261Yg8ObpaNQxqEzY0QqCX/6asaI5GG9r/zV VHyt4v8AL3eiC5K21yTKr1gvbQ== X-Google-Smtp-Source: AK7set+G0paWR2/JFN0EGvCSwL6kFcb0BAIqxInbx+ncHDKolJlxnz/6fMLNOHBvKlx79w7AP2TXfg== X-Received: by 2002:a05:6402:5299:b0:4a1:e4fa:7db2 with SMTP id en25-20020a056402529900b004a1e4fa7db2mr5576610edb.17.1676984619930; Tue, 21 Feb 2023 05:03:39 -0800 (PST) Received: from hera (ppp176092130041.access.hol.gr. [176.92.130.41]) by smtp.gmail.com with ESMTPSA id i14-20020a50d74e000000b004acbde59e64sm2669534edj.8.2023.02.21.05.03.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Feb 2023 05:03:39 -0800 (PST) Date: Tue, 21 Feb 2023 15:03:37 +0200 From: Ilias Apalodimas To: Simon Glass Cc: U-Boot Mailing List , Sughosh Ganu Subject: Re: [PATCH 2/2] tpm: Implement tpm_auto_start() for TPMv1.2 Message-ID: References: <20230220212736.885114-1-sjg@chromium.org> <20230220212736.885114-2-sjg@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230220212736.885114-2-sjg@chromium.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 Hi Simon, On Mon, Feb 20, 2023 at 02:27:36PM -0700, Simon Glass wrote: > Add an implementation of this, moving the common call to tpm_init() up > into the common API implementation. > > Add a test. > > Signed-off-by: Simon Glass > --- > > include/tpm-common.h | 2 +- > include/tpm-v1.h | 11 +++++++++++ > lib/tpm-v1.c | 16 ++++++++++++++++ > lib/tpm-v2.c | 8 -------- > lib/tpm_api.c | 19 ++++++++++++++++--- > test/dm/tpm.c | 45 ++++++++++++++++++++++++++++++++++++++++++++ > 6 files changed, 89 insertions(+), 12 deletions(-) > > diff --git a/include/tpm-common.h b/include/tpm-common.h > index b2c5404430f..1ba81386ce1 100644 > --- a/include/tpm-common.h > +++ b/include/tpm-common.h > @@ -94,7 +94,7 @@ struct tpm_ops { > * close(). > * > * @dev: Device to open > - * @return 0 ok OK, -ve on error > + * @return 0 ok OK, -EBUSY if already opened, other -ve on other error > */ > int (*open)(struct udevice *dev); > > diff --git a/include/tpm-v1.h b/include/tpm-v1.h > index 33d53fb695e..60b71e2a4b6 100644 > --- a/include/tpm-v1.h > +++ b/include/tpm-v1.h > @@ -591,4 +591,15 @@ u32 tpm_set_global_lock(struct udevice *dev); > */ > u32 tpm1_resume(struct udevice *dev); > > +/** > + * tpm1_auto_start() - start up the TPM > + * > + * This does not do a self test. > + * > + * @dev TPM device > + * Return: TPM2_RC_SUCCESS, on success, or when the TPM returns > + * TPM_INVALID_POSTINIT; TPM_FAILEDSELFTEST, if the TPM is in failure state > + */ > +u32 tpm1_auto_start(struct udevice *dev); > + > #endif /* __TPM_V1_H */ > diff --git a/lib/tpm-v1.c b/lib/tpm-v1.c > index d0e3ab1b21d..ea3833549bc 100644 > --- a/lib/tpm-v1.c > +++ b/lib/tpm-v1.c > @@ -69,6 +69,22 @@ u32 tpm1_continue_self_test(struct udevice *dev) > return tpm_sendrecv_command(dev, command, NULL, NULL); > } > > +u32 tpm1_auto_start(struct udevice *dev) > +{ > + u32 rc; > + > + rc = tpm1_startup(dev, TPM_ST_CLEAR); > + /* continue on if the TPM is already inited */ > + if (rc && rc != TPM_INVALID_POSTINIT) > + return rc; > + > + rc = tpm1_self_test_full(dev); > + if (rc) > + return rc; Mind if I remove this if before merging? > + > + return rc; > +} > + > { [...] > + > + return 0; > +} > +DM_TEST(dm_test_tpm_autostart_reinit, UT_TESTF_SCAN_FDT); > -- > 2.39.2.637.g21b0678d19-goog > Other than that Reviewed-by: Ilias Apalodimas