Skip to contentSkip to conversation

tpm/tpm_tis: Free IRQ if probing fails

PATCH In review Jarkko Sakkinen 2 participants 4 messages Apr 16, 2020 – Apr 21, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 tpm/tpm_tis: Free IRQ if probing fails

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.

Fixes e3837e74a06d ("tpm_tis: Refactor the interrupt setup")
---
 drivers/char/tpm/tpm_tis_core.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/char/tpm/tpm_tis_core.c +7 -1
index 27c6ca031e23..2435216bd10a 100644
@@ -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);
 		}
Signature · 1 line
2.25.1
Tested-by on v2 1/1
#1 lore raw

Hi,

Quoted 7 lines · Jarkko Sakkinen

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.

Fixes e3837e74a06d ("tpm_tis: Refactor the interrupt setup")

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

Regards,

Hans

Quoted 33 lines
---
  drivers/char/tpm/tpm_tis_core.c | 8 +++++++-
  1 file changed, 7 insertions(+), 1 deletion(-)
drivers/char/tpm/tpm_tis_core.c +7 -1
index 27c6ca031e23..2435216bd10a 100644
@@ -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 lore raw
Quoted 6 lines · Hans de Goede

Hi,

Quoted 3 lines · Jarkko Sakkinen

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.

Quoted 8 lines
Quoted 4 lines
Fixes e3837e74a06d ("tpm_tis: Refactor the interrupt setup")

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

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

#3 lore raw

Hi,

Quoted 14 lines · Jarkko Sakkinen
Quoted 13 lines · Hans de Goede

Hi,

Quoted 7 lines · Jarkko Sakkinen

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.

Fixes e3837e74a06d ("tpm_tis: Refactor the interrupt setup")

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

Quoted 8 lines
Quoted 1 line

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.

Quoted 2 lines

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

Agreed.

Regards,

Hans