From: James Ettle <james@ettle.org.uk>
To: Javier Martinez Canillas <javierm@redhat.com>,
Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>,
Jason Gunthorpe <jgg@ziepe.ca>
Cc: linux-integrity@vger.kernel.org, azhar.shaikh@intel.com,
linux-kernel@vger.kernel.org, james.l.morris@oracle.com
Subject: Re: [BISECTED] tpm CLKRUN breaks PS/2 keyboard and touchpad on Braswell system
Date: Mon, 18 Dec 2017 18:26:35 +0000 [thread overview]
Message-ID: <6b41f2a7-3b6e-69f2-fd49-d2ae774ff0f5@ettle.org.uk> (raw)
In-Reply-To: <16609e73-e35d-4bb0-410d-e87915daba39@redhat.com>
The keyboard and touchpad work OK with the patch quoted below and the earlier two applied, i.e. the three patches with signatures:
667dcc75be864ff4c17cf58891853b7393bba3e2
db3248e8a036c39141c8f7e9f1cf5c5ae6815f76
370d45a34dc8914066a995a3a6d6df1953ea9f60
I applied these to a vanilla kernel.org 4.14.7 source using Fedora 4.14.5-300.fc27 .config. Confirmed the tpm modules are loaded.
Tests:
1. Keyboard and touchpad work OK on boot - PASS
2. Still work after suspend/resume - PASS
Let me know if you want any further tests.
Many thanks,
James.
On 18/12/17 12:29, Javier Martinez Canillas wrote:
> On 12/18/2017 01:22 PM, Javier Martinez Canillas wrote:
>
> [snip]
>
>>
>> James,
>>
>> Can you please test the following (untested) patch on top of the other two
>> mentioned patches to see if it makes a difference for you?
>>
>
> I should had tried to at least compile the patch :)
>
> Updated patch below:
>
> From 370d45a34dc8914066a995a3a6d6df1953ea9f60 Mon Sep 17 00:00:00 2001
> From: Javier Martinez Canillas <javierm@redhat.com>
> Date: Mon, 18 Dec 2017 12:56:28 +0100
> Subject: [PATCH v2] tpm: only attempt to disable the LPC CLKRUN if is already
> enabled
>
> Commit 5e572cab92f0 ("tpm: Enable CLKRUN protocol for Braswell systems")
> added logic in the TPM TIS driver to disable the Low Pin Count CLKRUN
> signal during TPM transactions.
>
> Unfortunately this breaks other devices that are attached to the LPC bus
> like for example PS/2 mouse and keyboards.
>
> One flaw with the logic is that it assumes that the CLKRUN is always
> enabled, and so it unconditionally enables it after a TPM transaction.
>
> But it could be that the CLKRUN signal was already disabled in the LPC
> bus and so after the driver probes, the signal will remain enabled which
> may break other devices transactions since the clocks will be restarted
> by the CLKRUN# signal.
>
> Fixes: 5e572cab92f0 ("tpm: Enable CLKRUN protocol for Braswell systems")
> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
> ---
> drivers/char/tpm/tpm_tis_core.c | 15 ++++++++++++---
> 1 file changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
> index e7bd2e750f69..5f2b1fc2194f 100644
> --- a/drivers/char/tpm/tpm_tis_core.c
> +++ b/drivers/char/tpm/tpm_tis_core.c
> @@ -688,7 +688,8 @@ static void tpm_tis_clkrun_enable(struct tpm_chip *chip, bool value)
> struct tpm_tis_data *data = dev_get_drvdata(&chip->dev);
> u32 clkrun_val;
>
> - if (!IS_ENABLED(CONFIG_X86) || !is_bsw())
> + if (!IS_ENABLED(CONFIG_X86) || !is_bsw() ||
> + !data->ilb_base_addr)
> return;
>
> if (value) {
> @@ -746,7 +747,7 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
> const struct tpm_tis_phy_ops *phy_ops,
> acpi_handle acpi_dev_handle)
> {
> - u32 vendor, intfcaps, intmask;
> + u32 vendor, intfcaps, intmask, clkrun_val;
> u8 rid;
> int rc, probe;
> struct tpm_chip *chip;
> @@ -772,6 +773,14 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
> ILB_REMAP_SIZE);
> if (!priv->ilb_base_addr)
> return -ENOMEM;
> +
> + clkrun_val = ioread32(priv->ilb_base_addr + LPC_CNTRL_OFFSET);
> + /* Check if CLKRUN# is already not enabled in the LPC bus */
> + if (!(clkrun_val & LPC_CLKRUN_EN)) {
> + priv->flags |= TPM_TIS_CLK_ENABLE;
> + iounmap(priv->ilb_base_addr);
> + priv->ilb_base_addr = NULL;
> + }
> }
>
> if (chip->ops->clk_enable != NULL)
> @@ -868,7 +877,7 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
> }
>
> rc = tpm_chip_register(chip);
> - if (rc && is_bsw())
> + if (rc && is_bsw() && priv->ilb_base_addr)
> iounmap(priv->ilb_base_addr);
>
> if (chip->ops->clk_enable != NULL)
>
next prev parent reply other threads:[~2017-12-18 18:27 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-11 19:37 James Ettle
2017-12-12 11:38 ` Javier Martinez Canillas
2017-12-12 18:57 ` Jason Gunthorpe
2017-12-12 19:12 ` Javier Martinez Canillas
2017-12-12 21:17 ` James Ettle
2017-12-14 19:08 ` Javier Martinez Canillas
2017-12-14 19:10 ` Jason Gunthorpe
2017-12-15 14:56 ` Jarkko Sakkinen
2017-12-15 17:38 ` Jason Gunthorpe
2017-12-16 17:01 ` Jarkko Sakkinen
2017-12-16 20:59 ` Javier Martinez Canillas
2017-12-18 11:11 ` Javier Martinez Canillas
2018-01-02 20:53 ` Pavel Machek
2017-12-18 12:22 ` Javier Martinez Canillas
2017-12-18 12:29 ` Javier Martinez Canillas
2017-12-18 17:55 ` Jason Gunthorpe
2017-12-18 19:29 ` Javier Martinez Canillas
2017-12-18 19:34 ` Shaikh, Azhar
2017-12-18 20:04 ` Shaikh, Azhar
2017-12-18 20:19 ` Jason Gunthorpe
2017-12-18 23:34 ` Javier Martinez Canillas
2017-12-19 2:08 ` Jason Gunthorpe
2017-12-19 13:10 ` Jarkko Sakkinen
2017-12-19 13:12 ` Javier Martinez Canillas
2017-12-19 13:04 ` Jarkko Sakkinen
2017-12-19 20:20 ` Jason Gunthorpe
2017-12-18 23:06 ` Javier Martinez Canillas
2017-12-18 20:17 ` Jason Gunthorpe
2017-12-19 13:02 ` Jarkko Sakkinen
2017-12-18 18:26 ` James Ettle [this message]
2017-12-18 19:34 ` Javier Martinez Canillas
2017-12-19 13:00 ` Jarkko Sakkinen
2017-12-19 13:18 ` James Ettle
2017-12-22 18:30 ` Jarkko Sakkinen
2017-12-19 12:59 ` Jarkko Sakkinen
2017-12-19 13:10 ` Javier Martinez Canillas
2017-12-19 21:08 ` [PATCH 1/1] tpm: only attempt to disable the LPC CLKRUN if is already kbuild test robot
2017-12-14 11:21 ` [BISECTED] tpm CLKRUN breaks PS/2 keyboard and touchpad on Braswell system Jarkko Sakkinen
2017-12-14 12:05 ` Javier Martinez Canillas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6b41f2a7-3b6e-69f2-fd49-d2ae774ff0f5@ettle.org.uk \
--to=james@ettle.org.uk \
--cc=azhar.shaikh@intel.com \
--cc=james.l.morris@oracle.com \
--cc=jarkko.sakkinen@linux.intel.com \
--cc=javierm@redhat.com \
--cc=jgg@ziepe.ca \
--cc=linux-integrity@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®