From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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-Google-Smtp-Source: AB8JxZoygxXRETgUphg5mSYeVSaofPSLw0qQiLtVRuC+xA0uFl9re0yajjnTQDtevXr+JJYmzKk+Sg== 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 Cc: Ard Biesheuvel , Laszlo Ersek , Leif Lindholm , Michael D Kinney , Liming Gao , Star Zeng , Eric Dong , Dandan Bi 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: [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: , X-List-Received-Date: Tue, 22 May 2018 14:08:57 -0000 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