Message ID | 20221120133134.28926-13-LinoSanfilippo@gmx.de |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1116495wrr; Sun, 20 Nov 2022 05:33:37 -0800 (PST) X-Google-Smtp-Source: AA0mqf7S83d7Z1h/Oum7dfFNYsbuprToRO1DIjuZcCzwc6jXrtcBt5wC1HcdQ98cPwKpX+mpNB8i X-Received: by 2002:a17:902:e04b:b0:186:605b:f99b with SMTP id x11-20020a170902e04b00b00186605bf99bmr5728627plx.49.1668951216756; Sun, 20 Nov 2022 05:33:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668951216; cv=none; d=google.com; s=arc-20160816; b=sE7gHR7i9TCA4tykZfdUIBmhGrqTU7MHLnTx8o3Tu3RS/IeWS2sBYLKU9R2K0vWkhw hmdNyUN1xMrEGYQ+63Uq9xbGhQVIoq7qqSXNq8p7tqkRYQnZoyjfLD+FO5CfybR9tMo2 TaCMMZ0DxRLw7Qe0ZFFW9k5GMAjEFxcNZJv7SMM+lrDsj+/zIkTrF6EgVeBuXfTt8GKm 7Z1km5CgukPtZAJAzlAoJl7EpI5BG0YUKrxa27H7mCFR88ABuY1JJkqid3sweOTC/SIm Lps1Kg7fgSEtilG1ZD/sWaxNKEVfLrVazSfhda3fVpSr4V9V4NNAvtA7Qxavp0BV8CB7 u84Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:ui-outboundreport:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4OA7IK6FYkk305Zhb0W1evKbz0zZ40AwmsMipD4BkLE=; b=YH8BrH+H9j96R6ZjYJyKAUSy2F1YmejKqMBmAcwQzwGzxqvjG89ldx8NJxO2Q4KUw5 YwWYq3xq5KZnLxrF6N48prjvu2vc/cYuepdJ7oonhLXrtf5RQg3RufOZH9vKhhI/h2V1 BD1WyHC8XdgH3oyOA1/K2NLX3exJbfApjr2zbFn6R+ykaPTJeOkF40v24BQD9dGc2gGb AI1FoZ+iKgakVK2bdHXUXO0DEfRf0RYFU+rTq7EtVlejtZkel8QYuFq98KKap6YQHegv MbNWMHdYA1FdlQRfvVqmZQFvHkuekDi8h37MQtbHhcOoGNojly8mZvdr6LQL/S9WLn3m 2DGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=NSBTHCpb; 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=pass (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 s5-20020a656445000000b004468ff8fd57si8907630pgv.680.2022.11.20.05.33.23; Sun, 20 Nov 2022 05:33:36 -0800 (PST) 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.de header.s=s31663417 header.b=NSBTHCpb; 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=pass (p=NONE sp=NONE dis=NONE) header.from=gmx.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229455AbiKTNcs (ORCPT <rfc822;yuanzuo1009@gmail.com> + 99 others); Sun, 20 Nov 2022 08:32:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229652AbiKTNc3 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 20 Nov 2022 08:32:29 -0500 Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7CDA824C; Sun, 20 Nov 2022 05:32:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1668951128; bh=4OA7IK6FYkk305Zhb0W1evKbz0zZ40AwmsMipD4BkLE=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=NSBTHCpbkjFFSJ2iELowShWXLJ/DsbOAcN5yzEAo+5jUsmHpdecwn/PEWEp1OZu7x +iZ9Dzon0CDxHEUAPQ5/wq95yje7yK1+Cy3BBC9vQuXdaVn3YrEJqQyJXgP9/S6wL6 es5TT7Kk3kEZVBCG//62/vJk6p+9guMF+uozKh29uAyHjYy0V+VZTT0AEHOCzoxPgZ D8tBINVQEzOIHDGqVDgjx/YSXg1UitREpki5ezClrMiita84qYb5NTRwDJH8ourAgn XnHOArEWN433lxP1FtaT/ia5SgJnq3Za8Ej7t8AvrspcsVpjG/vkhdC4fp5kedAF/J Kmbj1Tp1/rnow== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from Venus.speedport.ip ([84.162.7.17]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MCKBc-1onMmA3ACg-009RAT; Sun, 20 Nov 2022 14:32:08 +0100 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 v10 12/14] tpm, tpm_tis: Claim locality when interrupts are reenabled on resume Date: Sun, 20 Nov 2022 14:31:32 +0100 Message-Id: <20221120133134.28926-13-LinoSanfilippo@gmx.de> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20221120133134.28926-1-LinoSanfilippo@gmx.de> References: <20221120133134.28926-1-LinoSanfilippo@gmx.de> MIME-Version: 1.0 Content-Transfer-Encoding: base64 X-Provags-ID: V03:K1:Y2Bn6bdeDl3t3/ithIn9bOFj1yJNMiWUB6ywXGw5LG20I8Pov/9 QvJYibFa1pdIC3bTtDU+GUHDY24TPVfdTvJ506nTc9DYSqmXZ7vevwNzbaHLe4jtpG194c8 mDP0STxKk2YNQE6Yb1aUsHsM6tN8ouuh8WkQD/JMwxUCIoJ3qGr2Epui3fgaG5ZilWW0boB ZCZ7Hn3YNez4hQeaejUyw== UI-OutboundReport: notjunk:1;M01:P0:Nok8fe+gyn0=;mDY6JN+z9tqG7De91VyS9iEMns/ gRYGlqR+3QOdsfOPZlj51R4mCZZ3gnl7iSQEVPvdA5JHovRI63axlIg/Dd8Zn+Yx+daiPwAUK HeHDGD6ymUE7r7YujIyVkNM9HUjoCQ6ketUoT4ytRki3qvgisQ6jHEaMfc9MXFHd7bVj2sMJ9 sO5E2suzurAVEnhQD1Kz5qMcYTQmA0VCEuDxoyqYvDEjzQxcvG/wSV6MFc64UVOA0MTePtZEQ c2hTBnGXmvPHutIHBKuxg2Z1cfHmaF8DF/gFMHVLfO1YBvaMc3Uc313kt5KTDCFU2cejsxdxd B290wl5KsAXVVIGLDX8TFjnNYtwjmk3NW64Gzni8UVX49iLwx2zN6RbMSuAtqDwY6zTyJuJWE JjESKjwNswHIIeFSLTNPVW1BP2QEiqeYzubFxjT5jObf4j99adDrLY0cDWrvI082D7RXTA3s+ LZ4khSBzcT3MK8pVu1wXxG7AI0gLv1y7Tav+O9IYhtlt3abCHluaLeUNNRIPori+v3/4z/cx7 yA0H0gVqUdp2ZR/wNL01kExlP/AyxZHQlOQOcRmLe8JzSN+hbmpSxGj/a9gUvk5oxcXRTN2Sv iaX+BcYq6fHLE+OYrlz0miHQMpQgjO+9wMjIvT73GBblzARx4yXhVkiUa18+bNLRTNp9a9XYw Hit9BrdAquEehZKoQqKXqmZzhiIaVFe+Usca+m7AvuHvB0h3kIJwdmOEj+BMKelzGctTFeq1c hGe38Kuo4V7pzXuXk2mqv8gQesdCNGEQ/9Oe+2GvxCTDvIXKnqbjBQXNMxGnIEZnfxsWnSQwz B+KvkWWEaN73/eQfrrNG3C15YNkkOZqAGvUNamGXNjfkZmoDogVZgRxHpeC0AN53WbaklZuJ7 DUpVv3zhD167/NxRthzyuGqxgU3yh5XbSI70YPjlKydB+w9BbZK172rNC5mVfkIi7RqAqWMIk bIVd8Q== X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,MIME_BASE64_TEXT, RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2,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?1750022191321833539?= X-GMAIL-MSGID: =?utf-8?q?1750022191321833539?= |
Series |
TPM IRQ fixes
|
|
Commit Message
Lino Sanfilippo
Nov. 20, 2022, 1:31 p.m. UTC
From: Lino Sanfilippo <l.sanfilippo@kunbus.com> In tpm_tis_resume() make sure that the locality has been claimed when tpm_tis_reenable_interrupts() is called. Otherwise the writings to the register might not have any effect. Fixes: 45baa1d1fa39 ("tpm_tis: Re-enable interrupts upon (S3) resume") Signed-off-by: Lino Sanfilippo <l.sanfilippo@kunbus.com> --- drivers/char/tpm/tpm_tis_core.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)
Comments
On Sun, Nov 20, 2022 at 02:31:32PM +0100, Lino Sanfilippo wrote: > From: Lino Sanfilippo <l.sanfilippo@kunbus.com> > > In tpm_tis_resume() make sure that the locality has been claimed when > tpm_tis_reenable_interrupts() is called. Otherwise the writings to the > register might not have any effect. > > Fixes: 45baa1d1fa39 ("tpm_tis: Re-enable interrupts upon (S3) resume") > Signed-off-by: Lino Sanfilippo <l.sanfilippo@kunbus.com> > --- > drivers/char/tpm/tpm_tis_core.c | 19 +++++++++---------- > 1 file changed, 9 insertions(+), 10 deletions(-) > > diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c > index 4312c5cc13da..2514e60f6778 100644 > --- a/drivers/char/tpm/tpm_tis_core.c > +++ b/drivers/char/tpm/tpm_tis_core.c > @@ -1220,28 +1220,27 @@ int tpm_tis_resume(struct device *dev) > struct tpm_chip *chip = dev_get_drvdata(dev); > int ret; > > + ret = tpm_tis_request_locality(chip, 0); > + if (ret < 0) > + return ret; > + > if (chip->flags & TPM_CHIP_FLAG_IRQ) > tpm_tis_reenable_interrupts(chip); > > ret = tpm_pm_resume(dev); > if (ret) > - return ret; > + goto out; > > /* > * TPM 1.2 requires self-test on resume. This function actually returns > * an error code but for unknown reason it isn't handled. > */ > - if (!(chip->flags & TPM_CHIP_FLAG_TPM2)) { > - ret = tpm_tis_request_locality(chip, 0); > - if (ret < 0) > - return ret; > - > + if (!(chip->flags & TPM_CHIP_FLAG_TPM2)) > tpm1_do_selftest(chip); > +out: > + tpm_tis_relinquish_locality(chip, 0); > > - tpm_tis_relinquish_locality(chip, 0); > - } > - > - return 0; > + return ret; > } > EXPORT_SYMBOL_GPL(tpm_tis_resume); > #endif > -- > 2.36.1 > Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org> BR, Jarkko
diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c index 4312c5cc13da..2514e60f6778 100644 --- a/drivers/char/tpm/tpm_tis_core.c +++ b/drivers/char/tpm/tpm_tis_core.c @@ -1220,28 +1220,27 @@ int tpm_tis_resume(struct device *dev) struct tpm_chip *chip = dev_get_drvdata(dev); int ret; + ret = tpm_tis_request_locality(chip, 0); + if (ret < 0) + return ret; + if (chip->flags & TPM_CHIP_FLAG_IRQ) tpm_tis_reenable_interrupts(chip); ret = tpm_pm_resume(dev); if (ret) - return ret; + goto out; /* * TPM 1.2 requires self-test on resume. This function actually returns * an error code but for unknown reason it isn't handled. */ - if (!(chip->flags & TPM_CHIP_FLAG_TPM2)) { - ret = tpm_tis_request_locality(chip, 0); - if (ret < 0) - return ret; - + if (!(chip->flags & TPM_CHIP_FLAG_TPM2)) tpm1_do_selftest(chip); +out: + tpm_tis_relinquish_locality(chip, 0); - tpm_tis_relinquish_locality(chip, 0); - } - - return 0; + return ret; } EXPORT_SYMBOL_GPL(tpm_tis_resume); #endif