Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp679566lqp; Sat, 13 Apr 2024 14:41:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVU4lDhQLAIiYfX+Vogq3NRP+91Tfwh1iQqGF8FowbscB3WN/C64eWcNV//F4gNxX77G7qxkH2pd/oAHfQOLno6J6vvbYSeAkKoxaTM1A== X-Google-Smtp-Source: AGHT+IH/xdJSm0UY+8hgMLgD8zvHvgbhEU2bGRqZ6OJvyyeIR4TeUGt4BlSDBjQup/V7aiIQ8IM5 X-Received: by 2002:a05:620a:1449:b0:78d:7519:dcba with SMTP id i9-20020a05620a144900b0078d7519dcbamr6702722qkl.32.1713044505376; Sat, 13 Apr 2024 14:41:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713044505; cv=pass; d=google.com; s=arc-20160816; b=P5BCukhIksKlfF5Z0mjPrOzkM+brZdyyNxaCAdBPpI6kRksAqYMBkjxuCuGZFZ5i7k 4ZQiQHGv7cFMOzf2fkpb+4sCzd5rLw3r8m/wrU5vv1Z52xcYHJOnuz7H2Mi9lD5RPYDz 1zXSfU3JrHsYH2mllZm2VuOXmNPJl3Vfavtp+WRTVDN2wMx5nSwwYpzcAs6sjQCXaYvt Xn9dqImttyk+H6evGMVpgil4iPqHJxdU8+vpMqWF2oqM8k1ijEKU0qz8BslzR/tt+TRv qUODEeLsWPyzIkU7CewK1qVDBa9JnDpeT0SoNe4SpKsfnjQOmJbmyTm5yzYlf3EOnSnD jfxQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:dkim-signature; bh=qpQY9Eac7fHZ/MZ8CrcbAEQdI0WHvXAlfIeJJi2j9R0=; fh=HI6BEr0JqiifZyhLhGDO8n5TuB6JeP5C0aQ7Du+EBDQ=; b=S7VCl8XK6OUZmOwjI5BH/p1j2QEqblub8ZPC/0M387iwGuCZ6l1hOtczFM0zbQ0uJj 7kj30EXUtrtd9/3QHqloOzP8mz/h3RNkFlTGOgjdxKukKmRHxXeUr2JeV4pvQ1mpEtfF CLKwPPsLMAOID3Iz4Zbl6NhNcKZLBYS3QCPw51poNyNvUv9PyB/oRunx/uqnUm3RHNau pJZawSFmngpxvNkoAD281z6/JEebCmI1Ey4qMnVJuLdqDd8/6y1PSEsZeB8DYJuN++7z 7LIgMdCHYBSlysWioN/NiPoKCwBXadkXsRGCa8txbalVYOytOK9GIGUhaOJVuNgNlEyi Rzww==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ToAAOQXU; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-143891-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143891-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id a18-20020a05620a16d200b0078ec557bc6esi6122866qkn.422.2024.04.13.14.41.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Apr 2024 14:41:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-143891-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ToAAOQXU; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-143891-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143891-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 9A4061C20DB7 for ; Sat, 13 Apr 2024 21:41:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 059485647E; Sat, 13 Apr 2024 21:41:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ToAAOQXU" 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 241A1E542; Sat, 13 Apr 2024 21:41:33 +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=1713044494; cv=none; b=YKRJ1u5lcu+WuHKEZ3Z+8uYkIB3P69nq04GlIYQxrbP/CAxkX1x4c0owQxODoxfALe+8eFUcqBGLJKYb6Drcbg/nOge5M1N8vdNvv/UQYSLEdUF4DnSu/HdS79KP38h4p6zquP8feb/N76K7q+emRDGTMiYThornFZ7lNNN9jUQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713044494; c=relaxed/simple; bh=ZMcIxouqaKmGopD4LjyDkY37fHk0qCUz/R0GOM0XHUg=; h=Mime-Version:Content-Type:Date:Message-Id:Cc:Subject:From:To: References:In-Reply-To; b=TsI9QhmvoSoGWQ6L8dkKYdZQvqyW9CRNUvs8XyXGZZydx3JRNS68AoxTfDcobIoRlrd7sQjph0FSR5/ueh/X8rW41yYWHNV1nOeQXDG5dB0iQ6sfbQJZFFNKBIik9N7J0Xj/hjAyRg7tUnWAgP47+T2POcQx2/miWhFCG4NmKbE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ToAAOQXU; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2350EC113CD; Sat, 13 Apr 2024 21:41:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713044493; bh=ZMcIxouqaKmGopD4LjyDkY37fHk0qCUz/R0GOM0XHUg=; h=Date:Cc:Subject:From:To:References:In-Reply-To:From; b=ToAAOQXUhLrh9nCG0DBHIil5C1hzoy3H5Mi10fGBU7d9WE7fawotv31I4Xio4pCdv JbMWYbsYHrdSFhiKeZoYF8SjkhmYOrvaOtmaHmSYYz0cG4r1jFzF9k0T4i5T5N/ZHK fSFrrbTCfjGlTEmU30b4Ftc4VKqCt/+1s6E8LZejtrAzWWUQEsAJMvPEH6tDkLLfvF MdZXRZvMydTvKy02/a48YhX+XzUHbxhnSOmRHwN5BGqKJuUfas+H2Hn5g5eMh2S0oT SExamm1xJ2KdsWEfww8NAnt+l+wAWKw8xS7zfrc+BTSGmt1RhZz6CoQvjMAnEnfuu5 PFzpOf72b2tlw== 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: Sun, 14 Apr 2024 00:41:29 +0300 Message-Id: Cc: "Alexander Steffen" , "Daniel P . Smith" , "James Bottomley" , "Jason Gunthorpe" , "Jonathan Corbet" , "Lino Sanfilippo" , "Mimi Zohar" , "Peter Huewe" , "Randy Dunlap" , , Subject: Re: [PATCH 2/2] Documentation: tpm_tis From: "Jarkko Sakkinen" To: "Bagas Sanjaya" , X-Mailer: aerc 0.17.0 References: <20240409190847.10869-1-jarkko@kernel.org> <20240409190847.10869-3-jarkko@kernel.org> In-Reply-To: On Thu Apr 11, 2024 at 1:50 PM EEST, Bagas Sanjaya wrote: > On Tue, Apr 09, 2024 at 10:08:47PM +0300, Jarkko Sakkinen wrote: > > diff --git a/Documentation/security/tpm/tpm_tis.rst b/Documentation/sec= urity/tpm/tpm_tis.rst > > new file mode 100644 > > index 000000000000..b448ea3db71d > > --- /dev/null > > +++ b/Documentation/security/tpm/tpm_tis.rst > > @@ -0,0 +1,46 @@ > > +.. SPDX-License-Identifier: GPL-2.0 > > + > > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D > > +TPM FIFO interface driver > > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D > > + > > +TCG PTP Specification defines two interface types: FIFO and CRB. The f= ormer is > > +based on sequenced read and write operations, and the latter is based= on a > > +buffer containing the full command or response. > > + > > +FIFO (First-In-First-Out) interface is used by the tpm_tis_core depend= ent > > +drivers. Originally Linux had only a driver called tpm_tis, which cove= red > > +memory mapped (aka MMIO) interface but it was later on extended to cov= er other > > +physical interfaces supported by the TCG standard. > > + > > +For legacy compliance the original MMIO driver is called tpm_tis and t= he > Did you mean "For historical reasons above ..."? That would be better wording. > > +framework for FIFO drivers is named as tpm_tis_core. The postfix "tis"= in > > +tpm_tis comes from the TPM Interface Specification, which is the hardw= are > > +interface specification for TPM 1.x chips. > > + > > +Communication is based on a 20 KiB buffer shared by the TPM chip throu= gh a > > +hardware bus or memory map, depending on the physical wiring. The buff= er is > > +further split into five equal-size 4 KiB buffers, which provide equiva= lent > > +sets of registers for communication between the CPU and TPM. These > > +communication endpoints are called localities in the TCG terminology. > > + > > +When the kernel wants to send commands to the TPM chip, it first reser= ves > > +locality 0 by setting the requestUse bit in the TPM_ACCESS register. T= he bit is > > +cleared by the chip when the access is granted. Once it completes its > > +communication, the kernel writes the TPM_ACCESS.activeLocality bit. Th= is > > +informs the chip that the locality has been relinquished. > > + > > +Pending localities are served in order by the chip in descending order= , one at > > +a time: > > + > > +- Locality 0 has the lowest priority. > > +- Locality 5 has the highest priority. > > + > > +Further information on the purpose and meaning of the localities can b= e found > > +in section 3.2 of the TCG PC Client Platform TPM Profile Specification= . > > + > > +References > > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > + > > +TCG PC Client Platform TPM Profile (PTP) Specification > > +https://trustedcomputinggroup.org/resource/pc-client-platform-tpm-prof= ile-ptp-specification/ > > Other than that, > > Reviewed-by: Bagas Sanjaya Thanks! I'll apply this with the fix you proposed. For everyone: this is by no means perfect. The point is to seed something we can build on top of. So I leave it rather lacking stuff than try to document every possible bells and whistle. This can be then improved based on discussions and future patch sets. BR, Jarkko