From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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) 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) 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) From: Ard Biesheuvel To: edk2-devel@lists.01.org, lersek@redhat.com Cc: leif.lindholm@linaro.org, jordan.l.justen@intel.com, Ard Biesheuvel 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: [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: , X-List-Received-Date: Thu, 01 Jun 2017 11:21:51 -0000 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/AcpiPlatformDxe/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 +[FixedPcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiExposedTableVersions + [Depex] gEfiAcpiTableProtocolGuid diff --git a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c b/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c index 1bc5fe297a96..97632bc636c0 100644 --- a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c +++ b/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c @@ -24,6 +24,7 @@ #include #include #include +#include // @@ -173,6 +174,7 @@ ProcessCmdAllocate ( UINTN NumPages; EFI_PHYSICAL_ADDRESS Address; BLOB *Blob; + EFI_ALLOCATE_TYPE AllocType; if (Allocate->File[QEMU_LOADER_FNAME_SIZE - 1] != '\0') { DEBUG ((EFI_D_ERROR, "%a: malformed file name\n", __FUNCTION__)); @@ -192,9 +194,16 @@ ProcessCmdAllocate ( return Status; } + if ((FixedPcdGet32 (PcdAcpiExposedTableVersions) & + EFI_ACPI_TABLE_VERSION_1_0B) != 0) { + Address = 0xFFFFFFFF; + AllocType = AllocateMaxAddress; + } else { + AllocType = AllocateAnyPages; + } + NumPages = EFI_SIZE_TO_PAGES (FwCfgSize); - Address = 0xFFFFFFFF; - Status = gBS->AllocatePages (AllocateMaxAddress, EfiACPIMemoryNVS, NumPages, + Status = 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 +[FixedPcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiExposedTableVersions + [Depex] gEfiAcpiTableProtocolGuid -- 2.9.3