Message ID | 20220629232653.1306735-1-LinoSanfilippo@gmx.de (mailing list archive) |
---|---|
Headers | show
Return-Path: <linux-integrity-owner@kernel.org> 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 67A6EC433EF for <linux-integrity@archiver.kernel.org>; Wed, 29 Jun 2022 23:27:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231252AbiF2X1j (ORCPT <rfc822;linux-integrity@archiver.kernel.org>); Wed, 29 Jun 2022 19:27:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230504AbiF2X1i (ORCPT <rfc822;linux-integrity@vger.kernel.org>); Wed, 29 Jun 2022 19:27:38 -0400 Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EC1924F38; Wed, 29 Jun 2022 16:27:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1656545243; bh=2zc8/rUJ7dNQmSr6g++hY3lXlmXibvM/3VMSy/TocvQ=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date; b=JN7b4c7FGfAomklAyvkuVVEC62SLU3Vb0Sjbia7KFOeItS5GBUYfFyR4Pfw5a9LWW 2vNKOBs1KElR1s9ox9FFAzHXinfQmJ62E6d8/igkjuKrTUAyZHTsYwqQS+K0+cApoE kBZaKgbSJaHx4qxghX6zKjRnCiht/+graQdo1mX8= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([46.223.3.23]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MF3DW-1nrIt110si-00FR3n; Thu, 30 Jun 2022 01:27:23 +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, l.sanfilippo@kunbus.com, LinoSanfilippo@gmx.de, lukas@wunner.de, p.rosenberger@kunbus.com Subject: [PATCH v7 00/10] TPM IRQ fixes Date: Thu, 30 Jun 2022 01:26:43 +0200 Message-Id: <20220629232653.1306735-1-LinoSanfilippo@gmx.de> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: base64 X-Provags-ID: V03:K1:kn2TwQigqLq1k9hVEgWts/dcEKo9y9gt4xkBibqKIoTt0xZUwh0 HzeqcXpSyl2lI4CJfxAOw6jCOYvmNzWpSm/hQR7ALzK/fHo54YO4GoMsb26VWhEtledr3UI bigdIOZ4N1D0DKkkSvRhicVsxJvuPiAe/mqOLyb6LUSvdYI3QHxXmsa6u9RaySVwLZYuzm0 8Cps7SqkjCEN/9XAvz3ig== X-UI-Out-Filterresults: notjunk:1;V03:K0:huhEXYWJax0=:rl5vuwr9ZGUL4YaeFE0abD Ksq7dmDPt86ZwXikCm98wEdBC2l8GI8XtAM+EovErI58kBamQEpgMcGef7GbtCtXHsu2gK1pN zR5jkLdufrfjWFzQC/m6qJBqqjFL/31f1HZdEDBLp1DzvJz0GJ3fho/jyInEas2B5Ekxdh/as paQy5vnYsjJ63w+8TVK5FAb4hZNog7k4T7NNrMmu/amAiqhlijL1v1Er2+am8VtYw2qr7vdX1 W2sOenREMFSnouNOml8Yzx7MafHIYE9WHH4OGhCXMoQEHWEgHbMxibpGynkAQzPlrseWCLils FhMi6ZHZBu/bDfOeIftC90W/OkQyosRfY1cp1lHRMW6YQ/cgb7WguOud0e7NGcO1LgbGsWapU wXVcHd2Ly/tcotQV0FGH1FUhAmlCcqr6qKER1M0xfgfzgtVG1uz+lCDJR7GjlEoKXo39Nu2ZY /VU76yO+FYyyNcudUW+q7p6buTj3ON0QHt3C8f+YXwV/W4AVkZGwOCNmbMFHyJNWz+XSzaaIP hWdAGlZ1Tw7fcpVVRHDqLBkx0ntMka2TYBX/uoWF7gDPGyvD9BnThGvXi3tPm/wPIHbpEQ2c+ Q6LgHcXXT91ZPz0auERlD1aJSVcKQVzgvCWFdI5K4tBeDDLGrpl7ITkp6DcHaat2f5bF19tak EbjL43/ovpdaHxe91XnAalh7ELgseteXYHNkypGA8DptdJBIkBKfLWl3IJ8JrmYt7F9dTpeTt 2Ag72lDj6JtqNED6mk0Jz64oGNy5jBCJn7KNDyfLsmhHx4YAPyikGVKkK6cKNuBJRi/rjrosE 5xIFqjLRsSuGLAc9NjN3UgiFXZDuOkiQ6TU2+3kqiav6CvslqX4SuijdtIRW0pKLFO/LdZaNE F+jno/0r7MINmjTCS6p3oEghc1peiYTDQgEocNAGaKfZ6KPfj0o5W0fVAPwGGHYrHIXA4y+5V PopYKo6vKRKLeKMEuUv8eQGLhGBr6f4HBwHEGAwnBq6IX2uyEQUsiCILHkjQcgHwH3DTMrgnd HPewEwTPVDdnwZQQWiMYeSm2oS6ErbZgSCp8GQJBVYCjz9aXP01J0UETKozInG6/3a0AxNZRL BplQufNPSe7qXpzMFeh+s8IPOyqag5X3XuzJzEfH8ttwahQJT+U/Vspjg== Precedence: bulk List-ID: <linux-integrity.vger.kernel.org> X-Mailing-List: linux-integrity@vger.kernel.org |
Series |
TPM IRQ fixes
|
expand
|
From: Lino Sanfilippo <l.sanfilippo@kunbus.com> This series enables IRQ support for the TPM TIS core. For this reason a number of bugfixes around the interrupt handling are required (patches 1 to 4). Patch 5 takes into account that according to the TPM Interface Specification stsValid and commandRead interrupts might not be supported by the hardware. For this reason the supported interrupts are first queried and stored. Then wait_for_tpm_stat() is adjusted to not wait for status changes that are not reported by interrupts. Patch 6 moves the interrupt flag checks into an own function. Patch 7 addresses the issue with concurrent locality handling: Since the interrupt handler writes the interrupt status registers it needs to hold the locality. However it runs concurrently to the thread which triggered the interrupt (e.g. by reading or writing data to the TPM). So it must take care when claiming and releasing the locality itself, because it may race with the concurrent running thread which also claims and releases the locality. To avoid that both interrupt and concurrent running thread interfere with each other a locality counter is used which guarantees that at any time the locality is held as long as it is required by one of both execution paths. Patch 8 implements the request of a threaded interrupt handler. This is needed since SPI uses a mutex for data transmission and since we access the interrupt status register via SPI in the irq handler we need a sleepable context. Patch 9 makes sure that writes to the interrupt register are effective if done in the interrupt handler. Patch 10 enables the test for interrupts by setting the required flag before the test is executed. Changes in v7: - moved interrupt flag checks into an own function as suggested by Jarkko - added "Tested-by" tags for Tests from Michael Niewöhner - fixed one comment Changes in v6: - set TPM_TIS_IRQ_TESTED in flag member of the tpm_tis_data struct instead in an own bitfield - improve commit messages - use int_mask instead of irqs_in_use as variable name - use sts_mask instead of active_irqs as variable name - squash patch 5 and 6 - prefix functions with tpm_tis_ - remove "fixes" tag Changes in v5: - improve commit message of patch 1 as requested by Jarko - drop patch that makes locality handling simpler by only claiming it at driver startup and releasing it at driver shutdown (requested by Jarko) - drop patch that moves the interrupt test from tpm_tis_send() to tmp_tis_probe_irq_single() as requested by Jarko - add patch to make locality handling threadsafe so that it can also be done by the irq handler - separate logical changes into own patches - always request threaded interrupt handler Changes in v4: - only request threaded irq in case of SPI as requested by Jarko. - reimplement patch 2 to limit locality handling changes to the TIS core. - separate fixes from cleanups as requested by Jarko. - rephrase commit messages Changes in v3: - fixed compiler error reported by kernel test robot - rephrased commit message as suggested by Jarko Sakkinen - added Reviewed-by tag Changes in v2: - rebase against 5.12 - free irq on error path Lino Sanfilippo (10): tpm, tpm_tis: Avoid cache incoherency in test for interrupts tpm, tpm_tis: Claim locality before writing TPM_INT_ENABLE register tpm, tpm_tis: Disable interrupts if tpm_tis_probe_irq() failed tpm, tmp_tis: Claim locality before writing interrupt registers tpm, tpm_tis: Only handle supported interrupts tpm, tpm_tis: Move interrupt mask checks into own function tmp, tmp_tis: Implement usage counter for locality tpm, tpm_tis: Request threaded interrupt handler tpm, tpm_tis: Claim locality in interrupt handler tpm, tpm_tis: Enable interrupt test drivers/char/tpm/tpm_tis.c | 2 +- drivers/char/tpm/tpm_tis_core.c | 259 +++++++++++++++++++++----------- drivers/char/tpm/tpm_tis_core.h | 5 +- 3 files changed, 178 insertions(+), 88 deletions(-) base-commit: 941e3e7912696b9fbe3586083a7c2e102cee7a87