From b91c651e6d596cfe27448b19c8fb2f1168493827 Mon Sep 17 00:00:00 2001
From: Mikko Rapeli <mikko.rapeli@linaro.org>
Date: Mon, 15 Jan 2024 09:26:56 +0000
Subject: [PATCH] qemu_measured_boot.c: ignore TPM error and continue with boot

If firmware is configured with TPM support but it's missing
on HW, e.g. swtpm not started and/or configured with qemu,
then continue booting. Missing TPM is not a fatal error.
Enables testing boot without TPM device to see that
missing TPM is detected further up the SW stack and correct
fallback actions are taken.

Upstream-Status: Submitted [https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/36514]

Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org>
---
 plat/qemu/qemu/qemu_measured_boot.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/plat/qemu/qemu/qemu_measured_boot.c b/plat/qemu/qemu/qemu_measured_boot.c
index 76a4da17e6a9..ec7f44d3720d 100644
--- a/plat/qemu/qemu/qemu_measured_boot.c
+++ b/plat/qemu/qemu/qemu_measured_boot.c
@@ -80,7 +80,8 @@ void bl2_plat_mboot_finish(void)
 		 * Note: In QEMU platform, OP-TEE uses nt_fw_config to get the
 		 * secure Event Log buffer address.
 		 */
-		panic();
+		ERROR("Ignoring TPM errors, continuing without\n");
+		return;
 	}
 
 	/* Copy Event Log to Non-secure memory */
