All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
To: Stefan Berger <stefanb@linux.vnet.ibm.com>
Cc: Scot Doyle <lkml14@scotdoyle.com>,
	Peter Huewe <peterhuewe@gmx.de>,
	Ashley Lai <ashley@ashleylai.com>,
	Marcel Selhorst <tpmdd@selhorst.net>,
	tpmdd-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org,
	josh@joshtriplett.org, christophe.ricard@gmail.com,
	jason.gunthorpe@obsidianresearch.com,
	Will Arthur <will.c.arthur@intel.com>
Subject: Re: [PATCH v10 8/8] tpm: TPM 2.0 FIFO Interface
Date: Mon, 15 Dec 2014 01:13:02 +0200	[thread overview]
Message-ID: <20141214231302.GA4539@intel.com> (raw)
In-Reply-To: <548DF5A5.2080500@linux.vnet.ibm.com>

On Sun, Dec 14, 2014 at 03:40:05PM -0500, Stefan Berger wrote:
> On 12/14/2014 01:27 PM, Scot Doyle wrote:
> >On Sun, 14 Dec 2014, Stefan Berger wrote:
> >>On 12/14/2014 10:40 AM, Jarkko Sakkinen wrote:
> >>>On Sun, Dec 14, 2014 at 09:48:26AM -0500, Stefan Berger wrote:
> >>>>On 12/12/2014 02:46 PM, Jarkko Sakkinen wrote:
> >>>>>Detect TPM 2.0 by sending idempotent TPM 2.x command. Ordinals for
> >>>>>TPM 2.0 are higher than TPM 1.x commands so this should be fail-safe.
> >>>>>Using STS3 is unreliable because some chips just report 0xff and not
> >>>>>what the spec says.
> >>>>TPM TIS 1.2 can report either 0xff or 0x00 for sts3 since that part of
> >>>>register was not defined for this version but only for a later version.
> >>>>So,
> >>>>unless the TIS 1.3 for TPM 2.0 is broken, it should report a bit _pattern_
> >>>>(not plain 0x00 or 0xff) that you could apply the suggested mask to and
> >>>>check then.
> >>>I propose this: lets keep the bit ugly but approach for now and when
> >>>there are TPM2 FIFOs available in the market move to your workaround.
> >>>I think that would be the most reasonable middle road here.
> >>You are now calling tpm2_gen_interrupt and are looking at the rc, which is the
> >>rc from tpm_transmit_cmd, which seems to make sure that the sending of the
> >>command went alright and the reception of the response. Is this good enough to
> >>distinguish between a TPM 2 and a TPM 1.2? If you send a valid TPM 2 command
> >>to a TPM 1.2 this will at least transmit the data ok, but the TPM will respond
> >>with a TPM 1.2 tag in the response. The way I understand the code, the rc does
> >>not include whether the response packet is a valid TPM 2 response packet and
> >>lets you conclude to a TPM2. I do something similar in upcoming QEMU patches
> >>where I send a valid TPM2 command for probing and if the tag(!) in the
> >>response is a TPM2 tag (0x8001 = TPM_ST_NO_SESSIONS), then it's a TPM 2,
> >>otherwise a TPM 1.2.
> >>
> >>Did you test this with a TPM 1.2 ?
> >>
> >>    Stefan
> >One system's output, with a dev_info call to show the value of rc:
> >[ 0.223837] tpm_tis 00:08: tpm2_gen_interrupt(chip, true) -> 0xa
> >[ 0.223847] tpm_tis 00:08: 1.2 TPM (device-id 0xB, rev-id 16)
> >[ 0.280468] tpm_tis 00:08: [Firmware Bug]: TPM interrupt not working, polling instead
> >
> 
> Ok, good.
> 
> [We won't be able to use STS3 if the TIS of Jarkko's TPM2 is broken...]

Yes, the prototype module that I had to use had the same problem as TPM
1.2 chips.

I think your idea of using tag is much cleaner than using the error
code. I'll probably submit a separate patch for that later on but since
this code is now verified to work on two TPM 1.2 chips (my own and
Scots) and one dTPM2 module, lets keep it that way until this patch
set is pulled at least...

/Jarkko

  reply	other threads:[~2014-12-14 23:13 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-12 19:46 [PATCH v10 0/8] TPM 2.0 support Jarkko Sakkinen
2014-12-12 19:46 ` Jarkko Sakkinen
2014-12-12 19:46 ` [PATCH v10 1/8] tpm: merge duplicate transmit_cmd() functions Jarkko Sakkinen
     [not found]   ` <1418413600-5400-2-git-send-email-jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2014-12-14 14:03     ` Stefan Berger
2014-12-14 14:03       ` Stefan Berger
     [not found]       ` <548D98B8.3010003-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2014-12-14 14:57         ` Jarkko Sakkinen
2014-12-14 14:57           ` Jarkko Sakkinen
     [not found]           ` <1418569030.9230.7.camel-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2014-12-14 15:31             ` peterhuewe-Mmb7MZpHnFY
2014-12-14 15:31               ` peterhuewe
     [not found]               ` <889c95a4-ae60-44db-be8a-fd56a9497c78-2ueSQiBKiTY7tOexoI0I+QC/G2K4zDHf@public.gmane.org>
2014-12-14 15:42                 ` Jarkko Sakkinen
2014-12-14 15:42                   ` Jarkko Sakkinen
2014-12-12 19:46 ` [PATCH v10 3/8] tpm: fix raciness of PPI interface lookup Jarkko Sakkinen
2014-12-12 19:46 ` [PATCH v10 5/8] tpm: device class for tpm Jarkko Sakkinen
2014-12-12 19:46 ` [PATCH v10 6/8] tpm: TPM 2.0 baseline support Jarkko Sakkinen
2014-12-12 19:46 ` [PATCH v10 7/8] tpm: TPM 2.0 CRB Interface Jarkko Sakkinen
2014-12-13 17:53 ` [tpmdd-devel] [PATCH v10 0/8] TPM 2.0 support Scot Doyle
2014-12-14 14:56   ` Jarkko Sakkinen
     [not found] ` <1418413600-5400-1-git-send-email-jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2014-12-12 19:46   ` [PATCH v10 2/8] tpm: two-phase chip management functions Jarkko Sakkinen
2014-12-12 19:46     ` Jarkko Sakkinen
2014-12-12 19:46   ` [PATCH v10 4/8] tpm: rename chip->dev to chip->pdev Jarkko Sakkinen
2014-12-12 19:46     ` Jarkko Sakkinen
2014-12-12 19:46   ` [PATCH v10 8/8] tpm: TPM 2.0 FIFO Interface Jarkko Sakkinen
2014-12-12 19:46     ` Jarkko Sakkinen
     [not found]     ` <1418413600-5400-9-git-send-email-jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2014-12-14 14:48       ` Stefan Berger
2014-12-14 14:48         ` Stefan Berger
     [not found]         ` <548DA33A.4010300-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2014-12-14 15:40           ` Jarkko Sakkinen
2014-12-14 15:40             ` Jarkko Sakkinen
     [not found]             ` <20141214154003.GA13338-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-12-14 16:09               ` Stefan Berger
2014-12-14 16:09                 ` Stefan Berger
2014-12-14 18:27                 ` Scot Doyle
2014-12-14 20:40                   ` Stefan Berger
2014-12-14 23:13                     ` Jarkko Sakkinen [this message]
2014-12-15 20:17   ` [PATCH v10 0/8] TPM 2.0 support Jarkko Sakkinen
2014-12-15 20:17     ` Jarkko Sakkinen
2014-12-16 21:19     ` Aw: " Peter Huewe
2014-12-16 21:31       ` Jarkko Sakkinen
2014-12-16 21:31         ` Jarkko Sakkinen
2014-12-16 21:32       ` [tpmdd-devel] " Peter Huewe
2014-12-16 21:34         ` Jarkko Sakkinen
2014-12-16 21:34           ` Jarkko Sakkinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141214231302.GA4539@intel.com \
    --to=jarkko.sakkinen@linux.intel.com \
    --cc=ashley@ashleylai.com \
    --cc=christophe.ricard@gmail.com \
    --cc=jason.gunthorpe@obsidianresearch.com \
    --cc=josh@joshtriplett.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkml14@scotdoyle.com \
    --cc=peterhuewe@gmx.de \
    --cc=stefanb@linux.vnet.ibm.com \
    --cc=tpmdd-devel@lists.sourceforge.net \
    --cc=tpmdd@selhorst.net \
    --cc=will.c.arthur@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.