Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp5090985ybc; Fri, 15 Nov 2019 14:42:34 -0800 (PST) X-Google-Smtp-Source: APXvYqz8WfhEq3BAtR6sxmoN4Us2+PVOR5jmYixKqcIMqA4LcV8J9SvonTAP73uQuuQSPP2r6yL+ X-Received: by 2002:a17:906:4910:: with SMTP id b16mr4446984ejq.133.1573857754111; Fri, 15 Nov 2019 14:42:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573857754; cv=none; d=google.com; s=arc-20160816; b=Y22Ij+qLqAoaN9E1/PL77UWD7XhZyyLHwRjlqAn80EVi9vKkUe4yh8IWSzLFggAj3d +oLZa9yP4W+q6kR/gGMe+GLlIAtS+dl4LqkLKIp81uwwO1SXpKnq+VISVvBGb1sql8qk CCUuWL7mjrcM63GYnFNGh6ulvuFbVXV5J77Q9UpLYNCKtlxRE1yg1BDJnFZv2vbbq7wS KmznRAKj5GpHb8MiPYpZGSKv7Y6xJ874cG5riZaUKk7yjISgbv+UgHD0nmxyBmi4uush qSf6kcV/lQIR5FGHn25fhJcp8VCqwgdrfq4THGzgJ/yclEMv4vBtMzI3wYEnID7+mlSN hijw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=iw659X1e67OQGHCEwkaPl+OXNYmC6nLmw34jQbIvCEI=; b=a4LuvNV4GfSTrJSBg0diWycmbVPycP4A1wUmsvXkwvLumjU3qgqMpdIvvVgQmppnob WowP59Nj2jAsCdhb9hMfc3lkr85kv/4mx0i8780895gKEw3tk9/myeE9f7WfPovv8Zyy 0MUJvi4YwoYhzjhFHiKfK6wsx6qwrm0uauhzEC9spdmxXXnIkC42vAkWO07slRONJ3sw RljVL1m0wJH8UqcxBD9nDt/9tQcjzqftKPyw516Au7us7WEihTaZMBYHBNVww/err+Hc 82bNC1MMWisnIcDXheBE57nZk41nORhILxAMTrkuHd/2uSk1+gtvcwqhOkv4qE3oBjNi 2ZSw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l64si8200068edl.306.2019.11.15.14.42.02; Fri, 15 Nov 2019 14:42:34 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727073AbfKOWkd (ORCPT + 99 others); Fri, 15 Nov 2019 17:40:33 -0500 Received: from mga01.intel.com ([192.55.52.88]:32679 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726953AbfKOWkc (ORCPT ); Fri, 15 Nov 2019 17:40:32 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Nov 2019 14:40:31 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,309,1569308400"; d="scan'208";a="203699427" Received: from bpgilles-mobl1.ger.corp.intel.com (HELO localhost) ([10.251.95.141]) by fmsmga007.fm.intel.com with ESMTP; 15 Nov 2019 14:40:26 -0800 Date: Sat, 16 Nov 2019 00:40:25 +0200 From: Jarkko Sakkinen To: Jason Gunthorpe Cc: Jerry Snitselaar , linux-integrity , Peter Huewe , Linux List Kernel Mailing , linux-stable@vger.kernel.org, Christian Bundy Subject: Re: [PATCH] tpm_tis: turn on TPM before calling tpm_get_timeouts Message-ID: <20191115224025.GA29389@linux.intel.com> References: <20191111233418.17676-1-jsnitsel@redhat.com> <20191112200328.GA11213@linux.intel.com> <20191112202623.GB5584@ziepe.ca> <20191114165357.GA11107@linux.intel.com> <20191114165629.GC26068@ziepe.ca> <20191115174329.GA22029@linux.intel.com> <20191115183621.GD4055@ziepe.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191115183621.GD4055@ziepe.ca> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 15, 2019 at 02:36:21PM -0400, Jason Gunthorpe wrote: > On Fri, Nov 15, 2019 at 07:43:29PM +0200, Jarkko Sakkinen wrote: > > On Thu, Nov 14, 2019 at 12:56:29PM -0400, Jason Gunthorpe wrote: > > > On Thu, Nov 14, 2019 at 06:55:06PM +0200, Jarkko Sakkinen wrote: > > > > > Would it function with the timeout values set at the beginning of > > > > > tpm_tis_core_init (max values)? > > > > > > > > tpm_get_timeouts() should be replaced with: > > > > > > > > if (tpm_chip_start()) { > > > > dev_err(dev, "Could not get TPM timeouts and durations\n"); > > > > rc = -ENODEV; > > > > goto out_err; > > > > } > > > > > > > > tpm_stop_chip(chip); > > > > > > > > tpm_get_timeouts() is called by tpm_auto_startup(). Also the function > > > > should be moved to tpm_chip.c and converted to a static function so > > > > that it won't be called from random cal sites like above. > > > > > > Careful, the design here was to allow a driver to do only > > > get_timeouts, then additional setup work, then do auto_startup() > > > > > > Forcing a driver to do auto_startup too early may not be good. > > > > All drivers always do it anyway because all drivers always call > > tpm_chip_register(). > > But chip_register is after the driver has done it's setup and after it > may have called get_timeouts > > auto_setup should not be moved to before chip_register() I do not see any sense calling from get_timeouts() from call sites in the same initialization flow. /Jarkko