Skip to contentSkip to conversation

tpm_tis: Fix incorrect arguments in tpm_tis_probe_irq_single

PATCH In review Gunnar Kudrjavets 3 participants 3 messages Sep 15, 2025

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

PATCH 1/1 tpm_tis: Fix incorrect arguments in tpm_tis_probe_irq_single

The tpm_tis_write8() call specifies arguments in wrong order. Should be (data, addr, value) not (data, value, addr). The initial correct order was changed during the major refactoring when the code was split.

Fixes 41a5e1cf1fe1 ("tpm/tpm_tis: Split tpm_tis driver into a core and TCG TIS compliant phy")
---
 drivers/char/tpm/tpm_tis_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/char/tpm/tpm_tis_core.c +2 -2
index 4b12c4b9da8b..8954a8660ffc 100644
@@ -978,8 +978,8 @@ static int tpm_tis_probe_irq_single(struct tpm_chip *chip, u32 intmask,
 	 * will call disable_irq which undoes all of the above.
 	 */
 	if (!(chip->flags & TPM_CHIP_FLAG_IRQ)) {
-		tpm_tis_write8(priv, original_int_vec,
-			       TPM_INT_VECTOR(priv->locality));
+		tpm_tis_write8(priv, TPM_INT_VECTOR(priv->locality),
+			       original_int_vec);
 		rc = -1;
 	}
 

base-commit: f83ec76bf285bea5727f478a68b894f5543ca76e --
2.47.3

maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 27 lines · Gunnar Kudrjavets

The tpm_tis_write8() call specifies arguments in wrong order. Should be (data, addr, value) not (data, value, addr). The initial correct order was changed during the major refactoring when the code was split.

Fixes 41a5e1cf1fe1 ("tpm/tpm_tis: Split tpm_tis driver into a core and TCG TIS compliant phy")
---
 drivers/char/tpm/tpm_tis_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/char/tpm/tpm_tis_core.c +2 -2
index 4b12c4b9da8b..8954a8660ffc 100644
@@ -978,8 +978,8 @@ static int tpm_tis_probe_irq_single(struct tpm_chip *chip, u32 intmask,
 	 * will call disable_irq which undoes all of the above.
 	 */
 	if (!(chip->flags & TPM_CHIP_FLAG_IRQ)) {
-		tpm_tis_write8(priv, original_int_vec,
-			       TPM_INT_VECTOR(priv->locality));
+		tpm_tis_write8(priv, TPM_INT_VECTOR(priv->locality),
+			       original_int_vec);
 		rc = -1;
 	}
 
Quoted 4 lines

base-commit: f83ec76bf285bea5727f478a68b894f5543ca76e --
2.47.3

Amazing catch, thank you. Have you been able to verify this?

I'm asking this because post this there was a lot of unsuccesful attempts to enable irqs in the tis driver (which have never really worked too well since epoch) so perhaps this could move things forward.

Thus, I'm interested do you happen to have a working testing environment?

BR, Jarkko

Reviewed-by on v1 1/1
#2 lore raw
In reply to Gunnar Kudrjavets

Dear Gunnar,

Thank you for your patch.

Am 15.09.25 um 20:20 schrieb Gunnar Kudrjavets:

Quoted 5 lines

The tpm_tis_write8() call specifies arguments in wrong order. Should be (data, addr, value) not (data, value, addr). The initial correct order was changed during the major refactoring when the code was split.

Fixes 41a5e1cf1fe1 ("tpm/tpm_tis: Split tpm_tis driver into a core and TCG TIS compliant phy")
    $ git describe 41a5e1cf1fe1
    v4.7-rc2-83-g41a5e1cf1fe1

Interesting, that this did not cause more havoc.

Quoted 11 lines
---
  drivers/char/tpm/tpm_tis_core.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/char/tpm/tpm_tis_core.c +0 -0
index 4b12c4b9da8b..8954a8660ffc 100644

drivers/char/tpm/tpm_tis_core.c static int tpm_tis_probe_irq_single(struct tpm_chip *chip, u32 intmask, · line 984

Quoted 9 lines
drivers/char/tpm/tpm_tis_core.c +2 -2
@@ -978,8 +978,8 @@ static int tpm_tis_probe_irq_single(struct tpm_chip *chip, u32 intmask,
  	 * will call disable_irq which undoes all of the above.
  	 */
  	if (!(chip->flags & TPM_CHIP_FLAG_IRQ)) {
-		tpm_tis_write8(priv, original_int_vec,
-			       TPM_INT_VECTOR(priv->locality));
+		tpm_tis_write8(priv, TPM_INT_VECTOR(priv->locality),
+			       original_int_vec);
  		rc = -1;
  	}

Kind regards,

Paul