public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ming Huang <huangming@linux.alibaba.com>
To: devel@edk2.groups.io, ard.biesheuvel@arm.com,
	sami.mujawar@arm.com, jiewen.yao@intel.com
Cc: yitian.ly@alibaba-inc.com, terui.cl@alibaba-inc.com,
	guoheyi@linux.alibaba.com, ming.huang-@outlook.com,
	Ming Huang <huangming@linux.alibaba.com>
Subject: [PATCH edk2 v1 2/2] edk2/MM: Fix MM Communicate return wrong status issue
Date: Thu, 19 Nov 2020 20:39:28 +0800	[thread overview]
Message-ID: <20201119123928.29501-3-huangming@linux.alibaba.com> (raw)
In-Reply-To: <20201119123928.29501-1-huangming@linux.alibaba.com>

When edk2 driver call EFI_MM_COMMUNICATION_PROTOCOL.Communicate,
the status of mm event can't return exactly to edk2 driver.

Signed-off-by: Ming Huang <huangming@linux.alibaba.com>
---
 ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c           | 2 --
 MdePkg/Include/Pi/PiMmCis.h                                   | 2 +-
 StandaloneMmPkg/Core/StandaloneMmCore.c                       | 5 +++--
 StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/EventHandle.c | 5 +++--
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c b/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c
index 9457eaf1d8..b5b074b56e 100644
--- a/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c
+++ b/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c
@@ -172,12 +172,10 @@ MmCommunication2Communicate (
     // Unexpected error since the CommSize was checked for zero length
     // prior to issuing the SMC
     Status = EFI_OUT_OF_RESOURCES;
-    ASSERT (0);
     break;
 
   default:
     Status = EFI_ACCESS_DENIED;
-    ASSERT (0);
   }
 
   return Status;
diff --git a/MdePkg/Include/Pi/PiMmCis.h b/MdePkg/Include/Pi/PiMmCis.h
index fdf0591a03..762a1fbce5 100644
--- a/MdePkg/Include/Pi/PiMmCis.h
+++ b/MdePkg/Include/Pi/PiMmCis.h
@@ -237,7 +237,7 @@ typedef struct _EFI_MM_ENTRY_CONTEXT {
   @param[in] MmEntryContext  Processor information and functionality needed by MM Foundation.
 **/
 typedef
-VOID
+EFI_STATUS
 (EFIAPI *EFI_MM_ENTRY_POINT)(
   IN CONST EFI_MM_ENTRY_CONTEXT  *MmEntryContext
   );
diff --git a/StandaloneMmPkg/Core/StandaloneMmCore.c b/StandaloneMmPkg/Core/StandaloneMmCore.c
index ac3e2c0b1b..aa59ceb5d7 100644
--- a/StandaloneMmPkg/Core/StandaloneMmCore.c
+++ b/StandaloneMmPkg/Core/StandaloneMmCore.c
@@ -332,7 +332,7 @@ MmEndOfDxeHandler (
                                     needed by MM Foundation.
 
 **/
-VOID
+EFI_STATUS
 EFIAPI
 MmEntryPoint (
   IN CONST EFI_MM_ENTRY_CONTEXT  *MmEntryContext
@@ -398,7 +398,7 @@ MmEntryPoint (
   //
   // Process Asynchronous MMI sources
   //
-  MmiManage (NULL, NULL, NULL, NULL);
+  Status = MmiManage (NULL, NULL, NULL, NULL);
 
   //
   // TBD: Do not use private data structure ?
@@ -410,6 +410,7 @@ MmEntryPoint (
   gMmCorePrivate->InMm = FALSE;
 
   DEBUG ((DEBUG_INFO, "MmEntryPoint Done\n"));
+  return Status;
 }
 
 EFI_STATUS
diff --git a/StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/EventHandle.c b/StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/EventHandle.c
index 3730ee6379..6951d8ae50 100644
--- a/StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/EventHandle.c
+++ b/StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/EventHandle.c
@@ -68,6 +68,7 @@ PiMmStandaloneArmTfCpuDriverEntry (
   EFI_MM_COMMUNICATE_HEADER *GuidedEventContext = NULL;
   EFI_MM_ENTRY_CONTEXT        MmEntryPointContext = {0};
   EFI_STATUS                  Status;
+  EFI_STATUS                  MmRetStatus;
   UINTN                       NsCommBufferSize;
 
   DEBUG ((DEBUG_INFO, "Received event - 0x%x on cpu %d\n", EventId, CpuNumber));
@@ -135,7 +136,7 @@ PiMmStandaloneArmTfCpuDriverEntry (
     return EFI_UNSUPPORTED;
   }
 
-  mMmEntryPoint (&MmEntryPointContext);
+  MmRetStatus = mMmEntryPoint (&MmEntryPointContext);
 
   // Free the memory allocation done earlier and reset the per-cpu context
   ASSERT (GuidedEventContext);
@@ -147,7 +148,7 @@ PiMmStandaloneArmTfCpuDriverEntry (
   }
   PerCpuGuidedEventContext[CpuNumber] = NULL;
 
-  return Status;
+  return MmRetStatus;
 }
 
 EFI_STATUS
-- 
2.17.1


  parent reply	other threads:[~2020-11-19 12:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-19 12:39 [PATCH edk2 v1 0/2] Fix some issues for StandaloneMM Ming Huang
2020-11-19 12:39 ` [PATCH edk2 v1 1/2] edk2/StandaloneMmPkg: Fix several print issues Ming Huang
2020-11-19 12:39 ` Ming Huang [this message]
2020-11-20  5:18 ` 回复: [edk2-devel] [PATCH edk2 v1 0/2] Fix some issues for StandaloneMM gaoliming
  -- strict thread matches above, loose matches on Subject: below --
2020-11-07  8:28 Ming Huang
2020-11-07  8:28 ` [PATCH edk2 v1 2/2] edk2/MM: Fix MM Communicate return wrong status issue Ming Huang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201119123928.29501-3-huangming@linux.alibaba.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox