From patchwork Mon Oct 17 23:57: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: 13009725 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 CB46FC43219 for ; Mon, 17 Oct 2022 23:58:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231259AbiJQX61 (ORCPT ); Mon, 17 Oct 2022 19:58:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231194AbiJQX6U (ORCPT ); Mon, 17 Oct 2022 19:58:20 -0400 Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 076B48680F; Mon, 17 Oct 2022 16:58:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1666051073; bh=PbG1OYX6Y4kEPBzVrb+ulM+TX4iJNklZW45J9wC/7KE=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=KGtWOlMGgNx7n09+tKlPuD6lxv3cZbh2ucucazoy9nsOts6rTDFQXDvFgjHBxrMnW MmtyxzbrPcv90argVqs7cLTJva56fODUm3Q5sVSseyK9hUgwsOJjZiXrBRHLX5OVqA c1zURgJ6uenfI+S+t0uALGz6mdmw+A6E6CkaTgBY= 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 1MAOJP-1orPlC2ldD-00Bpcr; Tue, 18 Oct 2022 01:57:53 +0200 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 v8 10/11] tpm, tpm_tis: Claim locality in interrupt handler Date: Tue, 18 Oct 2022 01:57:31 +0200 Message-Id: <20221017235732.10145-11-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 X-Provags-ID: V03:K1:+Q245lTUnEiVujLhjvtNoaAeMRZ564XmmtJA1FOAgd1QoYjag6I ucpHK1Neq2jBwcV5z02NNlIfrQyxyLdDLMY6NuRvAX77OBG4YVr38aba8tkpAywHJbsMc43 HbTOPzXQLYUYN8hao5SrtXK3bLbzGn2hRo7y+pqibPJb37xD/5iJ1k8/gsx9hRPoZGZxJWN 1dDD3dEhi0Q+lgHG9ib1A== X-UI-Out-Filterresults: notjunk:1;V03:K0:rmmYQAqyqLY=:gOvchMX92CmjVRyT9DSMTT 7P1gR8zjFRUCKYya372G9xXafC8uNc3hDei0GDOhw2ZjQFXRQ972S/e5KqaqkeQNNK8zYVhwJ V2mf2ctLRG0GMDKO35yuEUvcpbZOcvos/KJfk5vzDPooMAZyL+eotHhsgKxluyC+Ekj/6rShF hsCQO7vNP8jPFvpCr9+a5mj0HMWiwao/obebd3SMw3g7927pcrwH0ujomjI6HNg0s7R6Dh/2j d8uyPdizUUzUjxoC6gfvGKXl4QaCH3flpyTQ26x521rYmVbkFEXoTMH1T8dYGabweNBFj1PIS kGOc0JtKnI/Af3+aqlIpHAjeEZqYnX+H54B/I5pKykykF5O/r3vbC/X33ZZ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V9ccf91D4g8RicHFsbdjpYEI8gha 6qr6tUi24KfNCrMVVgDm0or2grb1SkDzpEySpUp0TQk7Ka+ns3T4uknuPTP7HOSODXIMHlOyz ZbMm11i/4JFoSXtKGt6yN/aUaEctdIpp9TZ4Exk5IyLlc 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 1e065e7ac460..42f628e52cde 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_release_locality(chip, 0); if (rc < 0) return IRQ_NONE;