From patchwork Mon May 9 08:05:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lino Sanfilippo X-Patchwork-Id: 12843168 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 492C2C433EF for ; Mon, 9 May 2022 08:44:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232680AbiEIIq0 (ORCPT ); Mon, 9 May 2022 04:46:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235586AbiEIIOw (ORCPT ); Mon, 9 May 2022 04:14:52 -0400 Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5415B185CBF; Mon, 9 May 2022 01:10:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1652083625; bh=M4uiBJ0SrRm3ugvJXz12yggQ3vN5GTXqnSYLxrQ/oHs=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date; b=b/4Pa0oliyKAEasDWKOIFAeByXhAfC4XtPfN3dOlJHAnb4Mc0GJUWxCQ32pwineAl kcU+BpdIrS3GQVAmMNUUNm8Pod4iLRir/2ShxpVP/LWpB9358qUpKl2lo0hf2qqH4B edzuZ526y3lcfMIN0lXEfuPI+eaubtZzsXOJTBJY= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from Venus.fritz.box ([46.223.3.89]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MQMuX-1nSCJU2Lnl-00MKuy; Mon, 09 May 2022 10:07:05 +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, LinoSanfilippo@gmx.de, lukas@wunner.de, p.rosenberger@kunbus.com Subject: [PATCH v4 0/6] TPM irq fixes Date: Mon, 9 May 2022 10:05:53 +0200 Message-Id: <20220509080559.4381-1-LinoSanfilippo@gmx.de> X-Mailer: git-send-email 2.36.0 MIME-Version: 1.0 X-Provags-ID: V03:K1:jd1zsKpJOfv6QwsNpOuzhGc8NRM3R5nkXHVqzjdmH7YEXNIU7ne la/ZV2IY9Q74+00orv0t2MWAahRMJIDjQ3cSaW9eegv7N/uUUml30W5gcp1X/fPDSwdKoR7 K3gu732JFMsodXAgAFcEL8MBrG7b1ShzMV8H2hYQ5fVG1xkMxfJ7DywA0ZNk/CsazbFQg9P SCXsn80M2nwHPzO6bUf/g== X-UI-Out-Filterresults: notjunk:1;V03:K0:JkI4FvcRRfE=:ya3qy+PY8LWKx7E8pZIhrQ 4K0lhxQNPgpTXbrL5oIoGMUqmTUoz6Ov0OKQ381Xyga8FJmN7/vzewraNyMXFT9aBA2cPoLEB gZrRySJhPGv46WizbHrRrlNvTNd+iKL+ZIXEYib9Y0Yz2hfwt47yWprKuLXzs4TAMrQZOFlsj UVWHaUk/goIVV/EZusfPd9YmoKszYWuNHoR57FfarLt7buxj711GnMsIPt8M6ybRIpN5wXcBY Ncd3FQxZBZqYT+xbzvak3UNK2MnhsjnVOktajgn3ajVA6DoBQsXPdaOtY+Fdr4anaFRU2kkoK wGags94RP1YXwrOW8Jq3O+xOWR+o1S/iyz9ev+AWm3e5NVvnUCbXmn8UvtOL/2VtFLyfnwMbr 51Rrs6VaEstH3R5VcyhCIKcwjUN34Ayn6Jqf4MjVUPqbpD5+BG+zJzsDWGkL5Xsp9ooCVMkaU 7fnMRVIyvmwgzcz85NlTuAVxj9YSfh8rMc617GJ4V7FKjzYNm8ssbqW7W3Makc5mVlMJPOINW 6At4RQpo7QD1rkFzXuerXQgUrCoGmkgQN07KmhJ5P5VTNga6A8DyU0x5p9peVdNwzfqBp/Lhu XxTrS2QezZgPmLdnRg53Y3qqG8lj7EuK/Ayc3+318oMY+oyzlD+cNRj6WpXsWah8LukEY6GFs AUspHoN+2uDdfalqaA2ynqpxYjyg/frCj02AgydPYNHF9uwr7gJd06TVAwf/norQuy4rRXIzA M4FsFJcJyIcP6iwbfAhW92ClWcx7r/+U0FMjDxAxF9wDlap7gaBLymJ4LHnxMaSQieryef14D 5WtRGhcC9/ns5s4UaDRWwS7aY7WoLXqQio8WokhUkiA0jIeAQWlYFz7/HoAplfWeLYbmyLFqV PjMyGGvE+k4FEiLnUmHjfGPLJB99+UJh4RUy3i984EoBWWmxq6Z8b0okZXM0UySDKOamFe1d7 56/1aD/T0r3ppiiNVr/uKOYmZsnYXi1GIbWn/hqGJu3n5mt/PDfQDhtGKW/KmMYpI8rxMEn4F OhFHJ6XxloPGcYDJes0p8F12V0280JiQlIV8xUBCYVziSTUsmm1HU7BDRDgVyfIchNIbZOX3c BHZrerWgZMP5I0= Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org This series fixes issues around the interrupt handling in the TPM TIS core. Patch 1: Request threaded interrupt handler for SPI. This is needed since SPI uses a mutex for data transmission and since we exchange data via SPI int the irq handler we need a sleepable context. Patch 2: Make locality handling simpler by only claiming it at driver startup and releasing it at driver shutdown. Patch 3: Enable the irq test which is always skipped in the current code. Patch 4: Fix the irq test by ensuring CPU cache coherency when setting the irq test condition on one and checking it on another CPU. Patch 5: Move the irq test and the check for irq test from tpm_tis_send() to tpm_tis_probe_irq_single() so the check has not to be done for each data transmission. Patch 6: Instead of blindly trying to enable all possible interrupts, use the result from the capability query and request only the interrupts that are actually supported. 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 (6): tpm, tpm_tis_spi: Request threaded irq tpm, tpm_tis: Claim and release locality only once tpm, tpm_tis: enable irq test tpm, tpm_tis: avoid CPU cache incoherency in irq test tpm, tpm_tis: Move irq test from tpm_tis_send() to tpm_tis_probe_irq_single() tpm, tpm_tis: Only enable supported IRQs drivers/char/tpm/tpm_tis_core.c | 202 ++++++++++++---------------- drivers/char/tpm/tpm_tis_core.h | 8 +- drivers/char/tpm/tpm_tis_spi_main.c | 5 +- 3 files changed, 96 insertions(+), 119 deletions(-) base-commit: fe27d189e3f42e31d3c8223d5daed7285e334c5e