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 B3E93ECAAD8 for ; Wed, 31 Aug 2022 03:06:37 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 09183849C5; Wed, 31 Aug 2022 05:06: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=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="TAL42HP/"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CE9FC849C3; Wed, 31 Aug 2022 05:06:03 +0200 (CEST) Received: from mail-ot1-x32b.google.com (mail-ot1-x32b.google.com [IPv6:2607:f8b0:4864:20::32b]) (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 2FAEA849B9 for ; Wed, 31 Aug 2022 05:05:58 +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-ot1-x32b.google.com with SMTP id h20-20020a056830165400b00638ac7ddba5so9431822otr.4 for ; Tue, 30 Aug 2022 20:05:58 -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:subject:date; bh=3Knm+RYZ5fqrbPlcXYRUqfvFJRm3XFSZHzgR2hbNN1M=; b=TAL42HP/shCyTVfrwsjYqeUrDvDhuYdDqRXSJgpfDZvU4zQQUt1UZxrIxEDC8Km3DC w+zfOaO+gvPXqvqvMWosjb89Pu77lpwOjGpo/78ETEfOEhyDDQ9nUzwjPdZrmyoz+RX2 mJNTygOmzAlE7WoqhtHoYJgXmOCxDpnWieh+k= 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 :subject:date; bh=3Knm+RYZ5fqrbPlcXYRUqfvFJRm3XFSZHzgR2hbNN1M=; b=gW+FPRhN6RtD+vwQl+LKVw9/JZHz00pYROAdbZIIt/Zijg97ksjDYOvPt1PjldjIU8 TZhhomoVLNu1jVTMpFbHfvyl0k2Mq7juQNigv3Iz/uuUgC94DGAv94sC5mVFT3G1LZiG JuZHSvJr0O5e7MqFrf8fkdCoJYDz8mELENMloli8dSYqQnq8frptMd1b9siiY38h4tOO W0Rs8pvNblbyCAlWD8/is2Za6P8enHRP5uXEtSm4dyEM5w36zvAQNdJ5G7xzLI5E0Wem vFBG2c1XTOxqF3EcrSh0QalcWaJXxS9myMU3absk0nq6Hvk9iNSXaujUOrwHV5kRTUiz qwgA== X-Gm-Message-State: ACgBeo0c1dXuWue3EcKc7e2SJCP50DzAMOqtj9KcOOtu/N8Xup7Qp4IJ Ie/ChS8N24cNDCZbHXpQyM6HsSLUG/OjiQ== X-Google-Smtp-Source: AA6agR6lUhX8Fg6IcG/GlrjYOUYRqMVrG7TS1p+yu87hkf6KIrNwj2SmGVbTsdT7ZjS+vjPBLxz8Ww== X-Received: by 2002:a9d:76d7:0:b0:637:b30f:526f with SMTP id p23-20020a9d76d7000000b00637b30f526fmr9326951otl.137.1661915156576; Tue, 30 Aug 2022 20:05:56 -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 cp6-20020a056830660600b0063b34c35575sm2888129otb.42.2022.08.30.20.05.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Aug 2022 20:05:56 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Ilias Apalodimas Subject: [PATCH v5 4/7] tpm: sandbox: Allow init of TPM in a different phase Date: Tue, 30 Aug 2022 21:05:35 -0600 Message-Id: <20220831030538.26742-5-sjg@chromium.org> X-Mailer: git-send-email 2.37.2.672.g94769d06f0-goog In-Reply-To: <20220831030538.26742-1-sjg@chromium.org> References: <20220831030538.26742-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.2.672.g94769d06f0-goog