Message ID | 20221017235732.10145-8-LinoSanfilippo@gmx.de |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp1696141wrs; Mon, 17 Oct 2022 16:59:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM45LTwF8UJX7vaIPNCY0ElQxSOA5Ip7PIT8wfq55QnkKPGKrhE1sKgMCCKOHuJHttRnwm0B X-Received: by 2002:a17:907:788:b0:741:4d1a:595d with SMTP id xd8-20020a170907078800b007414d1a595dmr153275ejb.737.1666051166269; Mon, 17 Oct 2022 16:59:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666051166; cv=none; d=google.com; s=arc-20160816; b=ehcgQdkwGgZpkynlBgoOBETYDl9Qgc63Tck2rXzDnfYyQU9JU57+VVdX6q/RXQb48z grklQr+KNYcSdOBTrY6TSLGbccIVe3kPKe52Z54Fnklr7LoANQJTYB7gcBQH7SI3HEjp rUwEExecIJadmsy6+ALFewWYO6RmYmnyvaFjfWMvn8a0bOiyh9tkrflC49mgHXPI9vH8 Nk8dt/eD5PRQpN9yDsE2Ntn02cK73YEq6dtFSvwY4Ge1HmcVSlmoQPamTLmVaYCJbeia kHKko1jyhEB7iK0zSlPbhcmWwCCVL5lnA17gpzJzNGh5Lsj3PA2Vzrp9a3Qn6jaPAIt1 CYoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=jDPq1ycfLA3Z7wF+Um4FjFbBCWSe4kP5xzmSs1/LP9Q=; b=xGksaTJ+/Bp/xtztAfB0bIeqDDEYipltOCma/v9RUPDuRPUlLvJyCoHUtcza4RMG+Q hEsgQ0SlvucWsQ1qVv0XGHUov05T7cwlqnEza0G3D6FnNifEmR8eTZUxl6KkR0t6gXcv c9qozOyUkvNuNNV1ZGaBxQfjs1mfFaRisfvBUgxZUuJRhoPWarj8x/rcJf/MKnmepSCg AhDf5jbdNdwrU5oAZwH2S/eT0hwDcgqGzFzFx72QbQsoDdgpvnrZaFyr4QdrHH6Wtd8L d7BcaLgdnKknM47A0MlYtmAYAnumrohA2aMvmXjJDE4l4pZs22ZiZBOg6+0b1U3JdaNp /Zgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=Z8jztJPX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmx.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w24-20020a17090633d800b0078d20294fe1si9533304eja.168.2022.10.17.16.59.01; Mon, 17 Oct 2022 16:59:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=Z8jztJPX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmx.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231255AbiJQX61 (ORCPT <rfc822;kernel.ruili@gmail.com> + 99 others); Mon, 17 Oct 2022 19:58:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230010AbiJQX6O (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 17 Oct 2022 19:58:14 -0400 Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 015647E31C; Mon, 17 Oct 2022 16:58:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1666051073; bh=jDPq1ycfLA3Z7wF+Um4FjFbBCWSe4kP5xzmSs1/LP9Q=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=Z8jztJPXlVz/DtDZuXC5yKXEEdFj49irePwI8mQLYfihn5KQcUNxGeSx7vX4PKhNR 2L1GOXcIq6XF/mCijRb8x/F0d2AdxDkdPBLCBF9203oSrRecYTUNYE/ApP0QhA5OFK nPJcfZDgDR1YgSfvj4RDCNsJFknWOeuekcYuDBcs= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from Venus.speedport.ip ([84.162.5.241]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MtwYu-1oyf082nGu-00uKuQ; Tue, 18 Oct 2022 01:57:52 +0200 From: Lino Sanfilippo <LinoSanfilippo@gmx.de> To: peterhuewe@gmx.de, jarkko@kernel.org, jgg@ziepe.ca Cc: stefanb@linux.vnet.ibm.com, linux@mniewoehner.de, linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org, jandryuk@gmail.com, pmenzel@molgen.mpg.de, l.sanfilippo@kunbus.com, LinoSanfilippo@gmx.de, lukas@wunner.de, p.rosenberger@kunbus.com Subject: [PATCH v8 07/11] tpm, tpm_tis: do not check for the active locality in interrupt handler Date: Tue, 18 Oct 2022 01:57:28 +0200 Message-Id: <20221017235732.10145-8-LinoSanfilippo@gmx.de> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20221017235732.10145-1-LinoSanfilippo@gmx.de> References: <20221017235732.10145-1-LinoSanfilippo@gmx.de> MIME-Version: 1.0 Content-Transfer-Encoding: base64 X-Provags-ID: V03:K1:8fzQ80YFE1JxOIOkmc8gb1a4v07OCSU8Nki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GWa6LkNRtc43FgyMOIrxNbNfz8Cbr1FNzWRVxcCr5eMdxDlehb cvUVZLAzGAyk1C4/9+Un5cZIu9W67RD4ybSAQEnf1FDoZMeTN+nTcRIvLsvmIZfU60fmwV5yD DmjQmapxqFIaB3nJ+I72M0q1o3gXHCbby4hLv/2PmNHJ564+8GuBd3lGLEbvALq1/GJmiICCx 55jokqbvQY0aaVQnJIyXOpBws6ZBtZUoDyrqDZPLHY6SA9DRrJqwd7KcdYhhql8uXvOiCRkEv oBdZl2juMrVlbf9LGvv45jlXovMduNlFd78fnvXRBJ9tVICmvCvzJ+4KUlqX3LYuM79ak2d+I 7LbFwgCwRf0+d2/7FSu2i8AklopF7dxBKvUqfVM8iDb3Lndkg5M2HPhG7SnV6uEpA64mqAXMC BUx/LKXp5KyQ0rNJFRev2qX1P1aKJeJjAfDQ3F/aqB4xe/XWRs6M+3ejsXCJEmBoxyeLJP3aZ 3k/wnv7Xx3Fepp7qXVW/TquvnpQ1T/D74aex1FMydHRuYCdH4Rcr9Lx/T48vpLotP54GW6+W4 QyIGGazDYcy7rQ6rnPbDtNiod4y2epIEuScPQtX6gV2eIPyzGlBfGOCHkitvaniMUGflDgANA aDeG199a4kTCd05/qizehM7Tz4wexRaGKG/y8HeznWf0Rd8LKaeY4mNknUzWRi9fS9t2Q2bXr 5ZZZ6vZwBnuluUpJsHaWinc0mIKOB9n5QMn33Ruv7zSBR X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FROM,MIME_BASE64_TEXT,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1746981268089643341?= X-GMAIL-MSGID: =?utf-8?q?1746981268089643341?= |
Series |
TPM IRQ fixes
|
|
Commit Message
Lino Sanfilippo
Oct. 17, 2022, 11:57 p.m. UTC
From: Lino Sanfilippo <l.sanfilippo@kunbus.com> After driver initialization tpm_tis_data->locality may only be modified in case of a LOCALITY CHANGE interrupt. In this case the interrupt handler iterates over all localities only to assign the active one to tpm_tis_data->locality. However this information is never used any more, so the assignment is not needed. Furthermore without the assignment tpm_tis_data->locality cannot change any more at driver runtime, and thus no protection against concurrent modification is required when the variable is read at other places. So remove this iteration entirely. Signed-off-by: Lino Sanfilippo <l.sanfilippo@kunbus.com> --- drivers/char/tpm/tpm_tis_core.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
Comments
On Tue, Oct 18, 2022 at 01:57:28AM +0200, Lino Sanfilippo wrote: > From: Lino Sanfilippo <l.sanfilippo@kunbus.com> > > After driver initialization tpm_tis_data->locality may only be modified in > case of a LOCALITY CHANGE interrupt. In this case the interrupt handler > iterates over all localities only to assign the active one to > tpm_tis_data->locality. > > However this information is never used any more, so the assignment is not > needed. > Furthermore without the assignment tpm_tis_data->locality cannot change any > more at driver runtime, and thus no protection against concurrent > modification is required when the variable is read at other places. > > So remove this iteration entirely. > > Signed-off-by: Lino Sanfilippo <l.sanfilippo@kunbus.com> Acked-by: Jarkko Sakkinen <jarkko@kernel.org> > --- > drivers/char/tpm/tpm_tis_core.c | 7 ++----- > 1 file changed, 2 insertions(+), 5 deletions(-) > > diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c > index 181c291b0bb8..4336f7ea8c2b 100644 > --- a/drivers/char/tpm/tpm_tis_core.c > +++ b/drivers/char/tpm/tpm_tis_core.c > @@ -728,7 +728,7 @@ static irqreturn_t tis_int_handler(int dummy, void *dev_id) > struct tpm_chip *chip = dev_id; > struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev); > u32 interrupt; > - int i, rc; > + int rc; > > rc = tpm_tis_read32(priv, TPM_INT_STATUS(priv->locality), &interrupt); > if (rc < 0) > @@ -740,10 +740,7 @@ static irqreturn_t tis_int_handler(int dummy, void *dev_id) > set_bit(TPM_TIS_IRQ_TESTED, &priv->flags); > if (interrupt & TPM_INTF_DATA_AVAIL_INT) > wake_up_interruptible(&priv->read_queue); > - if (interrupt & TPM_INTF_LOCALITY_CHANGE_INT) > - for (i = 0; i < 5; i++) > - if (check_locality(chip, i)) > - break; > + > if (interrupt & > (TPM_INTF_LOCALITY_CHANGE_INT | TPM_INTF_STS_VALID_INT | > TPM_INTF_CMD_READY_INT)) > -- > 2.36.1 > BR, Jarkko
diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c index 181c291b0bb8..4336f7ea8c2b 100644 --- a/drivers/char/tpm/tpm_tis_core.c +++ b/drivers/char/tpm/tpm_tis_core.c @@ -728,7 +728,7 @@ static irqreturn_t tis_int_handler(int dummy, void *dev_id) struct tpm_chip *chip = dev_id; struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev); u32 interrupt; - int i, rc; + int rc; rc = tpm_tis_read32(priv, TPM_INT_STATUS(priv->locality), &interrupt); if (rc < 0) @@ -740,10 +740,7 @@ static irqreturn_t tis_int_handler(int dummy, void *dev_id) set_bit(TPM_TIS_IRQ_TESTED, &priv->flags); if (interrupt & TPM_INTF_DATA_AVAIL_INT) wake_up_interruptible(&priv->read_queue); - if (interrupt & TPM_INTF_LOCALITY_CHANGE_INT) - for (i = 0; i < 5; i++) - if (check_locality(chip, i)) - break; + if (interrupt & (TPM_INTF_LOCALITY_CHANGE_INT | TPM_INTF_STS_VALID_INT | TPM_INTF_CMD_READY_INT))