From: Lukas Wunner <lukas@wunner.de>
To: Rob Herring <robh+dt@kernel.org>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Conor Dooley <conor+dt@kernel.org>,
Jarkko Sakkinen <jarkko@kernel.org>,
Peter Huewe <peterhuewe@gmx.de>, Jason Gunthorpe <jgg@ziepe.ca>,
devicetree@vger.kernel.org, linux-integrity@vger.kernel.org,
Lino Sanfilippo <LinoSanfilippo@gmx.de>,
Nayna Jain <nayna@linux.ibm.com>,
Thirupathaiah Annapureddy <thiruan@microsoft.com>,
Sasha Levin <sashal@kernel.org>,
Alexander Steffen <Alexander.Steffen@infineon.com>,
Johannes Holland <Johannes.Holland@infineon.com>,
Amir Mizinski <amirmizi6@gmail.com>,
Benoit HOUYERE <benoit.houyere@st.com>,
Peter Delevoryas <peter@pjd.dev>
Subject: Re: [PATCH v2 1/3] dt-bindings: tpm: Consolidate TCG TIS bindings
Date: Wed, 13 Dec 2023 17:23:19 +0100 [thread overview]
Message-ID: <20231213162319.GA31314@wunner.de> (raw)
In-Reply-To: <CAL_JsqKwJsaJhoi07gG76TgDtrwh0i=iGtxL-_pbQbGDZ_8C3A@mail.gmail.com>
On Mon, Nov 27, 2023 at 10:31:06AM -0600, Rob Herring wrote:
> On Mon, Nov 27, 2023 at 8:09AM Lukas Wunner <lukas@wunner.de> wrote:
> > A significant number of Trusted Platform Modules conform to the "TIS"
> > specification published by the Trusted Computing Group ("TCG PC Client
> > Specific TPM Interface Specification"). These chips typically use an
> > SPI, I²C or LPC bus as transport (via MMIO in the latter case). Some
> > of them even support multiple of those buses (selectable through a
> > config strap) or the same chip is available in multiple SKUs, each with
> > a different bus interface.
> >
> > The devicetree bindings for these TPMs have not been converted to DT
> > schema yet and are spread out across 3 generic files and 3 chip-specific
> > files. A few TPM compatible strings were added to trivial-devices.yaml
> > even though additional properties are documented in the plaintext
> > bindings.
> >
> > Consolidate the devicetree bindings into 3 files, one per bus.
[...]
> > Changes v1 -> v2:
> > * Drop google,cr50 SPI example (Rob).
>
> That's going to avoid a warning in the examples, but it's going to
> fail any actual google,c50 SPI user. What's going to happen is both
> the SPI and I2C TPM schemas will be applied. Any SPI based cases will
> fail if they have SPI properties because the I2C schema won't allow
> them. If there is no fallback for google,cr50, then you must do a
> separate schema doc (well, you could do an if/then schema in
> tcg,tpm-tis-i2c.yaml to reference spi-peripheral-props.yaml, but that
> would look kind of odd).
I'm wondering if a "select:" property in the schema would be a viable
(and acceptable) way to solve this.
Ideally the validator would match a regex against the $nodename of the
parent and see if it contains "spi" or "i2c". But I think matching
against the parent's $nodename isn't possible, is it? I can only
match the TPM's $nodename, right?
All the devicetree nodes in arch/arm64/boot/dts/* containing a
google,cr50 compatible string have an spi-max-frequency property if
they're attached to SPI. So I think it may be possible to select the
i2c or spi schema based on presence of that property if the compatible
string is google,cr50. A bit kludgy perhaps but if there's no better
option?
What I don't like about creating a custom schema for google,cr50 is that
there may be other chips in the future which support multiple buses,
so we'd need an spi+i2c schema and probably also an spi+i2c+mmio,
i2c+mmio, spi+mmio schema. It gets messy. Granted we could enforce
that these newly added chips use a fallback compatible that we could
select the schema with. Still, automatically selecting the right
schema would be better, in particular if I could somehow match against
the $nodename of the parent.
Thoughts?
Thanks,
Lukas
next prev parent reply other threads:[~2023-12-13 16:23 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-27 14:02 [PATCH v2 0/3] dt-bindings: tpm: Clean all the things Lukas Wunner
2023-11-27 14:02 ` [PATCH v2 1/3] dt-bindings: tpm: Consolidate TCG TIS bindings Lukas Wunner
2023-11-27 16:31 ` Rob Herring
2023-12-13 16:23 ` Lukas Wunner [this message]
2023-12-13 17:01 ` Rob Herring
2023-12-15 15:24 ` Lukas Wunner
2023-12-18 21:01 ` Rob Herring
2023-11-27 14:02 ` [PATCH v2 2/3] dt-bindings: tpm: Convert IBM vTPM bindings to DT schema Lukas Wunner
2023-11-27 14:02 ` [PATCH v2 3/3] dt-bindings: tpm: Document Microsoft fTPM bindings Lukas Wunner
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=20231213162319.GA31314@wunner.de \
--to=lukas@wunner.de \
--cc=Alexander.Steffen@infineon.com \
--cc=Johannes.Holland@infineon.com \
--cc=LinoSanfilippo@gmx.de \
--cc=amirmizi6@gmail.com \
--cc=benoit.houyere@st.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=jarkko@kernel.org \
--cc=jgg@ziepe.ca \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-integrity@vger.kernel.org \
--cc=nayna@linux.ibm.com \
--cc=peter@pjd.dev \
--cc=peterhuewe@gmx.de \
--cc=robh+dt@kernel.org \
--cc=sashal@kernel.org \
--cc=thiruan@microsoft.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.