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.web10.1041.1614130421244891497 for ; Tue, 23 Feb 2021 17:33:41 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=kERPzaFw; spf=pass (domain: intel.com, ip: 192.55.52.88, mailfrom: jiewen.yao@intel.com) IronPort-SDR: RFxsuQ8tXF5j0VEwna2x59l7YAbfBgryfA3+hqalIfRKnRqzU/ECdNPPy8pb+5I0Fv2dQ+Oro/ XzSuw9AJeGSA== X-IronPort-AV: E=McAfee;i="6000,8403,9904"; a="204464998" X-IronPort-AV: E=Sophos;i="5.81,201,1610438400"; d="png'150?scan'150,208,217,150";a="204464998" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Feb 2021 17:33:40 -0800 IronPort-SDR: 3NqGt+i6Tf+3f55EaFx9XU9D5PE/8E1a4AwxbtVgZHgs/hA5MgdNkG0MLkYuP7IPgeVSxlPjjS QN9999d8gIdg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,201,1610438400"; d="png'150?scan'150,208,217,150";a="364734482" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by orsmga003.jf.intel.com with ESMTP; 23 Feb 2021 17:33:40 -0800 Received: from orsmsx604.amr.corp.intel.com (10.22.229.17) 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; Tue, 23 Feb 2021 17:33:39 -0800 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) 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 via Frontend Transport; Tue, 23 Feb 2021 17:33:39 -0800 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.104) by edgegateway.intel.com (134.134.137.100) 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:33:39 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nx0FvDc2DoV9eO3SfwUXHZUccl/KRDhdyPF66EHSLX4TcygvRyZgWz0HFJG88L7/5Gn/OGAFaY/DT7DEpqV6II/kRN24d2NefK1yE7novoB1ADArsIHeTbt086tx0gpN81UAb+V/e2tbfn5pjEKrfJQgPFPwYUi2XsynQwV351l+pnw+KodqDwavDqjebgYHL2pFRgV1GHGbFrBa7rPWaUoqfFRd2i/gSv/qkrEYOYDcbexSMQ4zjLJTJX2Ickr5Qp3FBeqtikZT+uhnWT3BwrdbYjN6v3BVsEiHq8wwJaM6hBwr4DYENbBRP3UBBPzvEFm42tOzGYzIGMKjPHaqOQ== 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=yAYTiciQVkUUJa+Ln/ogopb66jvwlUQx5P19lGpix2M=; b=jPu4In3g4hARUnB3AkqriRfc0oo5y5JDPHERli76xsT6RtLNpQQtFsSMA+bpfi0tKA31zu+pjyBB13XaH/1/cIYKYje9qeUQS4DvNeD0R0HmNcpyGy45jaNOjvjiOXeqbtrTZchb25A04tRxmj5lBbac7ABghuAYKWei/fobL5Hwk8NPsxNXntxSWDBqr9+6+UY1JvLfwPiBjTzRweAN1+5MxzJodYupHEMkHeTCenfkVmmk0ZwxQukg1PjWqjvTIhZ1ckC7EY66TmWdiecqwLlCN/hcwHtidULwks4MU8XZqt/C79AGh3iBKUP6Ms5IovxVsKRXbQRzct72ZMLNIQ== 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=yAYTiciQVkUUJa+Ln/ogopb66jvwlUQx5P19lGpix2M=; b=kERPzaFwEbACrQZzndN5Cj6EGkDplsAGMoBhLkxko9UaUK4e6LZ5f/XQVtVoQfQUKMo5KVlsUyh4/RcuWYyylxkic7kYPdc/71nDBmy0pl5NFz+fnJMDLFPN17tC2RLv/9J4DZUwbWgHb5wvoHEpBNn2O5zW7QgV1MvpmXh1N70= Received: from BY5PR11MB4166.namprd11.prod.outlook.com (2603:10b6:a03:191::25) by BYAPR11MB3046.namprd11.prod.outlook.com (2603:10b6:a03:86::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.33; Wed, 24 Feb 2021 01:33:38 +0000 Received: from BY5PR11MB4166.namprd11.prod.outlook.com ([fe80::5983:f233:56d6:8132]) by BY5PR11MB4166.namprd11.prod.outlook.com ([fe80::5983:f233:56d6:8132%4]) with mapi id 15.20.3868.033; Wed, 24 Feb 2021 01:33:38 +0000 From: "Yao, Jiewen" 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: DxeMmUnblockMemoryLib: Added definition and null instance Thread-Topic: [edk2-devel] [PATCH v2 1/6] MdeModulePkg: DxeMmUnblockMemoryLib: Added definition and null instance Thread-Index: AQHW/0ugVgzMOlUi00mHCp9ERD5xj6pk8rnggAEu/ACAAGI+gIAAFlaA Date: Wed, 24 Feb 2021 01:33:37 +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: dlp-version: 11.5.1.3 dlp-product: dlpe-windows dlp-reaction: no-action authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [101.87.139.49] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 818096f4-8f31-4f4c-0a8c-08d8d86435a6 x-ms-traffictypediagnostic: BYAPR11MB3046: 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: kLAXpDolM/vAxPNclQGRiRhzXeq8HxUbcSdrVu2OFBtuf/RiDAdHfqBUCJIwUibB5+1e2VF8LEP7v5z1SRstWeprigDXTO9EohTNWnsPwDeMU+d1qnHad1jfS3AvFw9N2ewSLAGxDufS+dJ8hpdC2ISsCciKaQTyWneylM3ySgla3PoNBznEJ81Lt85eznaEPxCtYUAXBSadha+y0ySYJAsRcAMuLiP7b2opbl7wOC2pt8A6AjuqM96IB4f/EWOR6VJR6Wy5RK+0AZexdp4tEPXUYvWOAq4HfKjE0mYA/GVVD9yAwPt4kXM2rGyWjFiGWs+bd2MLb91w1PefmalqBWOo+da2uTGU4Q2SPI0dkDgG4plHIy14kUaHzmJ/bSnQN2r1NGnpX1zQmiDYMbst5FjQuJAsRmtek9jDH7EAKOT2yctRjwzM2DeXm9fhqpmU9bYf6BdTxBO/gaYRXoOW+JA/k9CI9wJQ82OPRNrea8E8Wjz/XKWSTsg8oTwFfo9eD9Aeu6R/xtphmTCM357HJSgctUUxIYse89gU1P1wfK6VFYOz0ulyCCi2egprEyvJeOeLFQ1aAIyoIuVFoE2JNmsz0hZZheqlh7+h9I+uUZ8= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR11MB4166.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(6029001)(136003)(396003)(376002)(366004)(346002)(39860400002)(86362001)(166002)(53546011)(26005)(76236003)(6506007)(186003)(107886003)(6636002)(8936002)(99936003)(55016002)(33656002)(7696005)(66946007)(66476007)(2906002)(4326008)(966005)(110136005)(64756008)(54906003)(30864003)(9686003)(76116006)(66446008)(66556008)(478600001)(52536014)(66616009)(5660300002)(8676002)(45080400002)(71200400001)(83380400001)(316002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?4jcdjJQMF1+DMgrJ8r1Sip/prr8qLC/wUQlY+rDv69EUkJQMTavAiyjh4FRL?= =?us-ascii?Q?i52Yya/i0BQ0FshQyefY20MVV9rehUi0KApoMvAcE0nPTW2Ln1Vj5DsatAQo?= =?us-ascii?Q?7APAhx+7f3LV93n8/04VrgTlOUr0zB8oBt/BVQ6hoR/LMFODENtycnMAgRTa?= =?us-ascii?Q?VfYoybqy9Pt5OvpIirG28Jm7s55+wtA8cnIC3jj9Se3+lX2zfpP7pcdjeq0b?= =?us-ascii?Q?cmwG/1QZJKiEt5TFSZWsFMREqPM/r/C1/czHYpQDoqEx1IQCuTZWnyEcZlSd?= =?us-ascii?Q?rNVTA3uJuWcgcRUzvmuPhZazc3W0/P2huxMVYTX+f1Vm76hvZrsvXATdIZO5?= =?us-ascii?Q?8nneSAqn9FQSELxXBA6artjnCeFJOu30bpW98CSu28x8lFbTvCSiNFnqbYEh?= =?us-ascii?Q?e30Y2zDn4PW/pYnSuIm+F8HmNgNYBmQ0NZMiMDEZ8tFe7/l0vjQlW0KpmYEp?= =?us-ascii?Q?f05GRt4y6tuRAztWEhCuiKBjrepSSpXGAtsGnMt/V1CAg6ZSD05Xs8UDmW5/?= =?us-ascii?Q?jRjMNcMPcQx+OP55luKUqASa00bSdCMQ1/XMpRspR0YY4lBEzzSR+nt9XEVg?= =?us-ascii?Q?RwqT7fzzHX9zq1RO69kTlMYI6zzqmMhjse3VpQgehI5xhdWy3xfptS/l2h9/?= =?us-ascii?Q?dBKuZEgXfh2kJ544cpZ+g42ZUaNtT8OqzD1VIN7nisS+hPbKBRZgkoeVXJWX?= =?us-ascii?Q?3DEl4/7lcVvGhVO0rIxHFpBNJbjvKUNM87ztwbTVvNc8fYaByctfaQOzjk3g?= =?us-ascii?Q?67d85t9O8avdkNRrjI7XtC5ZT/e3VRcrQ3uDBDupcWN8oI52Jg8Tn9F0IKzh?= =?us-ascii?Q?EVUBPTqV/3c03i6WgmlYBdQEomMCSN0EMTGNJKNq0RreYRizpUv98LCyUfnj?= =?us-ascii?Q?cGaUCbTihBnOqNRGKkajvHBNGVugDa+VSNikrdmnP3OQ6VErrTKRTOWHZ2ou?= =?us-ascii?Q?oDbHLhKHnBr6e18bvqNTcczE2ndyc5rZ3mWJwS+YINd26wqQyeDq3ImT/AJW?= =?us-ascii?Q?7NjUNy93gilsAd1pnniNCsrOwZHbdCqD6BfwNIvOApUU24jjZehnJXbL/8Og?= =?us-ascii?Q?9LNfEk1xL4gYnOfcz6B/FYVDEeUnDykwp060n6M6zjL8qAZJG8Cuwjlb+Z2r?= =?us-ascii?Q?8Q/ibpQDcmKt4vyVum+BM4O8uyUuDjXGzbfHi3iLSYCk+N0xLySfgbk6vTGJ?= =?us-ascii?Q?+66CI1gofRjkQauE1zwkRYQM3MFU7MzuwDEDXxK4IpeZztiNS0fw+A2AYHQp?= =?us-ascii?Q?6PpsQ/0pi+vqXPcWSJ6B5XOfPn9MS/4xQG3Gy2WFfIdIdGctAT1MAKAUZdnW?= =?us-ascii?Q?UpYRgb4ZutbjE/KL0LsGsWJZ?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BY5PR11MB4166.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 818096f4-8f31-4f4c-0a8c-08d8d86435a6 X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Feb 2021 01:33:37.9979 (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: NaYis8Xtz2n3KY4YvynOeWA4hmEHmdxtcCnwFsp6mwlGjM30tZae1YKunTVaHSRDvYgqYTP9k8g2S+a5pvKzyA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB3046 Return-Path: jiewen.yao@intel.com X-OriginatorOrg: intel.com X-Groupsio-MsgNum: 72129 Content-Language: en-US Content-Type: multipart/related; boundary="_004_BY5PR11MB4166945E2ADF8B0760214E208C9F9BY5PR11MB4166namp_"; type="multipart/alternative" --_004_BY5PR11MB4166945E2ADF8B0760214E208C9F9BY5PR11MB4166namp_ Content-Type: multipart/alternative; boundary="_000_BY5PR11MB4166945E2ADF8B0760214E208C9F9BY5PR11MB4166namp_" --_000_BY5PR11MB4166945E2ADF8B0760214E208C9F9BY5PR11MB4166namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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_BY5PR11MB4166945E2ADF8B0760214E208C9F9BY5PR11MB4166namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

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