diff mbox series

[edk2,RFC,7/7] MdePkg/ProcessorBind AARCH64: limit MAX_ALLOC_ADDRESS to 48 bits

Message ID 20181207112304.19765-8-ard.biesheuvel@linaro.org
State New
Headers show
Series introduce MAX_ALLOC_ADDRESS to limit boot time allocations | expand

Commit Message

Ard Biesheuvel Dec. 7, 2018, 11:23 a.m. UTC
Limit MAX_ALLOC_ADDRESS to 48 bits on AArch64 so that the memory
handling routines running at boot time take care not to allocate
memory that the CPU itself cannot access due to the fact that it
runs with 4 KB pages and thus an address space that is limited to
256 TB.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

---
 MdePkg/Include/AArch64/ProcessorBind.h | 5 +++++
 1 file changed, 5 insertions(+)

-- 
2.19.2

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Comments

Laszlo Ersek Dec. 7, 2018, 12:51 p.m. UTC | #1
On 12/07/18 12:23, Ard Biesheuvel wrote:
> Limit MAX_ALLOC_ADDRESS to 48 bits on AArch64 so that the memory

> handling routines running at boot time take care not to allocate

> memory that the CPU itself cannot access due to the fact that it

> runs with 4 KB pages and thus an address space that is limited to

> 256 TB.

> 

> Contributed-under: TianoCore Contribution Agreement 1.1

> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

> ---

>  MdePkg/Include/AArch64/ProcessorBind.h | 5 +++++

>  1 file changed, 5 insertions(+)

> 

> diff --git a/MdePkg/Include/AArch64/ProcessorBind.h b/MdePkg/Include/AArch64/ProcessorBind.h

> index 968c18f915ae..a8c698484a1d 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 address usable at boot services time (48 bits for 4 KB pages)

> +///

> +#define MAX_ALLOC_ADDRESS   0xFFFFFFFFFFFFULL

> +

>  ///

>  /// Maximum legal AArch64 INTN and UINTN values.

>  ///

> 


I think this patch is safer than the previous variant. If this series
omits some replacements, from MAX_ADDRESS to MAX_ALLOC_ADDRESS, at
various spots in the edk2 tree, we should be able to fix those up
incrementally. Whereas changing MAX_ADDRESS was a heavy hammer that hit
everything simultaneously.

Reviewed-by: Laszlo Ersek <lersek@redhat.com>


Thanks
Laszlo
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
diff mbox series

Patch

diff --git a/MdePkg/Include/AArch64/ProcessorBind.h b/MdePkg/Include/AArch64/ProcessorBind.h
index 968c18f915ae..a8c698484a1d 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 address usable at boot services time (48 bits for 4 KB pages)
+///
+#define MAX_ALLOC_ADDRESS   0xFFFFFFFFFFFFULL
+
 ///
 /// Maximum legal AArch64 INTN and UINTN values.
 ///