From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:4001:c0b::242; helo=mail-it0-x242.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-it0-x242.google.com (mail-it0-x242.google.com [IPv6:2607:f8b0:4001:c0b::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 706302097DD29 for ; Tue, 29 May 2018 01:49:55 -0700 (PDT) Received: by mail-it0-x242.google.com with SMTP id p3-v6so17488881itc.0 for ; Tue, 29 May 2018 01:49:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=LV/n3FGziCsSTKuTU836fkv1ZQGdgmN6oK8KWvS1lJ8=; b=W9RYG8eRD7ax0qzTVY+EI33SDlA9jYQot3ACFH2wfsnLuL7wOvk4SYhxYXZQK43EBJ 7EI/bQmWSiJQdmlEXL1eg6djIf52kjxb1mwDuccS3iMliep78I/ELE+VnsWAvDks0Plq HZU0tCD2hlEleF68hKPD9YsSwWxx82jTBk+o4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=LV/n3FGziCsSTKuTU836fkv1ZQGdgmN6oK8KWvS1lJ8=; b=BzKWy9YsRqOxbgxttvmywayZCw+N/X+4FuJyn74L4pF6vNZRSpUSMO4xibtXa5JWna /PdFnkhhh28RXzGyViR5mSkZJw43QuyhWbo0Z546HIun/l738HL+1XB4Hp8O4eD6AgDX t4/LHsrdRGx6gpMfNC4TgtjM/Al6LXKQ5t3geCkLXoNQZH405cP5jZIuKoGRifgY05YF 8TqKH5JoeDh1WT67m/5Ji5N6tuaVlX1fB3bK1ZMcOdxHgwxpTsCwayFEI85k13K/cz+F zUPPOibL714d8+c1Y3/t867MvVSHsqtpITpFPZYAVwzS0S/SebXbOuIBMxx5paRErqjr vB1w== X-Gm-Message-State: ALKqPwfzXx69UzTSPBXtQnih93Ftr+b7g+k95OodiPxXHg6TnPngTzLD 0nE/ZW6Gslp+A5vIrTVegt1rO2NFYoPLc1COIaeTIqxEtvE= X-Google-Smtp-Source: ADUXVKJyrp87vXNwBJ2iQlPq5iIuWB5pwG4UbRU9h+jsm2Oa4nH9fmkSrbkvb0XXibd57sNzfHIhclJbu/eMn3YC6UU= X-Received: by 2002:a24:534e:: with SMTP id n75-v6mr13585117itb.138.1527583794893; Tue, 29 May 2018 01:49:54 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a6b:bb86:0:0:0:0:0 with HTTP; Tue, 29 May 2018 01:49:54 -0700 (PDT) In-Reply-To: <20180528144024.10809-1-ard.biesheuvel@linaro.org> References: <20180528144024.10809-1-ard.biesheuvel@linaro.org> From: Ard Biesheuvel Date: Tue, 29 May 2018 10:49:54 +0200 Message-ID: To: "edk2-devel@lists.01.org" Cc: Ard Biesheuvel Subject: Re: [PATCH v3 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: Tue, 29 May 2018 08:49:56 -0000 Content-Type: text/plain; charset="UTF-8" On 28 May 2018 at 16:40, Ard Biesheuvel wrote: > 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. > > 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. > > Instead, I would like to propose the approach implemented in this series: > - create an abstracted AllocatePeiAccessiblePages() routine in DxeServicesLib > 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. > > 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. > > Code can be found here: > https://github.com/ardbiesheuvel/edk2/tree/allocate-pei-v3 > > Changes since v2: > - move AllocatePeiAccessiblePages() to a separate .c file, and create a special > X64 version (#3) > - add back ZeroMem() call to #4 > - add Laszlo's ack to #4 - #5 (but not to #3 since it has been updated) > > 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 > > 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 > Pushed as 2d0c6692eee4..65e984cd8ad8 Thanks all.