Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp1030721lqo; Fri, 17 May 2024 08:42:57 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXbPiiN18d2JnRHyknC3sjyZarIz/VgzAG7tgErHoVEBI3y1bCgBRUVwOuDleQPKT9L60RPNyrOWozwLTccggbjEWFqDCffunV9VfTbZw== X-Google-Smtp-Source: AGHT+IGpUh7mxIuTznTsP5YbzhS42J9vz2NwAI+kgBAwkByzVgz7qnoaDHHGu5sEZnx9EJrpMOhD X-Received: by 2002:a17:907:8293:b0:a5c:de6f:87e7 with SMTP id a640c23a62f3a-a5cde6f8c09mr399575766b.61.1715960577685; Fri, 17 May 2024 08:42:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715960577; cv=pass; d=google.com; s=arc-20160816; b=WO3s2b38J1BDkhbtGzTTfGiopvg1JzGPJMuUWu8j7bs97D02LgWg68XxkQY/1ysKAL hxpyKADgAv1BohzaPK+lZSsTHOAmdXlqrU21wzpywhwp5Pxs/3Ri5zW6of9fHFCHkvld jr9LQq+165ftumDNYtd06k7rdgkJfgCthDb+3VsHQzgrfmLlzcIgP1hKWGHOMeyhEJnG B4NpK9Vktw+X98aOsaAYPFSblY9/CcQXWyXT4HKLyVSEHZVta0g4rPYbuLXckWGAVcx/ Mg1Im9nmVzCFSwz8OrI1YxrtfFDLWjjHLRU0GKEavDoND1XV2aLV+LERgW+VUVIT7lR5 ZgWg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:references:cc:to:from:subject:message-id:date :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:dkim-signature; bh=D0E9lWer2+o1XjrKKtc2FsKGg9l2/uKwXydr1aSQp00=; fh=trMsrBH9aidWeZ7kx9PaMSACIzXcwMnnxPpecMwkaoE=; b=elVZTbQcV9sADLPji2x1SIILO5V8GPC+MunXqrc8nn7z2Q7oAxQMNhwIHxIdCJ+3gr f85+zq6doJ6npNPtznAYnsYFq1QNPdfDkjlyn0/T0bEeeywt3hKEuprAM28hSPkoe796 XsJB/mhydblmTUU8iwFDFNa3/aEZulKU4wBOQLeKfylOqU0VSY3n10vpasZ8Vh67nFW3 mri/mw1ILIF2D6P0UNrDrmK68+pDLpJw4JWZKJPMTyVNrf9wT4ci8qiPpDbXKXKBIYmH PSEjn/A482dZDAAH2UxbUgUQHUOgVbRmQcDaW/OywBh/1S4qsuRsI6j7UxyFWHVbJ59c mxEw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tNbjwofJ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-182308-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182308-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a80fffc12si461349066b.529.2024.05.17.08.42.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 08:42:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-182308-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tNbjwofJ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-182308-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182308-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 5852E1F212CB for ; Fri, 17 May 2024 15:42:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D75BB12F589; Fri, 17 May 2024 15:42:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="tNbjwofJ" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 097BB1A2C26; Fri, 17 May 2024 15:42:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715960528; cv=none; b=DEFWivAO44FEv2xDkS2LFmrxhlK74/vW1y0fOG20vqOpYKLFQuhGIOdG/0M7MK+t0z4op4pU9RWKLReSMGJwt5+yDyTvSg5BaHM0wEUkVwfDH+WqaTiL/MISjabZ5psKHQ1x0IXADva5M5hTKT/AmctgkNpU+fQx2H0tMTkZ73E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715960528; c=relaxed/simple; bh=yhVafEpOeiyybflVBl8GoHvZIG0y5kH+I19BIPviMXc=; h=Mime-Version:Content-Type:Date:Message-Id:Subject:From:To:Cc: References:In-Reply-To; b=rEaWmxBxBux6HuNz4SF9Kvf2j3ONWaeSFp8V0vdNEgfSVPiaiLJnE3FegX3JOYlA5YCF2o1pnQ9sG8ecKweHGm94z2KKuvmeQGwZ7IF4kq2bQOWydVqOAKTwWZ4l81m3likXYspQhHv8z+dn3vIZIqH6iEzEc4rtsSV99FKXkZw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tNbjwofJ; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 40A77C2BD10; Fri, 17 May 2024 15:42:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715960527; bh=yhVafEpOeiyybflVBl8GoHvZIG0y5kH+I19BIPviMXc=; h=Date:Subject:From:To:Cc:References:In-Reply-To:From; b=tNbjwofJiNnKlnVFDsr71EjVgjioaMGbmamWTE0eSuUVX9/VZz405WwHrrO0Q8+ri 3urfYHww0vHbDt8pqX9fnSNkagJluRBSPDl02wI4NbKE5jCy066T1zY+yb+8FEXMfs J0anOqVG71CQCC/45kqkfPA6/FaQXFltcvzbD1NrX6VjTJ8+s9F9nPKf4PDhomtcb4 qdUC5dv499PXXAaMmqEY13bd5986SXq6RM39RyC+7e0tACYWxKqdz+9IRi+eA1XIMC sR9T+oC8mSmunAUpuw/EL+s7Q/xEXNTzQRV4FtMx9b5WzFE5AEX7Le4eDOv7jh+FDi 9HoPwzcmcG9Fw== Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Fri, 17 May 2024 18:42:04 +0300 Message-Id: Subject: Re: tpm_tis_spi takes minutes to probe From: "Jarkko Sakkinen" To: "Vitor Soares" , , Cc: , , X-Mailer: aerc 0.17.0 References: In-Reply-To: On Fri May 17, 2024 at 5:53 PM EEST, Vitor Soares wrote: > Greetings, > > I'm using the tpm_tis_spi.ko module and it is taking several minutes to p= robe on > kernel: > - commit ea5f6ad9ad96 ("Merge tag 'platform-drivers-x86-v6.10-1' of > git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86"= ) > > root@verdin-imx8mm-07317726:~# time modprobe tpm_tis_spi=20 > [ 57.534597] SPI driver tpm_tis_spi has no spi_device_id for atmel,attp= m20p This was added in 6.9: $ git --no-pager log -1 3c45308c44eda commit 3c45308c44eda6cc3343a48341a82b96753c8a13 Author: Lukas Wunner Date: Sat Jan 13 18:10:52 2024 +0100 tpm_tis_spi: Add compatible string atmel,attpm20p =20 Commit 4f2a348aa365 ("arm64: dts: imx8mm-venice-gw73xx: add TPM device"= ) added a devicetree node for the Trusted Platform Module on certain Gateworks boards. =20 The commit only used the generic "tcg,tpm_tis-spi" compatible string, but public documentation shows that the chip is an ATTPM20P from Atmel (nowadays Microchip): https://trac.gateworks.com/wiki/tpm =20 Add the chip to the supported compatible strings of the TPM TIS SPI driver. =20 For reference, a datasheet is available at: https://ww1.microchip.com/downloads/en/DeviceDoc/ATTPM20P-Trusted-Platf= orm-Module-TPM-2.0-SPI-Interface-Summary-Data-Sheet-DS40002082A.pdf =20 Signed-off-by: Lukas Wunner Reviewed-by: Jarkko Sakkinen Cc: Tim Harvey Signed-off-by: Jarkko Sakkinen linux-tpmdd on =EE=82=A0 tpm2_key=20 $ git describe --contains 3c45308c44eda tpmdd-v6.9-rc1~2 > [ 57.560684] tpm_tis_spi spi2.1: 2.0 TPM (device-id 0x3205, rev-id 1) > [ 57.584943] tpm tpm0: A TPM error (256) occurred attempting the self t= est Course of event is I think: rc =3D tpm2_do_selftest(chip); if (rc && rc !=3D TPM2_RC_INITIALIZE) goto out; /* 1. TPM_RC_INITIALIZE */ if (rc =3D=3D TPM2_RC_INITIALIZE) { /* 2. Branches here. */ rc =3D tpm2_startup(chip); if (rc) goto out; rc =3D tpm2_do_selftest(chip); if (rc) goto out; } /* 4. Second self-test successful. */ It is possible that there is a performance regression given multitude of HMAC changes. It would likely had to be in tpm2_do_selftest(), since it is the most time-consuming function. I checked the timeouts etc. but in the first seek did find anything obvious. BR, Jarkko