From 1f425925b734951f53785aca1a763517db3e4591 Mon Sep 17 00:00:00 2001 From: Artur Kowalski Date: Tue, 27 Aug 2024 14:55:05 +0200 Subject: [PATCH] OvmfPkg: DxeTcg2PhysicalPresenceLib: fix changing of PCR banks Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunction writes to TPM2 physical presence PPI provided by coreboot (a memory region preserved across reboots). CPU caches must be explicitly flushed prior to platform reboot or request written to PPI will be lost. Signed-off-by: Artur Kowalski --- .../Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.c | 2 ++ .../Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.inf | 1 + 2 files changed, 3 insertions(+) diff --git a/OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.c b/OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.c index 5e8bf3a0b9..421eb9a77f 100644 --- a/OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.c +++ b/OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.c @@ -32,6 +32,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include +#include #include @@ -902,6 +903,7 @@ Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunction ( mPpi->Request = OperationRequest; mPpi->RequestParameter = RequestParameter; + WriteBackDataCache(); return TCG_PP_SUBMIT_REQUEST_TO_PREOS_SUCCESS; } diff --git a/OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.inf b/OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.inf index de39ef056a..26b715df37 100644 --- a/OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.inf +++ b/OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.inf @@ -62,6 +62,7 @@ UefiLib UefiRuntimeServicesTableLib Tcg2PhysicalPresencePlatformLib + CacheMaintenanceLib [Protocols] gEfiTcg2ProtocolGuid ## SOMETIMES_CONSUMES