From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: edk2-devel@lists.01.org
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>,
Michael D Kinney <michael.d.kinney@intel.com>,
Liming Gao <liming.gao@intel.com>,
Jian J Wang <jian.j.wang@intel.com>, Hao Wu <hao.a.wu@intel.com>,
Leif Lindholm <leif.lindholm@linaro.org>,
Laszlo Ersek <lersek@redhat.com>,
Eric Auger <eric.auger@redhat.com>,
Andrew Jones <drjones@redhat.com>,
Philippe Mathieu-Daude <philmd@redhat.com>
Subject: [PATCH v2 1/6] MdePkg/Base: introduce MAX_ALLOC_ADDRESS
Date: Wed, 19 Dec 2018 21:56:35 +0100 [thread overview]
Message-ID: <20181219205640.4704-2-ard.biesheuvel@linaro.org> (raw)
In-Reply-To: <20181219205640.4704-1-ard.biesheuvel@linaro.org>
On some architectures, the maximum representable address deviates from
the virtual address range that is accessible by the firmware at boot
time. For instance, on AArch64, UEFI mandates a 4 KB page size, which
limits the address space to 48 bits, while more than that may be
populated on a particular platform, for use by the OS.
So introduce a new macro MAX_ALLOC_ADDRESS, which represent the maximum
address the firmware should take into account when allocating memory
ranges that need to be accessible by the CPU at boot time.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
MdePkg/Include/AArch64/ProcessorBind.h | 5 +++++
MdePkg/Include/Arm/ProcessorBind.h | 5 +++++
MdePkg/Include/Ebc/ProcessorBind.h | 5 +++++
MdePkg/Include/Ia32/ProcessorBind.h | 5 +++++
MdePkg/Include/X64/ProcessorBind.h | 5 +++++
5 files changed, 25 insertions(+)
diff --git a/MdePkg/Include/AArch64/ProcessorBind.h b/MdePkg/Include/AArch64/ProcessorBind.h
index 968c18f915ae..f4a544b34d78 100644
--- a/MdePkg/Include/AArch64/ProcessorBind.h
+++ b/MdePkg/Include/AArch64/ProcessorBind.h
@@ -142,6 +142,11 @@ typedef INT64 INTN;
///
#define MAX_ADDRESS 0xFFFFFFFFFFFFFFFFULL
+///
+/// Maximum usable address at boot time (48 bits using 4 KB pages)
+///
+#define MAX_ALLOC_ADDRESS 0xFFFFFFFFFFFFULL
+
///
/// Maximum legal AArch64 INTN and UINTN values.
///
diff --git a/MdePkg/Include/Arm/ProcessorBind.h b/MdePkg/Include/Arm/ProcessorBind.h
index 8cca0f3bb050..16a61fc7a325 100644
--- a/MdePkg/Include/Arm/ProcessorBind.h
+++ b/MdePkg/Include/Arm/ProcessorBind.h
@@ -148,6 +148,11 @@ typedef INT32 INTN;
///
#define MAX_ADDRESS 0xFFFFFFFF
+///
+/// Maximum usable address at boot time
+///
+#define MAX_ALLOC_ADDRESS MAX_ADDRESS
+
///
/// Maximum legal ARM INTN and UINTN values.
///
diff --git a/MdePkg/Include/Ebc/ProcessorBind.h b/MdePkg/Include/Ebc/ProcessorBind.h
index 5217cfd97eac..45beb7572817 100644
--- a/MdePkg/Include/Ebc/ProcessorBind.h
+++ b/MdePkg/Include/Ebc/ProcessorBind.h
@@ -103,6 +103,11 @@ typedef unsigned long UINTN;
///
#define MAX_ADDRESS ((UINTN)(~0ULL >> (64 - sizeof (INTN) * 8)))
+///
+/// Maximum usable address at boot time (48 bits using 4 KB pages)
+///
+#define MAX_ALLOC_ADDRESS MAX_ADDRESS
+
///
/// Maximum legal EBC INTN and UINTN values.
///
diff --git a/MdePkg/Include/Ia32/ProcessorBind.h b/MdePkg/Include/Ia32/ProcessorBind.h
index 8e4de7029cfc..71d53e2543bb 100644
--- a/MdePkg/Include/Ia32/ProcessorBind.h
+++ b/MdePkg/Include/Ia32/ProcessorBind.h
@@ -246,6 +246,11 @@ typedef INT32 INTN;
///
#define MAX_ADDRESS 0xFFFFFFFF
+///
+/// Maximum usable address at boot time
+///
+#define MAX_ALLOC_ADDRESS MAX_ADDRESS
+
///
/// Maximum legal IA-32 INTN and UINTN values.
///
diff --git a/MdePkg/Include/X64/ProcessorBind.h b/MdePkg/Include/X64/ProcessorBind.h
index e4254285877b..1c04090c7d03 100644
--- a/MdePkg/Include/X64/ProcessorBind.h
+++ b/MdePkg/Include/X64/ProcessorBind.h
@@ -260,6 +260,11 @@ typedef INT64 INTN;
///
#define MAX_ADDRESS 0xFFFFFFFFFFFFFFFFULL
+///
+/// Maximum usable address at boot time
+///
+#define MAX_ALLOC_ADDRESS MAX_ADDRESS
+
///
/// Maximum legal x64 INTN and UINTN values.
///
--
2.19.2
next prev parent reply other threads:[~2018-12-19 20:56 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-19 20:56 [PATCH v2 0/6] introduce MAX_ALLOC_ADDRESS to limit boot time allocations Ard Biesheuvel
2018-12-19 20:56 ` Ard Biesheuvel [this message]
2018-12-20 6:45 ` [PATCH v2 1/6] MdePkg/Base: introduce MAX_ALLOC_ADDRESS Gao, Liming
2018-12-19 20:56 ` [PATCH v2 2/6] MdeModulePkg/Dxe/Gcd: disregard memory above MAX_ALLOC_ADDRESS Ard Biesheuvel
2018-12-19 20:56 ` [PATCH v2 3/6] MdeModulePkg/Dxe/Page: take MAX_ALLOC_ADDRESS into account Ard Biesheuvel
2018-12-20 3:27 ` Wang, Jian J
2018-12-19 20:56 ` [PATCH v2 4/6] ArmPkg/ArmMmuLib: " Ard Biesheuvel
2018-12-19 21:03 ` Leif Lindholm
2018-12-19 20:56 ` [PATCH v2 5/6] ArmPlatformPkg/MemoryInitPeim: " Ard Biesheuvel
2018-12-19 21:15 ` Leif Lindholm
2018-12-19 20:56 ` [PATCH v2 6/6] ArmVirtPkg/MemoryInitPeiLib: split memory HOB based on MAX_ALLOC_ADDRESS Ard Biesheuvel
2018-12-20 10:38 ` [PATCH v2 0/6] introduce MAX_ALLOC_ADDRESS to limit boot time allocations Ard Biesheuvel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181219205640.4704-2-ard.biesheuvel@linaro.org \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox