From: Jarkko Sakkinen <jarkko@kernel.org>
To: Lino Sanfilippo <LinoSanfilippo@gmx.de>
Cc: peterhuewe@gmx.de, jgg@ziepe.ca, stefanb@linux.vnet.ibm.com,
linux@mniewoehner.de, linux-integrity@vger.kernel.org,
linux-kernel@vger.kernel.org, lukas@wunner.de,
p.rosenberger@kunbus.com,
Lino Sanfilippo <l.sanfilippo@kunbus.com>
Subject: Re: [PATCH v4 1/6] tpm, tpm_tis_spi: Request threaded irq
Date: Wed, 11 May 2022 14:22:40 +0300 [thread overview]
Message-ID: <YnucgDH3I87RI8PN@kernel.org> (raw)
In-Reply-To: <20220509080559.4381-2-LinoSanfilippo@gmx.de>
On Mon, May 09, 2022 at 10:05:54AM +0200, Lino Sanfilippo wrote:
> From: Lino Sanfilippo <l.sanfilippo@kunbus.com>
>
> Interrupt handling at least includes reading and writing the interrupt
> status register within the interrupt routine. Since accesses over the SPI
> bus are synchronized by a mutex, request a threaded interrupt handler to
> ensure a sleepable context during interrupt processing.
>
> Fixes: 1a339b658d9d ("tpm_tis_spi: Pass the SPI IRQ down to the driver")
> Signed-off-by: Lino Sanfilippo <l.sanfilippo@kunbus.com>
When you state that it needs a sleepable context, you should bring a
context why it needs it. This not to disregard the code change overally but
you cannot make even the most obvious claim without backing data.
> ---
> drivers/char/tpm/tpm_tis_core.c | 15 +++++++++++++--
> drivers/char/tpm/tpm_tis_core.h | 1 +
> drivers/char/tpm/tpm_tis_spi_main.c | 5 +++--
> 3 files changed, 17 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
> index dc56b976d816..52369ef39b03 100644
> --- a/drivers/char/tpm/tpm_tis_core.c
> +++ b/drivers/char/tpm/tpm_tis_core.c
> @@ -747,8 +747,19 @@ 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) {
> +
> + if (priv->flags & TPM_TIS_USE_THREADED_IRQ) {
> + rc = devm_request_threaded_irq(chip->dev.parent, irq, NULL,
> + tis_int_handler,
> + IRQF_ONESHOT | flags,
> + dev_name(&chip->dev),
> + chip);
> + } else {
> + rc = devm_request_irq(chip->dev.parent, irq, tis_int_handler,
> + flags, dev_name(&chip->dev), chip);
> + }
> +
> + if (rc) {
> dev_info(&chip->dev, "Unable to request irq: %d for probe\n",
> irq);
> return -1;
> diff --git a/drivers/char/tpm/tpm_tis_core.h b/drivers/char/tpm/tpm_tis_core.h
> index 3be24f221e32..43b724e55192 100644
> --- a/drivers/char/tpm/tpm_tis_core.h
> +++ b/drivers/char/tpm/tpm_tis_core.h
> @@ -86,6 +86,7 @@ enum tis_defaults {
> enum tpm_tis_flags {
> TPM_TIS_ITPM_WORKAROUND = BIT(0),
> TPM_TIS_INVALID_STATUS = BIT(1),
> + TPM_TIS_USE_THREADED_IRQ = BIT(2),
> };
>
> struct tpm_tis_data {
> diff --git a/drivers/char/tpm/tpm_tis_spi_main.c b/drivers/char/tpm/tpm_tis_spi_main.c
> index 184396b3af50..f56613f2946f 100644
> --- a/drivers/char/tpm/tpm_tis_spi_main.c
> +++ b/drivers/char/tpm/tpm_tis_spi_main.c
> @@ -223,9 +223,10 @@ static int tpm_tis_spi_probe(struct spi_device *dev)
> phy->flow_control = tpm_tis_spi_flow_control;
>
> /* If the SPI device has an IRQ then use that */
> - if (dev->irq > 0)
> + if (dev->irq > 0) {
> irq = dev->irq;
> - else
> + phy->priv.flags |= TPM_TIS_USE_THREADED_IRQ;
> + } else
> irq = -1;
>
> init_completion(&phy->ready);
> --
> 2.36.0
>
BR, Jarkko
next prev parent reply other threads:[~2022-05-11 11:25 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-09 8:05 [PATCH v4 0/6] TPM irq fixes Lino Sanfilippo
2022-05-09 8:05 ` [PATCH v4 1/6] tpm, tpm_tis_spi: Request threaded irq Lino Sanfilippo
2022-05-11 11:22 ` Jarkko Sakkinen [this message]
2022-05-11 19:18 ` Lino Sanfilippo
2022-05-13 18:08 ` Jarkko Sakkinen
2022-05-16 19:52 ` Lino Sanfilippo
2022-05-17 18:23 ` Jarkko Sakkinen
2022-05-09 8:05 ` [PATCH v4 2/6] tpm, tpm_tis: Claim and release locality only once Lino Sanfilippo
2022-05-11 11:27 ` Jarkko Sakkinen
2022-05-11 19:29 ` Lino Sanfilippo
2022-05-13 17:59 ` Jarkko Sakkinen
2022-05-16 20:23 ` Lino Sanfilippo
2022-05-09 8:05 ` [PATCH v4 3/6] tpm, tpm_tis: enable irq test Lino Sanfilippo
2022-05-09 8:05 ` [PATCH v4 4/6] tpm, tpm_tis: avoid CPU cache incoherency in " Lino Sanfilippo
2022-05-11 15:06 ` Jarkko Sakkinen
2022-05-11 19:35 ` Lino Sanfilippo
2022-05-09 8:05 ` [PATCH v4 5/6] tpm, tpm_tis: Move irq test from tpm_tis_send() to tpm_tis_probe_irq_single() Lino Sanfilippo
2022-05-11 15:09 ` Jarkko Sakkinen
2022-05-11 19:56 ` Lino Sanfilippo
2022-05-16 17:51 ` Jarkko Sakkinen
2022-05-16 20:25 ` Lino Sanfilippo
2022-05-17 18:19 ` Michael Niewöhner
2022-05-18 1:26 ` Jarkko Sakkinen
2022-05-18 16:08 ` Michael Niewöhner
2022-05-09 8:05 ` [PATCH v4 6/6] tpm, tpm_tis: Only enable supported IRQs Lino Sanfilippo
2022-05-11 15:08 ` Jarkko Sakkinen
2022-05-11 19:58 ` Lino Sanfilippo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YnucgDH3I87RI8PN@kernel.org \
--to=jarkko@kernel.org \
--cc=LinoSanfilippo@gmx.de \
--cc=jgg@ziepe.ca \
--cc=l.sanfilippo@kunbus.com \
--cc=linux-integrity@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@mniewoehner.de \
--cc=lukas@wunner.de \
--cc=p.rosenberger@kunbus.com \
--cc=peterhuewe@gmx.de \
--cc=stefanb@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome