Skip to content

Commit

Permalink
[C-P] ArmPkg/Drivers/StandaloneMmCpu: Avoid redundant copy
Browse files Browse the repository at this point in the history
When MM Communicate message length is zero, then avoid the
overhead of copying the buffers.

Signed-off-by: Omkar <omkar.kulkarni@arm.com>
Change-Id: I39f30cb315f46235c9ce39922a0814ae089f51cf
  • Loading branch information
omkkul01 authored and kenlautner committed Dec 19, 2023
1 parent 6015ae1 commit d3299b7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ArmPkg/Drivers/StandaloneMmCpu/EventHandle.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,9 @@ PiMmStandaloneArmTfCpuDriverEntry (

// Free the memory allocation done earlier and reset the per-cpu context
ASSERT (GuidedEventContext);
CopyMem ((VOID *)NsCommBufferAddr, (CONST VOID *)GuidedEventContext, NsCommBufferSize);
if (GuidedEventContext->MessageLength) {
CopyMem ((VOID *)NsCommBufferAddr, (CONST VOID *)GuidedEventContext, NsCommBufferSize);
}

Status = mMmst->MmFreePool ((VOID *)GuidedEventContext);
if (Status != EFI_SUCCESS) {
Expand Down

0 comments on commit d3299b7

Please sign in to comment.