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 74090C32772 for ; Tue, 23 Aug 2022 17:13:43 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 00FC084859; Tue, 23 Aug 2022 19:13:13 +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="GXHe2tj9"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8D24884852; Tue, 23 Aug 2022 19:13:05 +0200 (CEST) Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) (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 1BC0884808 for ; Tue, 23 Aug 2022 19:13:02 +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-pl1-x62f.google.com with SMTP id 20so13368787plo.10 for ; Tue, 23 Aug 2022 10:13:01 -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=EW7ZppRx3bkqnmncLMF8/5qV575Z5OqykGJkx1mhYbA=; b=GXHe2tj917OvvfrXTLe1fdguXMZUnLqQ4naoqLyPV/Jun7rwYPA06nNANSOJZeBE17 z1ma9pwvYO31SqIRD1eCDE3dgxC1iBX74gBpieg4J3DC/80234mERuJB2GMGV+M4Kwrh oogvBE3yqQJZTb+KH1YAJBLOJIWZOLV3njM9c= 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=EW7ZppRx3bkqnmncLMF8/5qV575Z5OqykGJkx1mhYbA=; b=Q8imnNP6gDKxpRfynWJH6PvoKTUS2Q4SnSW632lIq3CMMyzKiD4w0oMJkjEB7X/rgD lfQVI80D1xojOEWc1T1JsLA8OUM3P70P0QLvJLg7MfkElX088xSIU4jdyB4qlO0hWXNA dCnNV5rq414VdBf6Lx90vdO2oVmYpdcpHRYl8m0Yi9swsXDXzJeeSsOsA2uApl9yXGPi 2ChoRgzrI8B0arYymw6XZ6DQLweELrGzYfs5XMWHqD6MT07R10zsic04GLmzsPQEXblF ccpy4pxvLhm/yV4j25Wd14qtLOS+SxH6QjnaiVr08/XLjNor4JuOpg1SlQ3hEeFJv5YT FXfQ== X-Gm-Message-State: ACgBeo26lfLQijoIX+HNSUJi12/ypNisnoDFPZsmw5G8mL2vE75t+91L gWlAqx8lsnx3RM+JWt9EQL6la0YxvS9GR69t X-Google-Smtp-Source: AA6agR4SgwVZryuZMnJuUP+NF+kfXJ1Lk/wA3lMIzorgjiliV2oTun/JFiWU19nb4jPG8Dwq/ittPg== X-Received: by 2002:a17:902:864c:b0:172:bc0d:c769 with SMTP id y12-20020a170902864c00b00172bc0dc769mr23064594plt.146.1661274780098; Tue, 23 Aug 2022 10:13:00 -0700 (PDT) Received: from sjg1.corp.google.com ([2620:0:1000:2514:4cd7:64:5174:de80]) by smtp.gmail.com with ESMTPSA id x3-20020a170902a38300b0016f154c8910sm10759441pla.204.2022.08.23.10.12.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Aug 2022 10:12:59 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Ilias Apalodimas Subject: [PATCH v4 4/7] tpm: sandbox: Allow init of TPM in a different phase Date: Tue, 23 Aug 2022 10:12:37 -0700 Message-Id: <20220823171240.386269-5-sjg@chromium.org> X-Mailer: git-send-email 2.37.2.609.g9ff673ca1a-goog In-Reply-To: <20220823171240.386269-1-sjg@chromium.org> References: <20220823171240.386269-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.609.g9ff673ca1a-goog