From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mx.groups.io with SMTP id smtpd.web09.4106.1614044553752437047 for ; Mon, 22 Feb 2021 17:42:34 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=ETYxIq8V; spf=pass (domain: intel.com, ip: 134.134.136.31, mailfrom: hao.a.wu@intel.com) IronPort-SDR: rZEYAvVQDsXvi8DeWkLLP6s9BwGN1/j+COfxA76KT7vw2FDvQsfhx6AZfatA0PKb922myQ+C+I 43zT/M6xGx3w== X-IronPort-AV: E=McAfee;i="6000,8403,9903"; a="246082837" X-IronPort-AV: E=Sophos;i="5.81,198,1610438400"; d="scan'208,217";a="246082837" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Feb 2021 17:42:32 -0800 IronPort-SDR: tAfwnfIqp+ObrXwrpf2lLlw+Sbg1RWr8LXPu8viAg9ok0sm/yRqb70nnUp6ldFWevdpj6XrvVQ XvQqZUKKbEgQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,198,1610438400"; d="scan'208,217";a="403294880" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by orsmga007.jf.intel.com with ESMTP; 22 Feb 2021 17:42:32 -0800 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Mon, 22 Feb 2021 17:42:32 -0800 Received: from orsmsx602.amr.corp.intel.com (10.22.229.15) by ORSMSX612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Mon, 22 Feb 2021 17:42:31 -0800 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2 via Frontend Transport; Mon, 22 Feb 2021 17:42:31 -0800 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.172) 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; Mon, 22 Feb 2021 17:42:31 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RUY+g83p0Y2UJuvUP/j37sG3yWXqpaqPcfF4qqnSYNJIvkmPIJY/7RjwNCqLJLzJD347tRlUAI2Sq+X8fvZs7gylkGhraQVXTW6f6DZVvxKDBzIvbjMSMq3aVkbiSC3irtiJIvzrMdzAcL9SJSO0LUQKc6Qh1PcIY3I31cri3A0ntcElbrkHIU6Fg0g2nRqoUpcl2oAjtWXpEc0HnGkbv5vJ0xVV8ZZ8l9cWzT1wMvEgqG347nujDjR5Hs6ojYdVRK0RSr3cgHf6bzAPZWcoQ2GQ8H68zt+1ZCJZs6mhs4/hgouKHDCnreLPEuTQN4bEzAA2RaKiM5PqEjGIsnITuQ== 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=QgNTQnv6gEzxx3+LsJjZ8/gENPt/HO4D7K7RjGuFifQ=; b=dSA+FvqW5tP1X9edv+MIyKBzqnOu3Idxb0nJbBtIzwxQA+nDOBTUC9VMP2EybBBouCC/2VxhTQ9tZrMG+T4ucUJN/8lrFE3g7HgWgZopIQJfXxslJJIv8A4QnZYXTwZ/P0rl9XWxE7kFZasTVE64+6vJ0CsnDxd4rEn08do+Aeu0dEcr3LYPJoehg4eXJiuVSIRVFA9f+++aZ4e2C3kCU+tR+pzjj2AaWeGKvqAWGvJdYo/xTE/+ZrSd/Z0oYO7Ovt4pykfiX2tBAofNnLuPJXxeM1p2b74K3Q66JfVHE8W7k1QQblBPwXo3UnxM46s2hRBQzf8tO0ypMJNYcAmpvw== 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=QgNTQnv6gEzxx3+LsJjZ8/gENPt/HO4D7K7RjGuFifQ=; b=ETYxIq8VvzZi09/6j55fZgcsPoaMt/iktLiVayUFUgXFm4lm1vkPFW/Ew3HgJgqVegU08PYOVYtg2mu8YbomVDQYmN4K/D4qus97cctLWWWMY5HqB9X9GbiJHpY5lqhT5SOVrnplbLJmPIiE4FE/4UXkXqMkn6iUC9smOgQX4I8= Received: from BN8PR11MB3666.namprd11.prod.outlook.com (2603:10b6:408:8c::19) by BN6PR11MB4082.namprd11.prod.outlook.com (2603:10b6:405:7d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.30; Tue, 23 Feb 2021 01:42:30 +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; Tue, 23 Feb 2021 01:42:30 +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: [PATCH v2 1/6] MdeModulePkg: DxeMmUnblockMemoryLib: Added definition and null instance Thread-Topic: [PATCH v2 1/6] MdeModulePkg: DxeMmUnblockMemoryLib: Added definition and null instance Thread-Index: AQHXCWg9qBr3J8KI80G3snW2Deth86pk8rng Date: Tue, 23 Feb 2021 01:42:30 +0000 Message-ID: References: <20210210012457.315-1-kun.q@outlook.com>, In-Reply-To: Accept-Language: en-US, zh-CN X-MS-Has-Attach: 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: dd61fcf2-1ce0-40be-7067-08d8d79c486f x-ms-traffictypediagnostic: BN6PR11MB4082: 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: Imm9Y5zRuWJv/HCsG/GDg/RktNIwmN8tnaEYbuNeE/ezsnkpEGT8jsxnc5S6lP2nc0V8W7rjr4ft0IFpH9dXXMRjcKtibjXmgmHzdB4IKu0UXqNsh2C70oh2MLZdE0m1MUMWbCOf1PhOqp/DmDAbLheeM0yoEFxRArjsAjA5NtoCwDbUQucs4XcPfjTm8FdIK6DQkm+1NJ8n+hbgy1I18vtM+2URXFZJinMCQLKEwpgzXW7ONfdSkakY+J6L1fjigMwvdywi3yj8R65NrZgUOQEiH4LNkjW+5V9Iml36sd6NUwUEMZo+yQ6b1e0/7YIPpWsw0eJyWmlCIrABY1oZwRTTGvIVHTMW84nKu/nFnHPaIUCsofqgyw0gnVy5yL17AjB6q1okIBumvGcLTzSijjRHb9Au8aB7FOQLAT1i3hW+K/24m3VyeULWvmiaS4xxh9bNffSZt+TPSqouzfraT4OEkytG5zkkUAsllanaA/Y65YjrBfdc20EqQoDKSq3r3Aa3ZVIKrC+uZvf3sVuz/9UvMigKpssVMb4EF2TySBaUWqfJDDsDsah+YL05PCar83aJ4vromJc5Myy458lMaG+0VCnyyu+320/vvDAiyk8= 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)(366004)(396003)(136003)(39860400002)(376002)(346002)(52536014)(71200400001)(186003)(45080400002)(7696005)(9686003)(5660300002)(4326008)(8676002)(107886003)(6506007)(66946007)(8936002)(33656002)(66476007)(26005)(64756008)(86362001)(66446008)(66556008)(54906003)(9326002)(166002)(83380400001)(2906002)(110136005)(6636002)(55016002)(76116006)(53546011)(966005)(316002)(478600001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?FAAm87Z3Leo8+q84A3YrU/DyH8IFphDMwDPvv9+YufQf4zRkN5f2SRGIE5hg?= =?us-ascii?Q?Z6JXgCzvPsnsL5pyciKlpg8IYbap/TO8FCp0PNkWwll8aLIkgxS9ZP/iJV+I?= =?us-ascii?Q?VWfolJoKRCEd8LQ3MzvWYMYNRvnyx59XAyE0tr9aasMbw3WW7LLQsArbtxyT?= =?us-ascii?Q?MtOshhtRWzThl5bWvpPQUl2fun+YtOro4EUKYZ+JsVMF/CM8cim6f8HYaUSA?= =?us-ascii?Q?+O7M6mNCqiAa+ACZogtXi6AkQm/4Peq1POZNsGWuh2FAgVZstOsg+VANm6vN?= =?us-ascii?Q?hXbQ6DvC92fOAGAkd1sEfxsuoN/mDs50k27h4DuvXvD72WUEVqSs96BFUkRJ?= =?us-ascii?Q?Z7fufINUIIwVSnPeUSCgsvEKWY3oSE6Ny5Bz43RMu540i7H332/nnDKG2Nit?= =?us-ascii?Q?82+XgND/ZgxHKm1PEDt3yhge7QNczyrp0LFAlkByWcZOS7kE+2hlY2pmUMV9?= =?us-ascii?Q?aXF7wRyGummS9K5MnnaCsEIPgpnkt9w0uVJlPWeBoAs/h20/bFGdByhTre8d?= =?us-ascii?Q?qipBikRcj+g+G8WKEe1nEh74otrq7I7dBie0n5wrtTDa/mSoBlaoKxwR9wUC?= =?us-ascii?Q?BJo6ajWaZ0VZ57Nc69quZnDC0VHr2EMuHaf4DX9wlKJEmq8fkb8wh3PSTe4I?= =?us-ascii?Q?AmL/opOv8KznYEUyNeAIaLQLeqvitQLirxh7Lq6WSMVQInX7MsMO6wPDH0h6?= =?us-ascii?Q?Dw5s/L3uP+dKlJywzCcS+lymCQ17wSc4jXqUk97kEAX/oAa31YOA2qwGHIrq?= =?us-ascii?Q?o9Qh2xLTPRWVsc2181vUfA8kv0ol6AaRyh5UIuwYpJMtFIPGouqLabG0LGj0?= =?us-ascii?Q?gVc+/VPf05Ys0vqXIqgf2qJDjhr6wSyrnLRRekbSre9mHGIQrAhPithMflT4?= =?us-ascii?Q?Z2odd9UqH1aHWXw2lAmMGjG62CVMEzWq8cpNVWZImRs6lRyOf4XrHb0YX59+?= =?us-ascii?Q?v8IS21hXWpmYi+zZKKaF1G2p9b3NeZSkE2v/3oe4sDrraVRAk3KwY4ydtdgQ?= =?us-ascii?Q?ejMH+7vlV0z9gX0LnrQujw2xbZ3Pzy2BWVyhW1CY88jKBhDumhBpkhYTw9Gl?= =?us-ascii?Q?2afvAo0/7TDS2uz2u8b3EijF+EYmfphIgJ1eKl0nG1bJULrKZiOOsItg7Ea5?= =?us-ascii?Q?+fvxASMTh1GCFZ7h2sqao60Dqk9aLgDAI1W+cbG76vmj4v8udmrh2KNvdINy?= =?us-ascii?Q?gJf0TciBF5UAhZB+rMmytPZJG9UodaEe9Q6BQAFKDX64dDgL7HrbqNF20YP5?= =?us-ascii?Q?AEdLsnHs7FORwRtg5TpivH9YOHmtfTlADorkEANOAt7z1XEBsCORrgjxm+a8?= =?us-ascii?Q?fD/XSHaEktTrHQCXPsMa2ocx?= 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: dd61fcf2-1ce0-40be-7067-08d8d79c486f X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Feb 2021 01:42:30.1698 (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: vWG+49320K8kj8UQ+PexM1/cdcxIw108lNANIbl5ndYCT3EMKsLcBR9nug7FPxNmzML6Uuot9Un6bPZ2HIr5XA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR11MB4082 Return-Path: hao.a.wu@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_BN8PR11MB3666CFF17BE27AE0EAF9566DCA809BN8PR11MB3666namp_" --_000_BN8PR11MB3666CFF17BE27AE0EAF9566DCA809BN8PR11MB3666namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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 case= 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 (O= VMF) 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 ; Dong, Eric ;= Ni, Ray ; Yao, Jiewen Subject: RE: [PATCH v2 1/6] MdeModulePkg: DxeMmUnblockMemoryLib: Added defi= nition 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 appreciat= ed. 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 definiti= on 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/DxeMmUnblockMemoryL= ibNull.c b/MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemoryLib= Null.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 ac= cess 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 i= nside MM environment. + + @param UnblockAddress The address of buffer caller requests to= unblock, the address + has to be page aligned. + @param NumberOfPages The number of pages requested to be unbl= ocked from MM + environment. + + @return EFI_SUCCESS The request goes through successfully. + @return EFI_NOT_AVAILABLE_YET The requested functionality is not produ= ced yet. + @return EFI_UNSUPPORTED The requested functionality is not suppo= rted on current platform. + @return EFI_SECURITY_VIOLATION The requested address failed to pass sec= urity check for + unblocking. + @return EFI_INVALID_PARAMETER Input address either NULL pointer or not= page aligned. + @return EFI_ACCESS_DENIED The request is rejected due to system ha= s 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/MdeModu= lePkg/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 ac= cess 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 i= nside MM environment. + + @param UnblockAddress The address of buffer caller requests to= unblock, the address + has to be page aligned. + @param NumberOfPages The number of pages requested to be unbl= ocked from MM + environment. + + @return EFI_SUCCESS The request goes through successfully. + @return EFI_NOT_AVAILABLE_YET The requested functionality is not produ= ced yet. + @return EFI_UNSUPPORTED The requested functionality is not suppo= rted on current platform. + @return EFI_SECURITY_VIOLATION The requested address failed to pass sec= urity check for + unblocking. + @return EFI_INVALID_PARAMETER Input address either NULL pointer or not= page aligned. + @return EFI_ACCESS_DENIED The request is rejected due to system ha= s 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/DxeMmUnblockMemoryL= ibNull.inf b/MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemoryL= ibNull.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 a= ccess 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 to= 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/DisplayUpdateProgressLibGr= aphics/DisplayUpdateProgressLibGraphics.inf VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/Var= iablePolicyHelperLib.inf + DxeMmUnblockMemoryLib|MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUn= blockMemoryLibNull.inf [LibraryClasses.EBC.PEIM] IoLib|MdePkg/Library/PeiIoLibCpuIo/PeiIoLibCpuIo.inf @@ -332,6 +333,7 @@ [Components] MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf MdeModulePkg/Library/DisplayUpdateProgressLibGraphics/DisplayUpdateProgr= essLibGraphics.inf MdeModulePkg/Library/DisplayUpdateProgressLibText/DisplayUpdateProgressL= ibText.inf + MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemoryLibNull.inf MdeModulePkg/Universal/BdsDxe/BdsDxe.inf MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenuApp.inf -- 2.30.0.windows.1 --_000_BN8PR11MB3666CFF17BE27AE0EAF9566DCA809BN8PR11MB3666namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

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 case for MdePkg\Library\SmmMemLib\

I have looped in Jiewen, Liming and Mike for comment= s.

 

Also, since:

* New library dependency for VariableSmmRuntimeDxe.i= nf

* 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 th= e 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 <jiewe= n.yao@intel.com>
Subject: RE: [PATCH v2 1/6] MdeModulePkg: DxeMmUnblockMemoryLib: Add= ed definition and null instance

 

Hi Hao,

 

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

 

Regards,

Kun

 

From: Ku= n 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 d= efinition 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 <jian.j.wang@in= tel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Eric Dong <
eric.dong@intel.co= m>
Cc: Ray Ni <ray.ni@intel.com>=
Cc: Jiewen Yao <jiewen.yao@intel= .com>

Signed-off-by: Kun Qin <kun.q@outlo= ok.com>
---

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

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

diff --git a/MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemoryL= ibNull.c b/MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemoryLib= Null.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 pa= ge 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 accessi= ble inside MM environment.
+
+  @param  UnblockAddress      &nbs= p;   The address of buffer caller requests to unblock, the addres= s
+            &n= bsp;            = ;         has to be page aligned. +  @param  NumberOfPages       = ;    The number of pages requested to be unblocked from MM +            &n= bsp;            = ;         environment.
+
+  @return EFI_SUCCESS        =      The request goes through successfully.
+  @return EFI_NOT_AVAILABLE_YET   The requested functionali= ty is not produced yet.
+  @return EFI_UNSUPPORTED       &n= bsp; The requested functionality is not supported on current platform.
+  @return EFI_SECURITY_VIOLATION  The requested address failed t= o pass security check for
+            &n= bsp;            = ;         unblocking.
+  @return EFI_INVALID_PARAMETER   Input address either NULL= pointer or not page aligned.
+  @return EFI_ACCESS_DENIED       The r= equest is rejected due to system has passed certain boot
+            &n= bsp;            = ;         phase.
+
+**/
+EFI_STATUS
+EFIAPI
+DxeMmUnblockMemoryRequest (
+  IN EFI_PHYSICAL_ADDRESS   UnblockAddress,
+  IN UINT64         &nbs= p;       NumberOfPages
+  )
+{
+  return EFI_UNSUPPORTED;
+}
diff --git a/MdeModulePkg/Include/Library/DxeMmUnblockMemoryLib.h b/MdeModu= lePkg/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 pa= ge 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 accessi= ble inside MM environment.
+
+  @param  UnblockAddress      &nbs= p;   The address of buffer caller requests to unblock, the addres= s
+            &n= bsp;            = ;         has to be page aligned. +  @param  NumberOfPages       = ;    The number of pages requested to be unblocked from MM +            &n= bsp;            = ;         environment.
+
+  @return EFI_SUCCESS        =      The request goes through successfully.
+  @return EFI_NOT_AVAILABLE_YET   The requested functionali= ty is not produced yet.
+  @return EFI_UNSUPPORTED       &n= bsp; The requested functionality is not supported on current platform.
+  @return EFI_SECURITY_VIOLATION  The requested address failed t= o pass security check for
+            &n= bsp;            = ;         unblocking.
+  @return EFI_INVALID_PARAMETER   Input address either NULL= pointer or not page aligned.
+  @return EFI_ACCESS_DENIED       The r= equest is rejected due to system has passed certain boot
+            &n= bsp;            = ;         phase.
+
+**/
+EFI_STATUS
+EFIAPI
+DxeMmUnblockMemoryRequest (
+  IN EFI_PHYSICAL_ADDRESS   UnblockAddress,
+  IN UINT64         &nbs= p;       NumberOfPages
+);
+
+#endif // _DXE_MM_UNBLOCK_MEMORY_LIB_H_
diff --git a/MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemoryL= ibNull.inf b/MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemoryL= ibNull.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 p= age access to be unblocked
+#  by MM environment if applicable.
+#
+#  Copyright (c), Microsoft Corporation.
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#
+##
+
+[Defines]
+  INF_VERSION         &n= bsp;          =3D 0x0001001B +  BASE_NAME         &nbs= p;            =3D Dx= eMmUnblockMemoryLibNull
+  FILE_GUID         &nbs= p;            =3D 9E= 890F68-5C95-4C31-95DD-59E6286F85EA
+  MODULE_TYPE         &n= bsp;          =3D BASE
+  VERSION_STRING         = ;        =3D 1.0
+  LIBRARY_CLASS         =          =3D DxeMmUnblockMemoryLib<= br> +
+#
+#  VALID_ARCHITECTURES        = ;   =3D IA32 X64
+#
+
+[Sources]
+  DxeMmUnblockMemoryLibNull.c
+
+[Packages]
+  MdePkg/MdePkg.dec
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec<= br> index 148395511034..1bb5017da2c5 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -154,6 +154,11 @@ [LibraryClasses]
   #
   VariablePolicyHelperLib|Include/Library/VariablePolicyHelperLi= b.h
 
+  ##  @libraryclass  This library provides an interface for= DXE drivers to request MM environment
+  #   to map/unblock a memory region for accessibility insi= de 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<= br> 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/DisplayUpdatePro= gressLibGraphics/DisplayUpdateProgressLibGraphics.inf
   VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHel= perLib/VariablePolicyHelperLib.inf
+  DxeMmUnblockMemoryLib|MdeModulePkg/Library/DxeMmUnblockMemoryLib/Dx= eMmUnblockMemoryLibNull.inf
 
 [LibraryClasses.EBC.PEIM]
   IoLib|MdePkg/Library/PeiIoLibCpuIo/PeiIoLibCpuIo.inf
@@ -332,6 +333,7 @@ [Components]
   MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf    MdeModulePkg/Library/DisplayUpdateProgressLibGraphics/DisplayU= pdateProgressLibGraphics.inf
   MdeModulePkg/Library/DisplayUpdateProgressLibText/DisplayUpdat= eProgressLibText.inf
+  MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemoryLibNul= l.inf
 
   MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
   MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenuApp= .inf
--
2.30.0.windows.1

 

--_000_BN8PR11MB3666CFF17BE27AE0EAF9566DCA809BN8PR11MB3666namp_--