From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web08.1069.1614130094713842578 for ; Tue, 23 Feb 2021 17:28:14 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=eW3TMUAS; spf=pass (domain: intel.com, ip: 192.55.52.88, mailfrom: hao.a.wu@intel.com) IronPort-SDR: hXYUWE3GBiByQQg8+7NVw1gV9tbCX5x0Fn5R3qSmElJu9xIfpsHejg4kXXI85K92g+9P1N9YVq ksF3gpjsrUHg== X-IronPort-AV: E=McAfee;i="6000,8403,9904"; a="204463856" X-IronPort-AV: E=Sophos;i="5.81,201,1610438400"; d="png'150?scan'150,208,217,150";a="204463856" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Feb 2021 17:28:13 -0800 IronPort-SDR: ToLKKin6G8Dhah4mJG+/5rf7ZzNeJj9ZHyii6yRgKVCXpEuH99aBj7NSb0i0mp01xrAyChG8La vZJTI6Hjb8Ug== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,201,1610438400"; d="png'150?scan'150,208,217,150";a="593457435" Received: from orsmsx604.amr.corp.intel.com ([10.22.229.17]) by fmsmga006.fm.intel.com with ESMTP; 23 Feb 2021 17:28:12 -0800 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX604.amr.corp.intel.com (10.22.229.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Tue, 23 Feb 2021 17:27:33 -0800 Received: from orsmsx601.amr.corp.intel.com (10.22.229.14) by ORSMSX611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Tue, 23 Feb 2021 17:27:32 -0800 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2 via Frontend Transport; Tue, 23 Feb 2021 17:27:32 -0800 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.174) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2106.2; Tue, 23 Feb 2021 17:27:29 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CQsLN5WHZ15yAVlde/uzoLRDpUqgF3j/53Xn9yZzWq2wqtqzNf1J0Ph0qy9uTXBQasETbCKKlmYCAMyD6ROnaC6dYXR4BQ0eXF+9SQbOnwpTaLEi0GVSstFMVDvvf2goEjbN7rij3N+k71NkUw+U5j7CPqX4+DpZcavIHh/hEQRN9uFz0iQ1lOEP8eCgZdOPXjoR4pX6AWuUal3GFMp/rPyctMq0GQVwHfR6DZPNukKQdK5KWxwYgwk34yhMcQEIihYxHQjsr/sf1/VEWgE/vw/Nb9TnPAGE2WnKLqZOl2VqxUhlwg+oJB2Rjn/lhwLtbHjLwrXUk2sLXoogSOaaGA== 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=KWtW4Y8YTrE9sDNe4cZnPCgK3xM+dymoRf/lxka2lWI=; b=at2gu5V/5QdEkV4Bo9pk4RareyJ44HKA6rzOZoQTLfal15UO2KncxWa0h3CY9CSxqFWoS6J1M/MxUMw9mizdo4HhqQ1Grh8LEJCjfNXFNXmeSDM6r4xbrEZimSvEYyKtldPrjcxFxVz4/umTvPkZgWtE3n1ApPutRh92IjMZ3v68E3iZyDtycq9gQvVag717QCdv48C5v2J6JXWJM/qxYrjero52PUWPWm8OSiFPmao+BsCR4YGViI403iBerl9osRSMJBELMEhfNRgeC9da7cNHMPklN6n7eNIdjVqhohzlSKgNUWCtQSrrPFtdKYOQVIcFcpW6s/LTtR86n8IYKQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KWtW4Y8YTrE9sDNe4cZnPCgK3xM+dymoRf/lxka2lWI=; b=eW3TMUASuP1zMIyvFKFnzfNaTtd8odw2NRRy8S2HxLRxyuIY5Gm3wuPVMAhJ8hbWA6QXLiVhuwRJvOBAlGVQuog9FXZ1wiv4OMozu6Xyhj5+w/G4uzTV/DfK4/2N+EaT9kpMT0F93gXp3PQO3gnfXZn/7ncFvFUhKZQ043eP3+w= Received: from BN8PR11MB3666.namprd11.prod.outlook.com (2603:10b6:408:8c::19) by BN6PR11MB3987.namprd11.prod.outlook.com (2603:10b6:405:78::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.32; Wed, 24 Feb 2021 01:27:28 +0000 Received: from BN8PR11MB3666.namprd11.prod.outlook.com ([fe80::9d91:6348:53a9:cb20]) by BN8PR11MB3666.namprd11.prod.outlook.com ([fe80::9d91:6348:53a9:cb20%7]) with mapi id 15.20.3868.032; Wed, 24 Feb 2021 01:27:28 +0000 From: "Wu, Hao A" 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: DxeMmUnblockMemoryLib: Added definition and null instance Thread-Topic: [edk2-devel] [PATCH v2 1/6] MdeModulePkg: DxeMmUnblockMemoryLib: Added definition and null instance Thread-Index: AQHXCWg9qBr3J8KI80G3snW2Deth86pk8rnggAEu/ACAAGI+gA== Date: Wed, 24 Feb 2021 01:27:28 +0000 Message-ID: References: <20210210012457.315-1-kun.q@outlook.com>, , In-Reply-To: Accept-Language: en-US, zh-CN X-MS-Has-Attach: yes X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.5.1.3 authentication-results: outlook.com; dkim=none (message not signed) header.d=none;outlook.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.198.147.218] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: be0766b4-058c-4f01-31ee-08d8d8635935 x-ms-traffictypediagnostic: BN6PR11MB3987: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: rh9MnwJTcZy8lMh8F5Ilyw12wZ1SxLEC1mVoeIf754peNix1nLSaOUuCA/Nn2EK8NusuEe3FBcx1GchfdqllEK9xjd+uQ763PbSpNXVACFlEHZPdzmJo6vJm8c8jrkBoSMVR4jug5GqT3MQ8sw6jw9zgsTv+Xv6QBGGYlPSdrXDvxx2gKcVUco52d3BLMOiRqp88t66YHRUF05O2EyyqovNQDRpr0D+T1Qvf0WEQejTuu9pizxnaHqtKQuFm7xTQkbT9r1iaMVKm6evEhmjsbG5qO2kzQTu0ZGttbBfhup66tx4Ob/V8oQcdrGRFYZv0w50VF+jF5Ep9D1LKNsNMqwtd7oi1vJgzm3UO7VBwum/C3zVX+pOOSxgLrX/npO+/J+M54sjvu4wfSr4SZLLXy24BY8uNM0rFcDBwn3BT/VWfJtHoz4XTdH/XjF0J40Wm/O+6ir/tOBgAf4EKhMNeviZc4A2MLptj55M/yEsNSEQ0sNGO/0b/J4R4us0uS6Bow7hX0lb/Vw6VzLOwfW5Vz2uL5j96osrSKnyhPAELC/2Tggkk57yl+aSRXUQ06C3TpoCxdM73IQ//txdlkSju3OsTrb2LLfSuUKLt0LZ3TQU= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR11MB3666.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(6029001)(396003)(376002)(39860400002)(366004)(346002)(136003)(4326008)(86362001)(52536014)(83380400001)(54906003)(33656002)(8676002)(6506007)(186003)(55016002)(8936002)(316002)(110136005)(53546011)(166002)(107886003)(76236003)(478600001)(66446008)(66616009)(66476007)(26005)(45080400002)(9686003)(7696005)(66556008)(5660300002)(2906002)(76116006)(6636002)(66946007)(71200400001)(64756008)(99936003)(966005);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?BhivmIDcGUN8a7X+mga9dn5RUefqmZR7ND/NHd6WLAriZLWncREL9lICNL3e?= =?us-ascii?Q?pr2EHv9Xp0kyAWbeLq5lmf24wwbrH27Dd0QLTz+NcJfuRwiuqdDhZ1Y68caj?= =?us-ascii?Q?36LWedMLGWYkcwLJ1c5x7gqPKFiFK711fSURvnvj1r5gQPG2UghWg/6ghN61?= =?us-ascii?Q?vi8DkgGnd65lOqHcsUCGB68X6FB+W+o2oPXhBaGBzqr7m9iv/jJMdQfm/WJa?= =?us-ascii?Q?f4E91Rnv8S2oVbeb8XDP7o7v+IlXrcAuVwL5M0lIJLq2ANhOA9q0p+t0ZUIx?= =?us-ascii?Q?710/cP0HtJl527YpJ+yWkzO+Kjlkv6SVIMLw+Uh+ZD6QQJzoYcB8eIbkHKcw?= =?us-ascii?Q?FrovUsyD0dMx2/O93Ullw6+g82qwXJcg8P8r170vutZG13qYQUocHJ76k/lD?= =?us-ascii?Q?mN2HowRBD4S085ZgiMR9XSTrGJ9ZKu1oBJjqlXb3LNWWtL4ItRCgPzzdojKt?= =?us-ascii?Q?Zd5lApmx74b6uiiKXjtWYYfAUKvX4aPjJU/cNZpYowRxQbpCZnZlxKRNPwJv?= =?us-ascii?Q?PvxDj35q1rAGZsBY9DNoPOCwZrrBw7BAmxF2rWaQPKThsk/5lE1lLwCrrNFQ?= =?us-ascii?Q?SkiDBPBpO9NWqR3CgEGUbVh0eFXLLY8sO+JtvD8Juo2IMB3AN53J8RVLLaKN?= =?us-ascii?Q?TCog4UoK/ISW5iBOGqYqIADl62XmQ36Z0nM4TgFrbsb/hA+R0HmE4iIAgZan?= =?us-ascii?Q?B7u1+X3UDwHyd8fmM0gIjWxKdLzCcG85UvxTDVUIfnWz9x45ZA4tSytRGYgw?= =?us-ascii?Q?BQDUowI/ID2GHaJDH+Hz8KoB1GCfjrM2y11iL8zdyK+PeQRZCOOY1WdB1alR?= =?us-ascii?Q?c+nXf+b7nJNCBFjnBgdu6pekyS/aQk9bdAhfHJAXZpqScaN43hEOjfnRAitD?= =?us-ascii?Q?RR6tM1KxbpCpPn3ULohmJ1tThlxpG1H24GfssFpL46LZ6qMUhW3u+1G8R7Tb?= =?us-ascii?Q?wvuUUkVyHPmSwsu94+nRKHLHUWeq/pIBQH9Z2gi/5Lnuoh1Nlht57n9vvv5k?= =?us-ascii?Q?JrxIL9tQnmdxnNWDS1ZawxwIlCf9FLsJM6h8qoiVat2NlXUmxojqrnN6KuOk?= =?us-ascii?Q?QMgc5c2TOOulqhUjUiAycTT6AW+pw6A25H8Lg3tzIoj0N/TO6q/UMmwLHvxv?= =?us-ascii?Q?lXH6Y3Zx75cjrSyM+psvsedwxShx2wGrggF7hX58E0cYokcyLC06o79RL918?= =?us-ascii?Q?N3B8EJOSfX9yFC987N2jVnzVnlzcMC6b7ld4EA0Ffigg8NXKtpMpdazfnedZ?= =?us-ascii?Q?xCKg3saOvQJuCPGyWInWKOT+k1CKSoYMyfRgpHcA+ql9BTgmtvRGgbFf42xd?= =?us-ascii?Q?fQETl0GYbC2xddMVhpGpxflr?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN8PR11MB3666.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: be0766b4-058c-4f01-31ee-08d8d8635935 X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Feb 2021 01:27:28.1586 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: mNo4zW4ejpoevD0+ewt9Nb1qWo794+Q0QkIZkhwMV/p8CETWu1LAQH31l8GAdUZP3fpWLW0km4IAn70S6BMgYQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR11MB3987 Return-Path: hao.a.wu@intel.com X-OriginatorOrg: intel.com X-Groupsio-MsgNum: 72127 Content-Language: en-US Content-Type: multipart/related; boundary="_004_BN8PR11MB36668BAC4F4D7F73CCB1D327CA9F9BN8PR11MB3666namp_"; type="multipart/alternative" --_004_BN8PR11MB36668BAC4F4D7F73CCB1D327CA9F9BN8PR11MB3666namp_ Content-Type: multipart/alternative; boundary="_000_BN8PR11MB36668BAC4F4D7F73CCB1D327CA9F9BN8PR11MB3666namp_" --_000_BN8PR11MB36668BAC4F4D7F73CCB1D327CA9F9BN8PR11MB3666namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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 ; Dong, 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_BN8PR11MB36668BAC4F4D7F73CCB1D327CA9F9BN8PR11MB3666namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

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 <michael.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_BN8PR11MB36668BAC4F4D7F73CCB1D327CA9F9BN8PR11MB3666namp_-- --_004_BN8PR11MB36668BAC4F4D7F73CCB1D327CA9F9BN8PR11MB3666namp_ Content-Type: image/png; name="image003.png" Content-Description: image003.png Content-Disposition: inline; filename="image003.png"; size=157; creation-date="Wed, 24 Feb 2021 01:27:27 GMT"; modification-date="Wed, 24 Feb 2021 01:27:27 GMT" Content-ID: Content-Transfer-Encoding: base64 iVBORw0KGgoAAAANSUhEUgAAAWIAAAABCAMAAADTlVQIAAAAAXNSR0IArs4c6QAAAANQTFRFv83b Bi0mqAAAAAlwSFlzAAAOxAAADsQBlSsOGwAAABl0RVh0U29mdHdhcmUATWljcm9zb2Z0IE9mZmlj ZX/tNXEAAAAOSURBVChTY2AYBTQOAQABYwABq21F9gAAAABJRU5ErkJggg== --_004_BN8PR11MB36668BAC4F4D7F73CCB1D327CA9F9BN8PR11MB3666namp_--