Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp115228ybt; Tue, 16 Jun 2020 18:19:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJycaBJ8U4A8DTU7KkKKwsQ5BIVABuaAz5GNP8P7BAYodR7FRh2O8q0auJLxMyZ7+OY3/xyr X-Received: by 2002:a05:6402:312a:: with SMTP id dd10mr5254043edb.320.1592356779161; Tue, 16 Jun 2020 18:19:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592356779; cv=none; d=google.com; s=arc-20160816; b=0jEhOiAfOIDqCqpnrphdnPFH/UyB3gid2KEzsq9+b0UOl29RVTXtCHnaXK6o/21KjL UsN6k+PLkLmers+EEktXozHBEOcVxubM5C8iF1v4NXrH0V61TAOoVl1nN2NX0sVJx2oO ZX52t7QbdPYZPUsNASjxGGmBJcAZLkMVQhuMgwqiDpquklFe7JrAGqXz2Spm1xwPGni0 etQqludcdoS9Upu31ut2+2XTunB0aQstPu6RspCa90mwzRrpQUkCGmM3W+2p+7zEuSLo 33I+gO2S1UPTGWy1cBrPvFmCrt6nP6DbHrSy0HQd8v2DZBfg5Hvu1h13fPSk3+EXkkRI NyVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:ironport-sdr:ironport-sdr; bh=zXEJyyBepaJFAzEbJ9q89lsAT0oc6gLeoX9k+MNeQsI=; b=dvk0R7J1qC+STdw6hiC9RhpSMJi3xSlilicM7fODu7cX3Wnsp4raN6DrwcYhX6pe3t VUlopA4NPAqrBSq4AiqyVWqqvCyqh9Cr9HxVeFMpsucOzKx8F9VlikCS3sZP2EpMc827 wk1KOU6DOpAsFq/oUJ+KYb965dHPf5xUjFfNFw/LeeR4YiNhrSGbuV51HvoxM5TC+qIG GySscAYs9o3xOe0Ka2TfxV4sYPkH/Ry6cHYOLerSXxe1wbXooGHFoEPgXUcuyefNVYCZ ighQ+z/0G9vT9wI+l6grtB0jg9K6MQVynafbUK97fBPhNk2ctDfNFsid2LPgez5Negd5 8buQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hb8si11572699ejb.207.2020.06.16.18.19.16; Tue, 16 Jun 2020 18:19:39 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726602AbgFQBR0 (ORCPT + 99 others); Tue, 16 Jun 2020 21:17:26 -0400 Received: from mga18.intel.com ([134.134.136.126]:51471 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726253AbgFQBRZ (ORCPT ); Tue, 16 Jun 2020 21:17:25 -0400 IronPort-SDR: lQA4CE45FwCgGFlXMPjoCh4cP20QHxy8Wamgs1HQ6XPURdKy4aX6f6m4G3OrkVwoAp7tejs0x9 nL9w0EyARBaQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2020 18:17:24 -0700 IronPort-SDR: bQFvK4v3jSvMKYV7mYxujZB44pNzl4SipeNCURWEO3iw9k19ivotm3Eag1MGkRXpuCP1vf7yEs IPZQ389lRZ0Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,520,1583222400"; d="scan'208";a="450055304" Received: from carusoal-mobl.ger.corp.intel.com (HELO localhost) ([10.252.48.130]) by orsmga005.jf.intel.com with ESMTP; 16 Jun 2020 18:17:14 -0700 Date: Wed, 17 Jun 2020 04:17:13 +0300 From: Jarkko Sakkinen To: amirmizi6@gmail.com Cc: Eyal.Cohen@nuvoton.com, oshrialkoby85@gmail.com, alexander.steffen@infineon.com, robh+dt@kernel.org, peterhuewe@gmx.de, christophe-h.richard@st.com, jgg@ziepe.ca, arnd@arndb.de, gregkh@linuxfoundation.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-integrity@vger.kernel.org, oshri.alkoby@nuvoton.com, tmaimon77@gmail.com, gcwilson@us.ibm.com, kgoldman@us.ibm.com, Dan.Morav@nuvoton.com, oren.tanami@nuvoton.com, shmulik.hager@nuvoton.com, amir.mizinski@nuvoton.com, Christophe Ricard Subject: Re: [PATCH v10 3/8] tpm: tpm_tis: Add retry in case of protocol failure or data integrity (on I2C only) failure. Message-ID: <20200617011713.GC5100@linux.intel.com> References: <20200604134713.157951-1-amirmizi6@gmail.com> <20200604134713.157951-4-amirmizi6@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200604134713.157951-4-amirmizi6@gmail.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 04, 2020 at 04:47:08PM +0300, amirmizi6@gmail.com wrote: > From: Amir Mizinski > > The FIFO protocol described in the TCG PC Client Device Driver Design > Principles for TPM 2.0 advises retrying sending a command or receiving > a response using the FIFO protocol in case of any error in the protocol. > > Add a retry mechanism on any protocol error. In addition, in case of a data > integrity issue in the I2C bus protocol, check after sending a command > completion or receiving a response from the TPM. The first sentence of this paragraph means absolutely nothing but nonsense. Please describe the implementation broadly instead. Also the code is organized badly and makes the current code base a mess. You should derive __tpm_tis_recv() from the "old" tpm_tis_recv(), and introduce a "new" tpm_tis_recv() that calls __tpm_tis_recv() a number of times. /Jarkko