From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (NAM10-MW2-obe.outbound.protection.outlook.com [40.92.42.107]) by mx.groups.io with SMTP id smtpd.web11.5617.1614218002218032757 for ; Wed, 24 Feb 2021 17:53:22 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@outlook.com header.s=selector1 header.b=Nr5VzI92; spf=pass (domain: outlook.com, ip: 40.92.42.107, mailfrom: kun.q@outlook.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D1bf658ltHfaUM0IFBfId/kIsR+GNyqnwHLxVHmQSASnLYwTTFg50cHXqL79TlhOXTMFSsj+bWOPYdLWqeU6awOKMiiO2Uq15nOruduaoa/dbRSU2jKwUCouDF0V2LSmXHLGhFSw3MOHQCLMxqKm5H06y3uBx6wtgaS9NwmIc95lZ7VDCVNQd9FHUaLICUR3YhoXu3qrn7maTj8h3+01SlRc8aFxpSmJQRjMM1y6iKvjyEsUFTrvFyFjwTaDDxafG1hDaRKbrqeCbhPqA68aG6mCRuEm5ZbE0SVHmP7stGWM3bUpP8y1dYO3iGJsqkOzeDJmDggorA1GKOgBxGFwOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NV6W4QPcZ+1QGvnz47a7dnKZt/W6rKzwb/g2RBqh67A=; b=ZPToTVT+aOc8VkJas0xnFFQ40Q3COCG+4E81mfibutennVMgWiOcX6Q07oN68ygIWcbyOHZ1TLxRTIkte6zaFiroLMkHQ2QG7s82u35WVg/nFoM65LFfN2+KmH/xumeT5baXaW7Fpl9OFpnvRaZ6lv9iwTA7QTZvSAinf4TRQLIcumA58HWJx90Wij4ujEuN+/7aQhSDzRJsbJptLfalQCw8+jUELnVXX1Bfym1iyPOll7dGe71cyeqsGdkDQRfEws+GSPrL+d8Lj1SFdwm6qbDAkC8bK6NIH/r0U/e9G23a0dR2hjGEWQOIdVjVWROpqnE9bTZmViRULf0SKoD3JA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NV6W4QPcZ+1QGvnz47a7dnKZt/W6rKzwb/g2RBqh67A=; b=Nr5VzI92fzlPykpzHQYPsFvGjOqJxU62zlzXynzfJrUI51QxCGo6EVBWoG5a927lLkUS5Ouw5kGbsobm8YP+oyMSVYVEL2uhLYfM/2VyRNE1E+VkYyMkBGZuJDFtHNgid6tlQKmLJ1LiMuaYe6DpBl7a9Ntl1gJg4m1ctHR/VWGKHsoqVXnz510VzI4gysFdf/B+ZRYncrd1xzwE3lt4Bfo1fngtvlTBO0xtXii6+TIKBK+CNkGbe9b/by9Xblevga2rGIL0mBVKCYEABcrDfs5MDlZoGY7GSX++WCSgBRY3Zg260lKGsidxGSlEtknnTSURm+x+IgpUBrp5ZkOtJw== Received: from DM6NAM10FT022.eop-nam10.prod.protection.outlook.com (2a01:111:e400:7e86::40) by DM6NAM10HT111.eop-nam10.prod.protection.outlook.com (2a01:111:e400:7e86::260) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27; Thu, 25 Feb 2021 01:53:20 +0000 Received: from MWHPR06MB3102.namprd06.prod.outlook.com (2a01:111:e400:7e86::42) by DM6NAM10FT022.mail.protection.outlook.com (2a01:111:e400:7e86::92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.19 via Frontend Transport; Thu, 25 Feb 2021 01:53:20 +0000 Received: from MWHPR06MB3102.namprd06.prod.outlook.com ([fe80::d4ee:1260:6f53:3f7b]) by MWHPR06MB3102.namprd06.prod.outlook.com ([fe80::d4ee:1260:6f53:3f7b%7]) with mapi id 15.20.3868.032; Thu, 25 Feb 2021 01:53:20 +0000 From: "Kun Qin" To: "devel@edk2.groups.io" , "jiewen.yao@intel.com" , "Wu, Hao A" , gaoliming , "Kinney, Michael D" , "Liu, Zhiguang" CC: "Wang, Jian J" , "Dong, Eric" , "Ni, Ray" , "Yao, Jiewen" Subject: Re: [edk2-devel] [PATCH v2 1/6] MdeModulePkg: DxeMmUnblockMemoryLib: Added definition and null instance Thread-Topic: [edk2-devel] [PATCH v2 1/6] MdeModulePkg: DxeMmUnblockMemoryLib: Added definition and null instance Thread-Index: AQHW/0uUyofdi3a8+UuCoenhRzNoH6pk0TcGgAA6fQCAARwymoAAce8AgAABuICAAAIkf4ABkuzt Date: Thu, 25 Feb 2021 01:53:20 +0000 Message-ID: References: <20210210012457.315-1-kun.q@outlook.com>, , ,,<16668BE524C457EA.19172@groups.io> In-Reply-To: <16668BE524C457EA.19172@groups.io> Accept-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:896E3CF0FEA0853D539F44DB41404DD925C78F0CF12E0D7DC22EFEC375FA8252;UpperCasedChecksum:E06C0641E58A5585DAC3B1F4E39C39141EC7B1E803F657F06E2CD2ABD233A893;SizeAsReceived:7806;Count:44 x-tmn: [N6xgUr4mwINLylZ524k5eL+KJjGMImYz] x-ms-publictraffictype: Email x-incomingheadercount: 44 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: dcfca39c-e2e2-4c53-316f-08d8d93020be x-ms-traffictypediagnostic: DM6NAM10HT111: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Ll/xHZwwtdFHYtFzI+aXlz4oPUyql0owPgNOG2Fz1rAMn7q6qf+KVZ1eC6WARNGxmY8+rL53umwZm/G8uwr85CF4OZvPSOpoYOmBqdaZoIqplQMauGjmMP7SjG4uR3kxpgUZR2jG4s+LmV6lBJEQt9fA9+Gb48W0izg2s7FDjkMBdzDHZO6RgYrcVy8KUnAVGpF7bfL90/zu5cLBPxHHs0mK0sz9NUvo9u9UilJcgDdX0w+rniTNdatyue944HUEp/7WQcCcCemdC6YeQr31bdBeuFJbMcEOQT471ylgEySTrN/VX0R6H9om5/CgptXcxtP48You7lXi0TaXrmyf3hfKtuw/sDVeZ9x0wG2udG8hdSkwvD75vtQ/JZ+PEUeYePsvJPG69gjjrt10jH9JB3W9CnNHKLovhFdNEJKTPT+QyuYT5WZMF7E5EPJuj39o x-ms-exchange-antispam-messagedata: 6CCUHgPmLY7kNcdlncP4zA6W/S87I2QcUSx0lXMaNeETJInNYptX+IkK+J8aea3ORMdRfUOiO5mGyNh2iS9uyiaL5FVBVpL7ugXLgrkzQ4w0vQ4qLSBAcUK7ZSyTr3u90C71FbFUsVV6larbLVwa3w== x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-AuthSource: DM6NAM10FT022.eop-nam10.prod.protection.outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: dcfca39c-e2e2-4c53-316f-08d8d93020be X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Feb 2021 01:53:20.3019 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6NAM10HT111 X-Groupsio-MsgNum: 72163 Content-Language: en-US Content-Type: multipart/related; boundary="_004_MWHPR06MB31027A0C9B12426B7B003755F39E9MWHPR06MB3102namp_"; type="multipart/alternative" --_004_MWHPR06MB31027A0C9B12426B7B003755F39E9MWHPR06MB3102namp_ Content-Type: multipart/alternative; boundary="_000_MWHPR06MB31027A0C9B12426B7B003755F39E9MWHPR06MB3102namp_" --_000_MWHPR06MB31027A0C9B12426B7B003755F39E9MWHPR06MB3102namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Liming/Mike/Jiewen, Do you have any opinions/objections on putting this interface definition i= n MdePkg as suggested by Hao? The reason it might be suitable for MdePkg is= because of its similarity with SmmMemLib. But I understand that this is no= t an industrial standard interface (at least not yet). Could you please she= d some light on your thoughts here? Any input is appreciated. Regards, Kun From: Kun Qin Sent: Tuesday, February 23, 2021 17:48 To: devel@edk2.groups.io; jiewen.yao@intel.co= m; Wu, Hao A; gaoli= ming; Kinney, Michael D; Liu, Zhiguang Cc: Wang, Jian J; Dong, Eric; Ni, Ray; Yao, Jiewen Subject: Re: [edk2-devel] [PATCH v2 1/6] MdeModulePkg: DxeMmUnblockMemoryL= ib: Added definition and null instance Hi Jiewen, I agree with your assessment that it could have a PEI and potentially MM = instance. Will remove the prefix and change them to `MmUnblockMemoryLib` in= v3 patches. Thanks for the input. Regards, Kun From: Yao, Jiewen Sent: Tuesday, February 23, 2021 17:33 To: Wu, Hao A; Kun Qin; devel@edk2.groups.io; gaoliming; Kinney, Michael D= ; Liu, Zhiguang Cc: Wang, Jian J; Dong, Eric; Ni, Ray; Yao, Jiewen Subject: Re: [edk2-devel] [PATCH v2 1/6] MdeModulePkg: DxeMmUnblockMemoryL= ib: Added definition and null instance I feel the name is confusing. The class name is DxeMmUnblockMemoryLib. But actually, this is not related= to DXE phase. I believe, it is also applicable to PEI phase, if we have a PEI instance. = Please correct me if I am wrong. Also, we can have SMM instance, right? If that is true, then I prefer to remove Dxe prefix. From: Wu, Hao A Sent: Wednesday, February 24, 2021 9:27 AM To: Kun Qin ; devel@edk2.groups.io; Yao, Jiewen ; gaoliming ; Kinney, Michael D ; Liu, Zhiguang Cc: Wang, Jian J ; Dong, Eric = ; Ni, Ray Subject: RE: [edk2-devel] [PATCH v2 1/6] MdeModulePkg: DxeMmUnblockMemoryL= ib: Added definition and null instance Thanks Kun, For putting the new library in MdePkg, I am not sure whether this is a sim= ilar case to SmmMemLib. I looped Jiewen, Liming and Mike to check if they have comments on this. Best Regards, Hao Wu From: Kun Qin > Sent: Wednesday, February 24, 2021 3:30 AM To: devel@edk2.groups.io; Wu, Hao A >; Yao, Jiewen >; gaoliming >; Kinney, Michael D >; Liu, Zhiguang > Cc: Wang, Jian J >; Do= ng, Eric >; Ni, Ray > Subject: RE: [edk2-devel] [PATCH v2 1/6] MdeModulePkg: DxeMmUnblockMemoryL= ib: Added definition and null instance Hi Hao, Thanks for the suggestion. I can move the library to MdePkg similar to Smm= MemLib and add the change for OVMF. Liming/Zhiguang, I am happy to prepare patches to cover the dependency change in ed2-platfo= rm in a separate patch series. But please let me know if you would like to = proceed otherwise. Thanks, Kun From: Wu, Hao A Sent: Monday, February 22, 2021 17:42 To: Kun Qin; devel@edk2.groups.io; Yao, Jiewen; gaoliming; Kinney, Michael D; Liu, Zhiguang Cc: Wang, Jian J; Dong, Eric; Ni, Ray Subject: Re: [edk2-devel] [PATCH v2 1/6] MdeModulePkg: DxeMmUnblockMemoryL= ib: Added definition and null instance Hello Kun, Sorry for the delayed response. Except for missing the UNI file for the newly added library, I do not have= other comment for the implementation at this moment. But I am wondering if this library can be added into the MdePkg as the cas= e for MdePkg\Library\SmmMemLib\ I have looped in Jiewen, Liming and Mike for comments. Also, since: * New library dependency for VariableSmmRuntimeDxe.inf * INF file separation and new library dependency in Tcg2Smm I think the series needs to prepare the changes for platforms under edk2 (= OVMF) and edk2-platforms repositories that consume the above 2 modules. I am not exactly sure on how this should be handled within edk2-platforms,= so I added Liming and Zhiguang here for comments. Best Regards, Hao Wu From: Kun Qin > Sent: Tuesday, February 23, 2021 6:15 AM To: devel@edk2.groups.io; Wu, Hao A > Cc: Wang, Jian J >; Do= ng, Eric >; Ni, Ray >; Yao, Jiewen > Subject: RE: [PATCH v2 1/6] MdeModulePkg: DxeMmUnblockMemoryLib: Added def= inition and null instance Hi Hao, The patch series was resent with intended usage in VariableRuntime and Tcg= 2 drivers. Could you please provide feedback on them? Any input is apprecia= ted. Regards, Kun From: Kun Qin Sent: Tuesday, February 9, 2021 17:25 To: devel@edk2.groups.io Cc: Jian J Wang; Hao A Wu; Eric Dong; Ray Ni; Jiewen Yao Subject: [PATCH v2 1/6] MdeModulePkg: DxeMmUnblockMemoryLib: Added definit= ion and null instance REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3168 This interface definition provides an abstraction layer for DXE drivers to request certain memory blocks to be mapped/unblocked for accessibility inside MM environment. Cc: Jian J Wang > Cc: Hao A Wu > Cc: Eric Dong > Cc: Ray Ni > Cc: Jiewen Yao > Signed-off-by: Kun Qin > --- Notes: v2: - Resend with practical usage. No change [Hao] MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemoryLibNull.c = | 40 ++++++++++++++++++++ MdeModulePkg/Include/Library/DxeMmUnblockMemoryLib.h = | 40 ++++++++++++++++++++ MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemoryLibNull.inf = | 29 ++++++++++++++ MdeModulePkg/MdeModulePkg.dec = | 5 +++ MdeModulePkg/MdeModulePkg.dsc = | 2 + 5 files changed, 116 insertions(+) diff --git a/MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemory= LibNull.c b/MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemoryLi= bNull.c new file mode 100644 index 000000000000..774a7e41cfb0 --- /dev/null +++ b/MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemoryLibNull= .c @@ -0,0 +1,40 @@ +/** @file + Null instance of MM Unblock Page Library. + + This library provides an abstraction layer of requesting certain page a= ccess to be unblocked + by MM environment if applicable. + + Copyright (c), Microsoft Corporation. + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +/** + This API provides a way to unblock certain data pages to be accessible = inside MM environment. + + @param UnblockAddress The address of buffer caller requests t= o unblock, the address + has to be page aligned. + @param NumberOfPages The number of pages requested to be unb= locked from MM + environment. + + @return EFI_SUCCESS The request goes through successfully. + @return EFI_NOT_AVAILABLE_YET The requested functionality is not prod= uced yet. + @return EFI_UNSUPPORTED The requested functionality is not supp= orted on current platform. + @return EFI_SECURITY_VIOLATION The requested address failed to pass se= curity check for + unblocking. + @return EFI_INVALID_PARAMETER Input address either NULL pointer or no= t page aligned. + @return EFI_ACCESS_DENIED The request is rejected due to system h= as passed certain boot + phase. + +**/ +EFI_STATUS +EFIAPI +DxeMmUnblockMemoryRequest ( + IN EFI_PHYSICAL_ADDRESS UnblockAddress, + IN UINT64 NumberOfPages + ) +{ + return EFI_UNSUPPORTED; +} diff --git a/MdeModulePkg/Include/Library/DxeMmUnblockMemoryLib.h b/MdeMod= ulePkg/Include/Library/DxeMmUnblockMemoryLib.h new file mode 100644 index 000000000000..8b63eb74a078 --- /dev/null +++ b/MdeModulePkg/Include/Library/DxeMmUnblockMemoryLib.h @@ -0,0 +1,40 @@ +/** @file + MM Unblock Memory Library Interface. + + This library provides an abstraction layer of requesting certain page a= ccess to be unblocked + by MM environment if applicable. + + Copyright (c), Microsoft Corporation. + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _DXE_MM_UNBLOCK_MEMORY_LIB_H_ +#define _DXE_MM_UNBLOCK_MEMORY_LIB_H_ + +/** + This API provides a way to unblock certain data pages to be accessible = inside MM environment. + + @param UnblockAddress The address of buffer caller requests t= o unblock, the address + has to be page aligned. + @param NumberOfPages The number of pages requested to be unb= locked from MM + environment. + + @return EFI_SUCCESS The request goes through successfully. + @return EFI_NOT_AVAILABLE_YET The requested functionality is not prod= uced yet. + @return EFI_UNSUPPORTED The requested functionality is not supp= orted on current platform. + @return EFI_SECURITY_VIOLATION The requested address failed to pass se= curity check for + unblocking. + @return EFI_INVALID_PARAMETER Input address either NULL pointer or no= t page aligned. + @return EFI_ACCESS_DENIED The request is rejected due to system h= as passed certain boot + phase. + +**/ +EFI_STATUS +EFIAPI +DxeMmUnblockMemoryRequest ( + IN EFI_PHYSICAL_ADDRESS UnblockAddress, + IN UINT64 NumberOfPages +); + +#endif // _DXE_MM_UNBLOCK_MEMORY_LIB_H_ diff --git a/MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemory= LibNull.inf b/MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemory= LibNull.inf new file mode 100644 index 000000000000..e40462e5ab81 --- /dev/null +++ b/MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemoryLibNull= .inf @@ -0,0 +1,29 @@ +## @file +# Null instance of MM Unblock Page Library. +# +# This library provides an abstraction layer of requesting certain page = access to be unblocked +# by MM environment if applicable. +# +# Copyright (c), Microsoft Corporation. +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +# +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D DxeMmUnblockMemoryLibNull + FILE_GUID =3D 9E890F68-5C95-4C31-95DD-59E6286F85EA + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D DxeMmUnblockMemoryLib + +# +# VALID_ARCHITECTURES =3D IA32 X64 +# + +[Sources] + DxeMmUnblockMemoryLibNull.c + +[Packages] + MdePkg/MdePkg.dec diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index 148395511034..1bb5017da2c5 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -154,6 +154,11 @@ [LibraryClasses] # VariablePolicyHelperLib|Include/Library/VariablePolicyHelperLib.h + ## @libraryclass This library provides an interface for DXE drivers t= o request MM environment + # to map/unblock a memory region for accessibility inside MM. + # + DxeMmUnblockMemoryLib|Include/Library/DxeMmUnblockMemoryLib.h + [Guids] ## MdeModule package token space guid # Include/Guid/MdeModulePkgTokenSpace.h diff --git a/MdeModulePkg/MdeModulePkg.dsc b/MdeModulePkg/MdeModulePkg.dsc index 7ca4a1bb3080..2bc6b8730b8b 100644 --- a/MdeModulePkg/MdeModulePkg.dsc +++ b/MdeModulePkg/MdeModulePkg.dsc @@ -100,6 +100,7 @@ [LibraryClasses] SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf DisplayUpdateProgressLib|MdeModulePkg/Library/DisplayUpdateProgressLibG= raphics/DisplayUpdateProgressLibGraphics.inf VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/Va= riablePolicyHelperLib.inf + DxeMmUnblockMemoryLib|MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmU= nblockMemoryLibNull.inf [LibraryClasses.EBC.PEIM] IoLib|MdePkg/Library/PeiIoLibCpuIo/PeiIoLibCpuIo.inf @@ -332,6 +333,7 @@ [Components] MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf MdeModulePkg/Library/DisplayUpdateProgressLibGraphics/DisplayUpdateProg= ressLibGraphics.inf MdeModulePkg/Library/DisplayUpdateProgressLibText/DisplayUpdateProgress= LibText.inf + MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemoryLibNull.in= f MdeModulePkg/Universal/BdsDxe/BdsDxe.inf MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenuApp.inf -- 2.30.0.windows.1 --_000_MWHPR06MB31027A0C9B12426B7B003755F39E9MWHPR06MB3102namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hi Liming/Mike/Jiewen,

 

Do you have any opinions/objections on putting this= interface definition in MdePkg as suggested by Hao? The reason it might be= suitable for MdePkg is because of its similarity with SmmMemLib. But I und= erstand that this is not an industrial standard interface (at least not yet). Could you please shed some light o= n your thoughts here? Any input is appreciated.

 

Regards,

Kun

 

From: Kun Qin
Sent: Tuesday, February 23, 2021 17:48
To: devel@edk2.groups.io; jiewen.yao@intel.com; Wu, Hao A<= /a>; gaoliming; Kinney, Micha= el D; Liu, Zhiguang
Cc: Wang, Jian J; Dong, Eric; Ni, Ray; Yao, Jiewen
Subject: Re: [edk2-devel] [PATCH v2 1/6] MdeModulePkg: DxeMmUnblock= MemoryLib: Added definition and null instance

 

Hi Jiewen,

 

I agree with your  assessment that it could ha= ve a PEI and potentially MM instance. Will remove the prefix and change the= m to `MmUnblockMemoryLib` in v3 patches. Thanks for the input.

 

Regards,

Kun

 

From: Yao, Jiewen
Sent: Tuesday, February 23, 2021 17:33
To: Wu, Hao A; Kun Qin; devel@edk2.groups.io<= /a>; gaoliming; Kinney, Micha= el D; Liu, Zhiguang
Cc: Wang, Jian J; Dong, Eric; Ni, Ray; Yao, Jiewen
Subject: Re: [edk2-devel] [PATCH v2 1/6] MdeModulePkg: DxeMmUnblock= MemoryLib: Added definition and null instance

 

I feel the name is confusing.

 

The class name is DxeMmUnblockMemoryLib. But actual= ly, this is not related to DXE phase.

 

I believe, it is also applicable to PEI phase, if w= e have a PEI instance. Please correct me if I am wrong.

Also, we can have SMM instance, right?

 

If that is true, then I prefer to remove Dxe prefix= .

 

From: Wu, Hao A <hao.a.wu@intel.com> <= br> Sent: Wednesday, February 24, 2021 9:27 AM
To: Kun Qin <kun.q@outlook.com>; devel@edk2.groups.io; Yao, J= iewen <jiewen.yao@intel.com>; gaoliming <gaoliming@byosoft.com.cn&= gt;; Kinney, Michael D <michael.d.kinney@intel.com>; Liu, Zhiguang &l= t;zhiguang.liu@intel.com>
Cc: Wang, Jian J <jian.j.wang@intel.com>; Dong, Eric <eric= .dong@intel.com>; Ni, Ray <ray.ni@intel.com>
Subject: RE: [edk2-devel] [PATCH v2 1/6] MdeModulePkg: DxeMmUnblock= MemoryLib: Added definition and null instance

 

Thanks Kun,

 

For putting the new library in MdePkg, I am not sur= e whether this is a similar case to SmmMemLib.

I looped Jiewen, Liming and Mike to check if they h= ave comments on this.

 

Best Regards,

Hao Wu

 

From: Kun Qin <kun.q@outlook.com>
Sent: Wednesday, February 24, 2021 3:30 AM
To: devel@edk2.groups.io; Wu, Hao A <hao.a.wu@intel.com>; Yao, Jiewen <jiewen.yao@= intel.com>; gaoliming <gaoliming@byosoft.com.cn>; Kinney, Michael D <micha= el.d.kinney@intel.com>; Liu, Zhiguang <zhiguang.liu@intel.com>
Cc: Wang, Jian J <jian.= j.wang@intel.com>; Dong, Eric <eric.dong@intel.com>; Ni, Ray <ray.ni@intel.com>
Subject: RE: [edk2-devel] [PATCH v2 1/6] MdeModulePkg: DxeMmUnblock= MemoryLib: Added definition and null instance

 

Hi Hao,

 

Thanks for the suggestion. I can move the library t= o MdePkg similar to SmmMemLib and add the change for OVMF.

 

Liming/Zhiguang,

 

I am happy to prepare patches to cover the dependen= cy change in ed2-platform in a separate patch series. But please let me kno= w if you would like to proceed otherwise.

 

Thanks,

Kun

 

From: = Wu, Hao A
Sent: Monday, February 22, 2021 17:42
To: Kun Qin; devel@edk2.groups.io; Yao, Jie= wen; gaoliming; Kinney, Micha= el D; Liu, Zhiguang
Cc: Wang, Jian J; Dong, Eric; Ni, Ray
Subject: Re: [edk2-devel] [PATCH v2 1/6] MdeModulePkg: DxeMmUnblock= MemoryLib: Added definition and null instance

 

Hello Kun,

 

Sorry for the delayed response.

 

Except for missing the UNI file for the newly added= library, I do not have other comment for the implementation at this moment= .

But I am wondering if this library can be added int= o the MdePkg as the case for MdePkg\Library\SmmMemLib\

I have looped in Jiewen, Liming and Mike for commen= ts.

 

Also, since:

* New library dependency for VariableSmmRuntimeDxe.= inf

* INF file separation and new library dependency in= Tcg2Smm

I think the series needs to prepare the changes for= platforms under edk2 (OVMF) and edk2-platforms repositories that consume t= he above 2 modules.

I am not exactly sure on how this should be handled= within edk2-platforms, so I added Liming and Zhiguang here for comments.

 

Best Regards,

Hao Wu

 

From: Kun Qin <kun.q@outlook.com>
Sent: Tuesday, February 23, 2021 6:15 AM
To: devel@edk2.groups.io; Wu, Hao A <hao.a.wu@intel.com>
Cc: Wang, Jian J <
jian.= j.wang@intel.com>; Dong, Eric <eric.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>
Subject: RE: [PATCH v2 1/6] MdeModulePkg: DxeMmUnblockMemoryLib: Ad= ded definition and null instance

 

Hi Hao,

 

The patch series was resent with intended usage in = VariableRuntime and Tcg2 drivers. Could you please provide feedback on them= ? Any input is appreciated.

 

Regards,

Kun

 

From: K= un Qin
Sent: Tuesday, February 9, 2021 17:25
To: devel@edk2.groups.io
Cc:
Jian J Wang; Hao A Wu; Eric Dong; Ray Ni; Jiewen Yao
Subject: [PATCH v2 1/6] MdeModulePkg: DxeMmUnblockMemoryLib: Added = definition and null instance

 

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3168

This interface definition provides an abstraction layer for DXE drivers to request certain memory blocks to be mapped/unblocked for accessibility<= br> inside MM environment.

Cc: Jian J Wang <jian.j.wang@i= ntel.com>
Cc: Hao A Wu <hao.a.wu@intel.com<= /a>>
Cc: Eric Dong <
eric.dong@intel.c= om>
Cc: Ray Ni <ray.ni@intel.com>= ;
Cc: Jiewen Yao <jiewen.yao@inte= l.com>

Signed-off-by: Kun Qin <kun.q@outl= ook.com>
---

Notes:
    v2:
    - Resend with practical usage. No change [Hao]

 MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemoryLibNull= .c   | 40 ++++++++++++++++++++
 MdeModulePkg/Include/Library/DxeMmUnblockMemoryLib.h  &nbs= p;            &= nbsp;     | 40 ++++++++++++++++++++
 MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemoryLibNull= .inf | 29 ++++++++++++++
 MdeModulePkg/MdeModulePkg.dec      &nb= sp;            =             &nb= sp;            |&nbs= p; 5 +++
 MdeModulePkg/MdeModulePkg.dsc      &nb= sp;            =             &nb= sp;            |&nbs= p; 2 +
 5 files changed, 116 insertions(+)

diff --git a/MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemory= LibNull.c b/MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemoryLi= bNull.c
new file mode 100644
index 000000000000..774a7e41cfb0
--- /dev/null
+++ b/MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemoryLibNull= .c
@@ -0,0 +1,40 @@
+/** @file
+  Null instance of MM Unblock Page Library.
+
+  This library provides an abstraction layer of requesting certain p= age access to be unblocked
+  by MM environment if applicable.
+
+  Copyright (c), Microsoft Corporation.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Uefi.h>
+
+/**
+  This API provides a way to unblock certain data pages to be access= ible inside MM environment.
+
+  @param  UnblockAddress      &nb= sp;   The address of buffer caller requests to unblock, the addre= ss
+            &= nbsp;           &nbs= p;         has to be page aligned.<= br> +  @param  NumberOfPages      &nbs= p;    The number of pages requested to be unblocked from MM<= br> +            &= nbsp;           &nbs= p;         environment.
+
+  @return EFI_SUCCESS        = ;     The request goes through successfully.
+  @return EFI_NOT_AVAILABLE_YET   The requested functional= ity is not produced yet.
+  @return EFI_UNSUPPORTED       &= nbsp; The requested functionality is not supported on current platform.
+  @return EFI_SECURITY_VIOLATION  The requested address failed = to pass security check for
+            &= nbsp;           &nbs= p;         unblocking.
+  @return EFI_INVALID_PARAMETER   Input address either NUL= L pointer or not page aligned.
+  @return EFI_ACCESS_DENIED       The = request is rejected due to system has passed certain boot
+            &= nbsp;           &nbs= p;         phase.
+
+**/
+EFI_STATUS
+EFIAPI
+DxeMmUnblockMemoryRequest (
+  IN EFI_PHYSICAL_ADDRESS   UnblockAddress,
+  IN UINT64         &nb= sp;       NumberOfPages
+  )
+{
+  return EFI_UNSUPPORTED;
+}
diff --git a/MdeModulePkg/Include/Library/DxeMmUnblockMemoryLib.h b/MdeMod= ulePkg/Include/Library/DxeMmUnblockMemoryLib.h
new file mode 100644
index 000000000000..8b63eb74a078
--- /dev/null
+++ b/MdeModulePkg/Include/Library/DxeMmUnblockMemoryLib.h
@@ -0,0 +1,40 @@
+/** @file
+  MM Unblock Memory Library Interface.
+
+  This library provides an abstraction layer of requesting certain p= age access to be unblocked
+  by MM environment if applicable.
+
+  Copyright (c), Microsoft Corporation.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _DXE_MM_UNBLOCK_MEMORY_LIB_H_
+#define _DXE_MM_UNBLOCK_MEMORY_LIB_H_
+
+/**
+  This API provides a way to unblock certain data pages to be access= ible inside MM environment.
+
+  @param  UnblockAddress      &nb= sp;   The address of buffer caller requests to unblock, the addre= ss
+            &= nbsp;           &nbs= p;         has to be page aligned.<= br> +  @param  NumberOfPages      &nbs= p;    The number of pages requested to be unblocked from MM<= br> +            &= nbsp;           &nbs= p;         environment.
+
+  @return EFI_SUCCESS        = ;     The request goes through successfully.
+  @return EFI_NOT_AVAILABLE_YET   The requested functional= ity is not produced yet.
+  @return EFI_UNSUPPORTED       &= nbsp; The requested functionality is not supported on current platform.
+  @return EFI_SECURITY_VIOLATION  The requested address failed = to pass security check for
+            &= nbsp;           &nbs= p;         unblocking.
+  @return EFI_INVALID_PARAMETER   Input address either NUL= L pointer or not page aligned.
+  @return EFI_ACCESS_DENIED       The = request is rejected due to system has passed certain boot
+            &= nbsp;           &nbs= p;         phase.
+
+**/
+EFI_STATUS
+EFIAPI
+DxeMmUnblockMemoryRequest (
+  IN EFI_PHYSICAL_ADDRESS   UnblockAddress,
+  IN UINT64         &nb= sp;       NumberOfPages
+);
+
+#endif // _DXE_MM_UNBLOCK_MEMORY_LIB_H_
diff --git a/MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemory= LibNull.inf b/MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemory= LibNull.inf
new file mode 100644
index 000000000000..e40462e5ab81
--- /dev/null
+++ b/MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemoryLibNull= .inf
@@ -0,0 +1,29 @@
+## @file
+#  Null instance of MM Unblock Page Library.
+#
+#  This library provides an abstraction layer of requesting certain = page access to be unblocked
+#  by MM environment if applicable.
+#
+#  Copyright (c), Microsoft Corporation.
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#
+##
+
+[Defines]
+  INF_VERSION         &= nbsp;          =3D 0x0001001B<= br> +  BASE_NAME         &nb= sp;            =3D D= xeMmUnblockMemoryLibNull
+  FILE_GUID         &nb= sp;            =3D 9= E890F68-5C95-4C31-95DD-59E6286F85EA
+  MODULE_TYPE         &= nbsp;          =3D BASE
+  VERSION_STRING        &nbs= p;        =3D 1.0
+  LIBRARY_CLASS         = ;         =3D DxeMmUnblockMemoryLib=
+
+#
+#  VALID_ARCHITECTURES       &nbs= p;   =3D IA32 X64
+#
+
+[Sources]
+  DxeMmUnblockMemoryLibNull.c
+
+[Packages]
+  MdePkg/MdePkg.dec
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec=
index 148395511034..1bb5017da2c5 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -154,6 +154,11 @@ [LibraryClasses]
   #
   VariablePolicyHelperLib|Include/Library/VariablePolicyHelperL= ib.h
 
+  ##  @libraryclass  This library provides an interface fo= r DXE drivers to request MM environment
+  #   to map/unblock a memory region for accessibility ins= ide MM.
+  #
+  DxeMmUnblockMemoryLib|Include/Library/DxeMmUnblockMemoryLib.h
+
 [Guids]
   ## MdeModule package token space guid
   # Include/Guid/MdeModulePkgTokenSpace.h
diff --git a/MdeModulePkg/MdeModulePkg.dsc b/MdeModulePkg/MdeModulePkg.dsc=
index 7ca4a1bb3080..2bc6b8730b8b 100644
--- a/MdeModulePkg/MdeModulePkg.dsc
+++ b/MdeModulePkg/MdeModulePkg.dsc
@@ -100,6 +100,7 @@ [LibraryClasses]
   SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf    DisplayUpdateProgressLib|MdeModulePkg/Library/DisplayUpdatePr= ogressLibGraphics/DisplayUpdateProgressLibGraphics.inf
   VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHe= lperLib/VariablePolicyHelperLib.inf
+  DxeMmUnblockMemoryLib|MdeModulePkg/Library/DxeMmUnblockMemoryLib/D= xeMmUnblockMemoryLibNull.inf
 
 [LibraryClasses.EBC.PEIM]
   IoLib|MdePkg/Library/PeiIoLibCpuIo/PeiIoLibCpuIo.inf
@@ -332,6 +333,7 @@ [Components]
   MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf<= br>    MdeModulePkg/Library/DisplayUpdateProgressLibGraphics/Display= UpdateProgressLibGraphics.inf
   MdeModulePkg/Library/DisplayUpdateProgressLibText/DisplayUpda= teProgressLibText.inf
+  MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemoryLibNu= ll.inf
 
   MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
   MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenuAp= p.inf
--
2.30.0.windows.1

 

 

 

 

--_000_MWHPR06MB31027A0C9B12426B7B003755F39E9MWHPR06MB3102namp_-- --_004_MWHPR06MB31027A0C9B12426B7B003755F39E9MWHPR06MB3102namp_ Content-Type: image/png; name="EA136335C1BA43BAA64D2BECD1313970.png" Content-Description: EA136335C1BA43BAA64D2BECD1313970.png Content-Disposition: inline; filename="EA136335C1BA43BAA64D2BECD1313970.png"; size=140; creation-date="Thu, 25 Feb 2021 01:50:32 GMT"; modification-date="Thu, 25 Feb 2021 01:50:32 GMT" Content-ID: Content-Transfer-Encoding: base64 iVBORw0KGgoAAAANSUhEUgAAAsQAAAABCAYAAADZ77itAAAAAXNSR0IArs4c6QAAAARnQU1BAACx jwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAhSURBVEhL7cMBDQAACAMg+5cygQkeRoMIG9WT VVXVn7MHYi5moJeByLMAAAAASUVORK5CYII= --_004_MWHPR06MB31027A0C9B12426B7B003755F39E9MWHPR06MB3102namp_--