From patchwork Thu Nov 10 15:25:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Lino Sanfilippo X-Patchwork-Id: 13038930 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C061C41535 for ; Thu, 10 Nov 2022 15:26:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230397AbiKJP0l (ORCPT ); Thu, 10 Nov 2022 10:26:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231520AbiKJP01 (ORCPT ); Thu, 10 Nov 2022 10:26:27 -0500 Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 920FC3FB97; Thu, 10 Nov 2022 07:26:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1668093946; bh=UIWWgQ8b2fsRQvPfPfHkm6StxCKq+xmUwy+9yaUc8mM=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=BjTOY1Xban+J7tuRw9hNZDmSQpSfFdGFoM74bNhMXFwvmdWwXD4e4NyQ++zOgAL4s hLKL7mWHv9BzDYs+xe6d9ILU80K+mQowxr9K/ojkEv+817WoBbxvajKkvFwL6WsUUI mw6FGOkOuPX2akB/wJxeXaSclPIE8vysxxvDaU8aZmtRhZIFfmzEt2ADjlLuN9YMkW bSE4+uqzw4PPi/pylCPhkfHygYMHhEX649WAch/v4EtqLxLP3iGVx+h4XTwqtdou/P X9Z0BkODbyMlbuWDDKLJy8Vcta3Q5WmN67u3mvJuQx/egRyxPIZU5y8w3tywnsfiyM DI2umVjQrcNdA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from Venus.speedport.ip ([84.162.7.17]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1McY8T-1pOukZ0B1Z-00d29g; Thu, 10 Nov 2022 16:25:46 +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 v9 10/12] tpm, tpm_tis: Claim locality in interrupt handler Date: Thu, 10 Nov 2022 16:25:31 +0100 Message-Id: <20221110152533.24243-11-LinoSanfilippo@gmx.de> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20221110152533.24243-1-LinoSanfilippo@gmx.de> References: <20221110152533.24243-1-LinoSanfilippo@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:2NYx2+Ps04Palgl1CFkfiIo2TjusG1YVxjgYjN2mHwYOy73ZM3U H8n/wi2pJbkHzUBOhGvW3nUkq2/M0wCFYzjta7Z0TMx4TvtUdArQhsph6w68hBRQnifEd7L bNS5bmuLQwGr1CRKQkrzO7XoVVgCZZ0f8M/Jbktx02kMK7xA5+Fbm84ScDHgpZ7uvst3vrU U0pb5hCGgledCXaQrg5tw== UI-OutboundReport: notjunk:1;M01:P0:RqxsIU8P8jU=;s67SjEbbNtsoRtz0NiA56GTdUZI dO0BdJIhcxeMJtooWqcsH/HxhzaBKrkA0YHiqEoA5kVPd1hu9r0WnsCUN/EBs+oJbHlaZ+8V6 WxvLQfc03RwIiCBM8rrqx9J8xX8BMLjCUemFHPBcN8LoPZbFpNLW9o1gJLXwmqgEXcsTBxOV6 Mm4xavlAqaNQgTVExNAk9Dwfvr2/8Bbbo9bMKnrZWrEGXfglg3UoUpoNl5sfOYz4HsL9NhOBL x1L4PFrKBE16JPONBEiHJl2/aBEb3eFaNuUIXBRKR46kx8M9X1ym041CJhWAlyA3baX/Zi0X4 trrdljAVoGYFYdMxOE6ieqQnautVv3xPtopg9PK2fi15rUelT83Mq0EnNA92E70X2+CtI4FIq 33hj+0vjw9EZDQWHK/JjWFx8e9+78+R48YAmZyQ10DNpRlE6tmMtmQjL5jU+EdBVn1Qj7QeFP mTrWvNJMxCNR2uw18+GnHEgGWg+Y+dEgZkoxLI+dlb9HQOgi+22GvWAMehRdOwCs/urS6iAXM EEzbe2MjIwtVOFKKqrLV2Yyw2UZoHLu2TcNSd1GAyrgK65slMpflhiKtKhkZnm4sgn4PgdSSq Ou9lv900KettuK6tH+kg0OVqJoODarszSJbv8glsl/Y8v/+DgUDWJcrL4WINjLEuknDRWZe7M vFqVdLe68ygRtwNp5vhbZiPSzL920geyX2eEsiX+kbDKfU8MWLHz4IY2YMzIy4IoFjMqWmXgT kvn2e/KrvdLEo4HrHpsbVN+WyQHH7XUwbEMHPgC2O1VaIxtvnSMCyILJj3PDm1IQqnfixnj2l JUoEBnVm3Mq/rIIEucnPGawbd4p4ABailymKtKU55plW+vRPfbxIbfysXhuh+ampBvgchsCO6 hssqwvQFvmLFc5yKY8jvaHElXaOZZORKA5BwTwJqRy1wik6GxIAZZkAKmYypkaszCjvjDMB5D 4vR1IFQV40K55Oav7HkKglytYs8= Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org 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 ced8eae3e4d5..a0a1b1a3ddc6 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;