Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1709911pxb; Mon, 8 Mar 2021 04:37:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJx7vFB6Vt/KVFvNwgo+v5V3VZr00wXEBeyhW3KbCJTX1Isiv0E9cVR4uVbGpvrcvIATwdVH X-Received: by 2002:a05:6402:8d7:: with SMTP id d23mr22248057edz.256.1615207047094; Mon, 08 Mar 2021 04:37:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615207047; cv=none; d=google.com; s=arc-20160816; b=GxqFAxW7K6dvqmcVxWM075bUaaplTpFb144z/9pmyAViRJhYgTU+Xadm4tRo9vKGc5 8DPHg5Lh0jSsxrOj45dr9aieqzZfYqcgpz9/yI+5WK7OXAYklkZvBMhZwjHMBsbckOI+ P70u16MjnLThViE5/y1Sgcs1s7IUxNI2XH5dh3V7wB8lXbnfjh5AsJJ0nOCtTqY2OaBI BPTq32AwVgEiXq/wNv9r9zOh5SHc6jzE/a41ktbZjSuLDJlwQzQW2F8TppP7pxnsz0n1 aBzQziUxTDHdT1g7bRtuA9Yk8cY60uSCMNh1TpTx3a987DvXEJZxMU4i49BSYIlbFgdq ViWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HvNdlkWwUKPZtHFDz99HEUnzLaiqdybbznaHVBq88mY=; b=CGK4clBTUkhpX/EH7DEaOy26/TZKcA59wB1d4TbeZ+PnyoGzghyA2FCviVUTZzzAOJ 0Y41Sk5UFaxA6O4raRb/1O6a1oxJ6meOKb5vxqC6YeNVfd38cg4a+llSWSckqsNcqueN gST6jFmHdgecfsiCxD6rz0WKoIfDmTP53xorDlilpOlpF2HULRNALPk9tvlmrXTcK5H5 krfsyWXCDe1OtAZ2AVyZLafbeTSav/fbBPvDh3pklNtSC9y4K1GKiDPzMU7PbxvYiNv1 5iOrpSfYNIhFsLV7G6H8bwgcIOVUvpTgmIIViKS4ew4HPu0rL/zlAniB3NOzuNyvcLyk LRFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=q9GZHp1n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n19si3202291edr.388.2021.03.08.04.37.03; Mon, 08 Mar 2021 04:37:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=q9GZHp1n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231506AbhCHMdt (ORCPT + 99 others); Mon, 8 Mar 2021 07:33:49 -0500 Received: from mail.kernel.org ([198.145.29.99]:42448 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230198AbhCHMdh (ORCPT ); Mon, 8 Mar 2021 07:33:37 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id A5B1E651C9; Mon, 8 Mar 2021 12:33:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615206817; bh=V1lv48gjteWvIbyktBzWjQzXKuw4HvDNePK8Xmk4c8c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q9GZHp1nDHJdfTRO/FgeyZuTPZ1ylJxm66N631QYsFelEpXzANkQuFj/i5l2W2iCT bzXADldyaAzPAvzzZwIi3civ/KyBHbtAohDrtmBmY+6qkI54MENnfQeBqofRzdTPwr zwMiIxw3niDKT82CeJgP0rK3e1q/8jJz75JIkO08= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Laurent Bigonville , James Bottomley , Guenter Roeck , Lukasz Majczak , Jarkko Sakkinen Subject: [PATCH 5.10 04/42] tpm, tpm_tis: Decorate tpm_tis_gen_interrupt() with request_locality() Date: Mon, 8 Mar 2021 13:30:30 +0100 Message-Id: <20210308122718.346392391@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210308122718.120213856@linuxfoundation.org> References: <20210308122718.120213856@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lukasz Majczak commit d53a6adfb553969809eb2b736a976ebb5146cd95 upstream. This is shown with Samsung Chromebook Pro (Caroline) with TPM 1.2 (SLB 9670): [ 4.324298] TPM returned invalid status [ 4.324806] WARNING: CPU: 2 PID: 1 at drivers/char/tpm/tpm_tis_core.c:275 tpm_tis_status+0x86/0x8f Background ========== TCG PC Client Platform TPM Profile (PTP) Specification, paragraph 6.1 FIFO Interface Locality Usage per Register, Table 39 Register Behavior Based on Locality Setting for FIFO - a read attempt to TPM_STS_x Registers returns 0xFF in case of lack of locality. The fix ======= Decorate tpm_tis_gen_interrupt() with request_locality() and release_locality(). Cc: Laurent Bigonville Cc: James Bottomley Cc: Guenter Roeck Cc: stable@vger.kernel.org Fixes: a3fbfae82b4c ("tpm: take TPM chip power gating out of tpm_transmit()") Signed-off-by: Lukasz Majczak Signed-off-by: Jarkko Sakkinen Signed-off-by: Greg Kroah-Hartman --- drivers/char/tpm/tpm_tis_core.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) --- a/drivers/char/tpm/tpm_tis_core.c +++ b/drivers/char/tpm/tpm_tis_core.c @@ -707,12 +707,22 @@ static int tpm_tis_gen_interrupt(struct const char *desc = "attempting to generate an interrupt"; u32 cap2; cap_t cap; + int ret; + /* TPM 2.0 */ if (chip->flags & TPM_CHIP_FLAG_TPM2) return tpm2_get_tpm_pt(chip, 0x100, &cap2, desc); - else - return tpm1_getcap(chip, TPM_CAP_PROP_TIS_TIMEOUT, &cap, desc, - 0); + + /* TPM 1.2 */ + ret = request_locality(chip, 0); + if (ret < 0) + return ret; + + ret = tpm1_getcap(chip, TPM_CAP_PROP_TIS_TIMEOUT, &cap, desc, 0); + + release_locality(chip, 0); + + return ret; } /* Register the IRQ and issue a command that will cause an interrupt. If an