Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp2163140ybf; Mon, 2 Mar 2020 03:16:49 -0800 (PST) X-Google-Smtp-Source: APXvYqwcqRnpZt+EcVAdS5oIplfRh1yhj9mdP114wu76IoyprD1T60+rYVbhWCX1E+huAWt2ueOH X-Received: by 2002:aca:ab0c:: with SMTP id u12mr7882023oie.171.1583147809138; Mon, 02 Mar 2020 03:16:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583147809; cv=none; d=google.com; s=arc-20160816; b=GLUnZ+PjZPjBX4/gMJv/IYxBXttoWJ06DLxbuuaN8XvVMuew0csnZ4f1ZEyqcztv95 Snbe5TvdEY73Cq1G0bjwTihw7dp3/wcgJhcIewz+lx+JNyj6BKXZyF8wzpMNiRSqcgEv IDqeuUr+vHpOdE4HevZhlihR9bFvAL+vofAS+zQsH0ejqccbmKzXjGfF9NqPbpkG8Rbb V4kyj8Bw7TFcUMW4ZgHs1JAr3nm9PeobCpLSEEDk9qFb7JRNzdg680K0p71bCqsJf/2+ VviwMQZzc1F7Bzr3v5tRMwMO+9he0cCBGIybtcaF72wqajtvUVDoxHDJWEkEwRYZ5NcS Aepg== 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=ZVpU3lv7vaLaumaQabUXv950+ySmgUGj8My+32BZEeY=; b=CvsqqvEaMhvo3mkzYgdnTv4lC6LR3CrliSGlMM3t7KRTGyvBzClpC9VtsoQZevt7BP LLAqG5AOsmKVrPcFIGwZg24X2sHRZFH1fbPuELZxcs1tglkqlz3Xo62mUcWvBmc1b++u rLotYj16XP5KpptaaT+59UIyeikCs8lsrYIjRDLUWO6RL0FJD0vc2GOxdGPS4NCmHw3R yZ5ibceINVMhf9QfqE9UGw9XMBQ8iLyziIcRw83Y/6Ed/6KsxE3rBkPkJCCGMU4ylYPi VIlzkWRiawy0h2SIYyNOBL4bvMzRWjpHrpGIMHar88SFywID+c/6dcDOwcTe+Fy+U8Rq IyjQ== 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 c19si6462824otp.129.2020.03.02.03.16.27; Mon, 02 Mar 2020 03:16:49 -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 S1727107AbgCBLPT (ORCPT + 99 others); Mon, 2 Mar 2020 06:15:19 -0500 Received: from mga01.intel.com ([192.55.52.88]:43024 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725996AbgCBLPS (ORCPT ); Mon, 2 Mar 2020 06:15:18 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Mar 2020 03:15:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,506,1574150400"; d="scan'208";a="412244791" Received: from aorourk1-mobl.ger.corp.intel.com (HELO localhost) ([10.251.86.123]) by orsmga005.jf.intel.com with ESMTP; 02 Mar 2020 03:15:15 -0800 Date: Mon, 2 Mar 2020 13:15:14 +0200 From: Jarkko Sakkinen To: Stefan Berger Cc: linux-integrity@vger.kernel.org, aik@ozlabs.ru, david@gibson.dropbear.id.au, linux-kernel@vger.kernel.org, nayna@linux.vnet.ibm.com, gcwilson@linux.ibm.com, jgg@ziepe.ca, Stefan Berger Subject: Re: [PATCH v5 3/3] tpm: ibmvtpm: Add support for TPM 2 Message-ID: <20200302111514.GC3979@linux.intel.com> References: <20200228030330.18081-1-stefanb@linux.vnet.ibm.com> <20200228030330.18081-4-stefanb@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200228030330.18081-4-stefanb@linux.vnet.ibm.com> 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 Thu, Feb 27, 2020 at 10:03:30PM -0500, Stefan Berger wrote: > From: Stefan Berger > > Support TPM 2 in the IBM vTPM driver. The hypervisor tells us what > version of TPM is connected through the vio_device_id. I'd prefer "TPM2" over "TPM 2". > In case a TPM 2 is found, we set the TPM_CHIP_FLAG_TPM2 flag > and get the command codes attributes table. The driver does > not need the timeouts and durations, though. A TPM2 what? TPM2 is not a thing. > Signed-off-by: Stefan Berger > --- > drivers/char/tpm/tpm.h | 1 + > drivers/char/tpm/tpm2-cmd.c | 2 +- > drivers/char/tpm/tpm_ibmvtpm.c | 8 ++++++++ > 3 files changed, 10 insertions(+), 1 deletion(-) > > diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h > index 5620747da0cf..ad55c9824338 100644 > --- a/drivers/char/tpm/tpm.h > +++ b/drivers/char/tpm/tpm.h > @@ -226,6 +226,7 @@ int tpm2_auto_startup(struct tpm_chip *chip); > void tpm2_shutdown(struct tpm_chip *chip, u16 shutdown_type); > unsigned long tpm2_calc_ordinal_duration(struct tpm_chip *chip, u32 ordinal); > int tpm2_probe(struct tpm_chip *chip); > +int tpm2_get_cc_attrs_tbl(struct tpm_chip *chip); > int tpm2_find_cc(struct tpm_chip *chip, u32 cc); > int tpm2_init_space(struct tpm_space *space); > void tpm2_del_space(struct tpm_chip *chip, struct tpm_space *space); > diff --git a/drivers/char/tpm/tpm2-cmd.c b/drivers/char/tpm/tpm2-cmd.c > index 13696deceae8..b6a0ee6bb03a 100644 > --- a/drivers/char/tpm/tpm2-cmd.c > +++ b/drivers/char/tpm/tpm2-cmd.c > @@ -613,7 +613,7 @@ ssize_t tpm2_get_pcr_allocation(struct tpm_chip *chip) > return rc; > } > > -static int tpm2_get_cc_attrs_tbl(struct tpm_chip *chip) > +int tpm2_get_cc_attrs_tbl(struct tpm_chip *chip) > { > struct tpm_buf buf; > u32 nr_commands; > diff --git a/drivers/char/tpm/tpm_ibmvtpm.c b/drivers/char/tpm/tpm_ibmvtpm.c > index eee566eddb35..676a65148f82 100644 > --- a/drivers/char/tpm/tpm_ibmvtpm.c > +++ b/drivers/char/tpm/tpm_ibmvtpm.c > @@ -29,6 +29,7 @@ static const char tpm_ibmvtpm_driver_name[] = "tpm_ibmvtpm"; > > static const struct vio_device_id tpm_ibmvtpm_device_table[] = { > { "IBM,vtpm", "IBM,vtpm"}, > + { "IBM,vtpm", "IBM,vtpm20"}, > { "", "" } > }; > MODULE_DEVICE_TABLE(vio, tpm_ibmvtpm_device_table); > @@ -672,6 +673,13 @@ static int tpm_ibmvtpm_probe(struct vio_dev *vio_dev, > if (rc) > goto init_irq_cleanup; > > + if (!strcmp(id->compat, "IBM,vtpm20")) { > + chip->flags |= TPM_CHIP_FLAG_TPM2; > + rc = tpm2_get_cc_attrs_tbl(chip); > + if (rc) > + goto init_irq_cleanup; > + } > + > if (!wait_event_timeout(ibmvtpm->crq_queue.wq, > ibmvtpm->rtce_buf != NULL, > HZ)) { > -- > 2.23.0 > The code change looks fine. /Jarkko