From: Javier Martinez Canillas <javierm@redhat.com>
To: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>,
Jason Gunthorpe <jgg@ziepe.ca>
Cc: James Ettle <james@ettle.org.uk>,
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 13:22:28 +0100 [thread overview]
Message-ID: <d3984354-56d4-747a-1266-bf28c657daae@redhat.com> (raw)
In-Reply-To: <1513443676.29063.0.camel@linux.intel.com>
On 12/16/2017 06:01 PM, Jarkko Sakkinen wrote:
> On Fri, 2017-12-15 at 10:38 -0700, Jason Gunthorpe wrote:
>> On Fri, Dec 15, 2017 at 04:56:30PM +0200, Jarkko Sakkinen wrote:
>>> On Thu, Dec 14, 2017 at 12:10:52PM -0700, Jason Gunthorpe wrote:
>>>> On Thu, Dec 14, 2017 at 08:08:58PM +0100, Javier Martinez Canillas wrote:
>>>>
>>>>> Although probably reverting the offending commits is the right thing to do
>>>>> until a proper solution is proposed.
>>>>
>>>> Yes, if a fix is not forthcoming soon Jarkko should revert.
>>>>
>>>
>>> I think I should drop the current patch going to 4.16 and revert the old
>>> patch. Do we agree on this?
>>
>> I think the entire is_bsw thing needs to go, clearly manipulating
>> CLKRUN directly was not fully thought out?
>>
>> Hopefully Intel will come up with a fix patch to preserve PS/2
>> functionality and it won't come to a revert..
>
> Agreed.
One flaw I found with the logic is that it assumes that the CLKRUN signal will
always be enabled. And so the driver enables it unconditionally after is probed
(I believe Jason mentioned that before?).
But I wonder if what's causing issues with the PS/2 devices is that the devices
assume the CLKRUN signal is disabled but this changes because of the tpm driver?
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?
>From 72a57eaa425d639d2622339173ff6bf9d9c86ff3 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 1/1] 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 | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
index e7bd2e750f69..42eb2c54494e 100644
--- a/drivers/char/tpm/tpm_tis_core.c
+++ b/drivers/char/tpm/tpm_tis_core.c
@@ -746,7 +746,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 +772,15 @@ 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;
+ chip->ops->clk_enable = 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)
--
2.14.3
next prev parent reply other threads:[~2017-12-18 12:22 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 [this message]
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
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=d3984354-56d4-747a-1266-bf28c657daae@redhat.com \
--to=javierm@redhat.com \
--cc=azhar.shaikh@intel.com \
--cc=james.l.morris@oracle.com \
--cc=james@ettle.org.uk \
--cc=jarkko.sakkinen@linux.intel.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®