public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [RFC PATCH] OvmfPkg/AcpiPlatformDxe: lift 4 GB alloc limit for modern ACPI systems
@ 2017-06-01 11:22 Ard Biesheuvel
  2017-06-01 12:25 ` Laszlo Ersek
  0 siblings, 1 reply; 7+ messages in thread
From: Ard Biesheuvel @ 2017-06-01 11:22 UTC (permalink / raw)
  To: edk2-devel, lersek; +Cc: leif.lindholm, jordan.l.justen, Ard Biesheuvel

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 <ard.biesheuvel@linaro.org>
---

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 <Library/PcdLib.h>
 #include <Library/OrderedCollectionLib.h>
 #include <IndustryStandard/Acpi.h>
+#include <Protocol/AcpiSystemDescriptionTable.h>
 
 
 //
@@ -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



^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-06-02 22:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-01 11:22 [RFC PATCH] OvmfPkg/AcpiPlatformDxe: lift 4 GB alloc limit for modern ACPI systems Ard Biesheuvel
2017-06-01 12:25 ` Laszlo Ersek
2017-06-01 15:16   ` Igor Mammedov
2017-06-01 16:37     ` Laszlo Ersek
2017-06-01 20:40   ` Laszlo Ersek
2017-06-02 14:56     ` Gerd Hoffmann
2017-06-02 22:40       ` Laszlo Ersek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox