Re: [RFC PATCH v8] tpm_tis: verify interrupt during init

From: Jason Gunthorpe
Date: Mon Sep 22 2014 - 13:14:04 EST


On Thu, Sep 11, 2014 at 12:50:00AM +0000, Scot Doyle wrote:
>
> On Mon, 8 Sep 2014, Jason Gunthorpe wrote:
> > On Tue, Sep 02, 2014 at 08:22:58PM +0000, Scot Doyle wrote:
> >
> >> It's spending that time (now 3 seconds) in tpm_tis_send_data.
> >
> > Due to request_locality?
>
> The first command transmitted (TPM_CAP_PROP) in tpm_get_timeouts goes
> through tpm_tis_send which calls tpm_tis_send_data before setting up
> polling mode for the interrupt test. In tpm_tis_send_data, the last call
> to wait_for_tpm_stat is still timing out.
>
> One solution would be to move the test from tpm_tis_send to
> tpm_tis_send_data. Another would be to expand the test in tpm_tis_send to
> include the call to tpm_tis_send_data.
>
> The latter seems safer, since it provides more opportunity for an IRQ to
> be generated. E.g. I'm not sure if TPM_CAP_PROP always generates an IRQ.
> But the problem with this approach is that tpm_tis_send becomes a bit
> messy. So this patch wraps tpm_tis_send in an attempt to keep the code
> clean. (Is there a better name for the wrapped function than
> tpm_tis_send_main?)

This does look much nicer, lets use this version.

I think Peter were prefer a new clean patch that superceeds the
original.

> + if (!priv->irq_tested) {

I think the sleep and check is still needed here, the IRQ delivery
could race relative to the MMIO read of completion, a sleep is the
only way we could attempt to synchronize them..

> + disable_interrupts(chip);
> + dev_err(chip->dev,
> + FW_BUG "TPM interrupt not working, polling instead\n");
> + }
> + priv->irq_tested = true;
> + return rc;
> +}

Thanks,
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/