linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oshri Alkobi <oshrialkoby85@gmail.com>
To: Alexander Steffen <Alexander.Steffen@infineon.com>
Cc: Eyal.Cohen@nuvoton.com,
	Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>,
	tmaimon77@gmail.com, robh+dt@kernel.org, mark.rutland@arm.com,
	peterhuewe@gmx.de, jgg@ziepe.ca, arnd@arndb.de,
	gregkh@linuxfoundation.org, oshri.alkoby@nuvoton.com,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-integrity@vger.kernel.org, gcwilson@us.ibm.com,
	kgoldman@us.ibm.com, nayna@linux.vnet.ibm.com,
	Dan.Morav@nuvoton.com, oren.tanami@nuvoton.com,
	amir.mizinski@nuvoton.com
Subject: Re: [PATCH v2 0/2] char: tpm: add new driver for tpm i2c ptp
Date: Sun, 25 Aug 2019 14:25:17 +0300	[thread overview]
Message-ID: <CAM9mBw+bz4OLoaWqJVs-+O0Wuovcx9bbj+PJWMHq_60WNbgTCg@mail.gmail.com> (raw)
In-Reply-To: <528c9364-f4f4-d7c1-5e58-6ba6b8e90a6c@infineon.com>

On Fri, Aug 16, 2019 at 7:12 PM Alexander Steffen
<Alexander.Steffen@infineon.com> wrote:
>
> On 15.08.2019 19:03, Oshri Alkobi wrote:
> > On Thu, Jul 18, 2019 at 8:10 PM Alexander Steffen
> > <Alexander.Steffen@infineon.com> wrote:
> >>
> >> On 18.07.2019 14:51, Eyal.Cohen@nuvoton.com wrote:
> >>> Hi Jarkko and Alexander,
> >>>
> >>> We have made an additional code review on the TPM TIS core driver, it looks quite good and we can connect our new I2C driver to this layer.
> >>
> >> Great :) In the meantime, I've done some experiments creating an I2C
> >> driver based on tpm_tis_core, see
> >> https://patchwork.kernel.org/patch/11049363/ Please have a look at that
> >> and provide your feedback (and/or use it as a basis for further
> >> implementations).
> >>
> >
> > Sorry for the late response.
> >
> > Thanks Alexander, indeed it looks much simpler.
> > I've checked it with Nuvoton's TPM - basic TPM commands work
>
> Nice :)
>
> > I only
> > had to remove the first msg from the read/write I2C transmitting
> > (from/to TPM_LOC_SEL), the TPM couldn't handle two register writes in
> > a sequence.
> > Actually it is more efficient to set TPM_LOC_SEL only before locality
> > check/request/relinquish - it is sticky.
>
> There is one problem though: Do we assume that only the kernel driver
> will communicate with the TPM or might there be something else that also
> talks to the TPM?
>
> If it is only the kernel driver, we could probably skip setting
> TPM_LOC_SEL at all, since it defaults to 0 and the driver will never use
> anything else. If something else does its own I2C communication with the
> TPM, it might write different values to TPM_LOC_SEL at any time, causing
> the kernel driver to use a different locality than intended. This was
> the reason I always set TPM_LOC_SEL within the same transaction.
>
> > I still didn't manage to work with interrupts, will debug it.
>
> Interrupt support might be broken in general at the moment, see this
> thread: https://www.spinics.net/lists/linux-integrity/msg08663.html
>
> > We weren't aware to the implementation of Christophe/ST which looks
> > good and can be complement to yours.
> > If no one is currently working on that, we can prepare a new patch
> > that is based on both.
> > Please let us know.
>
> I won't have the time to do anything, at least for the next two weeks,
> so feel free to pick it up.
>

Great, we will start working on it.

> >>> However, there are several differences between the SPI interface and the I2C interface that will require changes to the TIS core.
> >>> At a minimum we thought of:
> >>> 1. Handling TPM Localities in I2C is different
> >>
> >> It turned out not to be that different in the end, see the code
> >> mentioned above and my comment here:
> >> https://patchwork.kernel.org/cover/11049365/
> >>
> >>> 2. Handling I2C CRC - relevant only to I2C bus hence not supported today by TIS core
> >>
> >> That is completely optional, so there is no need to implement it in the
> >> beginning. Also, do you expect a huge benefit from that functionality?
> >> Are bit flips that much more likely on I2C compared to SPI, which has no
> >> CRC at all, but still works fine?
> >>
> >
> > I2C is noisy bus with potentially more devices with larger variety
> > than SPI. I2C may have more than one master and may have collisions
> > and/or arbitration.
>
> If multi-master usage is a concern, there are probably a lot more places
> in the driver that need to be adapted to deal with concurrent
> access/data corruption. For now, I'd assume a single master, similar to SPI.
>
> Alexander

Oshri

  reply	other threads:[~2019-08-25 11:25 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-28 15:13 [PATCH v2 0/2] char: tpm: add new driver for tpm i2c ptp Oshri Alkoby
2019-06-28 15:13 ` [PATCH v2 1/2] dt-bindings: tpm: add the TPM I2C PTP device tree binding documentation Oshri Alkoby
2019-06-28 15:13 ` [PATCH v2 2/2] char: tpm: add new driver for tpm i2c ptp Oshri Alkoby
2019-07-04  8:43 ` [PATCH v2 0/2] " Jarkko Sakkinen
2019-07-04 11:29   ` Alexander Steffen
2019-07-05 11:15     ` Jarkko Sakkinen
     [not found]     ` <CAM9mBwJC2QD5-gV1eJUDzC2Fnnugr-oCZCoaH2sT_7ktFDkS-Q@mail.gmail.com>
2019-07-05 11:28       ` Jarkko Sakkinen
     [not found]         ` <6e7ff1b958d84f6e8e585fd3273ef295@NTILML02.nuvoton.com>
     [not found]           ` <CAP6Zq1hPo9dG71YFyr7z9rjmi-DvoUZJOme4+2uqsfO+7nH+HQ@mail.gmail.com>
2019-07-15  9:45             ` Jarkko Sakkinen
2019-07-18 12:51               ` Eyal.Cohen
2019-07-18 17:10                 ` Alexander Steffen
2019-07-30  8:39                   ` Benoit HOUYERE
2019-07-30 17:42                     ` Alexander Steffen
2019-09-06 12:16                       ` Benoit HOUYERE
2019-08-15 17:03                   ` Oshri Alkobi
2019-08-16 16:12                     ` Alexander Steffen
2019-08-25 11:25                       ` Oshri Alkobi [this message]
2019-07-17  7:48             ` Alexander Steffen

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=CAM9mBw+bz4OLoaWqJVs-+O0Wuovcx9bbj+PJWMHq_60WNbgTCg@mail.gmail.com \
    --to=oshrialkoby85@gmail.com \
    --cc=Alexander.Steffen@infineon.com \
    --cc=Dan.Morav@nuvoton.com \
    --cc=Eyal.Cohen@nuvoton.com \
    --cc=amir.mizinski@nuvoton.com \
    --cc=arnd@arndb.de \
    --cc=devicetree@vger.kernel.org \
    --cc=gcwilson@us.ibm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jarkko.sakkinen@linux.intel.com \
    --cc=jgg@ziepe.ca \
    --cc=kgoldman@us.ibm.com \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=nayna@linux.vnet.ibm.com \
    --cc=oren.tanami@nuvoton.com \
    --cc=oshri.alkoby@nuvoton.com \
    --cc=peterhuewe@gmx.de \
    --cc=robh+dt@kernel.org \
    --cc=tmaimon77@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).