From patchwork Tue May 22 14:08:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 136547 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp1682808lji; Tue, 22 May 2018 07:08:59 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoS/jEPS8Zz/0QXAYwzToJrBK7d3sTwcwk62jcDimgCPg3lnPAawI7QXVIcq6XZeZd3tEU6 X-Received: by 2002:a63:6584:: with SMTP id z126-v6mr19284938pgb.168.1526998139804; Tue, 22 May 2018 07:08:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526998139; cv=none; d=google.com; s=arc-20160816; b=wfX/e8b1SPRqCMY9NHqKndL6i9xKTdHIwPQZqQlhppNrtdV96wngE3IfmaDEgbASZW a+BzFCA5m8r9umOf7b93JdkDjFsFBJv0yrgW2AMhFE/Swk3ixsceXcc01AsI5hFTf9da JD5Ufl/l/rDfe47UcstCSqiT6ARVYyD5qu1+3mzkkLOv5sH9oKltobu/34rDCI09WUGB oq3y6bkPEDNNWIk+FV9Kz6t/JMBhF2tTQ0noiZpHQWwrihfCjjSSfyfC4iwpAdPzsP3S 50w3nu8xsfZLOh0iw+Kvaifvm6JkYD2Y6pN05v99muRLqFuw7I9RsBsAr/0FrJLCCuXr /hRw== 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=wbPXQHBxww6Vtv2/2hBsOTqmzDIEtN898HriV8VNN/U=; b=sTzPKqV9m/jD0kdyFnolK/oDfVWJj6d5PKl+eKKkos2rse8r5KZiPyhhDTcDfF8Fgy i86jHna0qlXwbnr5qes9zdFGHKs2fMH5frs7qZh8PnmHBTEHg86EoXOj8tpROk+hT809 xseampyJShZ5WKLxWDsbaVqpdHnFd5oSvL+OPf85IqDwjqWycJtvHAq7g1vZGSuuhht7 NcLB5YsR8yKiiLSjqtGPGUJYj2GCq3IOx4WeDk7QDPcA6DbrYO0PJA+j9NJ/RhmBNxQR 0tIKOGCsCDfx6CWt1HzrukvHH7lozn7yXu+JAxeCqVMh4mMnWLo8dbLXw1qjxVO335Vd AStg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ET8lpetd; 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 r5-v6si16744317plo.479.2018.05.22.07.08.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 May 2018 07:08:59 -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=ET8lpetd; 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 CE0EF203B992E; Tue, 22 May 2018 07:08:58 -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::243; helo=mail-wr0-x243.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr0-x243.google.com (mail-wr0-x243.google.com [IPv6:2a00:1450:400c:c0c::243]) (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 4671B203B992C for ; Tue, 22 May 2018 07:08:57 -0700 (PDT) Received: by mail-wr0-x243.google.com with SMTP id i12-v6so7288532wrc.4 for ; Tue, 22 May 2018 07:08:56 -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=nJHNdtsubLoNNi/NZjGfhx/+M4HNtCakh5wk9ZiKJ0w=; b=ET8lpetdHva362Iu4Y/R0+QOkpCGagubCVa0Jh+yTTv4zNywE8ynsatLISN33ZINK6 O0z8U1MBIWXTdV+GVwAWoKSEQUjMGBq/rknpIG5Sq6BeDX8hHtDLg2d/xV/gjj4DjCpV VR/XmSBhdGuu32MBSqLIWoMkfXw9ZcZqZ6qiE= 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=nJHNdtsubLoNNi/NZjGfhx/+M4HNtCakh5wk9ZiKJ0w=; b=bBDorhcvHfgPXKvLAZBXpOTfGDmaqURDYdrHN5q9ldcDl+o7BrJPLaT2RlBTnRJprp 6N/t5FvE6LkMHQxltu6tURh4uOq9A+vEtG2Bz7gTATOGQi5UxYXF/bWELMmceU69tzMU g33OT4pgrapSUMNz0YC+/z7PL4Vgba+ouIlkgy/dSXKyBO7xRMwC/b7HlIegP14collm Y9STklkDSHRcvf/CJmzdWdU1bSbhggLQ3c2pnVTt7Xds6VTDoWAQLdAC1/6/0jjt7IYp d/CHpivXSGijvOmTEC6/fxpVTAC+nsGUCAH72AHaMDammbnv3C6h29RZBsGY5ovnLxfz uSNg== X-Gm-Message-State: ALKqPwcmD7xUD4mxonf9oTHs6OOYQ3VxKS+3gDFiRReObPxQQBqAq+nZ xe0mtjntA08N8hCGoQEC3bnAzm9K/fE= X-Received: by 2002:adf:9dc7:: with SMTP id q7-v6mr7448019wre.14.1526998135392; Tue, 22 May 2018 07:08:55 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:3995:5470:200:1aff:fe1b:b328]) by smtp.gmail.com with ESMTPSA id r6-v6sm17755545wrg.73.2018.05.22.07.08.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 May 2018 07:08:54 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Tue, 22 May 2018 16:08:44 +0200 Message-Id: <20180522140850.30369-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.0 Subject: [edk2] [PATCH 0/6] 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 Cc: Laszlo Ersek Cc: Leif Lindholm Cc: Michael D Kinney Cc: Liming Gao Cc: Star Zeng Cc: Eric Dong Cc: Dandan Bi Ard Biesheuvel (6): OvmfPkg/PlatformBootManagerLib: add missing report status code call ArmVirtPkg/PlatformBootManagerLib: add missing report status code call MdePkg/UefiLib: introduce EfiAllocatePeiAccessiblePages routine IntelFrameworkPkg/FrameworkUefiLib: add EfiAllocatePeiAccessiblePages routine MdeModulePkg/DxeCorePerformanceLib: use EfiAllocatePeiAccessiblePages MdeModulePkg/FirmwarePerformanceDataTableDxe: use EfiAllocatePeiAccessiblePages .../PlatformBootManagerLib.inf | 1 + .../PlatformBootManagerLib/QemuKernel.c | 4 ++ .../Library/FrameworkUefiLib/UefiLib.c | 48 ++++++++++++++++++ .../DxeCorePerformanceLib.c | 45 ++--------------- .../FirmwarePerformanceDxe.c | 50 +++---------------- MdePkg/Include/Library/UefiLib.h | 23 +++++++++ MdePkg/Library/UefiLib/UefiLib.c | 48 ++++++++++++++++++ .../PlatformBootManagerLib.inf | 1 + .../PlatformBootManagerLib/QemuKernel.c | 4 ++ 9 files changed, 141 insertions(+), 83 deletions(-) -- 2.17.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel