Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp972124pxy; Wed, 5 May 2021 19:46:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw41HwF+jnT94jc/quhnLReahddxny3yQw0SOcNsyCO1LYjpoEMExVz9NSdC1Tu23AxpHvg X-Received: by 2002:a17:902:a406:b029:e6:78c4:71c8 with SMTP id p6-20020a170902a406b02900e678c471c8mr1830284plq.17.1620269178388; Wed, 05 May 2021 19:46:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620269178; cv=none; d=google.com; s=arc-20160816; b=WlDniQ08SgkAGLtmlIF7SjLZ3GcA17HSSz00gY5yVCeChRxgC1hOjmd19pO1jYgv7A sf3O9ar6WznIeRvj3fLVfF5AeQuX0Q66DgLcIBsYA2bvZdIc52MgBt8sbvPMplyZYV+w Rka8eEAEJmsXhSyO6mQP4GgjutoEPaWN66jHNf51vYep5GF2wepuKbaGvSIixjO7BWJ4 I6iFhkFcr5LPl91WW4tUoHJJ8G06HyryjeP4rL1u9I1mD4dFvrEGNTOFnZaCMFDO8Ltq qIKxxSETmL6/yz/YuFRp1NOa8Bw/vkNbUuZqwlfTBr5LGCyCpsBXg0f4vXiykNfT+yGf Yniw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=iXquhfAkMusQjE2Z8c4JxbaL5PrKzN82Ciu2GmCL3tU=; b=jSlKmERXIzPL6LjDBA/qHDOSZPwySV+ALKXcx4EBuo+oKet8jO+s6oZG8NKcQQvnyf bVM4WwyFrPTclCNT6PXJYLkt8PUDFZcYVR0PbT3VLiHxBMaoOIMzBDDv6jsW3B59oSm7 GEPrjZZ1CSWsymHLBra0wJXQNl2BUiYSgkwZX6Zxbff0C8h+EmL8GuRHMmZmcGMTjbYo CuXSrNHuTIlpEFeAHT1yO/XT4DpyEJH4G8NmGOhLklqzBSwAOr4+0wm0Ab7qAlYrJste hpBKsO1bwdlinifWFOxMfFuzhZ/syVHNYcEyK/AGO5DBWjfezOoxonH0twhBg8P4qw9l TF/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SDEdnnG0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i22si9297928pjl.16.2021.05.05.19.46.03; Wed, 05 May 2021 19:46:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SDEdnnG0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230386AbhEFBsb (ORCPT + 99 others); Wed, 5 May 2021 21:48:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:48764 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229752AbhEFBsb (ORCPT ); Wed, 5 May 2021 21:48:31 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id BDFEE613B4; Thu, 6 May 2021 01:47:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1620265654; bh=m/FucFqXwnvEgJZYcs2ulmK47101wLuoMnPmPvt7+94=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=SDEdnnG07dODGDPyh1N43aqloKlcg8vcq1JCyYtNVuh3nPz5+e6AlomaiZFK2CDvo hhAeL7Vyq2kTxfXLefIpl8kPpDZ6TzMbuVyFsjU7282j1Mg7diHYKRxT949X8IgrlO ADG2JCOXOq7EUam6hASIVVf0t2IICw0NfEFMdpOGL/P/NJ+lTsQJm8UhfOD2Ppo1Ad HIdlv0ZDK7yN04e2FRqPxv5u9j9JXgYoIN4Ddgbkdjfu7PuLHj0bZB3WIqAHBb1bPm L2pxFQ0fxJNXBx1OdC5g9Jc8r472CaHa/WZ5GZ3gnC5Ird7JMx7yzX/qfwWZN95EHC svfZipkxquB9A== Date: Thu, 6 May 2021 04:47:31 +0300 From: Jarkko Sakkinen To: Lino Sanfilippo Cc: peterhuewe@gmx.de, jgg@ziepe.ca, stefanb@linux.vnet.ibm.com, James.Bottomley@hansenpartnership.com, keescook@chromium.org, jsnitsel@redhat.com, ml.linux@elloe.vision, linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 2/4] tpm: Simplify locality handling Message-ID: References: <20210501135727.17747-1-LinoSanfilippo@gmx.de> <20210501135727.17747-3-LinoSanfilippo@gmx.de> <6722bf6f-1a3f-ee9c-55e2-cf63c64266a9@gmx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6722bf6f-1a3f-ee9c-55e2-cf63c64266a9@gmx.de> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 05, 2021 at 01:15:29AM +0200, Lino Sanfilippo wrote: > Hi, > > On 03.05.21 at 17:50, Jarkko Sakkinen wrote: > > What the heck is "simplification" and what that has to do with fixing > > anything? I don't understand your terminology. > > > The intention for this patch is not to fix anything. Please read the cover > letter and the commit message. > This patch is about making the locality handling easier by not claiming/releasing > it multiple times over the driver life time, but claiming it once at driver > startup and only releasing it at driver shutdown. > > Right now we have locality request/release combos in > > - probe_itpm() > - tpm_tis_gen_interrupt() > - tpm_tis_core_init() > - tpm_chip_start() > > and there is still one combo missing for > > - tpm2_get_timeouts() > > which is the reason why we get the "TPM returned invalid status" bug in case > of TPM2 (and this is the bug which is _incidentally_ fixed by this patch, see > below). > > And if we are going to enable interrupts, we have to introduce yet another combo, > for accessing the status register in the interrupt handler, since TPM 2.0 > requires holding the locality for writing to the status register. That makes > 6 different code places in which we take and release the locality. > > With this patch applied we only take the locality at one place. Furthermore > with interrupts enabled we dont have to claim the locality for each handler > execution, saving us countless claim/release combinations at runtime. > > Hence the term "simplification" which is perfectly justified IMO. > > So again, this patch is "only" in preparation for the next patch when interrupts > are actually enabled and we would have to take the locality in the interrupt > handler without this patch. So: what problem this patch does solve? /Jarkko