From patchwork Sun Nov 20 13:31:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Lino Sanfilippo X-Patchwork-Id: 13050042 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 7DA7CC43217 for ; Sun, 20 Nov 2022 13:32:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229655AbiKTNcu (ORCPT ); Sun, 20 Nov 2022 08:32:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229708AbiKTNci (ORCPT ); Sun, 20 Nov 2022 08:32:38 -0500 Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6017CE33; Sun, 20 Nov 2022 05:32:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1668951128; bh=Fh91Z/S6CdFbZcIlWAtBWi5M+Ufp4fdLO7yRx0mA5co=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=eBvdx59MiCt7nWfZqJpVdNH00Q+524VzOGZt5Iwpnu/O8aACnEjsN/r3KWjXnHVS9 jqWWkUkabri9ZL7nf2K3/6dL9En7XegauqEXx1eJE8QqkaH0mFpmQOlWFuAbAcv0nZ uH9HAIEFPnK6o2zJLDwjpA3hx3ij9oQypKWNeP62VF/fj4fZs6ppnF9gH0IoKqIUXA hI4cSQE/AYxJWSpp7x5WKfkIbslPt3j719PrqnC8e24t/+iRe5T+FiY6jxFHBWOqet 7fe5tqFo7Vzdvq+2hucM5+DHqxvBrIMlyGT+SUv2+TNTTUY0mBCwkO2W7M0pbpM4BX D7V76EGkHapCg== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from Venus.speedport.ip ([84.162.7.17]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MBDjA-1omFmQ0MFq-00CkYD; Sun, 20 Nov 2022 14:32:08 +0100 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 v10 10/14] tpm, tpm_tis: Request threaded interrupt handler Date: Sun, 20 Nov 2022 14:31:30 +0100 Message-Id: <20221120133134.28926-11-LinoSanfilippo@gmx.de> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20221120133134.28926-1-LinoSanfilippo@gmx.de> References: <20221120133134.28926-1-LinoSanfilippo@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:eOWaNTW8FLNMvyPKVdWuy8VMWOkkayU+lKPsQWbeIJ+zIUri7QD fQHMBToTd6EmbYjH4xD/EZ/89RUU5GzupzCyP2hk+prD23Vis0/SDMyGp8HW7OfbZZ1jkbh YptTTe415Q7YxRuudPV812H5jqrp66HE1/LScLLxHyTQ1p+qulo4lOVRGryMpLgYXaSfGFG nZonkZ+NtssoyLQG6HluQ== UI-OutboundReport: notjunk:1;M01:P0:9dwm6XbUp9Q=;gqt37mfZgKTSzuXO8S2lBU6hWrU vShXolsRIQR9cMOgiNNPT4yanYtb2Z5NSk7c8h0nN0noCaTKEfb/to5TYXQEo7LK8/pn/mCKI VtzI5aNV/8oUaFNuvl7QSl51J3mQiIREjsckpk4Nl848cPUNbDwQuq0wu0auB4gfJv2lz5IKN aMQCI2QU4WvzeyU8YdbuqT7Q9FwrFYSVt+rm4QYcnC6KtedYChlFueIBdlzKpziN9Ww74wVry flOj+SmzZTx4drXWcNHVOATQTrxT2HRK5ke6qjukVjKd//f4PI1d18lk37um+nGkyRUkR4Q7X MuFQIazC45gURjhCUvJNvBmxMG9xUKSawMqYUEkRt464Jx3h3KhkDu/4dzMdhoIL5R/QjDaiT woNJPcP8o026UGBqFnjsYHDk8k4Gjz/fYE6JrS7/khnzkOzehR1mdlAdO4cAYOEQXQD+86KRP YlS9VHGZatcyvfTblqiYS1HXvfa28Zdkby6d813twthsjZ5AYB5/qclVejR1rrLAyZCMtcbZF 8hwSG/UEgpG9tcquw0L7GZpcVhnT/WtAQnKHHHS9bX5UGAbxYwVX9tXWnpbdGpPRiEOIaU9li k8RY1ur4PS5cdl0sLxp1uiy7N3YvcPzePErgP9VgDvxeM7rTfGktDd/Q/I9/VsJRQbs6qy9zV vFlcBMRiWGfD1jZQrcwpAu1mf0EE/puQh65sZKWC4Gw4I4W+WKnGR9zyqi4vHiEWAj2Yf6wMr TYuqHAAKNUvGVtfuAkCgeAn3qb1U3SifUaJS/+0zYF9mDu0cLHjaD9qGGEqe1U99Bsx1W2Cpt dlcCiIREY5GQz1BmLamTaM/tKdfVTxDMfiRspFXTaK9LpliJVLlPX1XMK9mWSGOCK7otUPZX8 qarwIJelf4Pr8T/370LivR+WPiZ081l5cVZ0DzMTDw+wjEqhJ8KvOr6bXkBO5pna7JxOJuvHE 43JglQ== Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org From: Lino Sanfilippo The TIS interrupt handler at least has to read and write the interrupt status register. In case of SPI both operations result in a call to tpm_tis_spi_transfer() which uses the bus_lock_mutex of the spi device and thus must only be called from a sleepable context. To ensure this request a threaded interrupt handler. Signed-off-by: Lino Sanfilippo Tested-by: Michael Niewöhner Reviewed-by: Jarkko Sakkinen --- drivers/char/tpm/tpm_tis_core.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c index 9aed9c26d2d5..6c765a4406bc 100644 --- a/drivers/char/tpm/tpm_tis_core.c +++ b/drivers/char/tpm/tpm_tis_core.c @@ -804,8 +804,11 @@ static int tpm_tis_probe_irq_single(struct tpm_chip *chip, u32 intmask, int rc; u32 int_status; - if (devm_request_irq(chip->dev.parent, irq, tis_int_handler, flags, - dev_name(&chip->dev), chip) != 0) { + + rc = devm_request_threaded_irq(chip->dev.parent, irq, NULL, + tis_int_handler, IRQF_ONESHOT | flags, + dev_name(&chip->dev), chip); + if (rc) { dev_info(&chip->dev, "Unable to request irq: %d for probe\n", irq); return -1;