From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=40.107.15.57; helo=eur01-db5-obe.outbound.protection.outlook.com; envelope-from=achin.gupta@arm.com; receiver=edk2-devel@lists.01.org Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150057.outbound.protection.outlook.com [40.107.15.57]) (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 3E60B2194EB70 for ; Wed, 6 Mar 2019 08:56:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Rs3DrR/96peic+9CKwYgpSbu/S4DX3OLEn/GViAJDKg=; b=M//Ms00iaOMsZgMEfn5+lnhzH8ukWs+osd8mBsRki0ckFLErqoJpad0TJfaYWoWwxfsHBmhdGBtSQg80m0npX46LNLqf6RHRMiEdvnHF7xEJrhJLZwPNFKOItC0r5ku7lYvNfkPso6niEsmczBT3LVDP59SiDELvgHFLdYCD+HA= Received: from AM0PR08MB2980.eurprd08.prod.outlook.com (52.134.92.153) by AM0PR08MB3524.eurprd08.prod.outlook.com (20.177.109.219) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1665.19; Wed, 6 Mar 2019 16:56:56 +0000 Received: from AM0PR08MB2980.eurprd08.prod.outlook.com ([fe80::a133:50fa:bbbe:81a6]) by AM0PR08MB2980.eurprd08.prod.outlook.com ([fe80::a133:50fa:bbbe:81a6%5]) with mapi id 15.20.1665.020; Wed, 6 Mar 2019 16:56:56 +0000 From: Achin Gupta To: Ard Biesheuvel CC: "edk2-devel@lists.01.org" , Supreeth Venkatesh , Jiewen Yao , Leif Lindholm , Jagadeesh Ujja , nd Thread-Topic: [PATCH 07/10] StandaloneMmPkg/Core: dispatch all drivers at init time Thread-Index: AQHU01f36XhTUtj7N0GPVgq7VFR88aX+1HwA Date: Wed, 6 Mar 2019 16:56:56 +0000 Message-ID: <20190306165648.GT21602@mac-ubuntu-vm> 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: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Mutt/1.9.4 (2018-02-28) x-originating-ip: [95.146.138.15] x-clientproxiedby: LO2P265CA0345.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:d::21) To AM0PR08MB2980.eurprd08.prod.outlook.com (2603:10a6:208:5b::25) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Achin.Gupta@arm.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 0f661907-8f08-4fc9-6d87-08d6a254bd65 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB3524; x-ms-traffictypediagnostic: AM0PR08MB3524: nodisclaimer: True x-microsoft-exchange-diagnostics: 1; AM0PR08MB3524; 20:BKSmlvvUZK2zeLyczuo8WU9lgNQtCNZ5K1QZPJXrebh/r/ClWYJT1EZfaAwexjzCcQSC7tH7XXKCQbbRQbRwocOQiYfS6Ebe7Stun0BSQXfDCAtV7Vg4MBxkxTEas7wUoE2IEigQQ2lgLlckFrBCxO2vVMOU6ySE93Og6qV+KnE= x-microsoft-antispam-prvs: x-forefront-prvs: 0968D37274 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6029001)(7916004)(136003)(366004)(376002)(346002)(39860400002)(396003)(199004)(189003)(316002)(105586002)(7736002)(476003)(86362001)(446003)(44832011)(14444005)(6436002)(478600001)(76176011)(6486002)(5660300002)(25786009)(256004)(11346002)(99286004)(1076003)(71200400001)(71190400001)(52116002)(229853002)(72206003)(486006)(53936002)(9686003)(58126008)(33656002)(6512007)(26005)(81156014)(66066001)(8676002)(6506007)(4326008)(386003)(102836004)(6246003)(6916009)(54906003)(186003)(68736007)(14454004)(2906002)(33716001)(305945005)(97736004)(81166006)(6116002)(3846002)(8936002)(106356001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR08MB3524; H:AM0PR08MB2980.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: LfLQgbcL0UpCxrD+iamNrNvufNHBygv9WLVqupn3hfN3Nd1A3653YKRMAHMMuX8yFywBfOIjY52REusIjVORKsp7oJQhHSKWB8ndUKH2E+NmeZ4fxgwZ24EQzqHEZ/MYuZHowXhXdKvys9z7KyG+/T52KDkUngVsU3iNTnDQw+VlJhmfF4tvWXJImizbm79Zv5G9O1cG9kdwSbQoweeG1KFSQZDkhBQZT5WEevKUuDfOZcqahyE2FFMF87p6jga6hkKLujEtZJahkMbaSe+3nYvl4kx0oLnLVL9HGxvVclcJhJS6NSxJ4gxcUuhQYfiAYh7HFDi0Y4ppFES27Z4zH28+0hBtFiHrRWdG7257BS1Qya6o29D/U1o7G1ywiOk2GjG6vZ9A6/JwkoF6gMGEywOgBLcdrZNTZrA/VPGrOGs= MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0f661907-8f08-4fc9-6d87-08d6a254bd65 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Mar 2019 16:56:56.0949 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3524 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: Wed, 06 Mar 2019 16:56:58 -0000 X-List-Received-Date: Wed, 06 Mar 2019 16:56:58 -0000 X-List-Received-Date: Wed, 06 Mar 2019 16:56:58 -0000 X-List-Received-Date: Wed, 06 Mar 2019 16:56:58 -0000 X-List-Received-Date: Wed, 06 Mar 2019 16:56:58 -0000 X-List-Received-Date: Wed, 06 Mar 2019 16:56:58 -0000 X-List-Received-Date: Wed, 06 Mar 2019 16:56:58 -0000 X-List-Received-Date: Wed, 06 Mar 2019 16:56:58 -0000 X-List-Received-Date: Wed, 06 Mar 2019 16:56:58 -0000 X-List-Received-Date: Wed, 06 Mar 2019 16:56:58 -0000 X-List-Received-Date: Wed, 06 Mar 2019 16:56:58 -0000 X-List-Received-Date: Wed, 06 Mar 2019 16:56:58 -0000 X-List-Received-Date: Wed, 06 Mar 2019 16:56:58 -0000 X-List-Received-Date: Wed, 06 Mar 2019 16:56:58 -0000 X-List-Received-Date: Wed, 06 Mar 2019 16:56:58 -0000 X-List-Received-Date: Wed, 06 Mar 2019 16:56:58 -0000 X-List-Received-Date: Wed, 06 Mar 2019 16:56:58 -0000 X-List-Received-Date: Wed, 06 Mar 2019 16:56:58 -0000 X-List-Received-Date: Wed, 06 Mar 2019 16:56:58 -0000 X-List-Received-Date: Wed, 06 Mar 2019 16:56:58 -0000 X-List-Received-Date: Wed, 06 Mar 2019 16:56:58 -0000 X-List-Received-Date: Wed, 06 Mar 2019 16:56:58 -0000 X-List-Received-Date: Wed, 06 Mar 2019 16:56:58 -0000 X-List-Received-Date: Wed, 06 Mar 2019 16:56:58 -0000 X-List-Received-Date: Wed, 06 Mar 2019 16:56:58 -0000 X-List-Received-Date: Wed, 06 Mar 2019 16:56:58 -0000 X-List-Received-Date: Wed, 06 Mar 2019 16:56:58 -0000 X-List-Received-Date: Wed, 06 Mar 2019 16:56:58 -0000 X-List-Received-Date: Wed, 06 Mar 2019 16:56:58 -0000 X-List-Received-Date: Wed, 06 Mar 2019 16:56:58 -0000 X-List-Received-Date: Wed, 06 Mar 2019 16:56:58 -0000 X-List-Received-Date: Wed, 06 Mar 2019 16:56:58 -0000 X-List-Received-Date: Wed, 06 Mar 2019 16:56:58 -0000 X-List-Received-Date: Wed, 06 Mar 2019 16:56:58 -0000 X-List-Received-Date: Wed, 06 Mar 2019 16:56:58 -0000 X-List-Received-Date: Wed, 06 Mar 2019 16:56:58 -0000 X-List-Received-Date: Wed, 06 Mar 2019 16:56:58 -0000 X-List-Received-Date: Wed, 06 Mar 2019 16:56:58 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-ID: <898854294D0EA2439AA33117820F8ADA@eurprd08.prod.outlook.com> Content-Transfer-Encoding: quoted-printable Reviewed-by: achin.gupta@arm.com On Tue, Mar 05, 2019 at 02:32:45PM +0100, Ard Biesheuvel wrote: > 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. > > 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(-) > > diff --git a/StandaloneMmPkg/Core/Dispatcher.c b/StandaloneMmPkg/Core/Dis= patcher.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; > > DEBUG ((DEBUG_INFO, "MmDispatcher\n")); > > @@ -639,11 +638,6 @@ MmDispatcher ( > DriverEntry->Initialized =3D TRUE; > RemoveEntryList (&DriverEntry->ScheduledLink); > > - // > - // Cache state of MmEntryPointRegistered before calling entry poin= t > - // > - PreviousMmEntryPointRegistered =3D gMmCorePrivate->MmEntryPointReg= istered; > - > // > // 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->MmEntryPoin= tRegistered) { > - // > - // 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 dispatc= hed. > - // Once the MM Entry Point has been registered, then MM Mode wil= l be > - // used. > - // > - gRequestDispatch =3D TRUE; > - gDispatcherRunning =3D FALSE; > - return EFI_NOT_READY; > - } > } > > // > @@ -903,78 +883,6 @@ MmAddToDriverList ( > return EFI_SUCCESS; > } > > -/** > - 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 an= d > - 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 wa= s specified when the handler was registered. > - @param CommBuffer A pointer to a collection of data in memory th= at 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 previousl= y > - // 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 er= ror > - // > - *(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/Co= re/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, T= RUE }, > - { MmDriverDispatchHandler, &gEfiEventDxeDispatchGuid, NULL, T= RUE }, > { MmReadyToLockHandler, &gEfiDxeMmReadyToLockProtocolGuid, NULL, T= RUE }, > { MmEndOfDxeHandler, &gEfiEndOfDxeEventGroupGuid, NULL, F= ALSE }, > { MmLegacyBootHandler, &gEfiEventLegacyBootGuid, NULL, F= ALSE }, > -- > 2.20.1 >