From 0a5499bdfa92019968156a06dee5c418a5597888 Mon Sep 17 00:00:00 2001
From: Japheth Lim <Japheth.Lim@data61.csiro.au>
Date: Fri, 28 Jun 2019 13:10:33 +1000
Subject: [PATCH] exynos4, exynos5, sabrelite: clamp memory to fit in kernel
 window

This is a hack that allows user-space tools like the capDL static
allocator to work. Otherwise, the allocator (currently unaware of the
kernel window) would think that there is a 28-bit untyped at pptr
0xf0000000, and would generate untyped derivations that are not
available at runtime.

Note that we clamp to 0xff000000 on exynos4 and exynos5, *not*
0xfff00000 (PPTR_TOP), to avoid the ASID PD hole at
0xff000000..0xff200000. The affected platforms are ARM VM platforms;
VM images are often larger than 13MiB and would overlap the ASID hole
if loaded from PPTR_TOP. init_freemem fails if this overlap exists.
---
 src/plat/exynos4/overlay-exynos4.dts    | 10 +++-------
 src/plat/exynos5/overlay-exynos5250.dts |  2 +-
 src/plat/exynos5/overlay-exynos5410.dts |  2 +-
 src/plat/exynos5/overlay-exynos5422.dts |  2 +-
 src/plat/imx6/overlay-sabre.dts         |  1 +
 5 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/src/plat/exynos4/overlay-exynos4.dts b/src/plat/exynos4/overlay-exynos4.dts
index 994a2a0b3..6abd2a479 100644
--- a/src/plat/exynos4/overlay-exynos4.dts
+++ b/src/plat/exynos4/overlay-exynos4.dts
@@ -11,17 +11,13 @@
  */
 
 / {
-
-    /delete-node/ memory;
+	/delete-node/ memory;
 	memory@40000000 {
 		device_type = "memory";
 	};
 
-    memory@40000000 {
+	memory@40000000 {
 		device_type = "memory";
-		reg = < 0x40000000 0x20000000 >;
+		reg = < 0x40000000 0x1f000000 >;
 	};
-
-
-
 };
diff --git a/src/plat/exynos5/overlay-exynos5250.dts b/src/plat/exynos5/overlay-exynos5250.dts
index bc9974a21..05b1a817a 100644
--- a/src/plat/exynos5/overlay-exynos5250.dts
+++ b/src/plat/exynos5/overlay-exynos5250.dts
@@ -17,7 +17,7 @@
 	};
 
 	memory@40000000 {
-		reg = <0x60000000 0x60000000>;
+		reg = <0x60000000 0x1f000000>;
 	};
 
 	vm-memory@40000000 {
diff --git a/src/plat/exynos5/overlay-exynos5410.dts b/src/plat/exynos5/overlay-exynos5410.dts
index 6d28b70b1..7a8e1dcc0 100644
--- a/src/plat/exynos5/overlay-exynos5410.dts
+++ b/src/plat/exynos5/overlay-exynos5410.dts
@@ -39,7 +39,7 @@
 	};
 
 	memory@40000000 {
-		reg = <0x60000000 0x5ea00000>;
+		reg = <0x60000000 0x1f000000>;
 	};
 
 	vm-memory@40000000 {
diff --git a/src/plat/exynos5/overlay-exynos5422.dts b/src/plat/exynos5/overlay-exynos5422.dts
index 0dfcdbf7b..a5b9a4187 100644
--- a/src/plat/exynos5/overlay-exynos5422.dts
+++ b/src/plat/exynos5/overlay-exynos5422.dts
@@ -30,7 +30,7 @@
 	};
 
 	memory@40000000 {
-		reg = <0x60000000 0x5ea00000>;
+		reg = <0x60000000 0x1f000000>;
 	};
 
 	vm-memory@40000000 {
diff --git a/src/plat/imx6/overlay-sabre.dts b/src/plat/imx6/overlay-sabre.dts
index 854afe354..cfd2e11ee 100644
--- a/src/plat/imx6/overlay-sabre.dts
+++ b/src/plat/imx6/overlay-sabre.dts
@@ -16,5 +16,6 @@
 	/delete-node/ memory;
 	memory@10000000 {
 		device_type = "memory";
+		reg = <0x10000000 0x1ff00000>;
 	};
 };
-- 
GitLab