Message ID | 20220621132447.16281-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 04D1FCCA482 for <linux-integrity@archiver.kernel.org>; Tue, 21 Jun 2022 13:34:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350725AbiFUNeY (ORCPT <rfc822;linux-integrity@archiver.kernel.org>); Tue, 21 Jun 2022 09:34:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351579AbiFUNbC (ORCPT <rfc822;linux-integrity@vger.kernel.org>); Tue, 21 Jun 2022 09:31:02 -0400 Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50E652AE17; Tue, 21 Jun 2022 06:25:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1655817936; bh=vLz9Wf2+6MlMxzDvcnR6bF4tQIwwWW2OtZip072WcPg=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date; b=lPW9Vx5rvFOZK++BIZ6HSKC9cxArBrrcNYMX/Bpa6tTw3fIOSCboWc3DUyzcmDqpF gtCTIgUg8+rmG+Dep3M0+WF2E0sKek758UOSktLt2dXbThwo5Fw3hR1vxl3ywVVmAP zv2sk22TtelEeuR+CVqwPA0qzLOWFX/ZVyL7nSww= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from Venus.fritz.box ([46.223.2.162]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MSKyI-1oEcEi0PfM-00Sbd6; Tue, 21 Jun 2022 15:25:36 +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 v6 0/9] TPM IRQ fixes Date: Tue, 21 Jun 2022 15:24:38 +0200 Message-Id: <20220621132447.16281-1-LinoSanfilippo@gmx.de> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Content-Transfer-Encoding: base64 X-Provags-ID: V03:K1:VrMkKDj7QnWhNze5ttV1evfMRvtx/UFBImuDqIINsdLXnwGMawH InkQDtd/RZ3Zdw8UmzD9d7MmGKLkKwIsHdIbEenkbHsPgz2AXzl2SnBD1jP41lo+AMu/AF6 1k42hv78yH2jJ+JFqN51G0utD2XPtWUZ/LlyB5spmWagOrskxgh20SapeN+yIURud/+H9Qq NKIXk+etLnKQedAjOBSgA== X-UI-Out-Filterresults: notjunk:1;V03:K0:FjBVVmvSacQ=:nra10x3JWv3Kh4MaYpjtWW cKiJTlTQv1MySAB8vu15WJaR5xjYM9FEykEEmX7rmxM9fmjbavk4s/EHiONfrtZOIzSC9PVHf Bd867ctVlMuZwJGsTfCHbSZjCbQG4GzKNzLgZew6ErMzbwF9/PNuGaGPshoiD1xHhe+cRFLkd rO6WacdXkEsZi7iJpuZnco1IqI4fpQcdlXCqX87smq4xFjUggIXc4IxKPpBDI5nnBBFBXA5Rn nga5AEpGVpEincWLY9V5UKW7kG2+xjkvyFR284FeuqHqIwXtfYQe2eI9ZdsRJs5MeToDHacDg PVJ4aCxsLVCtMZbdmTi8MRCfR9+kKwbWe/Jj8gpFybGq+VHLM2DEWSyC1m7adHYFWfxPTXnLC e8ZFiSUELp+/f/Bp0Pc/AsVolsk+uugYwRaJdcs1Z8fxLiuUU5k6MZvLjD6O+sa8kXh/4rDdg 13wBDaGMr0jtutzR8m+wZY0OhwF2hSZ1HyotFNgTSwv8NE7YSDy2drA6GguK0r5jvihSO4PqS l73kETGhWN/gb/m5nyANbqL/9EValwrpYaXd+otea4+PLGWC+f+H3EjfZstNBcHwp12toh8Up QlhwkuXidTFoRfSOJOd87kX/p2vVJ95UKKNZAm6YqflKEFaV+gPeSo1gxg34iKyEUnZG/Pxxc vh+4MmPWlqeNrUK1PN0QJG18Os+Olaa7U8VCSdYwJ9Ux+60wtw57wEH+yGxZope6l38TMr1So EeipkQL4x77c7lVeLD2RcRG31xkO0WcdRTq35kmILd43FwzgYO8jI09Dyl/fGvIXEFc2g9i03 Xj9Z7XunWEyGkc2bxa8EABhWRqpuOBGGN7/vsKt+tL47iZZnEydj3plflpXcbdXNUEwmStmrp StaF8/81daM5/9xvd3e85KofaM0DVzIxVLi/QX/GajIwXyN1Va+TQPySntqCJzWPnM1JEEkFV jiHCtKtondWmhKDNMrKp+SDzGsLsj3ODPRHLCf06sJvzpWa+2qPM1UrBKYjFxC1Z3taI5muhf 41UfV/kApnzfgze3/bnslEfifUNRH2tJfzFfWTMOJCDObXCjbtY2biZkhd8ItohwKFvzm2O2x /iac687bkAYAOBhYUYAj7O5JTM4oI3DmwlykWJP1SxuYWp7qYAm92xi0Q== 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 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 7 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 8 makes sure that writes to the interrupt register are effective if done in the interrupt handler. Patch 9 enables the test for interrupts by setting the required flag before the test is executed. 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 (9): 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 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 | 252 +++++++++++++++++++++----------- drivers/char/tpm/tpm_tis_core.h | 5 +- 3 files changed, 171 insertions(+), 88 deletions(-) base-commit: 78ca55889a549a9a194c6ec666836329b774ab6d