Received: by 10.213.65.68 with SMTP id h4csp453589imn; Tue, 13 Mar 2018 09:31:59 -0700 (PDT) X-Google-Smtp-Source: AG47ELtJMegTwrp8SJhx9Pv7Gm96/RPA4afQZvhVKI3amjDPetfoU4/0CuJkGaPkid0S6Pp4oe2Y X-Received: by 2002:a17:902:3041:: with SMTP id u59-v6mr1072392plb.115.1520958719810; Tue, 13 Mar 2018 09:31:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520958719; cv=none; d=google.com; s=arc-20160816; b=CCiuQr1fQxmKc+rR/CKgeR9x8tox94OkZwzGj2hQEcFyeU10FX18SJtaZWZr6SzuID poZDkWKuOLYQzV1Gtr7H4lCuObZDkVoKSHfuoLm+WvCJ9f1mn9emqfppxn7y+cADownx 4F5+DQoko9/nHyKjXWCV+f41Syi0efIpuJ04NHTDAle0xjraMhFBWX7jonpQCMoKOeQb YODtCiGCE527D4dzKVs+/pv+eGaTIH6gojGH649DqxGPOFWUXjb/6B8nteDjEEK/HrTy gGjZke8wowP80bDmeEZIoJaN3KfTlCOhKro5kfu8whXGYutb/ZPnAmhxLchBLoaIuBmo q4cA== 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=7gtIq/lQHq6ap10nJhOV0CXeuS/pyaixJnvoYSWqGI4=; b=EKwfT+89oGPYkG3ErdRKDn+0HbpJNTWrfgs0WFTdNIt2LeHkobDJPBuDIcMbI++Cz6 AHPkz9z6IGZ80eJzM8mZGd68K48ZjINIfVzFrhvOh8NHD3Ih32+DSzWzaSVcs5WiUBJc b99DdcQzqo7viP1PhO58QLqfommBwt+hgI76p/ThEatjX/KxOz59umxtrSLharNER+GE QX/2SRIrZzINpBJQ1swItg/P2Qg2itMaF+YUlJ0GakAjSK2ysS49ubALQqD9M2HuJ7hD Sc6aPOxhs9882945xP+t8BSheQnOiKHJ6YF4XIDiyAnMKyO0vcUGmmlC2uvMjsJBy2FK XPdQ== 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 e13si339033pff.8.2018.03.13.09.31.45; Tue, 13 Mar 2018 09:31:59 -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 S933522AbeCMPdV (ORCPT + 99 others); Tue, 13 Mar 2018 11:33:21 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:60092 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933509AbeCMPdT (ORCPT ); Tue, 13 Mar 2018 11:33:19 -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 113BA122F; Tue, 13 Mar 2018 15:33:18 +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.15 122/146] tpm: only attempt to disable the LPC CLKRUN if is already enabled Date: Tue, 13 Mar 2018 16:24:49 +0100 Message-Id: <20180313152329.652720758@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180313152320.439085687@linuxfoundation.org> References: <20180313152320.439085687@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.15-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)