From fd05f33b715731df734535544e77502158265350 Mon Sep 17 00:00:00 2001 From: Artur Kowalski Date: Tue, 10 Sep 2024 11:09:47 +0200 Subject: [PATCH] OvmfPkg: DxeTcg2PhysicalPresenceLib: fix bootloop Flush cache not only when placing request in PPI, but also after clearing old request from PPI. Signed-off-by: Artur Kowalski --- .../DxeTcg2PhysicalPresenceLib.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.c b/OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.c index 421eb9a77f..16ab0028fa 100644 --- a/OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.c +++ b/OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.c @@ -733,6 +733,8 @@ Tcg2ExecutePendingTpmRequest ( mPpi->LastRequest = mPpi->Request; mPpi->Request = TCG2_PHYSICAL_PRESENCE_NO_ACTION; mPpi->RequestParameter = 0; + + WriteBackDataCacheRange(mPpi, sizeof(QEMU_TPM_PPI)); return; } @@ -763,6 +765,7 @@ Tcg2ExecutePendingTpmRequest ( mPpi->RequestParameter = 0; if (mPpi->Response == TCG_PP_OPERATION_RESPONSE_USER_ABORT) { + WriteBackDataCacheRange(mPpi, sizeof(QEMU_TPM_PPI)); return; } @@ -791,6 +794,7 @@ Tcg2ExecutePendingTpmRequest ( } Print (L"Rebooting system to make TPM2 settings in effect\n"); + WriteBackDataCacheRange(mPpi, sizeof(QEMU_TPM_PPI)); gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL); ASSERT (FALSE); } @@ -903,7 +907,7 @@ Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunction ( mPpi->Request = OperationRequest; mPpi->RequestParameter = RequestParameter; - WriteBackDataCache(); + WriteBackDataCacheRange(mPpi, sizeof(QEMU_TPM_PPI)); return TCG_PP_SUBMIT_REQUEST_TO_PREOS_SUCCESS; }