Skip to content

Commit

Permalink
OvmfPkg: DxeTcg2PhysicalPresenceLib: fix bootloop
Browse files Browse the repository at this point in the history
Flush cache not only when placing request in PPI, but also after
clearing old request from PPI.

Signed-off-by: Artur Kowalski <[email protected]>
  • Loading branch information
arturkow2000 authored and miczyg1 committed Sep 16, 2024
1 parent 0266320 commit 4d1eaf5
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,8 @@ Tcg2ExecutePendingTpmRequest (
mPpi->LastRequest = mPpi->Request;
mPpi->Request = TCG2_PHYSICAL_PRESENCE_NO_ACTION;
mPpi->RequestParameter = 0;

WriteBackDataCacheRange((VOID*)mPpi, sizeof(QEMU_TPM_PPI));
return;
}

Expand Down Expand Up @@ -777,6 +779,7 @@ Tcg2ExecutePendingTpmRequest (
mPpi->RequestParameter = 0;

if (mPpi->Response == TCG_PP_OPERATION_RESPONSE_USER_ABORT) {
WriteBackDataCacheRange((VOID*)mPpi, sizeof(QEMU_TPM_PPI));
return;
}

Expand Down Expand Up @@ -806,6 +809,7 @@ Tcg2ExecutePendingTpmRequest (
}

Print (L"Rebooting system to make TPM2 settings in effect\n");
WriteBackDataCacheRange((VOID*)mPpi, sizeof(QEMU_TPM_PPI));
gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
ASSERT (FALSE);
}
Expand Down Expand Up @@ -915,7 +919,7 @@ Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunction (

mPpi->Request = OperationRequest;
mPpi->RequestParameter = RequestParameter;
WriteBackDataCache();
WriteBackDataCacheRange((VOID*)mPpi, sizeof(QEMU_TPM_PPI));

return TCG_PP_SUBMIT_REQUEST_TO_PREOS_SUCCESS;
}
Expand Down

0 comments on commit 4d1eaf5

Please sign in to comment.