diff mbox series

[5/6,v4] doc: qemu: Add instructions for swtpm usage

Message ID 20211103150910.69732-6-ilias.apalodimas@linaro.org
State Superseded
Headers show
Series TPM cleanups and MMIO driver | expand

Commit Message

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

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

---
 doc/board/emulation/qemu-arm.rst | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

-- 
2.33.1

Comments

Simon Glass Nov. 5, 2021, 2:02 a.m. UTC | #1
On Wed, 3 Nov 2021 at 09:09, 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

>

> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

> ---

>  doc/board/emulation/qemu-arm.rst | 25 +++++++++++++++++++++++++

>  1 file changed, 25 insertions(+)

>


Reviewed-by: Simon Glass <sjg@chromium.org>


Any particular QEMU version? We should enable this in CI.

> 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

>  ----------

>

> --

> 2.33.1

>


Regards,
Simon
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
 ----------