From nobody Wed May 1 23:14:22 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zoho.com; dkim=fail spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1496316177108963.835961386106; Thu, 1 Jun 2017 04:22:57 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 9136B21AE30EF; Thu, 1 Jun 2017 04:21:51 -0700 (PDT) Received: from mail-wm0-x22c.google.com (mail-wm0-x22c.google.com [IPv6:2a00:1450:400c:c09::22c]) (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 B6BDA21AE30EC for ; Thu, 1 Jun 2017 04:21:50 -0700 (PDT) Received: by mail-wm0-x22c.google.com with SMTP id d127so56020812wmf.0 for ; Thu, 01 Jun 2017 04:22:52 -0700 (PDT) Received: from localhost.localdomain ([196.71.200.86]) by smtp.gmail.com with ESMTPSA id l8sm19562140wmd.8.2017.06.01.04.22.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Jun 2017 04:22:47 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=pj4rL0ebrCjlXcS9lo1yv93lknT/m4e9PBHzYaUp8kw=; b=LisfDTvrgQ1sLFZ3sRRmghi6LrjRgkkXH8T8K+NU/N9hBjAd7g+xFpGMCbhLXUXZw2 NTxOxGdS8htoRJHhkktErf3hZ4tLNChndfLdClMPS4MDTitgFLRCv7OeKkuC/89Argx1 uyg/UNhExYaG3UsfgbvDON/lF939HygXLIa3E= 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=pj4rL0ebrCjlXcS9lo1yv93lknT/m4e9PBHzYaUp8kw=; b=n1yW5vUn9jYl6I8fE8vjyWghzMakqqc2y1H652avQy/DsLKR4WJpX0KTx2gavItd9x ++b+IJjkhlVf+OaD8QWSyoySpFn+lTZyqCGccg9qs4erICtBumyHhv8UbLNWgVH45dgq LPu6Dn90a8dW6n1aXJunYr+YbrBiDSh1d7lRSsjLhCcN+QnZKpxyhkLZpEeFcloa8Oke d4JXCD3x2hFzjbl7Nm0ktNLLS62i0y4xc/ilIn92GHO8fgzfftn7vvMuAIkcQAUniHSp ta5Qh3Ehlhnpi9oOibiJQLK8P97ly9FCYbBmGD8sjmfY+S1NqH/MJAdQu74TL30bi0s8 SExg== X-Gm-Message-State: AODbwcAYaEEebQ6gO9kPOCicY9QHWUblwpwqfCStPXhakS8VVnzzUOtK tRXiWsJhNVUyIRVCLCE0AQ== X-Received: by 10.223.138.188 with SMTP id y57mr878822wry.93.1496316169627; Thu, 01 Jun 2017 04:22:49 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org, lersek@redhat.com Date: Thu, 1 Jun 2017 11:22:41 +0000 Message-Id: <20170601112241.2580-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.9.3 Subject: [edk2] [RFC PATCH] OvmfPkg/AcpiPlatformDxe: lift 4 GB alloc limit for modern ACPI systems X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jordan.l.justen@intel.com, leif.lindholm@linaro.org, Ard Biesheuvel MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" ACPI supports architectures such as arm64, which did not exist when the original 32-bit ACPI 1.0 was introduced. These days, ACPI tables can all support 64-bit memory addresses, and so QEMU has been updated to emit 64-bit table and entry point types on arm64/mach-virt. For the UEFI side, this means we no longer have to serve allocation requests from the 32-bit addressable region. So lift this restriction when the platform has been configured without ACPI 1.0b support. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- This is an RFC because this change breaks compatibility with older versions of QEMU. At the least, this means I should sit on this patch for another while, but perhaps it also means we need some runtime logic to detect which QEMU we are dealing with? Comments welcome. OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf | 3 +++ OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c | 13 +++++++++++-- OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf | 3 +++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf b/OvmfPkg/AcpiPlat= formDxe/AcpiPlatformDxe.inf index 9a9b2e6bb2e5..9b883871bc23 100644 --- a/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf +++ b/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf @@ -73,5 +73,8 @@ [Pcd] gPcAtChipsetPkgTokenSpaceGuid.Pcd8259LegacyModeEdgeLevel gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFdBaseAddress =20 +[FixedPcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiExposedTableVersions + [Depex] gEfiAcpiTableProtocolGuid diff --git a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c b/OvmfPkg/AcpiPlatform= Dxe/QemuFwCfgAcpi.c index 1bc5fe297a96..97632bc636c0 100644 --- a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c +++ b/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c @@ -24,6 +24,7 @@ #include #include #include +#include =20 =20 // @@ -173,6 +174,7 @@ ProcessCmdAllocate ( UINTN NumPages; EFI_PHYSICAL_ADDRESS Address; BLOB *Blob; + EFI_ALLOCATE_TYPE AllocType; =20 if (Allocate->File[QEMU_LOADER_FNAME_SIZE - 1] !=3D '\0') { DEBUG ((EFI_D_ERROR, "%a: malformed file name\n", __FUNCTION__)); @@ -192,9 +194,16 @@ ProcessCmdAllocate ( return Status; } =20 + if ((FixedPcdGet32 (PcdAcpiExposedTableVersions) & + EFI_ACPI_TABLE_VERSION_1_0B) !=3D 0) { + Address =3D 0xFFFFFFFF; + AllocType =3D AllocateMaxAddress; + } else { + AllocType =3D AllocateAnyPages; + } + NumPages =3D EFI_SIZE_TO_PAGES (FwCfgSize); - Address =3D 0xFFFFFFFF; - Status =3D gBS->AllocatePages (AllocateMaxAddress, EfiACPIMemoryNVS, Num= Pages, + Status =3D gBS->AllocatePages (AllocType, EfiACPIMemoryNVS, NumPages, &Address); if (EFI_ERROR (Status)) { return Status; diff --git a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf b/OvmfPkg= /AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf index adc50cfd9f76..64db80dd9cbc 100644 --- a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf +++ b/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf @@ -58,5 +58,8 @@ [Guids] [Pcd] gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration =20 +[FixedPcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiExposedTableVersions + [Depex] gEfiAcpiTableProtocolGuid --=20 2.9.3 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel