From patchwork Thu May 24 09:09:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 136720 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp1938252lji; Thu, 24 May 2018 02:09:54 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrK7IleqjXMQIS6ANBM5NZQocq8uMKiXNuUAe9VHWPEQKl/a8G3ZWN9vyffPbk4GkOvIwDT X-Received: by 2002:a63:ae4c:: with SMTP id e12-v6mr5010458pgp.181.1527152993953; Thu, 24 May 2018 02:09:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527152993; cv=none; d=google.com; s=arc-20160816; b=qa1+RImpcPNSnAeMoE9U0QzlwqP57Fg8FfmOp/ftEXKza5Ui70NE3c69Mv3Oa+3Czq B6njeDY86qZKyX3fbF4pTHAk68/QctVda2YCapb34DeIBUXWC0ToXeSICco+pafOlT54 yaOmB+WOYVLPLnt1nIq3mpukcnghvcM47/rk9MiIl8Eww/BXuaEHRRDrPZQHsHjLMvoN tta1HUHepap1hz2DIJmRFJVW7XXS4ka++tkh6unIqPmBbjpefRdU/cliv4zlSVazmEN6 8lzhcfT9z981LNL6Uzf2RJ6Q1zQjubub/vfazI82PGhD36pWkhfJZTLTVgmgk3Dc6u7k 7M2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to:arc-authentication-results; bh=M41ZrnrnhF0njvODe2fY1RR22P2IibIKWc8SzPiCLvY=; b=dTr4guEuNqArxER4LHZdNrxnHBLscNNEHKYAoFVT58nUUvB8pmci+6M816P2kkYvjp TGTf6l9f+Q5w194rRdK/Gecc4vrBTxDK6Xy3pn5GAa5Pe6KFmYWJJDtjLl7Ndy26uQ6u 6cd8KfUe2BKHuFaZfv9yd5810BSPbstMhEpjJgxxXwNd8LQjpaNT8W5jsUd/EEczQJXS kR2QJvJfAirTQSGo/gm56+lo/ig1ZoYepPzBzlGzmaaBTRFODMOIf89g1giApgDMYC3Y YnN/rk/4ghIYVtV0RCwK/WV6YIj85a/NMEoAMCJ0+kxgndqU/hGYMazkAKe1Tk5dlhdf Xlqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=iptXnlA5; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id v38-v6si21412365plg.283.2018.05.24.02.09.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 May 2018 02:09:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=iptXnlA5; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 568E42083796D; Thu, 24 May 2018 02:09:53 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c0c::241; helo=mail-wr0-x241.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr0-x241.google.com (mail-wr0-x241.google.com [IPv6:2a00:1450:400c:c0c::241]) (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 81744207E6376 for ; Thu, 24 May 2018 02:09:52 -0700 (PDT) Received: by mail-wr0-x241.google.com with SMTP id i12-v6so1695950wrc.4 for ; Thu, 24 May 2018 02:09:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=Uzz0QyLt4Fr8pKPiHZYf9hT1+XiwIbv2OCEoNsHYP3Y=; b=iptXnlA5ZX9dyr3DbjHaXLQtEBRkooUkFh66CQLkvXMbqnkVsEF3Ysce7hq02oD4lR HkYnaBzO+MhO+19IBjAocsdC64vH4M0AGPLCdu/CeTeoYrtANuS412hquZ7N7Nh3vDlp fd8aKPlurs/W2sMZm4GNmWdqigtYwQUqFSikA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Uzz0QyLt4Fr8pKPiHZYf9hT1+XiwIbv2OCEoNsHYP3Y=; b=tO/xBjYapw12MVzGV885rtAwpQ1hQa9141Nb7D52c0epaxQIJ6IGP2u30dqzlEYFck CAF7SawnXCkDcT/199KYoE/AUxgtgMG3GAd+xwHY/9tec+zdeepdNh/38l9pzhQwR8mJ eq1Obxm+SwD03zo4mQLtP+zxlwyWMYc/4+claaFff9VXe7SCwOnBV7Hk15ITusXmwZAq usILm0vbOPz7DgTtwDTkLnTQnrk5xtaPUafosKC71En8BtmOBtXujBCIiJsvJqec8vSB DMZAe8jx4J8a5CqnrrT8rm3K7DpFK7vY0xAWplgcII37nGsX5tp+3ePqvMxIuXUc+Rl2 A4Hg== X-Gm-Message-State: ALKqPwef/+psQ6A8AwwbWQRzUntRQagJGXd0SJaqmUCo90pTjk9OzQHp 0EFcHJgbxWnEuESAi46KfnMQixMXUH8= X-Received: by 2002:adf:a9aa:: with SMTP id b39-v6mr5782942wrd.36.1527152989809; Thu, 24 May 2018 02:09:49 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:3995:5470:200:1aff:fe1b:b328]) by smtp.gmail.com with ESMTPSA id x16-v6sm8505467wmc.2.2018.05.24.02.09.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 May 2018 02:09:48 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Thu, 24 May 2018 11:09:40 +0200 Message-Id: <20180524090945.10289-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.0 Subject: [edk2] [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: , Cc: Eric Dong , Ard Biesheuvel , Liming Gao , Dandan Bi , Leif Lindholm , Michael D Kinney , Laszlo Ersek , Star Zeng MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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 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. 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-v2 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 Cc: Laszlo Ersek Cc: Leif Lindholm Cc: Michael D Kinney Cc: Liming Gao Cc: Star Zeng Cc: Eric Dong Cc: Dandan Bi 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 .../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(-) -- 2.17.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel