From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AG47ELt2pjWbTrEBsartI6ycHJJ+NVYQFI1GeuhpiECF9/LKi/aBkV7woajEXO/CMGtctLSz+I9z ARC-Seal: i=1; a=rsa-sha256; t=1520955359; cv=none; d=google.com; s=arc-20160816; b=ECwp9ptlMjErZ3niwZo3y6Rsai3LfhHxur0tr+gV3nirr/NLyFw7teeKY9lZkqhmQn i17WK2FlVuZNIKqOoNdyqz6I3jcZ0IXP8JllKCo9qYswMqm2majWIzQF8tGQjvfXRCWN 2CoPg40wC+PwGyh38XtUtMQxDd7l3uhWDF3Soz7n9tzusBqy/UWUkVG5TC9caTGydMlc 0/mnidwYBHYpvJBhiSnQBFEPafCWHv/RbY+ECNJ9YaO/7BEU6CR981aRy/r+2o3R2sib PFoAqgqmhT5vcNDLjLQr7cnIFDM1MCH4R+PCAibAlaQ7YXr8hR0FYYbnaFSycGtCluek cpwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=J3h6SIFl7jEHj9u29YNLjg5SosV0188jxJM3pVWfAxY=; b=A8aD1Dn1VwnKFzQX3HO83rv9KSrWyJ5TUCz0Al60JuclPIuKysyhxg+vBUYAl2BfO0 jAd5XDn3tTQLlOP0UISkt/fSQeM0OZPjGRSmWxzYgsuNhrJi5+08GQ+qoOVCKxCr7zHd Hi4n2D9pmbNoqeYFCYJmmXH4rinzNUkEqhwVXh4oRsN8ODLPbN7Qf0my5OYzIVnKuzD1 5tLwu1A+M3kDRguNxYD5uNILUI8oVHCG6S2DWwaGUG3Hs5Mw0TFp6Q00PgD1VyDwYiNq 7lQvsUnx34irJfxbfsXXlXkWj5ZbgnN+0WtdH4S7xUdIVUAXiGxQQNeX6C6/ezmpNhwe gu+Q== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.71.90 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.71.90 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Javier Martinez Canillas , James Ettle , Jeffery Miller , Jarkko Sakkinen Subject: [PATCH 4.14 023/140] tpm: only attempt to disable the LPC CLKRUN if is already enabled Date: Tue, 13 Mar 2018 16:23:46 +0100 Message-Id: <20180313152459.591519822@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180313152458.201155692@linuxfoundation.org> References: <20180313152458.201155692@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-LABELS: =?utf-8?b?IlxcU2VudCI=?= X-GMAIL-THRID: =?utf-8?q?1594837119781067640?= X-GMAIL-MSGID: =?utf-8?q?1594837286750767049?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Javier Martinez Canillas commit 6c9f0ce0dffe64da2204f38b0fd90f3ae2a8903c upstream. 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, CLKRUN_EN will remain enabled which may break other devices that are attached to the LPC bus but don't have support for the CLKRUN protocol. Fixes: 5e572cab92f0 ("tpm: Enable CLKRUN protocol for Braswell systems") Signed-off-by: Javier Martinez Canillas Tested-by: James Ettle Tested-by: Jeffery Miller Reviewed-by: Jarkko Sakkinen Tested-by: Jarkko Sakkinen Signed-off-by: Jarkko Sakkinen Signed-off-by: Greg Kroah-Hartman --- drivers/char/tpm/tpm_tis_core.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) --- a/drivers/char/tpm/tpm_tis_core.c +++ b/drivers/char/tpm/tpm_tis_core.c @@ -694,7 +694,8 @@ static void tpm_tis_clkrun_enable(struct 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) { @@ -751,6 +752,7 @@ int tpm_tis_core_init(struct device *dev acpi_handle acpi_dev_handle) { u32 vendor, intfcaps, intmask; + u32 clkrun_val; u8 rid; int rc, probe; struct tpm_chip *chip; @@ -776,6 +778,13 @@ int tpm_tis_core_init(struct device *dev 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)) { + iounmap(priv->ilb_base_addr); + priv->ilb_base_addr = NULL; + } } if (chip->ops->clk_enable != NULL)