Hi Aidan,

On 2026-05-13T00:26:04, Aidan Garske <[email protected]> wrote:
> arm: dts: qemu-arm64: add TPM TIS MMIO node
>
> Add a TPM 2.0 TIS MMIO node at the address QEMU's virt machine
> exposes when started with -device tpm-tis-device.  This lets the
> in-tree QEMU+swtpm test path (used by the wolfTPM Python test
> suite, and similarly usable by anyone bringing up the existing
> TPM 2.0 stack against swtpm) work without having to inject a DT
> overlay at runtime.
>
> Address 0x0c000000 / size 0x5000 matches QEMU's virt machine TPM
> TIS region.
>
> Signed-off-by: Aidan Garske <[email protected]>
>
> arch/arm/dts/qemu-arm64.dts | 4 ++++
>  1 file changed, 4 insertions(+)

> diff --git a/arch/arm/dts/qemu-arm64.dts b/arch/arm/dts/qemu-arm64.dts
> @@ -12,4 +12,8 @@
>  / {
> +     tpm@0c000000 {
> +             compatible = 'tcg,tpm-tis-mmio';
> +             reg = <0x0 0x0c000000 0x0 0x5000>;
> +     };
>  };

I don't think this addition takes effect at runtime. qemu_arm64 sets
imply OF_HAS_PRIOR_STAGE and board_fdt_blob_setup() returns the DTB
QEMU loaded into RAM, so U-Boot uses QEMU's generated DT, not the
compiled-in qemu-arm64.dtb. OF_OMIT_DTB defaults to y when
OF_HAS_PRIOR_STAGE is set, so the compiled DT isn't even bundled into
u-boot.bin. See doc/develop/devicetree/dt_qemu.rst

When QEMU is started with -device tpm-tis-device it already adds a tpm
node at the same 0x0c000000 region, so the existing TPM 2.0 stack
picks it up without any change here. Have you confirmed that removing
this hunk actually breaks the test path? If not, please drop the
patch; if it does help in some specific path (e.g. -dtb u-boot.dtb),
the commit message should call that out.

See also this patch where a similar thing came up (due to a QEMU
maintainer refusing to support DT additions, U-Boot needs to do the
overlay itself).

https://patchwork.ozlabs.org/project/uboot/patch/20260507140624.v3.1.5f8ce2dc2b00328d29e64be2684b10d9f52c6a7b@changeid/

I also found the context re QEMU expectations (basically Tianocore).

https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

Also, the reg property uses four cells but the root node doesn't
declare #address-cells/#size-cells, so the defaults (2/1) apply and
the cell count is wrong. Per
dts/upstream/Bindings/tpm/tcg,tpm-tis-mmio.yaml the compatible needs a
vendor-specific string first with tcg,tpm-tis-mmio as the fallback -
tcg,tpm-tis-mmio alone fails the schema. If the node really is needed,
please match what QEMU emits (or pick a sensible vendor prefix) and
wrap it in a parent that sets the address/size cells.

Regards,
Simon

Reply via email to