Message ID | 20200929223216.22584-4-James.Bottomley@HansenPartnership.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | tpm_tis: fix interrupts (again) | expand |
On Tue, Sep 29, 2020 at 03:32:15PM -0700, James Bottomley wrote: > Unless the TPM_CHIP_FLAG_IRQ is set somewhere, an initial probe of the > IRQ never gets done. > > Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com> Please add a clear statement what the patch does in imperative form. > --- > drivers/char/tpm/tpm_tis_core.c | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c > index 02cc384fdaea..b8ab26077cb1 100644 > --- a/drivers/char/tpm/tpm_tis_core.c > +++ b/drivers/char/tpm/tpm_tis_core.c > @@ -808,6 +808,19 @@ static int tpm_tis_probe_irq_single(struct tpm_chip *chip, > } > priv->irq = irq; > > + /* > + * note writes to the interrupt registers are only effective > + * when the TPM is in the active locality, so we have to > + * request the locality here to get the interrupt set up. > + * This request has no corresponding release, because the > + * locality will be relinquished at the end of the tpm command > + * that probes the interrupts > + */ > + if (request_locality(chip, 0) != 0) { > + dev_err(&chip->dev, "failed to gain locality for irq probe\n"); > + return -EBUSY; > + } > + > rc = tpm_tis_read8(priv, TPM_INT_VECTOR(priv->locality), > &original_int_vec); > if (rc < 0) > @@ -835,6 +848,7 @@ static int tpm_tis_probe_irq_single(struct tpm_chip *chip, > return rc; > > priv->irq_tested = false; > + chip->flags |= TPM_CHIP_FLAG_IRQ; > > /* Generate an interrupt by having the core call through to > * tpm_tis_send > -- > 2.28.0 > Agree with the code change tho. /Jarkko
diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c index 02cc384fdaea..b8ab26077cb1 100644 --- a/drivers/char/tpm/tpm_tis_core.c +++ b/drivers/char/tpm/tpm_tis_core.c @@ -808,6 +808,19 @@ static int tpm_tis_probe_irq_single(struct tpm_chip *chip, } priv->irq = irq; + /* + * note writes to the interrupt registers are only effective + * when the TPM is in the active locality, so we have to + * request the locality here to get the interrupt set up. + * This request has no corresponding release, because the + * locality will be relinquished at the end of the tpm command + * that probes the interrupts + */ + if (request_locality(chip, 0) != 0) { + dev_err(&chip->dev, "failed to gain locality for irq probe\n"); + return -EBUSY; + } + rc = tpm_tis_read8(priv, TPM_INT_VECTOR(priv->locality), &original_int_vec); if (rc < 0) @@ -835,6 +848,7 @@ static int tpm_tis_probe_irq_single(struct tpm_chip *chip, return rc; priv->irq_tested = false; + chip->flags |= TPM_CHIP_FLAG_IRQ; /* Generate an interrupt by having the core call through to * tpm_tis_send
Unless the TPM_CHIP_FLAG_IRQ is set somewhere, an initial probe of the IRQ never gets done. Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com> --- drivers/char/tpm/tpm_tis_core.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)