Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751676AbdFHTC6 convert rfc822-to-8bit (ORCPT ); Thu, 8 Jun 2017 15:02:58 -0400 Received: from mga03.intel.com ([134.134.136.65]:38005 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751452AbdFHTC5 (ORCPT ); Thu, 8 Jun 2017 15:02:57 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,315,1493708400"; d="scan'208";a="1180060395" From: "Shaikh, Azhar" To: Alan Cox CC: "jarkko.sakkinen@linux.intel.com" , "jgunthorpe@obsidianresearch.com" , "tpmdd-devel@lists.sourceforge.net" , "linux-kernel@vger.kernel.org" , "linux-security-module@vger.kernel.org" Subject: RE: [PATCH v3] tpm: Enable CLKRUN protocol for Braswell systems Thread-Topic: [PATCH v3] tpm: Enable CLKRUN protocol for Braswell systems Thread-Index: AQHS39SiwJ4GDqs/JkyDneHONWNViaIaZDwA//+7DECAAZ7qgP//lZOQ Date: Thu, 8 Jun 2017 19:02:54 +0000 Message-ID: <5FFFAD06ADE1CA4381B3F0F7C6AF5828910FA4@ORSMSX109.amr.corp.intel.com> References: <1496369044-38234-1-git-send-email-azhar.shaikh@intel.com> <1496870610-29462-1-git-send-email-azhar.shaikh@intel.com> <20170607224444.5043f545@lxorguk.ukuu.org.uk> <5FFFAD06ADE1CA4381B3F0F7C6AF5828910C7B@ORSMSX109.amr.corp.intel.com> <20170608192259.43150ffa@lxorguk.ukuu.org.uk> In-Reply-To: <20170608192259.43150ffa@lxorguk.ukuu.org.uk> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_IC x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZTY0MWFlNDYtYzBlZC00YmI2LWFiMTAtMDkyZTE4YjY0YTVhIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6ImxoZ0N6cURDbkJYdndiSHMrYStMRk43aTIwNXZac0dxMDdyQTRKVVpGdk09In0= dlp-product: dlpe-windows dlp-version: 10.0.102.7 dlp-reaction: no-action x-originating-ip: [10.22.254.140] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1353 Lines: 39 > -----Original Message----- > From: Alan Cox [mailto:gnomes@lxorguk.ukuu.org.uk] > Sent: Thursday, June 8, 2017 11:23 AM > To: Shaikh, Azhar > Cc: jarkko.sakkinen@linux.intel.com; jgunthorpe@obsidianresearch.com; > tpmdd-devel@lists.sourceforge.net; linux-kernel@vger.kernel.org; linux- > security-module@vger.kernel.org > Subject: Re: [PATCH v3] tpm: Enable CLKRUN protocol for Braswell systems > > > > > + outb(0x80, 0xCC); > > > > + > > > > + /* Make sure the above write is completed */ > > > > + wmb(); > > > > > > Why the wmb(). It doesn't do what the comment says! Also this code > > > is x86 specific > > > > > > > > > > Memory barrier to enforce the order so that the outb() is completed, > which ensures that the LPC clocks are running before sending any TPM > command. > > wmb() doesn't do that. It merely ensures that the write has been posted to > the fabric. If as I suspect your LPC bus implements outb() as a non-posted > write you don't need the wmb(). If it doesn't then you need to issue > whatever access is needed to the fabric to ensure the post completed (eg for > PCI if you do an MMIO write you must do an MMIO read from the same > devfn). > > Secondly outb(0x80, 0xCC) doesn't write 0xCC to port 0x80. It writes 0x80 to > port 0xCC ! > Oops my bad! I got that reversed. Will change it. > Alan