Received: by 10.213.65.68 with SMTP id h4csp444599imn; Tue, 13 Mar 2018 09:14:46 -0700 (PDT) X-Google-Smtp-Source: AG47ELu+edlg8NQLl9MDRkIAg0IPg6Ltj+mwvhXqLdmK/IgtUqda6EKPsEv1te9HWAeunI+5Dpr4 X-Received: by 10.98.150.212 with SMTP id s81mr1168969pfk.100.1520957686779; Tue, 13 Mar 2018 09:14:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520957686; cv=none; d=google.com; s=arc-20160816; b=AN7auYLKpjzXt7UhvrGuPsEVetVB0oEYhVwZ0bDsZEMkrSSl8Uz3BbmugnSUPFJUkO cWUnjVKksptbqm6fv/sRPjnnUFeoGAFku2p/gGEXZjN8x9Wi2VfNhmXJ7XGBQ6a1Apw4 TWT8U2qM3jniv952vRzevAmtchhowsZGkZ5decR3Msfckbfqp811alJ1OqX25L4ya0px ci7d//Dqd73aGOAd92lIZcduykRxzDhH95S9jaR9XkWJNA7VL69yqOHndOyJFjQyNVjk 3FnbU0MSlwaWcvxsXfh1/ixdvPuE1i8goOlHGtNEVVTRK//lsfXGiEE6FIgpUlYC7JiZ nZ6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=J3h6SIFl7jEHj9u29YNLjg5SosV0188jxJM3pVWfAxY=; b=eC8gjDUrHPj1qRvuHN8fMRcKnSm01SSsdE3gEQBKY3MdqbNjbWS7uI1gG69T17Jdor sG3d90M2KaYTEmkFe3PezMSMg3+aDBygue8YiVRRj50ep0MZ30SWANlC2pL8mTGpWCHl AG67JFrEcRlC7DgGJkXvy/kGPDIZjNn/2SHVFGnk2km9cm9hDsOYmp46oD33VpUltvlv bWDFBGOsUsXS/0hK9a7bklmRe/4mAur11KxTCv7M7TPb5DPm1Uq6Jr9exJ2QKT1K1HdR vr5Mgn2wKV3lDT7+k58FvBZrZgfUDbi2EHOTU7No9i6/E2j48IVnadakcz60jjfeLCt9 LY6g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z3si284988pgp.788.2018.03.13.09.14.32; Tue, 13 Mar 2018 09:14:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752929AbeCMPgB (ORCPT + 99 others); Tue, 13 Mar 2018 11:36:01 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:33360 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933694AbeCMPf7 (ORCPT ); Tue, 13 Mar 2018 11:35:59 -0400 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 775781184; Tue, 13 Mar 2018 15:35:58 +0000 (UTC) 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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)