From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=40.107.5.62; helo=eur03-ve1-obe.outbound.protection.outlook.com; envelope-from=achin.gupta@arm.com; receiver=edk2-devel@lists.01.org Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50062.outbound.protection.outlook.com [40.107.5.62]) (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 E83762194EB70 for ; Wed, 6 Mar 2019 08:59:12 -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=mANrSbKMj66H1uSb3225lVYwDAUInfBUUXWVqBIQWPY=; b=rRNktkNdoNrdklh1EjYjaZeq7qIgyw8q79F1RNgnZR6nIstqlGveUE4cXz8F+Coe+Cg9ToA3CM+bgqWNmPQqJXU5a7qzWHkScR8gRXMuc5PvDJTSz+ZkhjDoInKZGlksDYrClUeZtlbnpL2+mglVUAViR7IJcwRyn1qpZcSvAIQ= Received: from AM0PR08MB2980.eurprd08.prod.outlook.com (52.134.92.153) by AM0PR08MB4481.eurprd08.prod.outlook.com (20.179.36.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1686.17; Wed, 6 Mar 2019 16:59:10 +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:59:10 +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 09/10] StandaloneMmPkg/Core: remove legacy boot support Thread-Index: AQHU01f4DtrDWKZOrki2IO4C9nCGS6X+1R2A Date: Wed, 6 Mar 2019 16:59:10 +0000 Message-ID: <20190306165902.GW21602@mac-ubuntu-vm> References: <20190305133248.4828-1-ard.biesheuvel@linaro.org> <20190305133248.4828-10-ard.biesheuvel@linaro.org> In-Reply-To: <20190305133248.4828-10-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: LO2P265CA0191.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a::35) 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: 623ed774-19f0-4ddd-1c79-08d6a2550d53 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:AM0PR08MB4481; x-ms-traffictypediagnostic: AM0PR08MB4481: nodisclaimer: True x-microsoft-exchange-diagnostics: 1; AM0PR08MB4481; 20:Ezt3sgQeP69gVTKHUufP9CETlLKI6Ap9dImNAE3ElxlrqHaoBnWkYd/ra/R81AMe+L1JrtOFkLYOxXzFcqA8PnQiXdDn7uqsIhNLDetYLbcgFfVLzSAF1kCm5t24A4xBIV+T0QlJ5SzQBk5kMIbEDghOYdkun7glr7qFvNRe45U= x-microsoft-antispam-prvs: x-forefront-prvs: 0968D37274 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6029001)(7916004)(366004)(39860400002)(396003)(346002)(136003)(376002)(199004)(189003)(14444005)(256004)(478600001)(9686003)(19627235002)(486006)(2906002)(44832011)(53936002)(6512007)(476003)(11346002)(6916009)(81166006)(6506007)(72206003)(8936002)(7736002)(8676002)(81156014)(229853002)(52116002)(3846002)(6246003)(6116002)(102836004)(33656002)(25786009)(386003)(99286004)(4326008)(76176011)(66066001)(446003)(5660300002)(105586002)(58126008)(54906003)(316002)(68736007)(106356001)(1076003)(86362001)(14454004)(33716001)(305945005)(6436002)(71190400001)(71200400001)(186003)(97736004)(26005)(6486002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR08MB4481; 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: 8WKGzk58IEHNMUqg8njeljPYfjYMlG6utPTIpbdQrDuFqNZDKzPDgruwXD1ufgbYMohBq/3fjjl4i7pctXteGuHgoqZu/vi22berLr05LrSKn8iuQpqLW+o4kViMJuWkWHiVx6AmwkZ1Qj+5NuB7xs+4ySdg6Z8G/KrO5Sr+ntyW0G0qzpC8LO/2xTHbSYeKOTa6r+FW85RRMDyJ6jCUmTn4CWFDe32VXeXT2fSTuhr6cHIQiNX3VD1EkI4IqDw06NQSJmKYufyn1j2HHbuFoChCbHZwC8cwQiewIW79jV6bVjJm9Wg2rp9A+6xWHMr+uQ6ejxX/u22xS+uZmIXn/WXUlig5CGstEKDrBqJUkpol/EG1lJdvjXYxcMtTNTbWpYNBRBRBtkN/g1V7u7G/qq9iZC5mqcPHwO8e/596ues= MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: 623ed774-19f0-4ddd-1c79-08d6a2550d53 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Mar 2019 16:59:10.2937 (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: AM0PR08MB4481 Subject: Re: [PATCH 09/10] StandaloneMmPkg/Core: remove legacy boot support 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:59:13 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: quoted-printable Reviewed-by: achin.gupta@arm.com On Tue, Mar 05, 2019 at 02:32:47PM +0100, Ard Biesheuvel wrote: > Remove the support for booting 'legacy' (i.e., non-UEFI boot) OSes. > > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Ard Biesheuvel > --- > StandaloneMmPkg/Core/StandaloneMmCore.h | 22 ---- > StandaloneMmPkg/Core/StandaloneMmCore.c | 124 ++++++-------------- > 2 files changed, 33 insertions(+), 113 deletions(-) > > diff --git a/StandaloneMmPkg/Core/StandaloneMmCore.h b/StandaloneMmPkg/Co= re/StandaloneMmCore.h > index 74338dc9da0d..5d336b3dbbf6 100644 > --- a/StandaloneMmPkg/Core/StandaloneMmCore.h > +++ b/StandaloneMmPkg/Core/StandaloneMmCore.h > @@ -635,28 +635,6 @@ MmDriverDispatchHandler ( > > @return Status Code > > -**/ > -EFI_STATUS > -EFIAPI > -MmLegacyBootHandler ( > - IN EFI_HANDLE DispatchHandle, > - IN CONST VOID *Context, OPTIONAL > - IN OUT VOID *CommBuffer, OPTIONAL > - IN OUT UINTN *CommBufferSize OPTIONAL > - ); > - > -/** > - This function is the main entry point for an MM handler dispatch > - or communicate-based callback. > - > - @param DispatchHandle The unique handle assigned to this handler by = MmiHandlerRegister(). > - @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 > diff --git a/StandaloneMmPkg/Core/StandaloneMmCore.c b/StandaloneMmPkg/Co= re/StandaloneMmCore.c > index 766cdb5c848c..fb6b3055e9c6 100644 > --- a/StandaloneMmPkg/Core/StandaloneMmCore.c > +++ b/StandaloneMmPkg/Core/StandaloneMmCore.c > @@ -87,21 +87,12 @@ EFI_MM_SYSTEM_TABLE gMmCoreMmst =3D { > MmiHandlerUnRegister > }; > > -// > -// Flag to determine if the platform has performed a legacy boot. > -// If this flag is TRUE, then the runtime code and runtime data associat= ed with the > -// MM IPL are converted to free memory, so the MM Core must guarantee th= at is > -// does not touch of the code/data associated with the MM IPL if this fl= ag is TRUE. > -// > -BOOLEAN mInLegacyBoot =3D FALSE; > - > // > // Table of MMI Handlers that are registered by the MM Core when it is i= nitialized > // > MM_CORE_MMI_HANDLERS mMmCoreMmiHandlers[] =3D { > { MmReadyToLockHandler, &gEfiDxeMmReadyToLockProtocolGuid, NULL, T= RUE }, > { MmEndOfDxeHandler, &gEfiEndOfDxeEventGroupGuid, NULL, F= ALSE }, > - { MmLegacyBootHandler, &gEfiEventLegacyBootGuid, NULL, F= ALSE }, > { MmExitBootServiceHandler,&gEfiEventExitBootServicesGuid, NULL, F= ALSE }, > { MmReadyToBootHandler, &gEfiEventReadyToBootGuid, NULL, F= ALSE }, > { NULL, NULL, NULL, F= ALSE }, > @@ -142,47 +133,6 @@ MmEfiNotAvailableYetArg5 ( > return EFI_NOT_AVAILABLE_YET; > } > > -/** > - Software MMI handler that is called when a Legacy Boot event is signal= ed. The MM > - Core uses this signal to know that a Legacy Boot has been performed an= d that > - gMmCorePrivate that is shared between the UEFI and MM execution enviro= nments can > - not be accessed from MM anymore since that structure is considered fre= e memory by > - a legacy OS. > - > - @param DispatchHandle The unique handle assigned to this handler by = MmiHandlerRegister(). > - @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 > -MmLegacyBootHandler ( > - IN EFI_HANDLE DispatchHandle, > - IN CONST VOID *Context, OPTIONAL > - IN OUT VOID *CommBuffer, OPTIONAL > - IN OUT UINTN *CommBufferSize OPTIONAL > - ) > -{ > - EFI_HANDLE MmHandle; > - EFI_STATUS Status =3D EFI_SUCCESS; > - > - if (!mInLegacyBoot) { > - MmHandle =3D NULL; > - Status =3D MmInstallProtocolInterface ( > - &MmHandle, > - &gEfiEventLegacyBootGuid, > - EFI_NATIVE_INTERFACE, > - NULL > - ); > - } > - mInLegacyBoot =3D TRUE; > - return Status; > -} > - > /** > Software MMI handler that is called when a ExitBoot Service event is s= ignaled. > > @@ -396,7 +346,6 @@ MmEntryPoint ( > { > EFI_STATUS Status; > EFI_MM_COMMUNICATE_HEADER *CommunicateHeader; > - BOOLEAN InLegacyBoot; > > DEBUG ((DEBUG_INFO, "MmEntryPoint ...\n")); > > @@ -413,44 +362,42 @@ MmEntryPoint ( > // > // If a legacy boot has occured, then make sure gMmCorePrivate is not = accessed > // > - InLegacyBoot =3D mInLegacyBoot; > - if (!InLegacyBoot) { > - // > - // TBD: Mark the InMm flag as TRUE > - // > - gMmCorePrivate->InMm =3D TRUE; > > + // > + // TBD: Mark the InMm flag as TRUE > + // > + gMmCorePrivate->InMm =3D TRUE; > + > + // > + // Check to see if this is a Synchronous MMI sent through the MM Commu= nication > + // Protocol or an Asynchronous MMI > + // > + if (gMmCorePrivate->CommunicationBuffer !=3D 0) { > // > - // Check to see if this is a Synchronous MMI sent through the MM Com= munication > - // Protocol or an Asynchronous MMI > + // Synchronous MMI for MM Core or request from Communicate protocol > // > - if (gMmCorePrivate->CommunicationBuffer !=3D 0) { > + if (!MmIsBufferOutsideMmValid ((UINTN)gMmCorePrivate->CommunicationB= uffer, gMmCorePrivate->BufferSize)) { > + // > + // If CommunicationBuffer is not in valid address scope, return EF= I_INVALID_PARAMETER > + // > + gMmCorePrivate->CommunicationBuffer =3D 0; > + gMmCorePrivate->ReturnStatus =3D EFI_INVALID_PARAMETER; > + } else { > + CommunicateHeader =3D (EFI_MM_COMMUNICATE_HEADER *)(UINTN)gMmCoreP= rivate->CommunicationBuffer; > + gMmCorePrivate->BufferSize -=3D OFFSET_OF (EFI_MM_COMMUNICATE_HEAD= ER, Data); > + Status =3D MmiManage ( > + &CommunicateHeader->HeaderGuid, > + NULL, > + CommunicateHeader->Data, > + (UINTN *)&gMmCorePrivate->BufferSize > + ); > // > - // Synchronous MMI for MM Core or request from Communicate protoco= l > + // Update CommunicationBuffer, BufferSize and ReturnStatus > + // Communicate service finished, reset the pointer to CommBuffer t= o NULL > // > - if (!MmIsBufferOutsideMmValid ((UINTN)gMmCorePrivate->Communicatio= nBuffer, gMmCorePrivate->BufferSize)) { > - // > - // If CommunicationBuffer is not in valid address scope, return = EFI_INVALID_PARAMETER > - // > - gMmCorePrivate->CommunicationBuffer =3D 0; > - gMmCorePrivate->ReturnStatus =3D EFI_INVALID_PARAMETER; > - } else { > - CommunicateHeader =3D (EFI_MM_COMMUNICATE_HEADER *)(UINTN)gMmCor= ePrivate->CommunicationBuffer; > - gMmCorePrivate->BufferSize -=3D OFFSET_OF (EFI_MM_COMMUNICATE_HE= ADER, Data); > - Status =3D MmiManage ( > - &CommunicateHeader->HeaderGuid, > - NULL, > - CommunicateHeader->Data, > - (UINTN *)&gMmCorePrivate->BufferSize > - ); > - // > - // Update CommunicationBuffer, BufferSize and ReturnStatus > - // Communicate service finished, reset the pointer to CommBuffer= to NULL > - // > - gMmCorePrivate->BufferSize +=3D OFFSET_OF (EFI_MM_COMMUNICATE_HE= ADER, Data); > - gMmCorePrivate->CommunicationBuffer =3D 0; > - gMmCorePrivate->ReturnStatus =3D (Status =3D=3D EFI_SUCCESS) ? E= FI_SUCCESS : EFI_NOT_FOUND; > - } > + gMmCorePrivate->BufferSize +=3D OFFSET_OF (EFI_MM_COMMUNICATE_HEAD= ER, Data); > + gMmCorePrivate->CommunicationBuffer =3D 0; > + gMmCorePrivate->ReturnStatus =3D (Status =3D=3D EFI_SUCCESS) ? EFI= _SUCCESS : EFI_NOT_FOUND; > } > } > > @@ -464,14 +411,9 @@ MmEntryPoint ( > // > > // > - // If a legacy boot has occured, then make sure gMmCorePrivate is not = accessed > + // Clear the InMm flag as we are going to leave MM > // > - if (!InLegacyBoot) { > - // > - // Clear the InMm flag as we are going to leave MM > - // > - gMmCorePrivate->InMm =3D FALSE; > - } > + gMmCorePrivate->InMm =3D FALSE; > > DEBUG ((DEBUG_INFO, "MmEntryPoint Done\n")); > } > -- > 2.20.1 >