From patchwork Thu Nov 24 13:55:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Lino Sanfilippo X-Patchwork-Id: 25542 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3410671wrr; Thu, 24 Nov 2022 05:57:36 -0800 (PST) X-Google-Smtp-Source: AA0mqf5qNCN91b7jjGW2saZnrXntUxMPFu1KYd3rQHEKiIwbLmcDw1AJGw6vkgAickvxeDbLqBvF X-Received: by 2002:a05:6402:4311:b0:458:c66a:3664 with SMTP id m17-20020a056402431100b00458c66a3664mr16248575edc.79.1669298256330; Thu, 24 Nov 2022 05:57:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669298256; cv=none; d=google.com; s=arc-20160816; b=vTnKN+qgj4sVjUoDbRz78gygtg9gNcXfyahqFKl60CCFenA+ZETSGXXVpmiNM0FEMP j059Dqn1PwyICjJPNVNtYQb/ukHEh5MO4dXeYtW1HoFbdTRzRMUziCdUpQKGF302O12m Dn7rzNdC8b/tcQl0BlgBzj0NYGq8JzMj44TCLGyalOrP41V//2eW55eZQvTcMPRtXJof 2F8cYphwcTf96mkbNhdrJXKYbiakxNAYN7KvnRy4kd+m1YrzX5nKtOUo6KV6M6P1FZTu PmZBXYHr7DQyFpY9enBhdFsRr+nwaML2M/KWbrkoJP3eG2+bFHLsC11Dq67SgDEWRpqz TF6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:ui-outboundreport:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vnp21/mfPoqtAE/9hipMWqTIgnCW9bDnAe+K+uHJwrI=; b=NM54EhFLULgh540IPCOfKvpNaMgPF00F2Z3NMz3w4+ZclpNzRi8fLsKAe/paAcWFC/ Qx/bvkniCpjWS6KoWawi43PYsLhoqgjEyAnKJnJSoigpNgHRcrP1J7yPZm/6tVmgOwk4 vzF9dQg5kVYkktp1jWs63ElFf2Bku+b8SljEg2+ue4/JZxC6GkMGnQh8JjZjwg5z2oLT e2M8JZBMiAD9D5ENWavZW32csA0hZvnIYkitBHEnMfEeK4KpYsAvbEjoNeUFek5aUb4n umveWfM114DY7iSkYpsuvMsGdusi7QBYL5v18BxfYNhCpAxdcksZ9ZUVvz5o4ANdYBJF 1+dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=LvEQYqwK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmx.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dd9-20020a1709069b8900b007ae61d89b3esi1243261ejc.356.2022.11.24.05.57.12; Thu, 24 Nov 2022 05:57:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=LvEQYqwK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmx.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230201AbiKXN4y (ORCPT + 99 others); Thu, 24 Nov 2022 08:56:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230079AbiKXN4d (ORCPT ); Thu, 24 Nov 2022 08:56:33 -0500 Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F22ED100B3E; Thu, 24 Nov 2022 05:56:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1669298173; bh=vnp21/mfPoqtAE/9hipMWqTIgnCW9bDnAe+K+uHJwrI=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=LvEQYqwKKJlb5S4pUaX7RxL3noLuSJv1rRgUqNElsH5Cj44g9xXImgXuGiSPYNajp LoyxrJhhJ9LhlZ6AbdES/IB23dtxOMoPZnb4Sca0xWatzN7V0cClfoXv4qIJQsFwTz gd/j++4x6FZRihrfjkrruMbIdBHTrYKUl/Que9sCIazI00gRfqhHTBRebUlb7HJoDN gazlUgsJPGsHe3NfvvJ1+ILK1Q3ssp0zFMYiylySFkF8GFZJLpLTI/tV4M6pqEnVcb VCNiPtIZg6rUFdXCp1e74MeAsCB0B48FW3SXfHWuUe+2GKLeUuTEddvoS/kvQZPIO4 x5+G8YSkK+0Rw== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from Venus.speedport.ip ([84.162.7.17]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MxUnz-1p8zDw1j8z-00xvZB; Thu, 24 Nov 2022 14:56:13 +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 v11 10/14] tpm, tpm_tis: Request threaded interrupt handler Date: Thu, 24 Nov 2022 14:55:34 +0100 Message-Id: <20221124135538.31020-11-LinoSanfilippo@gmx.de> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20221124135538.31020-1-LinoSanfilippo@gmx.de> References: <20221124135538.31020-1-LinoSanfilippo@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:FpAKGsitxv+CMneiAfduiO2RrZijFQTQp+bMXElnc3uL6bI8p7F zTshYoLZPrT8axM3jWbcpMLVq9mDHDdAM3tEq1uBH7XummJ8qw+y0+qVRCRfiBBWWjPfPKR HxVBk5dWcGeX13WUf5W/H/MUSLp/5/IiDTX7Aojuz0RmODZhawY2YNzTV92vhwoK7k4mYYw I6ycvYQPwupnhA3TxH/4Q== UI-OutboundReport: notjunk:1;M01:P0:LNScq3ME++Q=;BKzLYTTefHVMCZH5KtkD/2MYx2g yEEGIXB0VrNAzG1MPNtuPEad1NpHbQnDBhREjjp2/F+WkVba7j3fnsy5VBRpIJH4wJ+85Kl4P w3YeiiTuCcv1C2PWe0jYoCbyq8Sc2jpJB48ohmPZAtcopjolLQy6NhIHFx+ZLWqSfBLzDI1cC U2lRinQ6QHVwAk5j9UEPsZ1DZ3oi755kiFg8cIc1qCjKvVdwVuNb/LPBY0ESyqDyzuezG90y1 wQKIBFR7v11f69N2jVBKyjm+Fyjt8Z9irgLHT5YA8Edflc9jEU8gf4XlZAyYRiJjBIROl5si/ rKZT1XI8wypgy4T6eWIB3EzKcLPqGvJJaIcLPB7xXbfKbXV8h1PpJzG+nRuhS2lHqAAjpB0Bm YL3Jl+dFIHYSqqjAlyuqVpGmgR8OY7UR3OtUuCmU9HoUYyzSaiPLtAvwUCInmXuQqFEep/6QW rlZOHn1eWdulQ3cYXq/99ZEptGZP44GnSBgo10kfT743jbVJGseynRiPgg0ULyS1fiItL3OJE SVXyBr1dosQpVdJ+JZzaNzYsWsEx5Y2w1oRTBrM0hljT8aLkF3ZSDmF2sbwZj00je7CVFXg4Z KB8KQYCpM4cXiX9cVlpCtEv4cQwcX0rlcOwHfJdaGIICsf30pTVN6PiQo8DNxROccjN297fMo L3EXLpEP/IclWwfi/wCSySfN3Ogn4nxD5aekud0T89sl45LR2CJT5iGY2etExs6KdQRCtPseO wg4hpy7Jo6jp7vQPlK763YN8d4GRcgInN2xb/2D4+0FzaETFqjJAHKX8qvCifjEJAd6HARFyy lUUhJsekePLsi19qReLqJePnVSCah0YyulLyC7axAhMQgtsBLML7ah1bcH5LeG2E5R7Hd6CCE vn75t6E8BowE7vcJGB9IT0Zru91gag8mt3KduLDx/X1WveZIiNnVhcjHNdQhOfl/aRQ60R47Z jxc/+A== X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750386088199012696?= X-GMAIL-MSGID: =?utf-8?q?1750386088199012696?= 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 f00f1057fd27..3891499f9877 100644 --- a/drivers/char/tpm/tpm_tis_core.c +++ b/drivers/char/tpm/tpm_tis_core.c @@ -805,8 +805,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;