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 2EEBDC7EE23 for ; Thu, 1 Jun 2023 05:34:22 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BA5FD8615E; Thu, 1 Jun 2023 07:34:20 +0200 (CEST) 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="Wy5KL1IP"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EC1238615E; Thu, 1 Jun 2023 07:34:19 +0200 (CEST) Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) (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 3C8DF860FC for ; Thu, 1 Jun 2023 07:34:16 +0200 (CEST) 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-wr1-x42f.google.com with SMTP id ffacd0b85a97d-30ad99fa586so411315f8f.2 for ; Wed, 31 May 2023 22:34:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1685597655; x=1688189655; 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=OjEZlNpFMQyu9aXsZnM2JXtw6llLwOMdYvGiya16zG4=; b=Wy5KL1IPJH4JXTmkROTGtglH6v58Jz/k/kB4DU7tDpbmEdZZPxbj21dPwIxKl+mHJ9 rT4QE1uZy3LPO0MWsSlbwrXUsE54j8psv1maci8a+NweymxVNC1RStN/A9aM/1nFV2Aa Jm122gm7QYvF0j4U8hrA6up9E3+/TV6o6dRvzWsclsaFciajiBDCb4r2EQK78CEoJ9uE cYInyanq2yiYISHHX+Vfa8QSMeSphzdJBQzqkY49qU72CzMQ5+EXnuHCNS2mYzkTh4gs L5WTWQ6E8CbwjKJFOB49vgJVs4L/2MtBdazdB5PXV1apZFSO7+oX+A6lbG08jtOpS46i X5rA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685597655; x=1688189655; 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=OjEZlNpFMQyu9aXsZnM2JXtw6llLwOMdYvGiya16zG4=; b=ib61zCaU8QsKjMSwSWMsGsxOK+dLMVPR1Qwv5Ic5AeJd4jF/xmYoSm9vajcVvWBaYM rhPxpL31FY2A84t/mm1xiozxJn5ibAWofH0eSqRaHP3t8MAproq2vL36ruE1RocLtY8h 8rYoJwUgryRcwtLrR8lYN2fb0Ea3l9Ap4SZKJBncrFVeNSrk86ncUJWUt9RG4vCrriZU Yy4vhzxGLBF41HuV85R/aThggqkpqFmi1PupTDUsJDbf/Pn+8yM02dwH3y9S9ykA1yOm koBt9sLlwqroWK+X8p1kAZVVck5OTLltKpGD/NphsmPJRjptYdzXovLEdnP1b7W1Xld4 Kxuw== X-Gm-Message-State: AC+VfDz6vtaOhuuo4GlNYdjq//Vt4lei2jyLHaHsnxfccFEMT0zFxX0O Ava/wCL1XZC1caq7OxesOq4UgQ== X-Google-Smtp-Source: ACHHUZ5aPRQQQNOTCQgNRuL8dxW5SHtYnaGBfw39ePaObfMhcMcrZfs1Ha71Wi1MEP8gR3uM0AO9wA== X-Received: by 2002:a5d:5747:0:b0:30a:e7b6:52df with SMTP id q7-20020a5d5747000000b0030ae7b652dfmr748335wrw.36.1685597655638; Wed, 31 May 2023 22:34:15 -0700 (PDT) Received: from hera (ppp089210114029.access.hol.gr. [89.210.114.29]) by smtp.gmail.com with ESMTPSA id d24-20020a1c7318000000b003f17eaae2c9sm967148wmb.1.2023.05.31.22.34.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 May 2023 22:34:15 -0700 (PDT) Date: Thu, 1 Jun 2023 08:34:13 +0300 From: Ilias Apalodimas To: Simon Glass Cc: marex@denx.de, heinrich.schuchardt@canonical.com, trini@konsulko.com, u-boot@lists.denx.de Subject: Re: [PATCH] tpm: Make 'tpm init' to call tpm_auto_start() Message-ID: References: <20230530061843.248629-1-ilias.apalodimas@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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.8 at phobos.denx.de X-Virus-Status: Clean Hi Simon, On Wed, May 31, 2023 at 09:28:04PM -0600, Simon Glass wrote: > Hi Ilias, > > On Tue, 30 May 2023 at 00:18, Ilias Apalodimas > wrote: > > > > For a TPM device to be operational we need to initialize it and > > perform its startup sequence. The 'tpm init' command currently calls > > tpm_init() which ends up calling the ->open() per-device callback and > > performs the initial hardware configuration as well as requesting > > locality 0 for the caller. There no code that currently calls > > tpm_init() without following up with a tpm_startup() and tpm_self_test_full() > > or tpm_continue_self_test(). > > > > So let's wire up the 'tpm init' command and call tpm_auto_start() which > > leaves the device in an operational state and adjust any defconfigs > > using 'tpm init'. > > > > It's worth noting that calling tpm_init() only, doesn't allow a someone > > to use the TPM since the startup sequence is mandatory. We always > > repeat the pattern of calling > > - tpm_init() > > - tpm_startup() > > - tpm_self_test_full() or tpm_continue_self_test() > > as a result we don't expect any regression or boot delays with the current > > change. > > > > While at it fix the identation of test_tpm_autostart() comments as well. > > > > Signed-off-by: Ilias Apalodimas > > --- > > > > This is a split and resend of https://lore.kernel.org/u-boot/20230510074359.2837818-9-ilias.apalodimas@linaro.org/ > > Since Simon some had concerns I decided to split this off the series and send it > > as a single patch for further discussion. > > > > cmd/tpm-common.c | 3 ++- > > configs/chromebook_coral_defconfig | 2 +- > > test/dm/tpm.c | 9 +++++---- > > test/py/tests/test_tpm2.py | 9 --------- > > 4 files changed, 8 insertions(+), 15 deletions(-) > > We've already discussed this before. Please can you: > > - Call tpm_autostart() instead > - Add a new 'tpm autostart' command > > That way we can keep tpm_init() as it is. > We have discussed but I am not convinced on why we should ever keep 'tpm init' as is. You mentioned the ability to not always boot with Startup(Clear) but that makes little sense to be in a u-boot command. If we ever want to resume a tpm we should do that automatically. In any case the spec itself mentions that the _init function should put the TPM in a state were the next command *must* be a startup one, so I don't mind adding a 'tpm autostart'. Regards /Ilias > Regards, > Simon