linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] tpm/tpm_tis: Free IRQ if probing fails
@ 2020-04-16 16:07 Jarkko Sakkinen
  2020-04-21 13:23 ` Hans de Goede
  0 siblings, 1 reply; 4+ messages in thread
From: Jarkko Sakkinen @ 2020-04-16 16:07 UTC (permalink / raw)
  To: linux-integrity
  Cc: Jarkko Sakkinen, stable, Hans de Goede, Peter Huewe,
	Jason Gunthorpe, Arnd Bergmann, Greg Kroah-Hartman, open list

Call disable_interrupts() if we have to revert to polling in order not to
unnecessarily reserve the IRQ for the life-cycle of the driver.

Cc: stable@vger.kernel.org # 4.5.x
Reported-by: Hans de Goede <hdegoede@redhat.com>
Fixes: e3837e74a06d ("tpm_tis: Refactor the interrupt setup")
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
---
 drivers/char/tpm/tpm_tis_core.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
index 27c6ca031e23..2435216bd10a 100644
--- a/drivers/char/tpm/tpm_tis_core.c
+++ b/drivers/char/tpm/tpm_tis_core.c
@@ -433,6 +433,9 @@ static void disable_interrupts(struct tpm_chip *chip)
 	u32 intmask;
 	int rc;
 
+	if (priv->irq == 0)
+		return;
+
 	rc = tpm_tis_read32(priv, TPM_INT_ENABLE(priv->locality), &intmask);
 	if (rc < 0)
 		intmask = 0;
@@ -1062,9 +1065,12 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
 		if (irq) {
 			tpm_tis_probe_irq_single(chip, intmask, IRQF_SHARED,
 						 irq);
-			if (!(chip->flags & TPM_CHIP_FLAG_IRQ))
+			if (!(chip->flags & TPM_CHIP_FLAG_IRQ)) {
 				dev_err(&chip->dev, FW_BUG
 					"TPM interrupt not working, polling instead\n");
+
+				disable_interrupts(chip);
+			}
 		} else {
 			tpm_tis_probe_irq(chip, intmask);
 		}
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] tpm/tpm_tis: Free IRQ if probing fails
  2020-04-16 16:07 [PATCH v2] tpm/tpm_tis: Free IRQ if probing fails Jarkko Sakkinen
@ 2020-04-21 13:23 ` Hans de Goede
  2020-04-21 19:54   ` Jarkko Sakkinen
  0 siblings, 1 reply; 4+ messages in thread
From: Hans de Goede @ 2020-04-21 13:23 UTC (permalink / raw)
  To: Jarkko Sakkinen, linux-integrity
  Cc: stable, Peter Huewe, Jason Gunthorpe, Arnd Bergmann,
	Greg Kroah-Hartman, open list

Hi,

On 4/16/20 6:07 PM, Jarkko Sakkinen wrote:
> Call disable_interrupts() if we have to revert to polling in order not to
> unnecessarily reserve the IRQ for the life-cycle of the driver.
> 
> Cc: stable@vger.kernel.org # 4.5.x
> Reported-by: Hans de Goede <hdegoede@redhat.com>
> Fixes: e3837e74a06d ("tpm_tis: Refactor the interrupt setup")
> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>

I can confirm that this fixes the "irq 31 nobody cared" oops for me:

Tested-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans




> ---
>   drivers/char/tpm/tpm_tis_core.c | 8 +++++++-
>   1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
> index 27c6ca031e23..2435216bd10a 100644
> --- a/drivers/char/tpm/tpm_tis_core.c
> +++ b/drivers/char/tpm/tpm_tis_core.c
> @@ -433,6 +433,9 @@ static void disable_interrupts(struct tpm_chip *chip)
>   	u32 intmask;
>   	int rc;
>   
> +	if (priv->irq == 0)
> +		return;
> +
>   	rc = tpm_tis_read32(priv, TPM_INT_ENABLE(priv->locality), &intmask);
>   	if (rc < 0)
>   		intmask = 0;
> @@ -1062,9 +1065,12 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
>   		if (irq) {
>   			tpm_tis_probe_irq_single(chip, intmask, IRQF_SHARED,
>   						 irq);
> -			if (!(chip->flags & TPM_CHIP_FLAG_IRQ))
> +			if (!(chip->flags & TPM_CHIP_FLAG_IRQ)) {
>   				dev_err(&chip->dev, FW_BUG
>   					"TPM interrupt not working, polling instead\n");
> +
> +				disable_interrupts(chip);
> +			}
>   		} else {
>   			tpm_tis_probe_irq(chip, intmask);
>   		}
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] tpm/tpm_tis: Free IRQ if probing fails
  2020-04-21 13:23 ` Hans de Goede
@ 2020-04-21 19:54   ` Jarkko Sakkinen
  2020-04-21 20:25     ` Hans de Goede
  0 siblings, 1 reply; 4+ messages in thread
From: Jarkko Sakkinen @ 2020-04-21 19:54 UTC (permalink / raw)
  To: Hans de Goede
  Cc: linux-integrity, stable, Peter Huewe, Jason Gunthorpe,
	Arnd Bergmann, Greg Kroah-Hartman, open list

On Tue, Apr 21, 2020 at 03:23:19PM +0200, Hans de Goede wrote:
> Hi,
> 
> On 4/16/20 6:07 PM, Jarkko Sakkinen wrote:
> > Call disable_interrupts() if we have to revert to polling in order not to
> > unnecessarily reserve the IRQ for the life-cycle of the driver.
> > 
> > Cc: stable@vger.kernel.org # 4.5.x
> > Reported-by: Hans de Goede <hdegoede@redhat.com>
> > Fixes: e3837e74a06d ("tpm_tis: Refactor the interrupt setup")
> > Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
> 
> I can confirm that this fixes the "irq 31 nobody cared" oops for me:
> 
> Tested-by: Hans de Goede <hdegoede@redhat.com>

Hi, thanks a lot! Unfortunately I already put this out given the
criticality of the issue:

https://lkml.org/lkml/2020/4/20/1544

Sincere apologies that I couldn't include your tested-by but the most
important thing is to know that it works now.

/Jarkko

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] tpm/tpm_tis: Free IRQ if probing fails
  2020-04-21 19:54   ` Jarkko Sakkinen
@ 2020-04-21 20:25     ` Hans de Goede
  0 siblings, 0 replies; 4+ messages in thread
From: Hans de Goede @ 2020-04-21 20:25 UTC (permalink / raw)
  To: Jarkko Sakkinen
  Cc: linux-integrity, stable, Peter Huewe, Jason Gunthorpe,
	Arnd Bergmann, Greg Kroah-Hartman, open list

Hi,

On 4/21/20 9:54 PM, Jarkko Sakkinen wrote:
> On Tue, Apr 21, 2020 at 03:23:19PM +0200, Hans de Goede wrote:
>> Hi,
>>
>> On 4/16/20 6:07 PM, Jarkko Sakkinen wrote:
>>> Call disable_interrupts() if we have to revert to polling in order not to
>>> unnecessarily reserve the IRQ for the life-cycle of the driver.
>>>
>>> Cc: stable@vger.kernel.org # 4.5.x
>>> Reported-by: Hans de Goede <hdegoede@redhat.com>
>>> Fixes: e3837e74a06d ("tpm_tis: Refactor the interrupt setup")
>>> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
>>
>> I can confirm that this fixes the "irq 31 nobody cared" oops for me:
>>
>> Tested-by: Hans de Goede <hdegoede@redhat.com>
> 
> Hi, thanks a lot! Unfortunately I already put this out given the
> criticality of the issue:
> 
> https://lkml.org/lkml/2020/4/20/1544
> 
> Sincere apologies that I couldn't include your tested-by

No problem.

> but the most
> important thing is to know that it works now.

Agreed.

Regards,

Hans


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-04-21 20:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-16 16:07 [PATCH v2] tpm/tpm_tis: Free IRQ if probing fails Jarkko Sakkinen
2020-04-21 13:23 ` Hans de Goede
2020-04-21 19:54   ` Jarkko Sakkinen
2020-04-21 20:25     ` Hans de Goede

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).