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 E343FC43334 for ; Tue, 7 Jun 2022 08:49:05 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 15E738430F; Tue, 7 Jun 2022 10:49:03 +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="LDjEq+v7"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6C58784335; Tue, 7 Jun 2022 10:48:59 +0200 (CEST) Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) (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 4D43A842C2 for ; Tue, 7 Jun 2022 10:48:56 +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-wm1-x336.google.com with SMTP id p5-20020a1c2905000000b003970dd5404dso9151212wmp.0 for ; Tue, 07 Jun 2022 01:48:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=JTmg4WxwJVQS7ko/XOczrMHlv3vWIe/SF6jJ6r5qKk0=; b=LDjEq+v71+gkSJ46OR9/CKGYRS7gS9pUq9F3bnTEFKZQUA4eLscw8s4vEsrrlTU3kx EgpnDdD8lrICg9DoG8SIBU9prKFO0HXe5VeC99K85rZzXW72x1ydNIeYafLxGYfotr4n tmZXWdFhQksyk1z+NnF/W1pQHZY1AhbcIPM8qyGKtwiFb1AvIpRwpKbeu4Ydj6Qs656p /ODLeuolxOui5ZOMysPfoUmJT/8NGbNeJIRkyEmR6ZMhIWL0DE2wsfnEz1ytay4gBaDi sDqRBs6FTmVRV3LM1qcU+hjfmXLP/463JUMGcXOnHT/NzS1u2pMxmwnuCAvudst8akVW e9UA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=JTmg4WxwJVQS7ko/XOczrMHlv3vWIe/SF6jJ6r5qKk0=; b=hiRAG8qW7le8amIS5h2lOqIxTNoLgd6GlTAk8M4ubKC8HsVwmaEiBXFjwOut+Xybz5 kLxQiuqIhHMxczuaK8gsdw5vvVg+wW3bwKjisi0wqu5MY7wpRDpSguTRZ8aJIG/Cg1WA EF6fbvshOwxIMAYFVSvtq34r/9II+cR0CqTYJpt7LP+KbhIg12vHVaSvLAspumkxZIdw zTEbkZQLu1ahmBSyt3RBz7BpiEQUaQMLOuFRjQS5AZ4XwxzCL3IC8mw/7bdP2eWLLyyy FwJ0yfOXvYzoR9YwEd9MUSpoLXR2FzKUZ/YokwpvXsPUmksgftpd3XAip8mfIi61HYJr 7odQ== X-Gm-Message-State: AOAM532iG+L0kWLZnH5a805xUc6+hvrxCsQh/aNmXGnUXWpuZjBwc8O8 MILfMkrvEg5RYume/k6jAZujLQ== X-Google-Smtp-Source: ABdhPJygg7TllVkWUmj6h5xMxwgaPyTLd8cj5AtUtxM29vWNSuZeYv5FZeXZdXjx9KlF8426/hKN5A== X-Received: by 2002:a1c:4604:0:b0:39c:4769:3bb7 with SMTP id t4-20020a1c4604000000b0039c47693bb7mr16469601wma.115.1654591735796; Tue, 07 Jun 2022 01:48:55 -0700 (PDT) Received: from hera (ppp089210241233.access.hol.gr. [89.210.241.233]) by smtp.gmail.com with ESMTPSA id p9-20020a5d4589000000b0020fcf070f61sm17333992wrq.59.2022.06.07.01.48.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 01:48:55 -0700 (PDT) Date: Tue, 7 Jun 2022 11:48:52 +0300 From: Ilias Apalodimas To: Simon Glass Cc: U-Boot Mailing List Subject: Re: [PATCH 5/8] tpm: sandbox: Allow init of TPM in a different phase Message-ID: References: <20220301001125.1554442-1-sjg@chromium.org> <20220301001125.1554442-6-sjg@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220301001125.1554442-6-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.5 at phobos.denx.de X-Virus-Status: Clean Hi Simon, On Mon, Feb 28, 2022 at 05:11:22PM -0700, Simon Glass wrote: > At present the emulator assumes that the TPM is inited in the same phase > where it is used. But in fact SPL may init the TPM, so we don't want to > complain when U-Boot proper later uses it. Remove this check. > > It might be best to save this information into the device state for the > TPM, so that we can make sure the TPM was inited at some point. For now, > this seems good enough. > > Signed-off-by: Simon Glass > --- > > drivers/tpm/tpm2_tis_sandbox.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/tpm/tpm2_tis_sandbox.c b/drivers/tpm/tpm2_tis_sandbox.c > index ac6eb14353..c26f5d35ab 100644 > --- a/drivers/tpm/tpm2_tis_sandbox.c > +++ b/drivers/tpm/tpm2_tis_sandbox.c > @@ -366,8 +366,10 @@ static int sandbox_tpm2_check_readyness(struct udevice *dev, int command) > > break; > default: > - if (!tpm->tests_done) > - return TPM2_RC_NEEDS_TEST; > + /* Skip this, since the startup may have happened in SPL > + * if (!tpm->tests_done) > + * return TPM2_RC_NEEDS_TEST; > + */ This looks reasonable. On top of that the TPM will return 'already initialized' if someone tries to do that after SPL, so we should be safe. > > break; > } > -- > 2.35.1.574.g5d30c73bfb-goog > Reviewed-by: Ilias Apalodimas