From patchwork Sat Feb 18 15:27:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 654766 Delivered-To: patch@linaro.org Received: by 2002:adf:9bcd:0:0:0:0:0 with SMTP id e13csp513779wrc; Sat, 18 Feb 2023 07:28:03 -0800 (PST) X-Google-Smtp-Source: AK7set8WYEYIQyO4PLOU2KXv5jPFNCnXLsxBz8S/2b5zNyj9PQbls1ygtTmT2OM65w5L/0/6lc/N X-Received: by 2002:a05:6870:170a:b0:171:a741:afe8 with SMTP id h10-20020a056870170a00b00171a741afe8mr659993oae.28.1676734082813; Sat, 18 Feb 2023 07:28:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676734082; cv=none; d=google.com; s=arc-20160816; b=bAZzByHZzh55T69YiRHtF7sMSDfzJ7Z+bC2sm1liutgDB89zGQi13xg3MzA16CHoVX ESahdKPKgTtu3sE43A/NHSBoJcofxoExwt3OzUpd8cSjl8WIVF0HpnMApimpOg6/e5UT khK/oIQiRRGN3CdVEQcR1e4NVxlxh/6b9P/2YlxYSynHGqp8Lvsh0ak6vt5O/PrQjLIC DZ8tc6AW1zbsPKiNKJJ3vFu/wOk+ktB3yNC72ThihHEkFVAwPG0u+IWqY3dzWF3WK/Hx 5VJvm/i1K5hMY8zMq8q/a1uuwpP1YJNVwtfalOb1pb7BPWkeoUTZrpYcPtjvpHYSZnRi 34nA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=uEksi9GhEUcpma/l0k/xgO6wK+ZBBsetmTIwhzr6mrs=; b=AcMFlgZmvO6r3XqAaQC9h97rpK8M5uB3gkKBTWBMUcIhgLZetMj62T9kKOjKrEA4Ek x8frQSWxl18bD0WMUp63SO+ilzsk1g7UA8gOP+OSIVESYtVrYia2ADvI9mraKr6ZChYx +AaSuqNvLVC6kHwmvKAWe4DSGRpNiUmJyTKFxmk4LOQ1yaorxLWUfjJ7FfT9c0U1BBfZ j1x07Yubs5Kd++PKulMjIQS9WX/WxF5SRu4bvOMR4U6lgVg/Qn09QhikBZuQa//jfaRc jvtQJjHJd7iV/mvhgftT6c2qcmEApl3+sm296VsudPURGURtRuFONphVacDfTRkUkvhB ibng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Wk3kSdVu; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id 17-20020a056870005100b0016fd161317fsi5678672oaz.147.2023.02.18.07.28.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Feb 2023 07:28:02 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Wk3kSdVu; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 48F4F85A40; Sat, 18 Feb 2023 16:27:56 +0100 (CET) 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="Wk3kSdVu"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 231E385A2E; Sat, 18 Feb 2023 16:27:54 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) (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 A438785A25 for ; Sat, 18 Feb 2023 16:27:50 +0100 (CET) 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-ed1-x532.google.com with SMTP id dm15so4595624edb.0 for ; Sat, 18 Feb 2023 07:27:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=uEksi9GhEUcpma/l0k/xgO6wK+ZBBsetmTIwhzr6mrs=; b=Wk3kSdVuG9xHkqcS/LnSpZ+ydRCO/vuuMqkIbzGSbnftzp7FWKcAT3Nv5yhc3oIPZN zu8BrVxIHrAfkY9Srl0mTClkJwfw4Ln7mmvdhH266Kpox7UNlSe/2k8vZt0xCtatlsr5 rTe1F+fWT50zQOEkFcK+vQYDNmpHYgwuhXJAWnmGsikzpL1y28A5853VGzJJYYr6B+HL 1E22Zu5o82odRR1xJPTDWRm4xDbm5k6LpJR5+bQw4Yef5KpZnZaE6rz2CUtRQJcamojy W7rCzekIBXNFQ0seEPBFuokMKR8b6YNkWc1U/0PclLI2Su67JWNmW6aEp87roZVou6SH pV0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=uEksi9GhEUcpma/l0k/xgO6wK+ZBBsetmTIwhzr6mrs=; b=p0LN43ZCEWumXfeRaZg/UJByImsYEbiF69pHFuFf7jzz0e5nLkBBg6E45qfn2b5S0F iBUFUHxOLYTFqqNzD9JLxFAYji62e6VpQ4F0lPS6DH59Y3RPe8ndc3/snuN97d8JJW5+ e7OIZqL3WvEE9hHsYzITEknD7VqJxm7lbpS3vAwY1uD4SaoJPmQr2NUC7xoc+xaLe0HM pPjZ1GOWXWdgVT9rvgZcZw/SiuhLNxLQXvmJbzSLfzL8RPYvFES4YTs0ZwrvgyCc4Ffa pK5T5BFl914i9LQ14KKDZg4j8w9AhKiELi/Ktb+FuEHkNeP61TRNzkJHDG3PupCfaCdb VaRA== X-Gm-Message-State: AO0yUKXz2l9g8V8Bcb1j5BMOZJatH7ZXJBqA47sVBkd80DR2M/vJWsD3 rX36omSYVcL4QAQ0sYj3W2pCTdhPHQBkye8w X-Received: by 2002:a17:907:9879:b0:8aa:1f89:122e with SMTP id ko25-20020a170907987900b008aa1f89122emr4220503ejc.39.1676734070148; Sat, 18 Feb 2023 07:27:50 -0800 (PST) Received: from localhost.localdomain ([2a02:85f:fc09:d5bf:82f9:4e04:7bf7:880c]) by smtp.gmail.com with ESMTPSA id ce25-20020a170906b25900b008b05b21e8aesm3512759ejb.172.2023.02.18.07.27.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Feb 2023 07:27:49 -0800 (PST) From: Ilias Apalodimas To: u-boot@lists.denx.de Cc: eajames@linux.ibm.com, Ilias Apalodimas , Heinrich Schuchardt , Simon Glass , Sughosh Ganu Subject: [PATCH 1/4 v4] tpm: add a function that performs selftest + startup Date: Sat, 18 Feb 2023 17:27:38 +0200 Message-Id: <20230218152741.528191-1-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 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 As described in [0] if a command requires use of an untested algorithm or functional module, the TPM performs the test and then completes the command actions. Since we don't check for TPM_RC_NEEDS_TEST (which is the return code of the TPM in that case) and even if we would, it would complicate our TPM code for no apparent reason, add a wrapper function that performs both the selftest and the startup sequence of the TPM. It's worth noting that this is implemented on TPMv2.0. The code for 1.2 would look similar, but I don't have a device available to test. [0] https://trustedcomputinggroup.org/wp-content/uploads/TPM-Rev-2.0-Part-1-Architecture-01.07-2014-03-13.pdf ยง12.3 Self-test modes Signed-off-by: Ilias Apalodimas Reviewed-by: Simon Glass --- Changes since v3: - Limit comments to 80 columns - drop extra lines from comments include/tpm-v2.h | 16 ++++++++++++++++ include/tpm_api.h | 8 ++++++++ lib/tpm-v2.c | 25 +++++++++++++++++++++++++ lib/tpm_api.c | 8 ++++++++ 4 files changed, 57 insertions(+) -- 2.39.2 diff --git a/include/tpm-v2.h b/include/tpm-v2.h index 737e57551d73..2893783c6ceb 100644 --- a/include/tpm-v2.h +++ b/include/tpm-v2.h @@ -688,4 +688,20 @@ u32 tpm2_report_state(struct udevice *dev, uint vendor_cmd, uint vendor_subcmd, u32 tpm2_enable_nvcommits(struct udevice *dev, uint vendor_cmd, uint vendor_subcmd); +/** + * tpm2_auto_start() - start up the TPM and perform selftests. + * If a testable function has not been tested and is + * requested the TPM2 will return TPM_RC_NEEDS_TEST. + * + * @param dev TPM device + * Return: TPM2_RC_TESTING, if TPM2 self-test is in progress. + * TPM2_RC_SUCCESS, if testing of all functions is complete without + * functional failures. + * TPM2_RC_FAILURE, if any test failed. + * TPM2_RC_INITIALIZE, if the TPM has not gone through the Startup + * sequence + + */ +u32 tpm2_auto_start(struct udevice *dev); + #endif /* __TPM_V2_H */ diff --git a/include/tpm_api.h b/include/tpm_api.h index 8979d9d6df7e..022a8bbaeca6 100644 --- a/include/tpm_api.h +++ b/include/tpm_api.h @@ -331,4 +331,12 @@ static inline bool tpm_is_v2(struct udevice *dev) return IS_ENABLED(CONFIG_TPM_V2) && tpm_get_version(dev) == TPM_V2; } +/** + * tpm_auto_start() - start up the TPM and perform selftests + * + * @param dev TPM device + * Return: return code of the operation (0 = success) + */ +u32 tpm_auto_start(struct udevice *dev); + #endif /* __TPM_API_H */ diff --git a/lib/tpm-v2.c b/lib/tpm-v2.c index 697b982e079f..895b093bcb1a 100644 --- a/lib/tpm-v2.c +++ b/lib/tpm-v2.c @@ -44,6 +44,31 @@ u32 tpm2_self_test(struct udevice *dev, enum tpm2_yes_no full_test) return tpm_sendrecv_command(dev, command_v2, NULL, NULL); } +u32 tpm2_auto_start(struct udevice *dev) +{ + u32 rc; + + /* + * the tpm_init() will return -EBUSY if the init has already happened + * The selftest and startup code can run multiple times with no side + * effects + */ + rc = tpm_init(dev); + if (rc && rc != -EBUSY) + return rc; + rc = tpm2_self_test(dev, TPMI_YES); + + if (rc == TPM2_RC_INITIALIZE) { + rc = tpm2_startup(dev, TPM2_SU_CLEAR); + if (rc) + return rc; + + rc = tpm2_self_test(dev, TPMI_YES); + } + + return rc; +} + u32 tpm2_clear(struct udevice *dev, u32 handle, const char *pw, const ssize_t pw_sz) { diff --git a/lib/tpm_api.c b/lib/tpm_api.c index 7e8df8795ef3..5b2c11a277cc 100644 --- a/lib/tpm_api.c +++ b/lib/tpm_api.c @@ -35,6 +35,14 @@ u32 tpm_startup(struct udevice *dev, enum tpm_startup_type mode) } } +u32 tpm_auto_start(struct udevice *dev) +{ + if (tpm_is_v2(dev)) + return tpm2_auto_start(dev); + + return -ENOSYS; +} + u32 tpm_resume(struct udevice *dev) { if (tpm_is_v1(dev)) From patchwork Sat Feb 18 15:27:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 654767 Delivered-To: patch@linaro.org Received: by 2002:adf:9bcd:0:0:0:0:0 with SMTP id e13csp513872wrc; Sat, 18 Feb 2023 07:28:17 -0800 (PST) X-Google-Smtp-Source: AK7set/o5QezFTcU2puBdnkM1WeBBdOgjnf9GXsnxSxkSA9sPe8El2LhVU4zCbntLdegsPJlX4y+ X-Received: by 2002:a05:6871:72a:b0:16e:cc40:5412 with SMTP id f42-20020a056871072a00b0016ecc405412mr3593561oap.30.1676734096888; Sat, 18 Feb 2023 07:28:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676734096; cv=none; d=google.com; s=arc-20160816; b=bJ1qXT5Wjkc9Ergv0uxz7g5fLbsVUaXIxnwk99vY6jixCnKFb0jr7KMRSJQfv1qF2H INZHKIzGgu3CymjqGZKQsRLq8Sn5a3kHCs/7mE50FMMEPTsZ9/hXHYcSIgmEpS2HT+X7 93UcvYpN7JJ2ddysiIx873JQVWi0djLzP7+od5PgyyRpHR43HSXa9xLRl8DaySQrFIQT VY/ACvEvBipS28aMtEbGbTeUrblBE0wnp65zBwqkicPH3AJMyGpdeG6k3qIUyj9stI/l 5wtvpPx87bKs7VEuZcs0R86fAPM6AtGgwbiF+uNaog34eHykH7RBCMA6XBTzEYPxXeiN tvWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=V3vR81Hzbu2ba3O8TvpV9GTQcDwEUeWCNAHs0JB9pvA=; b=aQS8RxYcihPQM2fi6PaHd4giA1J2DPsJtoVMuIN4k8DBmI/u82Jj/J45QyD3spP4Tn iYfV5RDujKpncywMKspdgXmpwIvm7TEkyfQA52Va3+H8c6y/Aie8JrnHZJGKLJMT343t c11vrUXvr++XlJfm1YKPUPy9W2AJeYreAz2MoM9yxMIXHZTIAThG49Rbgx+SsJTnAeVv PPHgWZLOvdKDks3cuh2e2a8dpfyNGecpVH+Q/p3gmWg2XdhSAtJXHugLjc5NblYed2ae VOU3uaJXEuLMJFkzukJoX4bLbblqpAN/sFqMQcTE40m747tLzdBNVQSsQ1WuXmkaTZSM Xi4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zxR30ztr; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id vi2-20020a0568710d8200b0016334c61c7bsi5647613oab.298.2023.02.18.07.28.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Feb 2023 07:28:16 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zxR30ztr; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DE301851EB; Sat, 18 Feb 2023 16:28:07 +0100 (CET) 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="zxR30ztr"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F30F685A42; Sat, 18 Feb 2023 16:27:55 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) (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 5A1F1851EB for ; Sat, 18 Feb 2023 16:27:53 +0100 (CET) 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-ed1-x531.google.com with SMTP id t19so2930581edi.13 for ; Sat, 18 Feb 2023 07:27:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.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 :message-id:reply-to; bh=V3vR81Hzbu2ba3O8TvpV9GTQcDwEUeWCNAHs0JB9pvA=; b=zxR30ztr1vhmrYL8zkpAW++r+bvlDTxqEw16gIVa/gj20uXWlMw5fy2kxCnEU4GewZ tE1GdzEOBmRC3t2QbPye8nqo6B0jjxH/0/lOv6Ijeuwy6yCvPz1pB58ofi9q3sLmwG23 FAp7OCUWIdnE59TJt4Rv2gsPgToSNnpP0yZzI4EhG5C5cCi/gpvdKFgEDpy44yLcbVAO TfaEmXimhvS7c7nMl5kHEc1vQcxHBCZvVCWzkDTKwAzpISlSdLwg6v1oNt3kdPKv9R3b 8S7b4z+uT8l0IrWiiNjUhRBdcoR3gKbu3OnJczIywPXi+lFKKNxleyHavsMAmnsgkQVZ ZhYg== 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:message-id:reply-to; bh=V3vR81Hzbu2ba3O8TvpV9GTQcDwEUeWCNAHs0JB9pvA=; b=hK/6SE5YpXDU7AR0jaOfujb01DxMVyPtKvQUxSw1e2T7l31xQhqyijee4YdYCmfTuJ v559KZMZKoJTD6w6Stv9LXgtmw2rEhSspie09RasMyWcb37bnezIb+apdEKSWW3t/V1m yJSvg+SzM5ZU8++aB95nykDTOwj+KuPSfer1avFz9UwdDS5ZcNCcINgUncFhfp7fCs+o IWyNLuy0NWAxrta474cjDEHU105VDsuuNRZer97qbjptEJJESSDfUB1lf7LbC7WZan4j K+mXH4svMFNC+J6I4knDLvKUthAOXAa6+vV4YdlYyCkmSKe915bvMhlEKkyRt3JyAmc8 opkA== X-Gm-Message-State: AO0yUKWR9RplC2dOcTqYmnUtzElTp/S5G2a7VWnrMx1/G9qU3WmV+EJg UNrQx5tuoeSR4SnugvQ9umQAFpPgOk2iDG9g X-Received: by 2002:a17:907:7288:b0:8bd:dc0:3834 with SMTP id dt8-20020a170907728800b008bd0dc03834mr2729386ejc.34.1676734072939; Sat, 18 Feb 2023 07:27:52 -0800 (PST) Received: from localhost.localdomain ([2a02:85f:fc09:d5bf:82f9:4e04:7bf7:880c]) by smtp.gmail.com with ESMTPSA id ce25-20020a170906b25900b008b05b21e8aesm3512759ejb.172.2023.02.18.07.27.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Feb 2023 07:27:52 -0800 (PST) From: Ilias Apalodimas To: u-boot@lists.denx.de Cc: eajames@linux.ibm.com, Ilias Apalodimas , Simon Glass , Heinrich Schuchardt , Sughosh Ganu Subject: [PATCH 2/4 v4] efi_loader: use tpm_auto_start for the tpm device Date: Sat, 18 Feb 2023 17:27:39 +0200 Message-Id: <20230218152741.528191-2-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230218152741.528191-1-ilias.apalodimas@linaro.org> References: <20230218152741.528191-1-ilias.apalodimas@linaro.org> MIME-Version: 1.0 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 A previous commit is adding a new tpm startup functions which initializes the TPMv2 and performs all the needed selftests. Since the TPM selftests might be needed depending on the requested algorithm or functional module use that instead. Reviewed-by: Simon Glass Signed-off-by: Ilias Apalodimas --- Changes since v3: - Added r-b tags by Simon lib/efi_loader/efi_tcg2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.39.2 diff --git a/lib/efi_loader/efi_tcg2.c b/lib/efi_loader/efi_tcg2.c index 918e9a268641..d035a00d98ac 100644 --- a/lib/efi_loader/efi_tcg2.c +++ b/lib/efi_loader/efi_tcg2.c @@ -2422,7 +2422,7 @@ efi_status_t efi_tcg2_register(void) } /* initialize the TPM as early as possible. */ - err = tpm_startup(dev, TPM_ST_CLEAR); + err = tpm_auto_start(dev); if (err) { log_err("TPM startup failed\n"); goto fail; From patchwork Sat Feb 18 15:27:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 654768 Delivered-To: patch@linaro.org Received: by 2002:adf:9bcd:0:0:0:0:0 with SMTP id e13csp513953wrc; Sat, 18 Feb 2023 07:28:30 -0800 (PST) X-Google-Smtp-Source: AK7set+j8OwriQGqysoeuCRAS65TxhlfVb894hvC8Mb/bW+VjCFbNuz6qhOP8v5a/9wzeXAV07Xi X-Received: by 2002:a05:6870:3453:b0:16d:e230:6a31 with SMTP id i19-20020a056870345300b0016de2306a31mr1861798oah.38.1676734110791; Sat, 18 Feb 2023 07:28:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676734110; cv=none; d=google.com; s=arc-20160816; b=PfTYsy9Cas/+zLMe6DkBbkxIyXqGydU+OolXbhHxGUbyvY9L2gIw2o/H8w/p6Z7Yr8 7EX2yGKGRRYDsZE+PH38iSyPjH71Ei/C5/akhY1JLyzTO0ZZ+OGXGVl5L8hGANsxta3e oUaq2IIzo2rcNBsLYKs9nv596al+tbRQl48ahZOPgBx0tyy0r+BhgzmTuSsDdi5jL2V0 t4RL35u/Q8FkaZ7vU1DxTvFQgHrf/Pih6GJ3h3cqeyRMwzW66Etcj6KWXZTYYDXdNeT9 Znm07pQJSyMH4iAg5iDIhlITjt5fyhCVpqSUzAt7GMxiNb0+MVs3ik9TlGTRq1r6UJX6 nvlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8OkxJHbX+T2iVU6hunqM7iY8vnuuWA0CPrZQ67p0HxE=; b=t8/UJdKVb9CUQ6ahXm2Nm+69TQA7MWseGkOGM4V8EBJ9PFHibalN+8kK08WKHywIUb p2jrGOxwD10qIyIBIC4wbJ0u/XD0BwQdEE475ixn/IzjyNVH5Q+8P9C21njY4iqBfnID HZMoucLjC05zcKQ+/JDtoppxLFAAElW6T5Eo24iW34pDV2DOhJ1mhR4/JFP5ILyDwzNe jMNpaPPe7Zb8iOP9fW6FPxtssHaPDb8XrSPv0QaDcolaRZCVvsrm3JvVjXX9vFP5nwbb OlC1o2f9K0OXEMXOzUgu+HGQD/DqKl+5pzq0if6wOgPgYNDnIIO9J1i1h5Y/3yAq9ovn oyZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Sd/lbB26"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id gf4-20020a056870660400b00132eefebdc4si10542042oab.11.2023.02.18.07.28.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Feb 2023 07:28:30 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Sd/lbB26"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D70E385A3C; Sat, 18 Feb 2023 16:28:12 +0100 (CET) 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="Sd/lbB26"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 42E2C85A3C; Sat, 18 Feb 2023 16:27:58 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) (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 14D1285A25 for ; Sat, 18 Feb 2023 16:27:55 +0100 (CET) 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-ed1-x535.google.com with SMTP id i28so2974467eda.8 for ; Sat, 18 Feb 2023 07:27:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.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 :message-id:reply-to; bh=8OkxJHbX+T2iVU6hunqM7iY8vnuuWA0CPrZQ67p0HxE=; b=Sd/lbB26oGtBS1GfD03jd13bBsWpyl4knOaRrfSLayRuRb1cierVzsJTfT5dT2d90+ 2Y4qs8PHfQE4Fg3xomCfS5cOCYANeyGIv/JMKaj8EFjimcwj8UZwwS3a5imCZ4jDREeT 8ZvM+UgHkffDQzgEwSdhpye35t5PmOpgY3WKUyEOc63Jg9XGNBkuXMLztGOHb+2TXD3N fKoqdDpc3AUzwbAFH5yUE6p84PUb6ITIQ3wxZXqAKhbxmEM3fww2+wBjnm+A4r8otnTy h8jfOjnJeOL9xG17TV4TyQ7mbshhU01ZCmalw11N1CWP/WpA1mN3A4ynJX2HhG/EM3eF PfZQ== 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:message-id:reply-to; bh=8OkxJHbX+T2iVU6hunqM7iY8vnuuWA0CPrZQ67p0HxE=; b=g2Xz0WcmEjlq8cxgkmlOiq4ZSi9pk83v7CYl6nM6YTk7MHxaorXcoRFK+1OzWBho5L 6/zW1IuiV6v2+CunjTDkMhuYM8m6SMnpNlga3fp/srgyzMkKpMoZ6VT5eioCiZRq93gQ YE77pCG3JgBFrKM5R5PLGQ5C1KlgWa2W/0lzmI8RURTYrqSPKgJT/b0cuw2HeNgjNnU2 IBF8fgaRLDoNQEKQMG8VXQrCwQneEabV2MMTb2fsBTeTkAMmYA3w1iK/j9SWowvR+1Gg AWSqLfGwxvN+LgSiNs3ceixORCmZb7P+xuZ9F9IhCLmLl3Jtzat/Hfd+Smi5ZD7ocxnq aVCg== X-Gm-Message-State: AO0yUKVonEedDZzsVX523CxhhZYMV/sCcJS91U5f7HiXkME9GKAs/owM blIksLatFE1OVpmYze+fKlkTJsu24TovSDv/ X-Received: by 2002:a17:907:ea2:b0:88d:33fe:3306 with SMTP id ho34-20020a1709070ea200b0088d33fe3306mr3635325ejc.31.1676734074693; Sat, 18 Feb 2023 07:27:54 -0800 (PST) Received: from localhost.localdomain ([2a02:85f:fc09:d5bf:82f9:4e04:7bf7:880c]) by smtp.gmail.com with ESMTPSA id ce25-20020a170906b25900b008b05b21e8aesm3512759ejb.172.2023.02.18.07.27.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Feb 2023 07:27:54 -0800 (PST) From: Ilias Apalodimas To: u-boot@lists.denx.de Cc: eajames@linux.ibm.com, Ilias Apalodimas , Heinrich Schuchardt , Simon Glass , Sughosh Ganu Subject: [PATCH 3/4 v4] tpm: sandbox: Change the return code when device is already open Date: Sat, 18 Feb 2023 17:27:40 +0200 Message-Id: <20230218152741.528191-3-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230218152741.528191-1-ilias.apalodimas@linaro.org> References: <20230218152741.528191-1-ilias.apalodimas@linaro.org> MIME-Version: 1.0 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 All the TPM drivers as well as out TCG TIS API for a TPM2.0 device return -EBUSY if the device has already been opened. Adjust the sandbox TPM do return the same error code. Signed-off-by: Ilias Apalodimas Reviewed-by: Simon Glass --- Changes since v3: - New patch. Required for [4/4] drivers/tpm/tpm2_tis_sandbox.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.39.2 diff --git a/drivers/tpm/tpm2_tis_sandbox.c b/drivers/tpm/tpm2_tis_sandbox.c index dd94bdc31fb7..e4004cfcca33 100644 --- a/drivers/tpm/tpm2_tis_sandbox.c +++ b/drivers/tpm/tpm2_tis_sandbox.c @@ -810,7 +810,7 @@ static int sandbox_tpm2_open(struct udevice *dev) struct sandbox_tpm2 *tpm = dev_get_priv(dev); if (tpm->init_done) - return -EIO; + return -EBUSY; tpm->init_done = true; From patchwork Sat Feb 18 15:27:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 654769 Delivered-To: patch@linaro.org Received: by 2002:adf:9bcd:0:0:0:0:0 with SMTP id e13csp514123wrc; Sat, 18 Feb 2023 07:28:55 -0800 (PST) X-Google-Smtp-Source: AK7set/PfprhIXA7N/unq73KYzCzZYBRSR3k8/MeJ+2IllxBWG2yhdtOJAtHgvwnXBCFt+NwvnOc X-Received: by 2002:a9d:14e:0:b0:68b:d890:1e03 with SMTP id 72-20020a9d014e000000b0068bd8901e03mr2114981otu.21.1676734135713; Sat, 18 Feb 2023 07:28:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676734135; cv=none; d=google.com; s=arc-20160816; b=XUx/oRwQHoxviM2Z9VVIZWL6omFy3zlv4Rug3PAyYdYtedyKQb0kjw+4L5xGU85+B7 8pEI3oWyW9RsSGVlE35k52Q9EhnsdRJWp4YmW/2yTInVTOZDPMFvoI68OGqIhtrZCQY1 Fs1dgSzkMHMQag5A7y9hyCsBe3NiDm54dssJx1ok0uXEnMQRQuje2Vr3CWsss7Vl52yJ ssWNI2S2WADOpJ4ebgwFMZ5Rn55AMxURNxNdrOo8VHECBYp9Lh1+lF3e2qneuhsCF9oz XV7IfCS2qWWzwqr/xcDwSuMyz+bgRwVR8qDbjKXQN82GRI/6J41zZXuXaItNUpCHX064 9gTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2OKVSn4URdFtFwiVDqazdY05nLnOSyKXVMqzGqzzOAY=; b=X9AsXVGfjwagPmQQE8h52dUCI/DM4Ua85gh0Ddffb1O0DRARWtOIh9GyNWE3bR76gW 9sMkvkqItxA2jOT+NugqVLnkhlL7PPhbq2Uq8ImXvhkP5ZNdbB06MCzENJNbpu39N7Su J8G1MI6UuwVs8+FRaTWDeo/RuAHTUTBMFABmugRPwT2i4UKmaG8/xtFH1B63Zxbdh4za FlRyQcMf9qc+lXsePfIMuiCeD5Qmcr0RtHNiGBrxw4N9lYX4Cp9scs1/aSeVJn+nFaQx mr85JIe9+uc8Y+g7T8ipU7LcQwFnenc6VV9LQJGgSWoUVj9KA0LoDj7JxW88n6iCPoMl uMVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="R/hwMV+r"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id d6-20020a9d4f06000000b0066c691d57b9si9222900otl.105.2023.02.18.07.28.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Feb 2023 07:28:55 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="R/hwMV+r"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0103185A58; Sat, 18 Feb 2023 16:28:22 +0100 (CET) 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="R/hwMV+r"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C1623851EB; Sat, 18 Feb 2023 16:28:04 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) (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 D9A7485A48 for ; Sat, 18 Feb 2023 16:27:56 +0100 (CET) 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-ed1-x534.google.com with SMTP id fd2so3554154edb.2 for ; Sat, 18 Feb 2023 07:27:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.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 :message-id:reply-to; bh=2OKVSn4URdFtFwiVDqazdY05nLnOSyKXVMqzGqzzOAY=; b=R/hwMV+rKcu8evMWvGeZbEfaW63zbDqMNgE3G9tt0VDPxhAVobEU63bU/Sf2pn0WQ+ US3KnxpJQfkEIChTOzSBFeFfg2rcwHER6LiWvEnFY6YN8DRCk0+kqUTbNuCSMshBiKpv fRz78/7SAINJAbSMuxj1oEtnhJcMQOb349m74vCsBA1/y+HSdUG7R70qKyN/sbMHGshX wk0f6eDh5igzsR9VDPQ6mRUUzREFnxAq/p6/dKiOxtpDoSMD6rxZMueQV8L4BhdokbrI DDYe1aAAg8GTZ4pYKLiDLH6lhFP8tAkOoghduGDkyNXZ64Mq+TpMX1xW6c/7Mcq6fZob sRcQ== 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:message-id:reply-to; bh=2OKVSn4URdFtFwiVDqazdY05nLnOSyKXVMqzGqzzOAY=; b=FYYY9H+IpYkK/OeAjgOyuUnBLbzw83NBpLpYTpPnlPDdIo3kgyT+O0EV8qkNQJkKLd ko44Nx2V+LY2WPdk13fwUUWMzjjpgKSu1sAA4aSaXgQPSSuWtdXy6TXmctmabEnGM3+y ERu/gJO90H7jNo5Pb5rNrSkT8EN8pTsK25lLZxgIydDt1FxlO3WXKu/jXJUz0g/e5Z47 +n33Q6RXb3EDABqLbteZBuxvu9hmWOo1Io6E3oAtaCZmQXYSqJrwmOhV6qpPBWBGeWvF usZydhw4CbfCTJc55S7rTp+55OMxXsIg9yS635Kt20KQeKSeZMsrTO7IyQlTZXwYYhWS sypA== X-Gm-Message-State: AO0yUKX/L68Dfvlh0BNWicBiX0FtKU3s3InzU3yY4+8SsPGYr+JEp0n8 B91LKbUNQtThG8jopUXkbnrXI23pSbBJZ1Wc X-Received: by 2002:a17:907:e8d:b0:8b1:2e8f:d524 with SMTP id ho13-20020a1709070e8d00b008b12e8fd524mr6840719ejc.27.1676734076362; Sat, 18 Feb 2023 07:27:56 -0800 (PST) Received: from localhost.localdomain ([2a02:85f:fc09:d5bf:82f9:4e04:7bf7:880c]) by smtp.gmail.com with ESMTPSA id ce25-20020a170906b25900b008b05b21e8aesm3512759ejb.172.2023.02.18.07.27.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Feb 2023 07:27:56 -0800 (PST) From: Ilias Apalodimas To: u-boot@lists.denx.de Cc: eajames@linux.ibm.com, Ilias Apalodimas , Heinrich Schuchardt , Simon Glass , Sughosh Ganu Subject: [PATCH 4/4 v4] test: add a test for the new tpm_auto_start() function Date: Sat, 18 Feb 2023 17:27:41 +0200 Message-Id: <20230218152741.528191-4-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230218152741.528191-1-ilias.apalodimas@linaro.org> References: <20230218152741.528191-1-ilias.apalodimas@linaro.org> MIME-Version: 1.0 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 A prior patch adds a new API function for TPM2.0, which performs the full startup sequence of the TPM. Add a selftest for that. Signed-off-by: Ilias Apalodimas Reviewed-by: Simon Glass --- Changes since v4: - New patch test/dm/tpm.c | 5 +++++ 1 file changed, 5 insertions(+) -- 2.39.2 diff --git a/test/dm/tpm.c b/test/dm/tpm.c index 0b46f799591f..8ee17f6a9bc3 100644 --- a/test/dm/tpm.c +++ b/test/dm/tpm.c @@ -25,6 +25,11 @@ static int dm_test_tpm(struct unit_test_state *uts) ut_asserteq_str("init_done=0", buf); ut_assertok(tpm_init(dev)); + /* + * tpm_auto_start will rerun tpm_init, but handles the + * -EBUSY return code internally. + */ + ut_assertok(tpm_auto_start(dev)); ut_assert(tpm_report_state(dev, buf, sizeof(buf))); ut_asserteq_str("init_done=1", buf);