diff mbox series

[7/8,v7] doc: qemu: Add instructions for swtpm usage

Message ID 20211109070223.76456-8-ilias.apalodimas@linaro.org
State Accepted
Commit be2868f097ee06ee98e71050f18d5d729106978f
Headers show
Series TPM cleanups and MMIO driver | expand

Commit Message

Ilias Apalodimas Nov. 9, 2021, 7:02 a.m. UTC
A previous patch added support for an mmio based TPM.
Add an example in QEMU on it's usage

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
---
 doc/board/emulation/qemu-arm.rst | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

Comments

Simon Glass Nov. 13, 2021, 6:14 p.m. UTC | #1
Hi Ilias,

On Tue, 9 Nov 2021 at 00:02, Ilias Apalodimas
<ilias.apalodimas@linaro.org> wrote:
>
> A previous patch added support for an mmio based TPM.
> Add an example in QEMU on it's usage
>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> ---
>  doc/board/emulation/qemu-arm.rst | 25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)

How would I run the test that need this TPM emulator? Remember I was
going to look at what is involved to enhance U-Boot's emulator.

Regards,
Simon
Ilias Apalodimas Nov. 15, 2021, 11:10 a.m. UTC | #2
Hi Simon,

On Sat, Nov 13, 2021 at 11:14:27AM -0700, Simon Glass wrote:
> Hi Ilias,
> 
> On Tue, 9 Nov 2021 at 00:02, Ilias Apalodimas
> <ilias.apalodimas@linaro.org> wrote:
> >
> > A previous patch added support for an mmio based TPM.
> > Add an example in QEMU on it's usage
> >
> > Reviewed-by: Simon Glass <sjg@chromium.org>
> > Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> > ---
> >  doc/board/emulation/qemu-arm.rst | 25 +++++++++++++++++++++++++
> >  1 file changed, 25 insertions(+)
> 
> How would I run the test that need this TPM emulator? Remember I was
> going to look at what is involved to enhance U-Boot's emulator.
> 


Heinrich has already sent patches adding this to the docker CI [1].  Is
that clear enough ?


[1] https://lore.kernel.org/u-boot/20211115101106.36479-1-heinrich.schuchardt@canonical.com/T/#u
> Regards,
> Simon


Thanks
/Ilias
Heinrich Schuchardt Jan. 27, 2022, 10:08 p.m. UTC | #3
Am 27. Januar 2022 16:06:03 MEZ schrieb Simon Glass <sjg@chromium.org>:
>Hi Ilias,
>
>On Mon, 15 Nov 2021 at 04:11, Ilias Apalodimas
><ilias.apalodimas@linaro.org> wrote:
>>
>> Hi Simon,
>>
>> On Sat, Nov 13, 2021 at 11:14:27AM -0700, Simon Glass wrote:
>> > Hi Ilias,
>> >
>> > On Tue, 9 Nov 2021 at 00:02, Ilias Apalodimas
>> > <ilias.apalodimas@linaro.org> wrote:
>> > >
>> > > A previous patch added support for an mmio based TPM.
>> > > Add an example in QEMU on it's usage
>> > >
>> > > Reviewed-by: Simon Glass <sjg@chromium.org>
>> > > Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
>> > > ---
>> > >  doc/board/emulation/qemu-arm.rst | 25 +++++++++++++++++++++++++
>> > >  1 file changed, 25 insertions(+)
>> >
>> > How would I run the test that need this TPM emulator? Remember I was
>> > going to look at what is involved to enhance U-Boot's emulator.
>> >
>>
>>
>> Heinrich has already sent patches adding this to the docker CI [1].  Is
>> that clear enough ?
>
>Yes thanks.

The sandbox could communicate to swtpm via a socket like QEMU does or call libtpm directly. You may want to look at the QEMU code first.

Best regards

Heinrich




>
>
>- Simon
>
>
>>
>>
>> [1] https://lore.kernel.org/u-boot/20211115101106.36479-1-heinrich.schuchardt@canonical.com/T/#u
>> > Regards,
>> > Simon
>>
>>
>> Thanks
>> /Ilias
diff mbox series

Patch

diff --git a/doc/board/emulation/qemu-arm.rst b/doc/board/emulation/qemu-arm.rst
index 8d7fda10f15e..584ef0a7e150 100644
--- a/doc/board/emulation/qemu-arm.rst
+++ b/doc/board/emulation/qemu-arm.rst
@@ -81,6 +81,31 @@  can be enabled with the following command line parameters:
 
 These have been tested in QEMU 2.9.0 but should work in at least 2.5.0 as well.
 
+Enabling TPMv2 support
+----------------------
+
+To emulate a TPM the swtpm package may be used. It can be built from the
+following repositories:
+
+     https://github.com/stefanberger/swtpm.git
+
+Swtpm provides a socket for the TPM emulation which can be consumed by QEMU.
+
+In a first console invoke swtpm with::
+
+     swtpm socket --tpmstate dir=/tmp/mytpm1   \
+     --ctrl type=unixio,path=/tmp/mytpm1/swtpm-sock --log level=20
+
+In a second console invoke qemu-system-aarch64 with::
+
+     -chardev socket,id=chrtpm,path=/tmp/mytpm1/swtpm-sock \
+     -tpmdev emulator,id=tpm0,chardev=chrtpm \
+     -device tpm-tis-device,tpmdev=tpm0
+
+Enable the TPM on U-Boot's command line with::
+
+    tpm2 startup TPM2_SU_CLEAR
+
 Debug UART
 ----------