Re: [PATCH 0/2] Revert patches fixing probing of interrupts

From: Jerry Snitselaar
Date: Mon Dec 09 2019 - 16:55:51 EST


On Mon Dec 09 19, Jarkko Sakkinen wrote:
On Mon, Dec 02, 2019 at 11:55:20AM -0700, Jerry Snitselaar wrote:
On Sun Dec 01 19, Stefan Berger wrote:
> On 11/29/19 5:37 PM, Jarkko Sakkinen wrote:
> > On Tue, Nov 26, 2019 at 08:17:51AM -0500, Stefan Berger wrote:
> > > From: Stefan Berger <stefanb@xxxxxxxxxxxxx>
> > >
> > > Revert the patches that were fixing the probing of interrupts due
> > > to reports of interrupt stroms on some systems
> > Can you explain how reverting is going to fix the issue?
>
>
> The reverts fix 'the interrupt storm issue' that they are causing on
> some systems but don't fix the issue with the interrupt mode not being
> used. I was hoping Jerry would get access to a system faster but this
> didn't seem to be the case. So sending these patches seemed the better
> solution than leaving 5.4.x with the problem but going back to when it
> worked 'better.'
>

I finally heard back from IT support, and unfortunately they don't
have any T490s systems to give out on temp loan. So I can only send
patched kernels to the end user that had the problem.

At least it is a fact that tpm_chip_stop() is called too early and that
is destined to cause issues.

Should I bake a patch or do you have already something?

/Jarkko


This is what I'm currently building:

diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
index 270f43acbb77..17184c07eb51 100644
--- a/drivers/char/tpm/tpm_tis_core.c
+++ b/drivers/char/tpm/tpm_tis_core.c
@@ -899,13 +899,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 out_err;
+ goto out_start;
}
/* 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 out_err;
+ goto out_start;
intmask |= TPM_INTF_CMD_READY_INT | TPM_INTF_LOCALITY_CHANGE_INT |
TPM_INTF_DATA_AVAIL_INT | TPM_INTF_STS_VALID_INT;
@@ -914,9 +914,8 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
rc = tpm_chip_start(chip);
if (rc)
- goto out_err;
+ goto out_start;
rc = tpm2_probe(chip);
- tpm_chip_stop(chip);
if (rc)
goto out_err;
@@ -980,7 +979,6 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
goto out_err;
}
- tpm_chip_start(chip);
chip->flags |= TPM_CHIP_FLAG_IRQ;
if (irq) {
tpm_tis_probe_irq_single(chip, intmask, IRQF_SHARED,
@@ -991,18 +989,17 @@ 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 out_err;
-
- if (chip->ops->clk_enable != NULL)
- chip->ops->clk_enable(chip, false);
+ goto out_start;
return 0;
out_err:
+ tpm_chip_stop(chip);
+out_start:
if ((chip->ops != NULL) && (chip->ops->clk_enable != NULL))
chip->ops->clk_enable(chip, false);