linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH for-linus-v5.5-rc6 0/3] TPM changes for v5.5-rc6
@ 2020-01-03 23:29 Jarkko Sakkinen
  2020-01-03 23:29 ` [PATCH for-linus-v5.5-rc6 1/3] tpm: Revert "tpm_tis: reserve chip for duration of tpm_tis_core_init" Jarkko Sakkinen
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Jarkko Sakkinen @ 2020-01-03 23:29 UTC (permalink / raw)
  To: linux-integrity
  Cc: Jarkko Sakkinen, Jerry Snitselaar, Dan Williams, Jason Gunthorpe,
	open list, Stefan Berger

There has been a bunch of reports (one from kernel bugzilla linked)
reporting that when this commit is applied it causes on some machines
boot freezes.

Unfortunately hardware where this commit causes a failure is not widely
available (only one I'm aware is Lenovo T490), which means we cannot
predict yet how long it will take to properly fix tpm_tis interrupt
probing.

Thus, the least worst short term action is to revert the code to the
state before this commit. In long term we need fix the tpm_tis probing
code to work on machines that Stefan's code was supposed to fix.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=205935
Cc: Jerry Snitselaar <jsnitsel@redhat.com>
Cc: Dan Williams <dan.j.williams@intel.com>

Jarkko Sakkinen (1):
  tpm: Revert "tpm_tis: reserve chip for duration of tpm_tis_core_init"

Stefan Berger (2):
  tpm: Revert "tpm_tis_core: Set TPM_CHIP_FLAG_IRQ before probing for
    interrupts"
  tpm: Revert "tpm_tis_core: Turn on the TPM before probing IRQ's"

 drivers/char/tpm/tpm_tis_core.c | 34 +++++++++++++++------------------
 1 file changed, 15 insertions(+), 19 deletions(-)

-- 
2.20.1


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

* [PATCH for-linus-v5.5-rc6 1/3] tpm: Revert "tpm_tis: reserve chip for duration of tpm_tis_core_init"
  2020-01-03 23:29 [PATCH for-linus-v5.5-rc6 0/3] TPM changes for v5.5-rc6 Jarkko Sakkinen
@ 2020-01-03 23:29 ` Jarkko Sakkinen
  2020-01-03 23:29 ` [PATCH for-linus-v5.5-rc6 2/3] tpm: Revert "tpm_tis_core: Set TPM_CHIP_FLAG_IRQ before probing for interrupts" Jarkko Sakkinen
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Jarkko Sakkinen @ 2020-01-03 23:29 UTC (permalink / raw)
  To: linux-integrity
  Cc: Jarkko Sakkinen, stable, Jerry Snitselaar, Dan Williams,
	Xiaoping Zhou, Peter Huewe, Jason Gunthorpe, Arnd Bergmann,
	Greg Kroah-Hartman, open list

Revert a commit, which was included in Linux v5.5-rc3 because it did not
properly fix the issues it was supposed to fix.

Fixes: 21df4a8b6018 ("tpm_tis: reserve chip for duration of tpm_tis_core_init")
Link: https://bugzilla.kernel.org/show_bug.cgi?id=205935
Cc: stable@vger.kernel.org
Cc: Jerry Snitselaar <jsnitsel@redhat.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Tested-by: Dan Williams <dan.j.williams@intel.com>
Tested-by: Xiaoping Zhou <xiaoping.zhou@intel.com>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
---
 drivers/char/tpm/tpm_tis_core.c | 35 ++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 18 deletions(-)

diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
index bb0343ffd235..8af2cee1a762 100644
--- a/drivers/char/tpm/tpm_tis_core.c
+++ b/drivers/char/tpm/tpm_tis_core.c
@@ -978,13 +978,13 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
 
 	if (wait_startup(chip, 0) != 0) {
 		rc = -ENODEV;
-		goto err_start;
+		goto out_err;
 	}
 
 	/* Take control of the TPM's interrupt hardware and shut it off */
 	rc = tpm_tis_read32(priv, TPM_INT_ENABLE(priv->locality), &intmask);
 	if (rc < 0)
-		goto err_start;
+		goto out_err;
 
 	intmask |= TPM_INTF_CMD_READY_INT | TPM_INTF_LOCALITY_CHANGE_INT |
 		   TPM_INTF_DATA_AVAIL_INT | TPM_INTF_STS_VALID_INT;
@@ -993,21 +993,21 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
 
 	rc = tpm_chip_start(chip);
 	if (rc)
-		goto err_start;
-
+		goto out_err;
 	rc = tpm2_probe(chip);
+	tpm_chip_stop(chip);
 	if (rc)
-		goto err_probe;
+		goto out_err;
 
 	rc = tpm_tis_read32(priv, TPM_DID_VID(0), &vendor);
 	if (rc < 0)
-		goto err_probe;
+		goto out_err;
 
 	priv->manufacturer_id = vendor;
 
 	rc = tpm_tis_read8(priv, TPM_RID(0), &rid);
 	if (rc < 0)
-		goto err_probe;
+		goto out_err;
 
 	dev_info(dev, "%s TPM (device-id 0x%X, rev-id %d)\n",
 		 (chip->flags & TPM_CHIP_FLAG_TPM2) ? "2.0" : "1.2",
@@ -1016,13 +1016,13 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
 	probe = probe_itpm(chip);
 	if (probe < 0) {
 		rc = -ENODEV;
-		goto err_probe;
+		goto out_err;
 	}
 
 	/* Figure out the capabilities */
 	rc = tpm_tis_read32(priv, TPM_INTF_CAPS(priv->locality), &intfcaps);
 	if (rc < 0)
-		goto err_probe;
+		goto out_err;
 
 	dev_dbg(dev, "TPM interface capabilities (0x%x):\n",
 		intfcaps);
@@ -1056,9 +1056,10 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
 		if (tpm_get_timeouts(chip)) {
 			dev_err(dev, "Could not get TPM timeouts and durations\n");
 			rc = -ENODEV;
-			goto err_probe;
+			goto out_err;
 		}
 
+		tpm_chip_start(chip);
 		chip->flags |= TPM_CHIP_FLAG_IRQ;
 		if (irq) {
 			tpm_tis_probe_irq_single(chip, intmask, IRQF_SHARED,
@@ -1069,20 +1070,18 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
 		} else {
 			tpm_tis_probe_irq(chip, intmask);
 		}
+		tpm_chip_stop(chip);
 	}
 
-	tpm_chip_stop(chip);
-
 	rc = tpm_chip_register(chip);
 	if (rc)
-		goto err_start;
-
-	return 0;
+		goto out_err;
 
-err_probe:
-	tpm_chip_stop(chip);
+	if (chip->ops->clk_enable != NULL)
+		chip->ops->clk_enable(chip, false);
 
-err_start:
+	return 0;
+out_err:
 	if ((chip->ops != NULL) && (chip->ops->clk_enable != NULL))
 		chip->ops->clk_enable(chip, false);
 
-- 
2.20.1


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

* [PATCH for-linus-v5.5-rc6 2/3] tpm: Revert "tpm_tis_core: Set TPM_CHIP_FLAG_IRQ before probing for interrupts"
  2020-01-03 23:29 [PATCH for-linus-v5.5-rc6 0/3] TPM changes for v5.5-rc6 Jarkko Sakkinen
  2020-01-03 23:29 ` [PATCH for-linus-v5.5-rc6 1/3] tpm: Revert "tpm_tis: reserve chip for duration of tpm_tis_core_init" Jarkko Sakkinen
@ 2020-01-03 23:29 ` Jarkko Sakkinen
  2020-01-03 23:29 ` [PATCH for-linus-v5.5-rc6 3/3] tpm: Revert "tpm_tis_core: Turn on the TPM before probing IRQ's" Jarkko Sakkinen
  2020-01-04  4:32 ` [PATCH for-linus-v5.5-rc6 0/3] TPM changes for v5.5-rc6 Jerry Snitselaar
  3 siblings, 0 replies; 6+ messages in thread
From: Jarkko Sakkinen @ 2020-01-03 23:29 UTC (permalink / raw)
  To: linux-integrity
  Cc: Stefan Berger, stable, Jerry Snitselaar, Dan Williams,
	Xiaoping Zhou, Jarkko Sakkinen, Peter Huewe, Jason Gunthorpe,
	Arnd Bergmann, Greg Kroah-Hartman, open list

From: Stefan Berger <stefanb@linux.ibm.com>

There has been a bunch of reports (one from kernel bugzilla linked)
reporting that when this commit is applied it causes on some machines
boot freezes.

Unfortunately hardware where this commit causes a failure is not widely
available (only one I'm aware is Lenovo T490), which means we cannot
predict yet how long it will take to properly fix tpm_tis interrupt
probing.

Thus, the least worst short term action is to revert the code to the
state before this commit. In long term we need fix the tpm_tis probing
code to work on machines that Stefan's fix was supposed to fix.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=205935
Fixes: 1ea32c83c699 ("tpm_tis_core: Set TPM_CHIP_FLAG_IRQ before probing for interrupts")
Cc: stable@vger.kernel.org
Cc: Jerry Snitselaar <jsnitsel@redhat.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Tested-by: Dan Williams <dan.j.williams@intel.com>
Tested-by: Xiaoping Zhou <xiaoping.zhou@intel.com>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reported-by: Jerry Snitselaar <jsnitsel@redhat.com>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
---
 drivers/char/tpm/tpm_tis_core.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
index 8af2cee1a762..5dc52c4e2292 100644
--- a/drivers/char/tpm/tpm_tis_core.c
+++ b/drivers/char/tpm/tpm_tis_core.c
@@ -1060,7 +1060,6 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
 		}
 
 		tpm_chip_start(chip);
-		chip->flags |= TPM_CHIP_FLAG_IRQ;
 		if (irq) {
 			tpm_tis_probe_irq_single(chip, intmask, IRQF_SHARED,
 						 irq);
-- 
2.20.1


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

* [PATCH for-linus-v5.5-rc6 3/3] tpm: Revert "tpm_tis_core: Turn on the TPM before probing IRQ's"
  2020-01-03 23:29 [PATCH for-linus-v5.5-rc6 0/3] TPM changes for v5.5-rc6 Jarkko Sakkinen
  2020-01-03 23:29 ` [PATCH for-linus-v5.5-rc6 1/3] tpm: Revert "tpm_tis: reserve chip for duration of tpm_tis_core_init" Jarkko Sakkinen
  2020-01-03 23:29 ` [PATCH for-linus-v5.5-rc6 2/3] tpm: Revert "tpm_tis_core: Set TPM_CHIP_FLAG_IRQ before probing for interrupts" Jarkko Sakkinen
@ 2020-01-03 23:29 ` Jarkko Sakkinen
  2020-01-04  4:32 ` [PATCH for-linus-v5.5-rc6 0/3] TPM changes for v5.5-rc6 Jerry Snitselaar
  3 siblings, 0 replies; 6+ messages in thread
From: Jarkko Sakkinen @ 2020-01-03 23:29 UTC (permalink / raw)
  To: linux-integrity
  Cc: Stefan Berger, stable, Jerry Snitselaar, Dan Williams,
	Xiaoping Zhou, Jarkko Sakkinen, Peter Huewe, Jason Gunthorpe,
	Arnd Bergmann, Greg Kroah-Hartman, open list

From: Stefan Berger <stefanb@linux.ibm.com>

There has been a bunch of reports (one from kernel bugzilla linked)
reporting that when this commit is applied it causes on some machines
boot freezes.

Unfortunately hardware where this commit causes a failure is not widely
available (only one I'm aware is Lenovo T490), which means we cannot
predict yet how long it will take to properly fix tpm_tis interrupt
probing.

Thus, the least worst short term action is to revert the code to the
state before this commit. In long term we need fix the tpm_tis probing
code to work on machines that Stefan's fix was supposed to fix.

Fixes: 21df4a8b6018 ("tpm_tis: reserve chip for duration of tpm_tis_core_init")
Link: https://bugzilla.kernel.org/show_bug.cgi?id=205935
Cc: stable@vger.kernel.org
Cc: Jerry Snitselaar <jsnitsel@redhat.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Tested-by: Dan Williams <dan.j.williams@intel.com>
Tested-by: Xiaoping Zhou <xiaoping.zhou@intel.com>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reported-by: Jerry Snitselaar <jsnitsel@redhat.com>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
---
 drivers/char/tpm/tpm_tis_core.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
index 5dc52c4e2292..27c6ca031e23 100644
--- a/drivers/char/tpm/tpm_tis_core.c
+++ b/drivers/char/tpm/tpm_tis_core.c
@@ -1059,7 +1059,6 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
 			goto out_err;
 		}
 
-		tpm_chip_start(chip);
 		if (irq) {
 			tpm_tis_probe_irq_single(chip, intmask, IRQF_SHARED,
 						 irq);
@@ -1069,7 +1068,6 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
 		} else {
 			tpm_tis_probe_irq(chip, intmask);
 		}
-		tpm_chip_stop(chip);
 	}
 
 	rc = tpm_chip_register(chip);
-- 
2.20.1


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

* Re: [PATCH for-linus-v5.5-rc6 0/3] TPM changes for v5.5-rc6
  2020-01-03 23:29 [PATCH for-linus-v5.5-rc6 0/3] TPM changes for v5.5-rc6 Jarkko Sakkinen
                   ` (2 preceding siblings ...)
  2020-01-03 23:29 ` [PATCH for-linus-v5.5-rc6 3/3] tpm: Revert "tpm_tis_core: Turn on the TPM before probing IRQ's" Jarkko Sakkinen
@ 2020-01-04  4:32 ` Jerry Snitselaar
  2020-01-06 17:44   ` Jarkko Sakkinen
  3 siblings, 1 reply; 6+ messages in thread
From: Jerry Snitselaar @ 2020-01-04  4:32 UTC (permalink / raw)
  To: Jarkko Sakkinen
  Cc: linux-integrity, Dan Williams, Jason Gunthorpe, open list, Stefan Berger

On Sat Jan 04 20, Jarkko Sakkinen wrote:
>There has been a bunch of reports (one from kernel bugzilla linked)
>reporting that when this commit is applied it causes on some machines
>boot freezes.
>
>Unfortunately hardware where this commit causes a failure is not widely
>available (only one I'm aware is Lenovo T490), which means we cannot
>predict yet how long it will take to properly fix tpm_tis interrupt
>probing.
>
>Thus, the least worst short term action is to revert the code to the
>state before this commit. In long term we need fix the tpm_tis probing
>code to work on machines that Stefan's code was supposed to fix.
>
>Link: https://bugzilla.kernel.org/show_bug.cgi?id=205935
>Cc: Jerry Snitselaar <jsnitsel@redhat.com>
>Cc: Dan Williams <dan.j.williams@intel.com>
>
>Jarkko Sakkinen (1):
>  tpm: Revert "tpm_tis: reserve chip for duration of tpm_tis_core_init"
>
>Stefan Berger (2):
>  tpm: Revert "tpm_tis_core: Set TPM_CHIP_FLAG_IRQ before probing for
>    interrupts"
>  tpm: Revert "tpm_tis_core: Turn on the TPM before probing IRQ's"
>
> drivers/char/tpm/tpm_tis_core.c | 34 +++++++++++++++------------------
> 1 file changed, 15 insertions(+), 19 deletions(-)
>
>-- 
>2.20.1
>

Reviewed-by: Jerry Snitselaar <jsnitsel@redhat.com>


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

* Re: [PATCH for-linus-v5.5-rc6 0/3] TPM changes for v5.5-rc6
  2020-01-04  4:32 ` [PATCH for-linus-v5.5-rc6 0/3] TPM changes for v5.5-rc6 Jerry Snitselaar
@ 2020-01-06 17:44   ` Jarkko Sakkinen
  0 siblings, 0 replies; 6+ messages in thread
From: Jarkko Sakkinen @ 2020-01-06 17:44 UTC (permalink / raw)
  To: Jerry Snitselaar
  Cc: linux-integrity, Dan Williams, Jason Gunthorpe, open list, Stefan Berger

On Fri, 2020-01-03 at 21:32 -0700, Jerry Snitselaar wrote:
> On Sat Jan 04 20, Jarkko Sakkinen wrote:
> > There has been a bunch of reports (one from kernel bugzilla linked)
> > reporting that when this commit is applied it causes on some machines
> > boot freezes.
> > 
> > Unfortunately hardware where this commit causes a failure is not widely
> > available (only one I'm aware is Lenovo T490), which means we cannot
> > predict yet how long it will take to properly fix tpm_tis interrupt
> > probing.
> > 
> > Thus, the least worst short term action is to revert the code to the
> > state before this commit. In long term we need fix the tpm_tis probing
> > code to work on machines that Stefan's code was supposed to fix.
> > 
> > Link: https://bugzilla.kernel.org/show_bug.cgi?id=205935
> > Cc: Jerry Snitselaar <jsnitsel@redhat.com>
> > Cc: Dan Williams <dan.j.williams@intel.com>
> > 
> > Jarkko Sakkinen (1):
> >  tpm: Revert "tpm_tis: reserve chip for duration of tpm_tis_core_init"
> > 
> > Stefan Berger (2):
> >  tpm: Revert "tpm_tis_core: Set TPM_CHIP_FLAG_IRQ before probing for
> >    interrupts"
> >  tpm: Revert "tpm_tis_core: Turn on the TPM before probing IRQ's"
> > 
> > drivers/char/tpm/tpm_tis_core.c | 34 +++++++++++++++------------------
> > 1 file changed, 15 insertions(+), 19 deletions(-)
> > 
> > -- 
> > 2.20.1
> > 
> 
> Reviewed-by: Jerry Snitselaar <jsnitsel@redhat.com>

I'm sorry but forgot to append this before sending pull request :-/

/Jarkko


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

end of thread, other threads:[~2020-01-06 17:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-03 23:29 [PATCH for-linus-v5.5-rc6 0/3] TPM changes for v5.5-rc6 Jarkko Sakkinen
2020-01-03 23:29 ` [PATCH for-linus-v5.5-rc6 1/3] tpm: Revert "tpm_tis: reserve chip for duration of tpm_tis_core_init" Jarkko Sakkinen
2020-01-03 23:29 ` [PATCH for-linus-v5.5-rc6 2/3] tpm: Revert "tpm_tis_core: Set TPM_CHIP_FLAG_IRQ before probing for interrupts" Jarkko Sakkinen
2020-01-03 23:29 ` [PATCH for-linus-v5.5-rc6 3/3] tpm: Revert "tpm_tis_core: Turn on the TPM before probing IRQ's" Jarkko Sakkinen
2020-01-04  4:32 ` [PATCH for-linus-v5.5-rc6 0/3] TPM changes for v5.5-rc6 Jerry Snitselaar
2020-01-06 17:44   ` 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).