Message ID | 20220610110846.8307-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 9C9D9CCA47B for <linux-integrity@archiver.kernel.org>; Fri, 10 Jun 2022 11:09:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348839AbiFJLJ1 (ORCPT <rfc822;linux-integrity@archiver.kernel.org>); Fri, 10 Jun 2022 07:09:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347807AbiFJLJW (ORCPT <rfc822;linux-integrity@vger.kernel.org>); Fri, 10 Jun 2022 07:09:22 -0400 Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A55781451F6; Fri, 10 Jun 2022 04:09:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1654859343; bh=FjTX5fdVXhUBj8RMsEYOWEWk4ytjsWf3pA6KjMuFGI4=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date; b=Kt86SNM15GOyutY7s0fOpaWqYWY3Z6RsLuL7xXLvsrybiV7aFQTKpy0uafM4HVF1T RV4lhcUOahI1CIxxCZCX+yZR7v7NP9y99GTUkiMk9P1MisZQ7JOuCJDteyHRUHU9mT B+y1CkzFkTGul7IxDlNwNKXUHHhFHJcCeTteWTjM= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from Venus.fritz.box ([46.223.3.165]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1N3se2-1nZOUp24SO-00zn5W; Fri, 10 Jun 2022 13:09:03 +0200 From: 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 v5 00/10] TPM IRQ fixes Date: Fri, 10 Jun 2022 13:08:36 +0200 Message-Id: <20220610110846.8307-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:NhRcHEK5j7+DlQA4RVFE7Wp6BIXFNGxMfSFUWWQomZ8NIpYkLzn Anj0/BR1DnQky72a+ssWFYGZs4hoJunsNA+qmI7yy+GPGmvRE6j7wkz9GWAPeMKvr2Dn95o +ksL6QgdRJ6QypWdV5udEaN00a77eXcLw2+E2sWIq2vAxdTynWNXonIA4d9TfkB+6PIZk5A vWRvXFgl2cAEOi3X8xNqA== X-UI-Out-Filterresults: notjunk:1;V03:K0:Js6tF1H60Mo=:opTi3sKIIpsVdkwH0HTi5C EhLEbqxEWgjB64hkc9Q8N7QBmvLNxcMqwDDZnUE5FX+KUQPbyEiZ7BksIe2gTQoNtn5m/G9VI +AYpeZu1tw40+L3ERYVJOfnsCJeT+2TgP3sP3YF4XD86Jy7HVdKXMoGIhvMPsHhx9TTADg1EI 8L8kzFwoJAD60SS3lOk1LDpIv///+w3v5M21SBkP9ai/tVTO/Dkk139EAhwtFzDLxWMOJwuJW wiDg4ptlgx3x+pXKZRcNJn/Il0QkbPptpfPHGSBmF9yRfJeZ5gGbod6c+d/RLCKzqGxaADS+B 8q+kZQF2PrT+TI2kfwC1RV2Lk/M7uR3FXn6fbIcvwOhogwJG6xsCjad/RJCD/9Ld+xLeQC7Z2 cK5Tz+5QWqLhJJFKPAQ3/FhcQCi+724uVcrYEQgrOPQlbHL/OAyCDIQkKGev+kvzz6+ne9R15 q1xxqkjrTSq6gSjFEvCVExSs4UEiX8Bd4xEL77xXdnOVVyjxGjQlN96/+HiAFB6jK37rRWTTm 3nYI45JZPfF2kCymsYZPj6NIn9qTUvMc5RWXRLLr3lXTH/CZ1SLsOsvWTMnPANkwky3yaQDVM RJWNay6teKgdlD6CdHN4LIR0mtk1gZXaOyd27QxyBXEEnQDzPzeEll0HM6IZq2nwccuFMniox /TsdWhuVwblofxuWtJnH+jtzzW5gd2IL7E5fFDSRSx8aXzBSA/kcnf6zyEtSTizretEbvwO6o i4EuPkhEEIoWCSW5s+1G6XnHZPWqI6LYubQrSgEB4OgJLb2W101Sn63fVRIE7GqBpmYBcqnJl 1gsvgU4QmR2HBuWPH5lVCi1BsVC/hx/Y/qSnvabDFP8igZCUIFiknKNcWCmAjj3FqsVfBn6N0 t1KEGF0bl7FfXoGvYGUwKxmJ5135KwNH6yi6FVxYOUDaTbYQDB35YEOcwG4vhG7t84923ekG9 mMSN14+ojVU23GuSKX1imQQobeU4Ybj6qu8kOE7Jvl7FXks2YigwlCYJHjwyqpNJwQ6y7WCt5 2y9LwbRPnLNXxgW4C9J+0G3edAEwhrwkOO9Y4r1GpxU0Wwss3b0ij9yMJ7aqdZNnzeuyID+d5 04Y+I1n/jAeJdaIBrZ/RASXQAG6SclQAoeqdqfSNvDc+zEXqKNemC/5Sg== 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). Patches 5 and 6 take 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 (patch 5). Then wait_for_tpm_stat() is adjusted to not wait for status changes that are not reported by interrupts (patch 6). 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. In the last version of this series this was only done for SPI. But since with patch 9 grabbing and releasing the locality includes using a mutex which protects a locality counter the threaded interrupt is always needed. 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: Store result of interrupt capability query tpm, tpm_tis: Only handle supported interrupts in wait_for_tpm_stat() 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_core.c | 217 ++++++++++++++++++++++---------- drivers/char/tpm/tpm_tis_core.h | 9 +- 2 files changed, 156 insertions(+), 70 deletions(-) base-commit: 4b0986a3613c92f4ec1bdc7f60ec66fea135991f