From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49825C433ED for ; Tue, 11 May 2021 23:36:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0AF186187E for ; Tue, 11 May 2021 23:36:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229920AbhEKXh3 (ORCPT ); Tue, 11 May 2021 19:37:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:56742 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229637AbhEKXh2 (ORCPT ); Tue, 11 May 2021 19:37:28 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 39C796162B; Tue, 11 May 2021 23:36:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1620776181; bh=0kddMno8L9vTWGOafdeTWibFtrcMKYCj9uXKnKrzec8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=uMgaCy0tzlycndd4vmEWxzT+gQb2yfTZi/i7jdJ9EXEIe3h10vTneAA/I92P+XkSX yU0IUkIjhwOs89AC/yuOiOCxLyDQwohpiXQwtViceLNSZJErrlq4x2lU3Z8r8vPQO0 UBPX4GpBABPdtBrFp6W3Wsw/Uay2a2+TnGP3HCT4ooGREHaerTZGGgGcRucqvjwx8S DFNAD9lfaG9B3Eu9eSwrmM7H6/5QLv4YZk7VcVT3yJCyoRMARpxMrL04gPO6ppoNGw uF9Xjh89Td9AVawxzN8h5MIsRmdkdixcWTSYJCj5FQtf49r1qSGjsG97x+98kkue+A SK38YyxcSxADw== Date: Wed, 12 May 2021 02:36:18 +0300 From: Jarkko Sakkinen To: Lino Sanfilippo Cc: linux-integrity@vger.kernel.org, Hans de Goede , stable@vger.kernel.org, Peter Huewe , Jason Gunthorpe , James Bottomley , Stefan Berger , Jerry Snitselaar Subject: Re: [PATCH 1/2] tpm, tpm_tis: Extend locality handling to TPM2 in tpm_tis_gen_interrupt() Message-ID: References: <20210510122831.409608-1-jarkko@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org On Tue, May 11, 2021 at 01:09:35AM +0200, Lino Sanfilippo wrote: > Hi, > > On 10.05.21 at 14:28, Jarkko Sakkinen wrote: > > The earlier fix (linked) only partially fixed the locality handling bug > > in tpm_tis_gen_interrupt(), i.e. only for TPM 1.x. > > > > Extend the locality handling to cover TPM2. > > > > Cc: Hans de Goede > > Cc: stable@vger.kernel.org > > Link: https://lore.kernel.org/linux-integrity/20210220125534.20707-1-jarkko@kernel.org/ > > Fixes: a3fbfae82b4c ("tpm: take TPM chip power gating out of tpm_transmit()") > > Reported-by: Lino Sanfilippo > > Signed-off-by: Jarkko Sakkinen > > --- > > > > v1: > > * Testing done with Intel NUC5i5MYHE with SLB9665 TPM2 chip. > > > > drivers/char/tpm/tpm_tis_core.c | 10 ++++------ > > 1 file changed, 4 insertions(+), 6 deletions(-) > > > > diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c > > index a2e0395cbe61..6fa150a3b75e 100644 > > --- a/drivers/char/tpm/tpm_tis_core.c > > +++ b/drivers/char/tpm/tpm_tis_core.c > > @@ -709,16 +709,14 @@ static int tpm_tis_gen_interrupt(struct tpm_chip *chip) > > cap_t cap; > > int ret; > > > > - /* TPM 2.0 */ > > - if (chip->flags & TPM_CHIP_FLAG_TPM2) > > - return tpm2_get_tpm_pt(chip, 0x100, &cap2, desc); > > - > > - /* TPM 1.2 */ > > ret = request_locality(chip, 0); > > if (ret < 0) > > return ret; > > > > - ret = tpm1_getcap(chip, TPM_CAP_PROP_TIS_TIMEOUT, &cap, desc, 0); > > + if (chip->flags & TPM_CHIP_FLAG_TPM2) > > + ret = tpm2_get_tpm_pt(chip, 0x100, &cap2, desc); > > + else > > + ret = tpm1_getcap(chip, TPM_CAP_PROP_TIS_TIMEOUT, &cap, desc, 0); > > > > release_locality(chip, 0); > > > > > > This fix works for me. Tested on a SLB9670vq2.0 and the warning message is gone. > > Tested-by: Lino Sanfilippo > > Regards, > Lino Thanks a lot, I'll add your tag. /Jarkko