public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tpm_tis: Fix incorrect arguments in tpm_tis_probe_irq_single
@ 2025-09-15 18:20 Gunnar Kudrjavets
  2025-09-15 18:42 ` Jarkko Sakkinen
  2025-09-15 20:15 ` Paul Menzel
  0 siblings, 2 replies; 4+ messages in thread
From: Gunnar Kudrjavets @ 2025-09-15 18:20 UTC (permalink / raw)
  To: peterhuewe, jarkko
  Cc: jgg, stefanb, christophe.ricard, linux-integrity, linux-kernel,
	Justinien Bouron

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")
Signed-off-by: Gunnar Kudrjavets <gunnarku@amazon.com>
Reviewed-by: Justinien Bouron <jbouron@amazon.com>
---
 drivers/char/tpm/tpm_tis_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
index 4b12c4b9da8b..8954a8660ffc 100644
--- a/drivers/char/tpm/tpm_tis_core.c
+++ b/drivers/char/tpm/tpm_tis_core.c
@@ -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


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

* Re: [PATCH] tpm_tis: Fix incorrect arguments in tpm_tis_probe_irq_single
  2025-09-15 18:20 [PATCH] tpm_tis: Fix incorrect arguments in tpm_tis_probe_irq_single Gunnar Kudrjavets
@ 2025-09-15 18:42 ` Jarkko Sakkinen
  2025-09-15 20:15 ` Paul Menzel
  1 sibling, 0 replies; 4+ messages in thread
From: Jarkko Sakkinen @ 2025-09-15 18:42 UTC (permalink / raw)
  To: Gunnar Kudrjavets
  Cc: peterhuewe, jgg, stefanb, christophe.ricard, linux-integrity,
	linux-kernel, Justinien Bouron

On Mon, Sep 15, 2025 at 06:20:44PM +0000, Gunnar Kudrjavets wrote:
> 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")
> Signed-off-by: Gunnar Kudrjavets <gunnarku@amazon.com>
> Reviewed-by: Justinien Bouron <jbouron@amazon.com>
> ---
>  drivers/char/tpm/tpm_tis_core.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
> index 4b12c4b9da8b..8954a8660ffc 100644
> --- a/drivers/char/tpm/tpm_tis_core.c
> +++ b/drivers/char/tpm/tpm_tis_core.c
> @@ -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
> 

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?


Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>

BR, Jarkko

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

* Re: [PATCH] tpm_tis: Fix incorrect arguments in tpm_tis_probe_irq_single
@ 2025-09-15 19:49 Kudrjavets, Gunnar
  0 siblings, 0 replies; 4+ messages in thread
From: Kudrjavets, Gunnar @ 2025-09-15 19:49 UTC (permalink / raw)
  To: Jarkko Sakkinen
  Cc: peterhuewe@gmx.de, jgg@ziepe.ca, stefanb@linux.vnet.ibm.com,
	christophe.ricard@gmail.com, linux-integrity@vger.kernel.org,
	linux-kernel@vger.kernel.org, Bouron, Justinien


On 9/15/25, 11:43, "Jarkko Sakkinen" <jarkko@kernel.org <mailto:jarkko@kernel.org>> wrote:

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

The patch was tested in a custom test environment specifically
constructed for this case. However, this test suite does not *fully*
exercise the IRQ handling in this driver.

We figured it was worth proposing this patch even given these
limitations.

Regards,
Gunnar



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

* Re: [PATCH] tpm_tis: Fix incorrect arguments in tpm_tis_probe_irq_single
  2025-09-15 18:20 [PATCH] tpm_tis: Fix incorrect arguments in tpm_tis_probe_irq_single Gunnar Kudrjavets
  2025-09-15 18:42 ` Jarkko Sakkinen
@ 2025-09-15 20:15 ` Paul Menzel
  1 sibling, 0 replies; 4+ messages in thread
From: Paul Menzel @ 2025-09-15 20:15 UTC (permalink / raw)
  To: Gunnar Kudrjavets
  Cc: peterhuewe, jarkko, jgg, stefanb, christophe.ricard,
	linux-integrity, linux-kernel, Justinien Bouron

Dear Gunnar,


Thank you for your patch.

Am 15.09.25 um 20:20 schrieb 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")

     $ git describe 41a5e1cf1fe1
     v4.7-rc2-83-g41a5e1cf1fe1

Interesting, that this did not cause more havoc.

> Signed-off-by: Gunnar Kudrjavets <gunnarku@amazon.com>
> Reviewed-by: Justinien Bouron <jbouron@amazon.com>
> ---
>   drivers/char/tpm/tpm_tis_core.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
> index 4b12c4b9da8b..8954a8660ffc 100644
> --- a/drivers/char/tpm/tpm_tis_core.c
> +++ b/drivers/char/tpm/tpm_tis_core.c
> @@ -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;
>   	}

Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>


Kind regards,

Paul

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

end of thread, other threads:[~2025-09-15 20:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-15 18:20 [PATCH] tpm_tis: Fix incorrect arguments in tpm_tis_probe_irq_single Gunnar Kudrjavets
2025-09-15 18:42 ` Jarkko Sakkinen
2025-09-15 20:15 ` Paul Menzel
  -- strict thread matches above, loose matches on Subject: below --
2025-09-15 19:49 Kudrjavets, Gunnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox