Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752859AbdFTVqo (ORCPT ); Tue, 20 Jun 2017 17:46:44 -0400 Received: from mga14.intel.com ([192.55.52.115]:35775 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752841AbdFTVqm (ORCPT ); Tue, 20 Jun 2017 17:46:42 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,366,1493708400"; d="scan'208";a="116798439" Date: Tue, 20 Jun 2017 23:46:22 +0200 From: Jarkko Sakkinen To: Jason Gunthorpe Cc: tpmdd-devel@lists.sourceforge.net, linux-security-module@vger.kernel.org, Peter Huewe , Marcel Selhorst , open list Subject: Re: [PATCH] tpm: consolidate the TPM startup code Message-ID: <20170620214622.lqt72f6fiqgno2rh@linux.intel.com> References: <20170620181334.28363-1-jarkko.sakkinen@linux.intel.com> <20170620193152.GA3368@obsidianresearch.com> <20170620205529.ku3nueglj3mqkd3s@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170620205529.ku3nueglj3mqkd3s@linux.intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: NeoMutt/20170306 (1.8.0) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1750 Lines: 41 On Tue, Jun 20, 2017 at 10:55:29PM +0200, Jarkko Sakkinen wrote: > On Tue, Jun 20, 2017 at 01:31:52PM -0600, Jason Gunthorpe wrote: > > On Tue, Jun 20, 2017 at 08:13:34PM +0200, Jarkko Sakkinen wrote: > > > Consolidated all the "manual" TPM startup code to a single function > > > in order to make code flows a bit cleaner and migrate to tpm_buf. > > > > > > Signed-off-by: Jarkko Sakkinen > > > drivers/char/tpm/tpm-interface.c | 67 +++++++++++++++++++++++++--------------- > > > drivers/char/tpm/tpm.h | 6 +--- > > > drivers/char/tpm/tpm2-cmd.c | 32 +------------------ > > > 3 files changed, 44 insertions(+), 61 deletions(-) > > > > Makes sense to me > > > > > diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c > > > index d2b4df6d9894..fbef47d8bd06 100644 > > > +++ b/drivers/char/tpm/tpm-interface.c > > > @@ -540,6 +540,47 @@ ssize_t tpm_transmit_cmd(struct tpm_chip *chip, struct tpm_space *space, > > > } > > > EXPORT_SYMBOL_GPL(tpm_transmit_cmd); > > > > > > +#define TPM_ORD_STARTUP 153 > > > +#define TPM_ST_CLEAR 1 > > > > We should really have a tpm1.h and tpm2.h that has all these various > > constants and things instead of open coding them randomly all over.. > > > > Jason > > I agree. I agree means here that I agree if you mean only protocol specific constants. I do not think it would make sense with things like struct tpm_readpubek_out that is a throw away only used by that one function as helper (would compare it to a helper function). It would only make reading the code slower. It would make sense, for example, to have enum tpm_ordinals for all TPM 1.2 ordinals in tpm1_proto.h (yes would add _proto for clarity). /Jarkko