summaryrefslogtreecommitdiff
path: root/plat/socionext/uniphier
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2020-03-26 13:18:48 +0900
committerSandrine Bailleux <sandrine.bailleux@arm.com>2020-04-01 16:40:16 +0200
commit664e15c2bde25645ebf4f80fff7bedebeec0e876 (patch)
tree6c2c3cfb4a7868edd2dc9219040a16305e8cc588 /plat/socionext/uniphier
parent2765ffdc99af8b5fc171771b5f0e04e96a74a52f (diff)
downloadarm-trusted-firmware-664e15c2bde25645ebf4f80fff7bedebeec0e876.tar.gz
uniphier: support read-only xlat tables
BL2 for this platform uses mmap_add_dynamic_region(), but BL31 and BL32 (TSP) only use static mapping. So, BL31 and BL32 can make the tables read-only after enabling MMU. Enable ALLOW_RO_XLAT_TABLES by default. Change-Id: Ib59c44697163629119888bb6abd47fa144f09ba3 Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'plat/socionext/uniphier')
-rw-r--r--plat/socionext/uniphier/platform.mk7
-rw-r--r--plat/socionext/uniphier/uniphier_xlat_setup.c13
2 files changed, 20 insertions, 0 deletions
diff --git a/plat/socionext/uniphier/platform.mk b/plat/socionext/uniphier/platform.mk
index 0fcef1d2c..3f8a1f864 100644
--- a/plat/socionext/uniphier/platform.mk
+++ b/plat/socionext/uniphier/platform.mk
@@ -14,6 +14,13 @@ override ENABLE_SVE_FOR_NS := 0
# UNIPHIER_MEM_BASE so that all TF images are loaded at their link addresses.
override ENABLE_PIE := 1
+ALLOW_RO_XLAT_TABLES := 1
+
+ifeq ($(ALLOW_RO_XLAT_TABLES),1)
+BL31_CFLAGS += -DPLAT_RO_XLAT_TABLES=1
+BL32_CFLAGS += -DPLAT_RO_XLAT_TABLES=1
+endif
+
# Cortex-A53 revision r0p4-51rel0
# needed for LD20, unneeded for LD11, PXs3 (no ACE)
ERRATA_A53_855873 := 1
diff --git a/plat/socionext/uniphier/uniphier_xlat_setup.c b/plat/socionext/uniphier/uniphier_xlat_setup.c
index c2ac7a29a..5043f4b59 100644
--- a/plat/socionext/uniphier/uniphier_xlat_setup.c
+++ b/plat/socionext/uniphier/uniphier_xlat_setup.c
@@ -10,6 +10,7 @@
#include <common/debug.h>
#include <lib/xlat_tables/xlat_tables_v2.h>
+#include <plat/common/platform.h>
#include "uniphier.h"
@@ -65,4 +66,16 @@ void uniphier_mmap_setup(unsigned int soc)
init_xlat_tables();
enable_mmu(0);
+
+#if PLAT_RO_XLAT_TABLES
+ {
+ int ret;
+
+ ret = xlat_make_tables_readonly();
+ if (ret) {
+ ERROR("Failed to make translation tables read-only.");
+ plat_error_handler(ret);
+ }
+ }
+#endif
}