linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/1] tpm: add request_locality before write TPM_INT_ENABLE
@ 2021-10-12 12:48 Chen Jun
  2021-10-12 17:34 ` Jarkko Sakkinen
  0 siblings, 1 reply; 5+ messages in thread
From: Chen Jun @ 2021-10-12 12:48 UTC (permalink / raw)
  To: linux-kernel, linux-integrity; +Cc: peterhuewe, jarkko, jgg, rui.xiang

the addr can not be written without request_locality.

Fixes: e6aef069b6e9 ("tpm_tis: convert to using locality callbacks")
Signed-off-by: Chen Jun <chenjun102@huawei.com>
---
 drivers/char/tpm/tpm_tis_core.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
index 69579efb247b..bea587301917 100644
--- a/drivers/char/tpm/tpm_tis_core.c
+++ b/drivers/char/tpm/tpm_tis_core.c
@@ -978,7 +978,15 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
 	intmask |= TPM_INTF_CMD_READY_INT | TPM_INTF_LOCALITY_CHANGE_INT |
 		   TPM_INTF_DATA_AVAIL_INT | TPM_INTF_STS_VALID_INT;
 	intmask &= ~TPM_GLOBAL_INT_ENABLE;
+
+	rc = request_locality(chip, 0);
+	if (rc < 0) {
+		rc = -ENODEV;
+		goto out_err;
+	}
+
 	tpm_tis_write32(priv, TPM_INT_ENABLE(priv->locality), intmask);
+	release_locality(chip, 0);
 
 	rc = tpm_chip_start(chip);
 	if (rc)
-- 
2.17.1


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

* Re: [PATCH v2 1/1] tpm: add request_locality before write TPM_INT_ENABLE
  2021-10-12 12:48 [PATCH v2 1/1] tpm: add request_locality before write TPM_INT_ENABLE Chen Jun
@ 2021-10-12 17:34 ` Jarkko Sakkinen
  0 siblings, 0 replies; 5+ messages in thread
From: Jarkko Sakkinen @ 2021-10-12 17:34 UTC (permalink / raw)
  To: Chen Jun, linux-kernel, linux-integrity; +Cc: peterhuewe, jgg, rui.xiang

On Tue, 2021-10-12 at 12:48 +0000, Chen Jun wrote:
> the addr can not be written without request_locality.

So, you need to describe the commit does here, e.g. you could replace
what you have with

"
Locality is not appropriately requested before writing the int mask.
Add the missing boilerplate.
"

I.e. for any commit you need to be able to describe what you are doing,
not just the sympton.

> 
> Fixes: e6aef069b6e9 ("tpm_tis: convert to using locality callbacks")
> Signed-off-by: Chen Jun <chenjun102@huawei.com>
> ---
>  drivers/char/tpm/tpm_tis_core.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
> index 69579efb247b..bea587301917 100644
> --- a/drivers/char/tpm/tpm_tis_core.c
> +++ b/drivers/char/tpm/tpm_tis_core.c
> @@ -978,7 +978,15 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
>         intmask |= TPM_INTF_CMD_READY_INT | TPM_INTF_LOCALITY_CHANGE_INT |
>                    TPM_INTF_DATA_AVAIL_INT | TPM_INTF_STS_VALID_INT;
>         intmask &= ~TPM_GLOBAL_INT_ENABLE;
> +
> +       rc = request_locality(chip, 0);
> +       if (rc < 0) {
> +               rc = -ENODEV;
> +               goto out_err;
> +       }
> +
>         tpm_tis_write32(priv, TPM_INT_ENABLE(priv->locality), intmask);
> +       release_locality(chip, 0);
>  
>         rc = tpm_chip_start(chip);
>         if (rc)

Thanks a lot for the fix. If you could fix the commit message,
I'm happy to apply this.

Also add:

Cc: stable@vger.kernel.org

/Jarkko


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

* Re: [PATCH v2 1/1] tpm: add request_locality before write TPM_INT_ENABLE
  2021-10-13  6:25 Chen Jun
  2021-10-14  0:00 ` Jarkko Sakkinen
@ 2021-10-26  2:14 ` Jarkko Sakkinen
  1 sibling, 0 replies; 5+ messages in thread
From: Jarkko Sakkinen @ 2021-10-26  2:14 UTC (permalink / raw)
  To: Chen Jun; +Cc: linux-kernel, linux-integrity, peterhuewe, jgg, rui.xiang

On Wed, Oct 13, 2021 at 06:25:56AM +0000, Chen Jun wrote:
> Locality is not appropriately requested before writing the int mask.
> Add the missing boilerplate.
> 
> Fixes: e6aef069b6e9 ("tpm_tis: convert to using locality callbacks")
> Signed-off-by: Chen Jun <chenjun102@huawei.com>


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

I'll queue this to v5.16-rc2 pull request (already closed
for rc1).

/Jarkko

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

* Re: [PATCH v2 1/1] tpm: add request_locality before write TPM_INT_ENABLE
  2021-10-13  6:25 Chen Jun
@ 2021-10-14  0:00 ` Jarkko Sakkinen
  2021-10-26  2:14 ` Jarkko Sakkinen
  1 sibling, 0 replies; 5+ messages in thread
From: Jarkko Sakkinen @ 2021-10-14  0:00 UTC (permalink / raw)
  To: Chen Jun, linux-kernel, linux-integrity; +Cc: peterhuewe, jgg, rui.xiang

On Wed, 2021-10-13 at 06:25 +0000, Chen Jun wrote:
> Locality is not appropriately requested before writing the int mask.
> Add the missing boilerplate.
> 
> Fixes: e6aef069b6e9 ("tpm_tis: convert to using locality callbacks")
> Signed-off-by: Chen Jun <chenjun102@huawei.com>
> ---
> 
>  v2: rewrite the commit message.
> 
>  drivers/char/tpm/tpm_tis_core.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
> index 69579efb247b..bea587301917 100644
> --- a/drivers/char/tpm/tpm_tis_core.c
> +++ b/drivers/char/tpm/tpm_tis_core.c
> @@ -978,7 +978,15 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
>         intmask |= TPM_INTF_CMD_READY_INT | TPM_INTF_LOCALITY_CHANGE_INT |
>                    TPM_INTF_DATA_AVAIL_INT | TPM_INTF_STS_VALID_INT;
>         intmask &= ~TPM_GLOBAL_INT_ENABLE;
> +
> +       rc = request_locality(chip, 0);
> +       if (rc < 0) {
> +               rc = -ENODEV;
> +               goto out_err;
> +       }
> +
>         tpm_tis_write32(priv, TPM_INT_ENABLE(priv->locality), intmask);
> +       release_locality(chip, 0);
>  
>         rc = tpm_chip_start(chip);
>         if (rc)

Thank you.

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

/Jarkko


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

* [PATCH v2 1/1] tpm: add request_locality before write TPM_INT_ENABLE
@ 2021-10-13  6:25 Chen Jun
  2021-10-14  0:00 ` Jarkko Sakkinen
  2021-10-26  2:14 ` Jarkko Sakkinen
  0 siblings, 2 replies; 5+ messages in thread
From: Chen Jun @ 2021-10-13  6:25 UTC (permalink / raw)
  To: linux-kernel, linux-integrity; +Cc: peterhuewe, jarkko, jgg, rui.xiang

Locality is not appropriately requested before writing the int mask.
Add the missing boilerplate.

Fixes: e6aef069b6e9 ("tpm_tis: convert to using locality callbacks")
Signed-off-by: Chen Jun <chenjun102@huawei.com>
---

 v2: rewrite the commit message.

 drivers/char/tpm/tpm_tis_core.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
index 69579efb247b..bea587301917 100644
--- a/drivers/char/tpm/tpm_tis_core.c
+++ b/drivers/char/tpm/tpm_tis_core.c
@@ -978,7 +978,15 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
 	intmask |= TPM_INTF_CMD_READY_INT | TPM_INTF_LOCALITY_CHANGE_INT |
 		   TPM_INTF_DATA_AVAIL_INT | TPM_INTF_STS_VALID_INT;
 	intmask &= ~TPM_GLOBAL_INT_ENABLE;
+
+	rc = request_locality(chip, 0);
+	if (rc < 0) {
+		rc = -ENODEV;
+		goto out_err;
+	}
+
 	tpm_tis_write32(priv, TPM_INT_ENABLE(priv->locality), intmask);
+	release_locality(chip, 0);
 
 	rc = tpm_chip_start(chip);
 	if (rc)
-- 
2.17.1


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

end of thread, other threads:[~2021-10-26  2:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-12 12:48 [PATCH v2 1/1] tpm: add request_locality before write TPM_INT_ENABLE Chen Jun
2021-10-12 17:34 ` Jarkko Sakkinen
2021-10-13  6:25 Chen Jun
2021-10-14  0:00 ` Jarkko Sakkinen
2021-10-26  2:14 ` Jarkko Sakkinen

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).