All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rob Herring <robh@kernel.org>
To: Stefan Berger <stefanb@linux.ibm.com>
Cc: kexec@lists.infradead.org, devicetree@vger.kernel.org,
	Nayna Jain <nayna@linux.ibm.com>,
	nasastry@in.ibm.com, Frank Rowand <frowand.list@gmail.com>,
	Eric Biederman <ebiederm@xmission.com>
Subject: Re: [PATCH 2/3] tpm/kexec: Duplicate TPM measurement log in of-tree for kexec
Date: Wed, 15 Jun 2022 14:18:37 -0600	[thread overview]
Message-ID: <20220615201837.GB1525994-robh@kernel.org> (raw)
In-Reply-To: <CAL_JsqJG4MJHeu+7Ar0jWi-W6P01_EFtwiz56m_vtVy39uMtiw@mail.gmail.com>

On Tue, Jun 14, 2022 at 11:48:30AM -0600, Rob Herring wrote:
> (),On Tue, Jun 14, 2022 at 10:13 AM Stefan Berger <stefanb@linux.ibm.com> wrote:
> >
> > The memory area of the TPM measurement log is currently not properly
> > duplicated for carrying it across kexec when an Open Firmware
> > Devicetree is used. Therefore, the contents of the log get corrupted.
> > Fix this for the kexec_file_load() syscall by allocating a buffer and
> > copying the contents of the existing log into it. The new buffer is
> > preserved across the kexec and a pointer to it is available when the new
> > kernel is started. To achieve this, store the allocated buffer's address
> > in the flattened device tree (fdt) under the name linux,tpm-kexec-buffer
> > and search for this entry early in the kernel startup before the TPM
> > subsystem starts up. Adjust the pointer in the of-tree stored under
> > linux,sml-base to point to this buffer holding the preserved log. The
> > TPM driver can then read the base address from this entry when making
> > the log available.
> 

> > +{
> > +       const u32 *sizep;
> > +       const u64 *basep;
> > +
> > +       sizep = of_get_property(np, "linux,sml-size", NULL);
> > +       basep = of_get_property(np, "linux,sml-base", NULL);
> 
> Any new properties need a schema. For chosen, that's located here[1].
> The more common pattern for similar properties is <base size>.

I noticed these are already documented and are TPM node properties. I 
was thinking these are chosen node properties. Though it would be good 
to get these common TPM properties converted to schema. That can live in 
the kernel tree.

Rob

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

WARNING: multiple messages have this Message-ID (diff)
From: Rob Herring <robh@kernel.org>
To: Stefan Berger <stefanb@linux.ibm.com>
Cc: kexec@lists.infradead.org, devicetree@vger.kernel.org,
	Nayna Jain <nayna@linux.ibm.com>,
	nasastry@in.ibm.com, Frank Rowand <frowand.list@gmail.com>,
	Eric Biederman <ebiederm@xmission.com>
Subject: Re: [PATCH 2/3] tpm/kexec: Duplicate TPM measurement log in of-tree for kexec
Date: Wed, 15 Jun 2022 14:18:37 -0600	[thread overview]
Message-ID: <20220615201837.GB1525994-robh@kernel.org> (raw)
In-Reply-To: <CAL_JsqJG4MJHeu+7Ar0jWi-W6P01_EFtwiz56m_vtVy39uMtiw@mail.gmail.com>

On Tue, Jun 14, 2022 at 11:48:30AM -0600, Rob Herring wrote:
> (),On Tue, Jun 14, 2022 at 10:13 AM Stefan Berger <stefanb@linux.ibm.com> wrote:
> >
> > The memory area of the TPM measurement log is currently not properly
> > duplicated for carrying it across kexec when an Open Firmware
> > Devicetree is used. Therefore, the contents of the log get corrupted.
> > Fix this for the kexec_file_load() syscall by allocating a buffer and
> > copying the contents of the existing log into it. The new buffer is
> > preserved across the kexec and a pointer to it is available when the new
> > kernel is started. To achieve this, store the allocated buffer's address
> > in the flattened device tree (fdt) under the name linux,tpm-kexec-buffer
> > and search for this entry early in the kernel startup before the TPM
> > subsystem starts up. Adjust the pointer in the of-tree stored under
> > linux,sml-base to point to this buffer holding the preserved log. The
> > TPM driver can then read the base address from this entry when making
> > the log available.
> 

> > +{
> > +       const u32 *sizep;
> > +       const u64 *basep;
> > +
> > +       sizep = of_get_property(np, "linux,sml-size", NULL);
> > +       basep = of_get_property(np, "linux,sml-base", NULL);
> 
> Any new properties need a schema. For chosen, that's located here[1].
> The more common pattern for similar properties is <base size>.

I noticed these are already documented and are TPM node properties. I 
was thinking these are chosen node properties. Though it would be good 
to get these common TPM properties converted to schema. That can live in 
the kernel tree.

Rob

  parent reply	other threads:[~2022-06-15 20:18 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-14 16:12 [PATCH 0/3] tpm: Preserve TPM measurement log across kexec Stefan Berger
2022-06-14 16:12 ` Stefan Berger
2022-06-14 16:12 ` [PATCH 1/3] of: kexec: Refactor IMA buffer related functions to make them reusable Stefan Berger
2022-06-14 16:12   ` Stefan Berger
2022-06-14 16:35   ` Nageswara R Sastry
2022-06-14 16:35     ` Nageswara R Sastry
2022-06-14 16:12 ` [PATCH 2/3] tpm/kexec: Duplicate TPM measurement log in of-tree for kexec Stefan Berger
2022-06-14 16:12   ` Stefan Berger
2022-06-14 16:46   ` Nageswara R Sastry
2022-06-14 16:46     ` Nageswara R Sastry
2022-06-14 17:48   ` Rob Herring
2022-06-14 17:48     ` Rob Herring
2022-06-15 13:08     ` Stefan Berger
2022-06-15 13:08       ` Stefan Berger
2022-06-15 20:14       ` Rob Herring
2022-06-15 20:14         ` Rob Herring
2022-06-15 21:45         ` Stefan Berger
2022-06-15 21:45           ` Stefan Berger
2022-06-15 20:18     ` Rob Herring [this message]
2022-06-15 20:18       ` Rob Herring
2022-06-14 18:58   ` kernel test robot
2022-06-14 18:58     ` kernel test robot
2022-06-15  0:54   ` kernel test robot
2022-06-15  0:54     ` kernel test robot
2022-06-15  9:42   ` kernel test robot
2022-06-15  9:42     ` kernel test robot
2022-06-14 16:12 ` [PATCH 3/3] tpm: of: Call of_tpm_get_sml_parameters() to get base and size of log Stefan Berger
2022-06-14 16:12   ` Stefan Berger
2022-06-14 16:47   ` Nageswara R Sastry
2022-06-14 16:47     ` Nageswara R Sastry
2022-06-15 21:25   ` Jarkko Sakkinen
2022-06-15 21:25     ` 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=20220615201837.GB1525994-robh@kernel.org \
    --to=robh@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=ebiederm@xmission.com \
    --cc=frowand.list@gmail.com \
    --cc=kexec@lists.infradead.org \
    --cc=nasastry@in.ibm.com \
    --cc=nayna@linux.ibm.com \
    --cc=stefanb@linux.ibm.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.