From patchwork Thu Nov 24 13:55:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Lino Sanfilippo X-Patchwork-Id: 25545 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3410828wrr; Thu, 24 Nov 2022 05:57:56 -0800 (PST) X-Google-Smtp-Source: AA0mqf564h295169eWmIHVbn78IzYkACDOKmBM+AlyoKMEmI02ohNX45qlJcxa7dITCIgygRqpt7 X-Received: by 2002:a17:906:a397:b0:7ae:5381:bd02 with SMTP id k23-20020a170906a39700b007ae5381bd02mr27023944ejz.286.1669298276634; Thu, 24 Nov 2022 05:57:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669298276; cv=none; d=google.com; s=arc-20160816; b=BGqW9vtD/FsZ+0Ysyu2cGoqts3tYjicI/GMaImQP13403RghIXrUP2YJFMPSzBZYnQ lpmY7rf3ywROmuNOZwrgaowBH1/8pJbphfwMi7iI4jFZLInbErZjy8ZGo7f9lWkiv5J3 wO28TQov8vecCqZMDZ6mZpq8TIvOIkx5ugCKfeYp8fDGNrS5kEeAyNFNpej5PpndKFjv u4Z39lF70iyjorCKqbcxuSIcpNgEabJxW5qX9EV0oUtkYJs7n9mdcZ+vQuskMqDSptmC xkLxONvvvLIfiKtm12HRhrEPVcr09JGhspVpxMBmSnknzxXqh7eitSYRgaiBHMOGesqT JXDA== 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=RNoCSRg3R8Wx3i1g1q633Fjj4lnL+OK+lra5ATnMp4U=; b=W6McehjJj0UoJoU8EVprcEwbJbKq1hsTBrtvOKFrhAfOC1TnAS6eTcQk+VndOOacov 2+rsj/svfFLqOtzbPDq5zPDnqShUZZYuV6ughY7ouJXNhTRpXj5sOWQQoGsaeNE1DneF EdfonwtkH9OLLdx0yrCgPXVDWag27q0RJ4mpkuySlAhOvVxY4yEKrkP99Wv5pRkN+vY4 8tFH0Xr0hlvsK8UCuiaAO2ZZQaGq7YvBpzRLO+yRLK7OvZqhJvMvexqURBEDq4cjJHAA hqF+EOC1OAmvHD/+wZcmER/IlIY66V11KcmMrDwBLokTU2GvM5HxvQYNAlk9xDwgUlgh +Xeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=EaPyy9kW; 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 hv12-20020a17090760cc00b007ae832c0b6bsi970568ejc.508.2022.11.24.05.57.32; Thu, 24 Nov 2022 05:57:56 -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=EaPyy9kW; 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 S230175AbiKXN4t (ORCPT + 99 others); Thu, 24 Nov 2022 08:56:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230072AbiKXN4d (ORCPT ); Thu, 24 Nov 2022 08:56:33 -0500 Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB867FFAA4; Thu, 24 Nov 2022 05:56:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1669298174; bh=RNoCSRg3R8Wx3i1g1q633Fjj4lnL+OK+lra5ATnMp4U=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=EaPyy9kWmOu7yKDblEHFb1TJ5KSgmh9amRrtcp6n4LxnIot32DPejBQEp6w5OZQMb wvGeQC8V5z2rSj0pQ1wZAVJP6dQqnCTae817QMGQ1xwCksrsb7fUSDcQ6phiyUQfWP Ba0nHQZ0ERIHCurT5pYh9gQKxcnG6GkGGu5UWSD3/aZmYOx4uNNR4IXIH0+fameSR4 BOidMDBAlEHo7entttgS2iAvsSus35bEgBZdrzLjCQ5swNMwux4uJTnoz607VQaQQA r/WXQ3kEy2wvRKtObjNS5wIy2mVlZF96wB67Xc609JwVa0r0Iha7wql8TDfUxkqIX1 Ttu292M01Cm0Q== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from Venus.speedport.ip ([84.162.7.17]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MtwZ4-1pCZjF3EZo-00uMey; Thu, 24 Nov 2022 14:56:13 +0100 From: Lino Sanfilippo 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 v11 11/14] tpm, tpm_tis: Claim locality in interrupt handler Date: Thu, 24 Nov 2022 14:55:35 +0100 Message-Id: <20221124135538.31020-12-LinoSanfilippo@gmx.de> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20221124135538.31020-1-LinoSanfilippo@gmx.de> References: <20221124135538.31020-1-LinoSanfilippo@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:+4teyRziUIPdBKrwSWvjbsYkNgwpeKjz1mYZdtd3vDEeyiycqjq Wn9EuRUn7cNzN0xLlFliMQlxrp3BVEhJBSEoTBpSpElfCo/J7xOXQ9/2TkRPrT0mGaalOUy 97c/MhwXZU2JvaFyfG+PHlwYacqYGORMF/RkmbU2JdwE2Wodb4K7URnxMG3W6fSRMKMjzWq VTXro35eiHY+OdD1aOzGg== UI-OutboundReport: notjunk:1;M01:P0:9cGxeBqa+go=;IZmiS8eY/s4mXxdKxByX1ytWAaV D7ibIuts1yzeVae/mmUwoaaegD1M24aTq+2HcJNDfQybbRRrp/xUSN48bKXNKHFwkA7BJOnw1 HUFjgAAU65YSumPyzvpOhjJv/addNEkVybPaq41S1SqmZN5rAhMOvZmnZILLRWd5cAOaUrHdZ wHooG4mwvJWcT/F9i9GksWlqSNPdlrsW8HLfybtlMs0X/77AzXUAFPmdG/ecJJ+vgb45MXTb2 FFgtiYPrSGBbNIZpQ8Puzn5yBgvkHWGXkia9tkx2BjGgu8yO0JfhrwjdnKtn0M+FutqkIvMnk aVcm2trverNdhUrwL8K+WmOTDRcUGJwplzJET08gaPmramDZH/NQ2FQioxMKE3OOEourBcier GfYu2NtVJrKd2uEMyhOxdLMbJJNDAxa7tQoXgKm+sGgT69VZ9tyWN7IM4ONlLc7pGnJ3HeCLE 30sKBMxjIC9OZflH9NqEZKjaAJIPfjYKaRgrl/K13mkr1rHWIq6V9B96QZYVIiMS8BDVBjGI5 zoPkOqaI0cduKu6gCrBKuANPDuhVl5moHKFPVBV9+trzcMp0C/Q4lfYRdwhQHkjdiDp1TL74D lXmTQ67gcWK3WMMof4sJmyFcxMBaO2bvnYP9QHoeo61FMuLxtX4x00jAwpnDPSP1Up9omPzDG Uc04HeDrs4PjK53D6ZgLwIeVACfL29Upgk/+BdToD5LwEbfqR3KkJgZg1N0q2iUJaLfGyCjNP Gtj9uWJZ9Xgs5S25P3cdefAQDuaBF/LkHW3HgwBZpUWDUyhVumLdFsC/MbLI3AWwqfRT74Asj 0X0mT9s0UpIQJQAgXeS0ClFoeKhgB1O1rbauvAZ8fwtRuWtAkkKZEJOZaRKJ7m3Mr1hI0Ae5f 6db04brPOWz2pHfpyd39uTgbq+2g2hKkKkSTEa2jTpFWcaaCujrYwU20hBjZWJt3a6gMW5X5M 4k24Cg== X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750386109656862201?= X-GMAIL-MSGID: =?utf-8?q?1750386109656862201?= From: Lino Sanfilippo Writing the TPM_INT_STATUS register in the interrupt handler to clear the interrupts only has effect if a locality is held. Since this is not guaranteed at the time the interrupt is fired, claim the locality explicitly in the handler. Signed-off-by: Lino Sanfilippo Reviewed-by: Jarkko Sakkinen Tested-by: Michael Niewöhner --- drivers/char/tpm/tpm_tis_core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c index 3891499f9877..eda3b122e540 100644 --- a/drivers/char/tpm/tpm_tis_core.c +++ b/drivers/char/tpm/tpm_tis_core.c @@ -772,7 +772,9 @@ static irqreturn_t tis_int_handler(int dummy, void *dev_id) wake_up_interruptible(&priv->int_queue); /* Clear interrupts handled with TPM_EOI */ + tpm_tis_request_locality(chip, 0); rc = tpm_tis_write32(priv, TPM_INT_STATUS(priv->locality), interrupt); + tpm_tis_relinquish_locality(chip, 0); if (rc < 0) return IRQ_NONE;