public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: edk2-devel@lists.01.org, liming.gao@intel.com,
	michael.d.kinney@intel.com
Cc: star.zeng@intel.com, jiewen.yao@intel.com,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: [PATCH v4 1/4] MdePkg/ProcessorBind: add defines for page allocation granularity
Date: Fri,  3 Mar 2017 15:11:31 +0000	[thread overview]
Message-ID: <1488553894-3520-2-git-send-email-ard.biesheuvel@linaro.org> (raw)
In-Reply-To: <1488553894-3520-1-git-send-email-ard.biesheuvel@linaro.org>

The UEFI spec differs between architectures in the minimum alignment
and granularity of page allocations that are visible to the OS as
EFI_MEMORY_RUNTIME regions.

So define macros that carry these values to the respective ProcessorBind.h
header files.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 MdePkg/Include/AArch64/ProcessorBind.h | 6 ++++++
 MdePkg/Include/Arm/ProcessorBind.h     | 6 ++++++
 MdePkg/Include/Ebc/ProcessorBind.h     | 6 ++++++
 MdePkg/Include/Ia32/ProcessorBind.h    | 6 ++++++
 MdePkg/Include/Ipf/ProcessorBind.h     | 6 ++++++
 MdePkg/Include/X64/ProcessorBind.h     | 6 ++++++
 6 files changed, 36 insertions(+)

diff --git a/MdePkg/Include/AArch64/ProcessorBind.h b/MdePkg/Include/AArch64/ProcessorBind.h
index f100d96be079..775e7498c5c9 100644
--- a/MdePkg/Include/AArch64/ProcessorBind.h
+++ b/MdePkg/Include/AArch64/ProcessorBind.h
@@ -104,6 +104,12 @@ typedef INT64   INTN;
 ///
 #define CPU_STACK_ALIGNMENT  16
 
+///
+/// Page allocation granularity for AARCH64
+///
+#define DEFAULT_PAGE_ALLOCATION_GRANULARITY   (0x1000)
+#define RUNTIME_PAGE_ALLOCATION_GRANULARITY   (0x10000)
+
 //
 // Modifier to ensure that all protocol member functions and EFI intrinsics
 // use the correct C calling convention. All protocol member functions and
diff --git a/MdePkg/Include/Arm/ProcessorBind.h b/MdePkg/Include/Arm/ProcessorBind.h
index a543687e57fd..dde1fd1152ba 100644
--- a/MdePkg/Include/Arm/ProcessorBind.h
+++ b/MdePkg/Include/Arm/ProcessorBind.h
@@ -110,6 +110,12 @@ typedef INT32   INTN;
 ///
 #define CPU_STACK_ALIGNMENT  sizeof(UINT64)
 
+///
+/// Page allocation granularity for ARM
+///
+#define DEFAULT_PAGE_ALLOCATION_GRANULARITY   (0x1000)
+#define RUNTIME_PAGE_ALLOCATION_GRANULARITY   (0x1000)
+
 //
 // Modifier to ensure that all protocol member functions and EFI intrinsics
 // use the correct C calling convention. All protocol member functions and
diff --git a/MdePkg/Include/Ebc/ProcessorBind.h b/MdePkg/Include/Ebc/ProcessorBind.h
index 075f768c7691..da8b1a6d802a 100644
--- a/MdePkg/Include/Ebc/ProcessorBind.h
+++ b/MdePkg/Include/Ebc/ProcessorBind.h
@@ -115,6 +115,12 @@ typedef unsigned long         UINTN;
 #define CPU_STACK_ALIGNMENT   sizeof(UINTN)
 
 ///
+/// Page allocation granularity for EBC
+///
+#define DEFAULT_PAGE_ALLOCATION_GRANULARITY   (0x1000)
+#define RUNTIME_PAGE_ALLOCATION_GRANULARITY   (0x1000)
+
+///
 /// Modifier to ensure that all protocol member functions and EFI intrinsics
 /// use the correct C calling convention. All protocol member functions and
 /// EFI intrinsics are required to modify their member functions with EFIAPI.
diff --git a/MdePkg/Include/Ia32/ProcessorBind.h b/MdePkg/Include/Ia32/ProcessorBind.h
index 086b1ff7b1b3..8ba2348261a2 100644
--- a/MdePkg/Include/Ia32/ProcessorBind.h
+++ b/MdePkg/Include/Ia32/ProcessorBind.h
@@ -257,6 +257,12 @@ typedef INT32   INTN;
 ///
 #define CPU_STACK_ALIGNMENT   sizeof(UINTN)
 
+///
+/// Page allocation granularity for IA-32.
+///
+#define DEFAULT_PAGE_ALLOCATION_GRANULARITY   (0x1000)
+#define RUNTIME_PAGE_ALLOCATION_GRANULARITY   (0x1000)
+
 //
 // Modifier to ensure that all protocol member functions and EFI intrinsics
 // use the correct C calling convention. All protocol member functions and
diff --git a/MdePkg/Include/Ipf/ProcessorBind.h b/MdePkg/Include/Ipf/ProcessorBind.h
index c19e47d8f3ca..51885ca61359 100644
--- a/MdePkg/Include/Ipf/ProcessorBind.h
+++ b/MdePkg/Include/Ipf/ProcessorBind.h
@@ -248,6 +248,12 @@ typedef INT64   INTN;
 ///
 #define CPU_STACK_ALIGNMENT   16
 
+///
+/// Page allocation granularity for Itanium
+///
+#define DEFAULT_PAGE_ALLOCATION_GRANULARITY   (0x1000)
+#define RUNTIME_PAGE_ALLOCATION_GRANULARITY   (0x2000)
+
 //
 // Modifier to ensure that all protocol member functions and EFI intrinsics
 // use the correct C calling convention. All protocol member functions and
diff --git a/MdePkg/Include/X64/ProcessorBind.h b/MdePkg/Include/X64/ProcessorBind.h
index 23e6e55abff6..72cc85151cba 100644
--- a/MdePkg/Include/X64/ProcessorBind.h
+++ b/MdePkg/Include/X64/ProcessorBind.h
@@ -271,6 +271,12 @@ typedef INT64   INTN;
 ///
 #define CPU_STACK_ALIGNMENT   16
 
+///
+/// Page allocation granularity for x64
+///
+#define DEFAULT_PAGE_ALLOCATION_GRANULARITY   (0x1000)
+#define RUNTIME_PAGE_ALLOCATION_GRANULARITY   (0x1000)
+
 //
 // Modifier to ensure that all protocol member functions and EFI intrinsics
 // use the correct C calling convention. All protocol member functions and
-- 
2.7.4



  reply	other threads:[~2017-03-03 15:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-03 15:11 [PATCH v4 0/4] MdePkg, MdeModulePkg: Enforce page allocation granularity Ard Biesheuvel
2017-03-03 15:11 ` Ard Biesheuvel [this message]
2017-03-03 15:11 ` [PATCH v4 2/4] MdeModulePkg/DxeCore: switch to MdePkg allocation granularity macros Ard Biesheuvel
2017-03-03 15:11 ` [PATCH v4 3/4] MdeModulePkg/PiSmmCore: " Ard Biesheuvel
2017-03-03 15:11 ` [PATCH v4 4/4] MdeModulePkg/PeiCore: honour minimal runtime allocation granularity Ard Biesheuvel
2017-03-03 15:31 ` [PATCH v4 0/4] MdePkg, MdeModulePkg: Enforce page " Yao, Jiewen
2017-03-06  2:33 ` Gao, Liming
2017-03-06 15:14   ` 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=1488553894-3520-2-git-send-email-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