From patchwork Thu Jun 1 11:22:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 100899 Delivered-To: patch@linaro.org Received: by 10.182.202.35 with SMTP id kf3csp706836obc; Thu, 1 Jun 2017 04:22:54 -0700 (PDT) X-Received: by 10.98.138.150 with SMTP id o22mr639529pfk.120.1496316173976; Thu, 01 Jun 2017 04:22:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496316173; cv=none; d=google.com; s=arc-20160816; b=NpKAExSbnQwhIiQ4H7lTqVW7CHG+GHIuB0yyLu5Nezkd3t8Jw9SDVXPuOm27VwOE3p zGYhz4ZRGwzbNhznF71qaGXtVZlONej2mwGKMHI5NESIRcwfbJfSz3K/q+d1QwytBUx7 NnltoUiO3+33vB4h/9I5AxSIPc8hxkg2F9jMTPeWfa21V8rKyDOMV1mzl4coq0vNxy1y tI1SL00humCxXBMTeLt/ErAl8kE6PjvJxmOHwKrjiyh9NeFFG2U05oEBXAfOM3HiThSd AI+KvRBoeOucrv4cVS6Ht6+fVv2uT7Der6L32umjvaR3cQYSUr/mV2LAZDj+tmmOsYDS hh5w== 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=7dsrN6Ao2pXkIKkbULSjM6DzFSnaV7ARKmNqqbtG5IM=; b=duv1XyQG/ESAmkJ1qh3tU+oveJN7Xku4oh0kOXbYebP6pwkXo9RJ7quBjTCJnTuu14 kjpsAVwh1poN/1mBTo3OwxAtsOqciGuwt57YnqkIwwK3yqWccTUwMWHppboZfOnlbjnG 4tQ20Xe6cSJb5hmdbqXzFn1otOEGdfzAoxObwN/XvEyiLsocSRzmvoBcYjvMAh45PsWs gYO5fxY0inBwsk6qxDZ2TaY4UYtLkaNV6y6q+rcQAXVtwHt+U+bXWLsoowBmEIhBGqUS gd7+WUfM3Srgk5CxIPWNWydsJtz36fSVCnTDjMo616zeyZ74ZiKPI/wf6zKppooXSeqq imcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; 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 e127si19258382pfa.287.2017.06.01.04.22.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Jun 2017 04:22:53 -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; 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 9136B21AE30EF; Thu, 1 Jun 2017 04:21:51 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org 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 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 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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(-) -- 2.9.3 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel 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