From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.88; helo=mga01.intel.com; envelope-from=jiewen.yao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 38EF9201B0386 for ; Tue, 5 Mar 2019 07:52:11 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Mar 2019 07:52:03 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,444,1544515200"; d="scan'208";a="162283761" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga001.jf.intel.com with ESMTP; 05 Mar 2019 07:52:02 -0800 Received: from fmsmsx158.amr.corp.intel.com (10.18.116.75) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 5 Mar 2019 07:52:02 -0800 Received: from shsmsx153.ccr.corp.intel.com (10.239.6.53) by fmsmsx158.amr.corp.intel.com (10.18.116.75) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 5 Mar 2019 07:52:02 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.163]) by SHSMSX153.ccr.corp.intel.com ([169.254.12.121]) with mapi id 14.03.0415.000; Tue, 5 Mar 2019 23:52:00 +0800 From: "Yao, Jiewen" To: Ard Biesheuvel , "edk2-devel@lists.01.org" Thread-Topic: [PATCH 07/10] StandaloneMmPkg/Core: dispatch all drivers at init time Thread-Index: AQHU01gFKVnDrpDqn0WbF8RXFYUmsaX9L//w Date: Tue, 5 Mar 2019 15:51:59 +0000 Message-ID: <74D8A39837DF1E4DA445A8C0B3885C503F54D161@shsmsx102.ccr.corp.intel.com> References: <20190305133248.4828-1-ard.biesheuvel@linaro.org> <20190305133248.4828-8-ard.biesheuvel@linaro.org> In-Reply-To: <20190305133248.4828-8-ard.biesheuvel@linaro.org> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNjAxMmVkZmYtYzUwOC00MjBjLWJlZmYtYmFlYzkzMGUzODAwIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiWE9LeFVvWDdYMjZhMlNDODROQUJCV0lCdmNpV2pYNXZUUm5WNFZBdXBIUmRVeWVPZ0FJY1lqbVVzSVptazcrVSJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH 07/10] StandaloneMmPkg/Core: dispatch all drivers at init time X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Mar 2019 15:52:11 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: jiewen.yao@intel.com > -----Original Message----- > From: Ard Biesheuvel [mailto:ard.biesheuvel@linaro.org] > Sent: Tuesday, March 5, 2019 5:33 AM > To: edk2-devel@lists.01.org > Cc: Ard Biesheuvel ; Achin Gupta > ; Supreeth Venkatesh > ; Yao, Jiewen ; > Leif Lindholm ; Jagadeesh Ujja > > Subject: [PATCH 07/10] StandaloneMmPkg/Core: dispatch all drivers at init > time >=20 > Instead of deferring dispatch of the remaining MM drivers once the > CPU driver has been dispatched, proceed and dispatch all drivers. > This makes sense for standalone MM, since all dispatchable drivers > should be present in the initial firmware volume anyway: dispatch > of additional FVs originating in the non-secure side is not supported. >=20 > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Ard Biesheuvel > --- > StandaloneMmPkg/Core/Dispatcher.c | 92 -------------------- > StandaloneMmPkg/Core/StandaloneMmCore.c | 1 - > 2 files changed, 93 deletions(-) >=20 > diff --git a/StandaloneMmPkg/Core/Dispatcher.c > b/StandaloneMmPkg/Core/Dispatcher.c > index 8a2ad5118d92..bede4832cfb7 100644 > --- a/StandaloneMmPkg/Core/Dispatcher.c > +++ b/StandaloneMmPkg/Core/Dispatcher.c > @@ -575,7 +575,6 @@ MmDispatcher ( > LIST_ENTRY *Link; > EFI_MM_DRIVER_ENTRY *DriverEntry; > BOOLEAN ReadyToRun; > - BOOLEAN PreviousMmEntryPointRegistered; >=20 > DEBUG ((DEBUG_INFO, "MmDispatcher\n")); >=20 > @@ -639,11 +638,6 @@ MmDispatcher ( > DriverEntry->Initialized =3D TRUE; > RemoveEntryList (&DriverEntry->ScheduledLink); >=20 > - // > - // Cache state of MmEntryPointRegistered before calling entry poin= t > - // > - PreviousMmEntryPointRegistered =3D > gMmCorePrivate->MmEntryPointRegistered; > - > // > // For each MM driver, pass NULL as ImageHandle > // > @@ -661,20 +655,6 @@ MmDispatcher ( > DEBUG ((DEBUG_INFO, "StartImage Status - %r\n", Status)); > MmFreePages(DriverEntry->ImageBuffer, > DriverEntry->NumberOfPage); > } > - > - if (!PreviousMmEntryPointRegistered && > gMmCorePrivate->MmEntryPointRegistered) { > - // > - // Return immediately if the MM Entry Point was registered by th= e > MM > - // Driver that was just dispatched. The MM IPL will reinvoke th= e > MM > - // Core Dispatcher. This is required so MM Mode may be > enabled as soon > - // as all the dependent MM Drivers for MM Mode have been > dispatched. > - // Once the MM Entry Point has been registered, then MM Mode > will be > - // used. > - // > - gRequestDispatch =3D TRUE; > - gDispatcherRunning =3D FALSE; > - return EFI_NOT_READY; > - } > } >=20 > // > @@ -903,78 +883,6 @@ MmAddToDriverList ( > return EFI_SUCCESS; > } >=20 > -/** > - This function is the main entry point for an MM handler dispatch > - or communicate-based callback. > - > - Event notification that is fired every time a FV dispatch protocol is = added. > - More than one protocol may have been added when this event is fired, s= o > you > - must loop on MmLocateHandle () to see how many protocols were added > and > - do the following to each FV: > - If the Fv has already been processed, skip it. If the Fv has not been > - processed then mark it as being processed, as we are about to process = it. > - Read the Fv and add any driver in the Fv to the mDiscoveredList.The > - mDiscoveredList is never free'ed and contains variables that define > - the other states the MM driver transitions to.. > - While you are at it read the A Priori file into memory. > - Place drivers in the A Priori list onto the mScheduledQueue. > - > - @param DispatchHandle The unique handle assigned to this handler > by SmiHandlerRegister(). > - @param Context Points to an optional handler context > which was specified when the handler was registered. > - @param CommBuffer A pointer to a collection of data in > memory that will > - be conveyed from a non-MM environment > into an MM environment. > - @param CommBufferSize The size of the CommBuffer. > - > - @return Status Code > - > -**/ > -EFI_STATUS > -EFIAPI > -MmDriverDispatchHandler ( > - IN EFI_HANDLE DispatchHandle, > - IN CONST VOID *Context, OPTIONAL > - IN OUT VOID *CommBuffer, OPTIONAL > - IN OUT UINTN *CommBufferSize OPTIONAL > - ) > -{ > - EFI_STATUS Status; > - > - DEBUG ((DEBUG_INFO, "MmDriverDispatchHandler\n")); > - > - // > - // Execute the MM Dispatcher on any newly discovered FVs and > previously > - // discovered MM drivers that have been discovered but not dispatched. > - // > - Status =3D MmDispatcher (); > - > - // > - // Check to see if CommBuffer and CommBufferSize are valid > - // > - if (CommBuffer !=3D NULL && CommBufferSize !=3D NULL) { > - if (*CommBufferSize > 0) { > - if (Status =3D=3D EFI_NOT_READY) { > - // > - // If a the MM Core Entry Point was just registered, then set fl= ag > to > - // request the MM Dispatcher to be restarted. > - // > - *(UINT8 *)CommBuffer =3D > COMM_BUFFER_MM_DISPATCH_RESTART; > - } else if (!EFI_ERROR (Status)) { > - // > - // Set the flag to show that the MM Dispatcher executed without > errors > - // > - *(UINT8 *)CommBuffer =3D > COMM_BUFFER_MM_DISPATCH_SUCCESS; > - } else { > - // > - // Set the flag to show that the MM Dispatcher encountered an > error > - // > - *(UINT8 *)CommBuffer =3D > COMM_BUFFER_MM_DISPATCH_ERROR; > - } > - } > - } > - > - return EFI_SUCCESS; > -} > - > /** > This function is the main entry point for an MM handler dispatch > or communicate-based callback. > diff --git a/StandaloneMmPkg/Core/StandaloneMmCore.c > b/StandaloneMmPkg/Core/StandaloneMmCore.c > index 74432320bfc7..ec53b8d8bec4 100644 > --- a/StandaloneMmPkg/Core/StandaloneMmCore.c > +++ b/StandaloneMmPkg/Core/StandaloneMmCore.c > @@ -100,7 +100,6 @@ BOOLEAN mInLegacyBoot =3D FALSE; > // > MM_CORE_MMI_HANDLERS mMmCoreMmiHandlers[] =3D { > { MmFvDispatchHandler, &gMmFvDispatchGuid, > NULL, TRUE }, > - { MmDriverDispatchHandler, &gEfiEventDxeDispatchGuid, > NULL, TRUE }, > { MmReadyToLockHandler, &gEfiDxeMmReadyToLockProtocolGuid, > NULL, TRUE }, > { MmEndOfDxeHandler, &gEfiEndOfDxeEventGroupGuid, > NULL, FALSE }, > { MmLegacyBootHandler, &gEfiEventLegacyBootGuid, > NULL, FALSE }, > -- > 2.20.1