Skip to contentSkip to conversation

arm-bsp/hafnium: extend stage-1 mapping limit on TC

PATCH Applied Arunachalam Ganapathy 2 participants 2 messages Jan 19, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm-bsp/hafnium: extend stage-1 mapping limit on TC

Change-Id Ia6fb2cfd7812a63a003dc3ffbc84fb8d410d02c3
---
 ...-if-start-address-exceeds-page-table.patch |  36 ++++
 .../0002-Extend-Stage-1-mapping-limit.patch   | 197 ++++++++++++++++++
 .../recipes-bsp/hafnium/hafnium-tc.inc        |   8 +-
 3 files changed, 240 insertions(+), 1 deletion(-)
 create mode 100644 meta-arm-bsp/recipes-bsp/hafnium/files/tc/0001-fix-fail-mapping-if-start-address-exceeds-page-table.patch
 create mode 100644 meta-arm-bsp/recipes-bsp/hafnium/files/tc/0002-Extend-Stage-1-mapping-limit.patch
meta-arm-bsp/recipes-bsp/hafnium/files/tc/0001-fix-fail-mapping-if-start-address-exceeds-page-table.patch new file +36 -0
new file mode 100644
index 0000000..79aee24
@@ -0,0 +1,36 @@
+From dace8802ae6332eb4ca29faf288b96c83fadb2ae Mon Sep 17 00:00:00 2001
+From: Arunachalam Ganapathy <[email protected]>
+Date: Tue, 28 Sep 2021 11:22:27 +0100
+Subject: [PATCH 1/2] fix: fail mapping if start address exceeds page table
+ mapping limit
+
+Currently the end address is capped to stay within bounds of page
+table range. If in case the start address is beyond bounds of
+page table then no mapping is made but the mm_map_root incorrectly
+returns success.
+
+Signed-off-by: Arunachalam Ganapathy <[email protected]>
+Change-Id: I858ac653aafff62e9a2cf5771a32dc38690cd899
+Upstream-Status: Pending [Not submitted to upstream yet]
+---
+ src/mm.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/mm.c b/src/mm.c
+index 6f15748..c57e24e 100644
+--- a/src/mm.c
++++ b/src/mm.c
+@@ -472,6 +472,10 @@ static bool mm_ptable_identity_map(struct mm_ptable *t, paddr_t pa_begin,
+ 	 */
+ 	CHECK(root_level >= 2);
+ 
++	if (begin >= ptable_end) {
++		return false;
++	}
++
+ 	/* Cap end to stay within the bounds of the page table. */
+ 	if (end > ptable_end) {
+ 		end = ptable_end;
+-- 
+2.30.2
+
meta-arm-bsp/recipes-bsp/hafnium/files/tc/0002-Extend-Stage-1-mapping-limit.patch new file +197 -0

197 lines not on this page · raw message

meta-arm-bsp/recipes-bsp/hafnium/hafnium-tc.inc +7 -1
index 8eb6b4c..27f7777 100644
@@ -1,4 +1,10 @@
-# TC0 specific configuration
+# TC specific configuration
 
 COMPATIBLE_MACHINE = "(tc?)"
 HAFNIUM_PLATFORM = "secure_tc"
+
+FILESEXTRAPATHS:prepend:tc := "${THISDIR}/files/tc:"
+SRC_URI:append = " \
+		file://0001-fix-fail-mapping-if-start-address-exceeds-page-table.patch \
+		file://0002-Extend-Stage-1-mapping-limit.patch \
+		 "
Signature · 1 line
2.30.2
Applied
#1 lore raw
Quoted 1 line · Arunachalam Ganapathy

Applied, thanks!

[1/1] arm-bsp/hafnium: extend stage-1 mapping limit on TC

      commit: 763764dd2aa74d2f2af9502cce4b1124ae1322fc

Best regards,

Signature · 1 line
Jon Mason <[email protected]>