From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (NAM11-BN8-obe.outbound.protection.outlook.com [40.92.20.37]) by mx.groups.io with SMTP id smtpd.web10.1213.1614131332292218897 for ; Tue, 23 Feb 2021 17:48:52 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@outlook.com header.s=selector1 header.b=jxSfen0K; spf=pass (domain: outlook.com, ip: 40.92.20.37, mailfrom: kun.q@outlook.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kFDRYsj9ZyEJFYMcIgKhFR9yir8cTa15w/b+tipN6GplCCDLaHGKTVZLgGoHbHOK1yS2MkomJrOHsITZ14P39NdUpoJo9/b4zgTwpjO8gh6C0Tcpu0wDtWUq/TFvOtWtT8MWI0yyR5PJFye4C5YORawrYt9vMcxIJadU1IPWJtHWmMVuERLW1wBTGvlLJ1GqdOzLSfQ73UaQw9hxhFp4z0PUTPIJbV0qjpLQ9FukMOlyZg28yuSuVf6vzOQwW4hjgvIPaU3H88X1BIiQ5Bm9InthrIse4gBk9hb/LnNxxxvs1jxHB11Z34rOu1FU2uOC9n1zYV5L2gADLFL/XLsaYA== 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=eoCpn3p1sF/tjjmpBJaSg/7gEMUlpW0kAtVZUPhpc5U=; b=H7c/SKPliGVnNk1Im1LY5k7l/68xDjbCHpVJa2nI12n6gAErj3indg/G/dVRLzZfuU/5+KAOhCYKcVUR8EPhteypfxCXZKZOKGv7nRbra1gzQlTZUhO28X4I2Aq6W6O/220xjpVSoSWC2qfmNDVGeF4CZT3pV8DsEe/8u9SFS8x/S8Lw6nMeslndIXjVLKHoiszqAeKG9IouJPyMFeK+oJElcgZkwNvPaR0SPxbOJkevM6h1Ba206g/baKpfRiMcRQ77rSObx4FjOjtfhzSt0LBaC9TzjsnnE6CPjWLALol4/nGm92FpmJjuqOmjKoRC17uE/iJ5xmuf4Cw5fE9FmA== 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=eoCpn3p1sF/tjjmpBJaSg/7gEMUlpW0kAtVZUPhpc5U=; b=jxSfen0K6ypqS0WEqMjtkVQLOGZUs7WSwc0r9DxOUoin00/QzKXhksNPHTXP/L2TxJykeYMxfMU80NsDNjNDLxV7WfFIKPM9BSwAC4NENhdTP+wosY+PNDYMEfs1YZK4YG5EIFG9/i5lrcsBMJMimI6FMdSH5CApoPe5Kseg4VaCiv/HEp4AvwPo3UtVLPqUJNfXEYXuXX4i6gkrc8StPYhbGhPFHya2W2ErfZBn0nUv/81pMoD8DT3jdVOP4z3zVR9pZh/2jhj4scMyEfh4mPt0B0D2F6pM2RoToeCNeDtCcU3KQENuXelexxKQlumPUNB7psPdnPrjKupYdFatTg== Received: from BN8NAM11FT045.eop-nam11.prod.protection.outlook.com (2a01:111:e400:fc4b::4e) by BN8NAM11HT204.eop-nam11.prod.protection.outlook.com (2a01:111:e400:fc4b::165) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27; Wed, 24 Feb 2021 01:48:50 +0000 Received: from MWHPR06MB3102.namprd06.prod.outlook.com (2a01:111:e400:fc4b::44) by BN8NAM11FT045.mail.protection.outlook.com (2a01:111:e400:fc4b::303) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Wed, 24 Feb 2021 01:48:50 +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; Wed, 24 Feb 2021 01:48:50 +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+UuCoenhRzNoH6pk0TcGgAA6fQCAARwymoAAce8AgAABuICAAAIkfw== Date: Wed, 24 Feb 2021 01:48:50 +0000 Message-ID: References: <20210210012457.315-1-kun.q@outlook.com>, , , In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:80AFE405141A694D17BAC8B488AEAC386948252397431FE7214E9A2B6F490C5A;UpperCasedChecksum:D20938CF291455CCFA527D8FFC13869812EEA64746CE13D50E54670CBBCA2DBE;SizeAsReceived:7800;Count:44 x-tmn: [obnvaDLzjIWnF+UiMRlyH9AZGz8Lvyo4] x-ms-publictraffictype: Email x-incomingheadercount: 44 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: 1709395f-b936-406e-49fa-08d8d8665541 x-ms-traffictypediagnostic: BN8NAM11HT204: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: ADxz5D/SVjJm701tfGoMHO1vM5F2wPQyKhhykMo/tVeNP9kMw4i8PVG/5yCbFxDqSaIKA36isHjdKnLY1+G59vuHySkuZnIbHNhE+NFBBGy/SbELuecbSFChg7eaPt3IUbHAQlO0jRmoEiVbBVEMhKHK7YKbtUedHrIXoYbYZjZiBN3x+WoQbn8JN2DoyGN6kBSIAhHwYOE49P1wHH/pgQYrkRjq1hfY1DqE1Kpg+dga2IeDW4fqxegTq16c28FGCoPaC8KBk3fs2LEBNTawP6cyfxoZmXAsGt8SUUwx9N2fBKBEX5PUOaOlJhpQFgaUlf+QfAmb4ZORbv2JJ3zHwVzCJkGnVzhpDzZWoZibNCi7rMStDWCfsoROvsnz8h8KpSs0yvEOD3+DuhPB9u1L0L0Le0Sowl8/f2BdqEtlXA+C+un/2MSTCy1HRTaEGmmT x-ms-exchange-antispam-messagedata: sbM6suwdQ+C6yHK8ZB3Rb9Fhug42GqSRVWPpG8sZgJTkbM1oRV93fQ6X9FcXJ0CjKGyiYmO+bBEtheB1/YBIOSXd9EuVAx0neLJmZRFUy1VKIZCQx13zeUOPsLfGG2yt56zl0oYtpjNnT++KzXWppA== 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: BN8NAM11FT045.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 1709395f-b936-406e-49fa-08d8d8665541 X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Feb 2021 01:48:50.0503 (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: BN8NAM11HT204 X-Groupsio-MsgNum: 72134 Content-Language: en-US Content-Type: multipart/related; boundary="_004_MWHPR06MB3102B6C622CDC2283D5AB91DF39F9MWHPR06MB3102namp_"; type="multipart/alternative" --_004_MWHPR06MB3102B6C622CDC2283D5AB91DF39F9MWHPR06MB3102namp_ Content-Type: multipart/alternative; boundary="_000_MWHPR06MB3102B6C622CDC2283D5AB91DF39F9MWHPR06MB3102namp_" --_000_MWHPR06MB3102B6C622CDC2283D5AB91DF39F9MWHPR06MB3102namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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_MWHPR06MB3102B6C622CDC2283D5AB91DF39F9MWHPR06MB3102namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

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_MWHPR06MB3102B6C622CDC2283D5AB91DF39F9MWHPR06MB3102namp_-- --_004_MWHPR06MB3102B6C622CDC2283D5AB91DF39F9MWHPR06MB3102namp_ Content-Type: image/png; name="12F88BA183674BA8B0F6935543EE8F9D.png" Content-Description: 12F88BA183674BA8B0F6935543EE8F9D.png Content-Disposition: inline; filename="12F88BA183674BA8B0F6935543EE8F9D.png"; size=140; creation-date="Wed, 24 Feb 2021 01:48:49 GMT"; modification-date="Wed, 24 Feb 2021 01:48:49 GMT" Content-ID: Content-Transfer-Encoding: base64 iVBORw0KGgoAAAANSUhEUgAAAsQAAAABCAYAAADZ77itAAAAAXNSR0IArs4c6QAAAARnQU1BAACx jwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAhSURBVEhL7cMBDQAACAMg+5cygQkeRoMIG9WT VVXVn7MHYi5moJeByLMAAAAASUVORK5CYII= --_004_MWHPR06MB3102B6C622CDC2283D5AB91DF39F9MWHPR06MB3102namp_--