From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.43; helo=mga05.intel.com; envelope-from=michael.d.kinney@intel.com; receiver=edk2-devel@lists.01.org Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 6D2E4207E53F8 for ; Thu, 24 May 2018 09:57:09 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 May 2018 09:57:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,436,1520924400"; d="scan'208";a="44478003" Received: from orsmsx106.amr.corp.intel.com ([10.22.225.133]) by orsmga006.jf.intel.com with ESMTP; 24 May 2018 09:57:08 -0700 Received: from orsmsx159.amr.corp.intel.com (10.22.240.24) by ORSMSX106.amr.corp.intel.com (10.22.225.133) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 24 May 2018 09:57:08 -0700 Received: from orsmsx113.amr.corp.intel.com ([169.254.9.119]) by ORSMSX159.amr.corp.intel.com ([169.254.11.143]) with mapi id 14.03.0319.002; Thu, 24 May 2018 09:57:08 -0700 From: "Kinney, Michael D" To: Ard Biesheuvel , "edk2-devel@lists.01.org" , "Kinney, Michael D" CC: Laszlo Ersek , Leif Lindholm , "Gao, Liming" , "Zeng, Star" , "Dong, Eric" , "Bi, Dandan" Thread-Topic: [PATCH v2 0/5] Abstract allocation of PEI accessible memory Thread-Index: AQHT8z7+Re80do4jOUCXsDj3Odtsg6Q/Fyjw Date: Thu, 24 May 2018 16:57:07 +0000 Message-ID: References: <20180524090945.10289-1-ard.biesheuvel@linaro.org> In-Reply-To: <20180524090945.10289-1-ard.biesheuvel@linaro.org> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.200.100 dlp-reaction: no-action x-originating-ip: [10.22.254.140] MIME-Version: 1.0 Subject: Re: [PATCH v2 0/5] Abstract allocation of PEI accessible memory X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 May 2018 16:57:09 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Ard, Thanks for the update. This looks really close. One comment is on the use of #ifdef MDE_CPU_X64 in a C file. In general, the #ifdef for a specific type of CPU should be limited to .h files and we should split out CPU specific sources into their own source files and use the INF file [Sources.] to list the CPU specific source files. Only other minor comment is that the summary still mentions adding the new API to the UefiLib. Mike > -----Original Message----- > From: Ard Biesheuvel [mailto:ard.biesheuvel@linaro.org] > Sent: Thursday, May 24, 2018 2:10 AM > To: edk2-devel@lists.01.org > Cc: Ard Biesheuvel ; Laszlo > Ersek ; Leif Lindholm > ; Kinney, Michael D > ; Gao, Liming > ; Zeng, Star > ; Dong, Eric ; > Bi, Dandan > Subject: [PATCH v2 0/5] Abstract allocation of PEI > accessible memory >=20 > At the moment, FirmwarePerformanceTableDataDxe or > DxeCorePerformanceLib > are unusable on systems such as AMD Seattle, because > they unconditionally > attempt to allocate memory below 4 GB, and ASSERT() if > this fails. On AMD > Seattle, no 32-bit addressable DRAM exists, and so the > driver will always > assert, and crash a running DEBUG build. >=20 > The reason for this is that some platforms (i.e., X64 > builds consisting of > a 32-bit PEI stage and 64-bit remaining stages) require > these allocations > to be below 4 GB, and for some reason, open coding this > practice throughout > the code without regard for other architectures has been > regarded as an > acceptable approach. >=20 > Instead, I would like to propose the approach > implemented in this series: > - create an abstracted EfiAllocatePeiAccessiblePages() > routine in UefiLib > that simply allocates pages from any region on all > architectures except > X64, and allocate below 4 GB for X64 > - update the various call sites with calls to this new > function. >=20 > The above is implemented in patches #3 - #6. Patches #1 > and #2 are fixes > for issues that I observed in ArmVirtPkg and OvmfPkg > while working on > these patches. >=20 > Code can be found here: > https://github.com/ardbiesheuvel/edk2/tree/allocate-pei- > v2 >=20 > Changes since v1: > - add Laszlo's ack to #1 - #2 > - move EfiAllocatePeiPages() to DxeServicesLib and drop > Efi prefix > - update implementation to take EfiFreeMemoryTop into > account when built > for X64 >=20 > Cc: Laszlo Ersek > Cc: Leif Lindholm > Cc: Michael D Kinney > Cc: Liming Gao > Cc: Star Zeng > Cc: Eric Dong > Cc: Dandan Bi >=20 > Ard Biesheuvel (5): > OvmfPkg/PlatformBootManagerLib: add missing report > status code call > ArmVirtPkg/PlatformBootManagerLib: add missing report > status code call > MdePkg/DxeServicesLib: introduce > AllocatePeiAccessiblePages routine > MdeModulePkg/DxeCorePerformanceLib: use > AllocatePeiAccessiblePages > MdeModulePkg/FirmwarePerformanceDataTableDxe: use > AllocatePeiAccessiblePages >=20 > .../PlatformBootManagerLib.inf | 1 + > .../PlatformBootManagerLib/QemuKernel.c | 4 ++ > .../DxeCorePerformanceLib.c | 45 ++-- > ----------- > .../FirmwarePerformanceDxe.c | 51 +++- > ------------- > .../FirmwarePerformanceDxe.inf | 1 + > MdePkg/Include/Library/DxeServicesLib.h | 23 > +++++++- > .../Library/DxeServicesLib/DxeServicesLib.c | 55 > +++++++++++++++++++ > .../Library/DxeServicesLib/DxeServicesLib.inf | 3 + > .../PlatformBootManagerLib.inf | 1 + > .../PlatformBootManagerLib/QemuKernel.c | 4 ++ > 10 files changed, 104 insertions(+), 84 deletions(-) >=20 > -- > 2.17.0