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 DDF6EC32771 for ; Fri, 19 Aug 2022 13:48:11 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 25B0284B77; Fri, 19 Aug 2022 15:47:34 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="SP+jeFO2"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3D41284B6D; Fri, 19 Aug 2022 15:47:21 +0200 (CEST) Received: from mail-oi1-x22c.google.com (mail-oi1-x22c.google.com [IPv6:2607:f8b0:4864:20::22c]) (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 DD84684B5B for ; Fri, 19 Aug 2022 15:47:16 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-oi1-x22c.google.com with SMTP id c185so4804459oia.7 for ; Fri, 19 Aug 2022 06:47:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=MDYCgUyLwozM5bi0RU/VrqmjKkv1XMPhSdLRJ2kYpaA=; b=SP+jeFO2gScCRfypdpfRdre3kKfXCD1Ux4r2WwmlSFzbkQJ+xZ7+YgB0nCyQbAE4vA CiUvQVTXqVg+s7SQcMVXXeTjFNa1rYZOFySsdm5aFOatbhT8eRo5skmskkrbQxsXZJK0 3xT1iWFvOguYUH5FadpowXqhKM67ZumWPRyPE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=MDYCgUyLwozM5bi0RU/VrqmjKkv1XMPhSdLRJ2kYpaA=; b=EcUrUBJNNi6TC2L9iSYieWEqbF7MekxvyOQMbdPn1zXEm9XO8lwm2gE/vG+5jk64cS a5m8vfwT0jYvNjC16jEXWc9aBM25EDrFveL5KvO2Ddt4cYv/Rj2WnNgzbmRshv7u2aqz Y5/PQX2DM2InB/UOBikHvs50jW5BfFhGozNS2XaDnfErT/mTxawCVKUGGMf/7622PqH7 eQfxsTNuSSWlO47n5jujY67AIwCQoNkt9SASU3+weZdfOtkZhCOlzckRnYnxW3JJqwNW oRB7Au+t5OcZEOVepg95qc6orJQ9BrgK6ltmyva4+9QspMdfq+T1Jyx+Uvh3uz3lc6pI RcGg== X-Gm-Message-State: ACgBeo1kkuBeYxti1mh61yfigXM0lgPclboT9ET/QRcA4bejECdo7xjF ZbyQuSqiVvsBou9NUA7ycVWDOaNqx4zx5A== X-Google-Smtp-Source: AA6agR75v0BB/Qx8xwEmDBDakOaZNGb8sBLM6vBpNq+ig+ZS68K4KpAqspb9DpT1hbtZE8Xa2HEDOg== X-Received: by 2002:aca:adce:0:b0:342:e878:2cc1 with SMTP id w197-20020acaadce000000b00342e8782cc1mr5614947oie.133.1660916835320; Fri, 19 Aug 2022 06:47:15 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-67-190-102-125.hsd1.co.comcast.net. [67.190.102.125]) by smtp.gmail.com with ESMTPSA id z36-20020a056870d6a400b0011856117469sm1309429oap.10.2022.08.19.06.47.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Aug 2022 06:47:15 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Ilias Apalodimas Subject: [PATCH v3 4/7] tpm: sandbox: Allow init of TPM in a different phase Date: Fri, 19 Aug 2022 07:46:44 -0600 Message-Id: <20220819134647.269563-5-sjg@chromium.org> X-Mailer: git-send-email 2.37.1.595.g718a3a8f04-goog In-Reply-To: <20220819134647.269563-1-sjg@chromium.org> References: <20220819134647.269563-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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. Reviewed-by: Ilias Apalodimas Signed-off-by: Simon Glass --- (no changes since v1) 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 ac6eb143539..c26f5d35abf 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; + */ break; } -- 2.37.1.595.g718a3a8f04-goog