Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp1042003ybc; Tue, 12 Nov 2019 13:17:40 -0800 (PST) X-Google-Smtp-Source: APXvYqxNJUxYIdxSzK++QLq0PmvNXqSrFWL/+H3qLEAX0QN/cq5ghxo8Itq+eFXoRxsARjHX4LEj X-Received: by 2002:aa7:c1d4:: with SMTP id d20mr35157547edp.273.1573593460209; Tue, 12 Nov 2019 13:17:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573593460; cv=none; d=google.com; s=arc-20160816; b=FVA+F0nCM+DHHmMlm/eLUswfnBHNwGwLWIoyvAkDHp5SGgIduO1ucjzs/bPX7EqeBX 0/EhFKNgmcIOd2mVrCMX/kFoLqrb3vfzBHF2wynnNvASlm7PhyPquJj203gZ9CBOgSNW 0HCnwfa8+Dz2RYDad7sM7xGMChLSDt+AaT4CBkIbud1xMj5s1NFVxOl6DX7CfOz8fPXb UVHo9JCjycSxPfKhJWmA+svwDlGzvh2Ex3oSxngCMBNVpLPlPxSddifZsjelKoqFE9N8 USaHEb/ywQpKZlkiz7zSCWoJpCnZYCaZSu+pWhcd78k25iMCYwnuWMzqEW3bfYKrswya Euxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:in-reply-to:mime-version:references :mail-followup-to:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=KhaSq6F0boqwPJebWHU+vS4X8WSartUyEjWwqUHsPz4=; b=s9WEX0QOY8MZedr/v7wtXcZNn5VER5az544If1aU5inMAyLdLP83YMINU+t6HkZw8C YtjnLdSKyQs02hFYECPAqFoo0l6YkCvdr/TfQaIqcM8KDN+uE/w5wxUeHPN45Ung6psX WWixallcRePD3lDzA/IeWPncLnmUz4qdcM5AgZxBvqz2DxHVc289q2B0J/kT0YUjVTD3 qS/jhIrKD96Jxv27pv3ICIF2tb2bByRfeXZKCvMvQfDu5tXtkjSIAXXPDzUMVqoczacO s7LaMDfv+WxktrbcVzvrxReS21ZjX1MmwedPty2ZBKUJCIM0YzMXjcaxhWLAJ+5UVG7Q Ooxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BAaOFLc1; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m12si797142ejr.306.2019.11.12.13.17.15; Tue, 12 Nov 2019 13:17:40 -0800 (PST) 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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BAaOFLc1; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727503AbfKLVO3 (ORCPT + 99 others); Tue, 12 Nov 2019 16:14:29 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:22098 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726952AbfKLVO2 (ORCPT ); Tue, 12 Nov 2019 16:14:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573593267; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KhaSq6F0boqwPJebWHU+vS4X8WSartUyEjWwqUHsPz4=; b=BAaOFLc1TJKBdf7dJ1oce3nTXUsLtrjbBtRUCaCTtpZ6vRiNg4nSoA1Jt4sejkZaLkkv1+ 7R5pjvRgjJzgAGcxUbugDQEoWU1M6Ezir/Y5mQHRJd7StQfoVv8pGNThDAwhIC/Wik5qh2 PqMZOgZK5I1z0pW66GEbdVay1hRS0w8= Received: from mail-yb1-f198.google.com (mail-yb1-f198.google.com [209.85.219.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-387-qNM5JECJM3W-I5r0HSksMQ-1; Tue, 12 Nov 2019 16:14:26 -0500 Received: by mail-yb1-f198.google.com with SMTP id t33so87314ybt.20 for ; Tue, 12 Nov 2019 13:14:26 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:reply-to :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=jB1CQxHZY09v+dVO/IW1sLsxw+s5h/wXvYhyMUh4nd4=; b=LxZyNf5QerCxGKlvi/1Coj6/Za0VrPT7sN31J5JMQ9Qfai+TKRpEwnvLTTNoxmOo2x zFGaM2YSZfa5bsou0fyX0t6H8xqlwAYj+MNF/a7qUxXNrbbecDu7mrecFYsGBIpuDsMX CYe2ex5LaXEXtRTRFAbRoxJEgTrRWrmJSQUIBdUrTMstDBheKS4SFH3IFF3XI4ZK5pO6 pgBGAqemNHD/SxtJW55gBAX5HqtaaN6o6n3LI0YK6W8ggzcoP2XH+9LAIAwlh8m8HRIq 9hl4G1LIsirCOkqiEr9IJUJQPJHbO0b1Eq12eBfhINVl2ijDSKwwb1DIYcUlSMTftWux A30Q== X-Gm-Message-State: APjAAAUY7yw0CsMv+83CdMe9bJ1+YfJXYdJ3Vgohwl1Sx8m4gBIkbW6f 32u7xjM5xJDyHTMFvpV0DanvNuDmRH9y/nl4gGNszBTwqD/+nhgxQbQ+Vp/Gj8RgeXGq/cB69sf JMB0hQS8SczGyi2Akk7NcpuRl X-Received: by 2002:a81:10d4:: with SMTP id 203mr49037ywq.390.1573593265499; Tue, 12 Nov 2019 13:14:25 -0800 (PST) X-Received: by 2002:a81:10d4:: with SMTP id 203mr49020ywq.390.1573593265161; Tue, 12 Nov 2019 13:14:25 -0800 (PST) Received: from localhost (ip70-163-223-149.ph.ph.cox.net. [70.163.223.149]) by smtp.gmail.com with ESMTPSA id v5sm128965ywi.95.2019.11.12.13.14.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Nov 2019 13:14:24 -0800 (PST) Date: Tue, 12 Nov 2019 14:14:23 -0700 From: Jerry Snitselaar To: Jason Gunthorpe Cc: Jarkko Sakkinen , linux-integrity , Peter Huewe , Linux List Kernel Mailing , stable@vger.kernel.org, Christian Bundy Subject: Re: [PATCH] tpm_tis: turn on TPM before calling tpm_get_timeouts Message-ID: <20191112211423.vgtervfk52txgfmm@cantor> Reply-To: Jerry Snitselaar Mail-Followup-To: Jason Gunthorpe , Jarkko Sakkinen , linux-integrity , Peter Huewe , Linux List Kernel Mailing , stable@vger.kernel.org, Christian Bundy References: <20191111233418.17676-1-jsnitsel@redhat.com> <20191112200328.GA11213@linux.intel.com> <20191112202623.GB5584@ziepe.ca> <20191112204623.GG5584@ziepe.ca> MIME-Version: 1.0 In-Reply-To: <20191112204623.GG5584@ziepe.ca> X-MC-Unique: qNM5JECJM3W-I5r0HSksMQ-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=WINDOWS-1252; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue Nov 12 19, Jason Gunthorpe wrote: >On Tue, Nov 12, 2019 at 01:31:09PM -0700, Jerry Snitselaar wrote: >> On Tue, Nov 12, 2019 at 1:28 PM Jerry Snitselaar w= rote: >> > >> > On Tue, Nov 12, 2019 at 1:26 PM Jason Gunthorpe wrote: >> > > >> > > On Tue, Nov 12, 2019 at 01:23:33PM -0700, Jerry Snitselaar wrote: >> > > > On Tue, Nov 12, 2019 at 1:03 PM Jarkko Sakkinen >> > > > wrote: >> > > > > >> > > > > On Mon, Nov 11, 2019 at 04:34:18PM -0700, Jerry Snitselaar wrote= : >> > > > > > With power gating moved out of the tpm_transmit code we need >> > > > > > to power on the TPM prior to calling tpm_get_timeouts. >> > > > > > >> > > > > > Cc: Jarkko Sakkinen >> > > > > > Cc: Peter Huewe >> > > > > > Cc: Jason Gunthorpe >> > > > > > Cc: linux-kernel@vger.kernel.org >> > > > > > Cc: linux-stable@vger.kernel.org >> > > > > > Fixes: a3fbfae82b4c ("tpm: take TPM chip power gating out of t= pm_transmit()") >> > > > > > Reported-by: Christian Bundy >> > > > > > Signed-off-by: Jerry Snitselaar >> > > > > > drivers/char/tpm/tpm_tis_core.c | 3 ++- >> > > > > > 1 file changed, 2 insertions(+), 1 deletion(-) >> > > > > > >> > > > > > diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tp= m/tpm_tis_core.c >> > > > > > index 270f43acbb77..cb101cec8f8b 100644 >> > > > > > +++ b/drivers/char/tpm/tpm_tis_core.c >> > > > > > @@ -974,13 +974,14 @@ int tpm_tis_core_init(struct device *dev= , struct tpm_tis_data *priv, int irq, >> > > > > > * to make sure it works. May as well use that c= ommand to set the >> > > > > > * proper timeouts for the driver. >> > > > > > */ >> > > > > > + tpm_chip_start(chip); >> > > > > > if (tpm_get_timeouts(chip)) { >> > > > > > dev_err(dev, "Could not get TPM timeouts= and durations\n"); >> > > > > > rc =3D -ENODEV; >> > > > > > + tpm_stop_chip(chip); >> > > > > > goto out_err; >> > > > > > } >> > > > > >> > > > > Couldn't this call just be removed? >> > > > > >> > > > > /Jarkko >> > > > > >> > > > >> > > > Probably. It will eventually get called when tpm_chip_register >> > > > happens. I don't know what the reason was for trying it prior to t= he >> > > > irq probe. >> > > >> > > At least tis once needed the timeouts before registration because it >> > > was issuing TPM commands to complete its setup. >> > > >> > > If timeouts have not been set then no TPM command should be executed= . >> > >> > Would it function with the timeout values set at the beginning of >> > tpm_tis_core_init (max values)? >> >> I guess that doesn't set the duration values though > >There is no reason to use anything but the correct timeouts, as read >from the device. > >Jason > Should there be a check in tpm1_get_timeouts and tpm2_get_timeouts: =09if (chip->flags & TPM_CHIP_FLAG_HAVE_TIMEOUTS) =09=09return 0; to skip going through it again in the auto startup code if it was already called and set?