refactor: Move the virtual address size config to platform
This patch moves the VIRT_ADDR_SPACE_WIDTH from lib/slot_buf component
to plat/common as this is only needed in that component.
Also the patch adds suitable documentation for the build option.
Signed-off-by: Soby Mathew <soby.mathew@arm.com>
Change-Id: I77663c27a77eee01a173818e42479082e25e9074
diff --git a/docs/getting_started/build-options.rst b/docs/getting_started/build-options.rst
index ccaa40c..ecb32c1 100644
--- a/docs/getting_started/build-options.rst
+++ b/docs/getting_started/build-options.rst
@@ -272,6 +272,7 @@
RMM_STATIC_ANALYSIS , , ,"Enable static analysis checkers"
PLAT_CMN_CTX_MAX_XLAT_TABLES , ,0 ,"Maximum number of translation tables used by the runtime context"
PLAT_CMN_EXTRA_MMAP_REGIONS , ,0 ,"Extra platform mmap regions that need to be mapped in S1 xlat tables"
+ PLAT_CMN_VIRT_ADDR_SPACE_WIDTH, ,38 ,"Stage 1 Virtual address space width in bits for this platform"
RMM_NUM_PAGES_PER_STACK , ,5 ,"Number of pages to use per CPU stack"
MBEDTLS_ECP_MAX_OPS ,248 - ,1000 ,"Number of max operations per ECC signing iteration"
RMM_FPU_USE_AT_REL2 ,ON | OFF ,OFF(fake_host) ON(aarch64),"Enable FPU/SIMD usage in RMM."
diff --git a/lib/slot_buf/CMakeLists.txt b/lib/slot_buf/CMakeLists.txt
index b45c3c2..95f0c5f 100644
--- a/lib/slot_buf/CMakeLists.txt
+++ b/lib/slot_buf/CMakeLists.txt
@@ -5,20 +5,6 @@
add_library(rmm-lib-slot_buf)
-arm_config_option(
- NAME VIRT_ADDR_SPACE_WIDTH
- HELP "Size in bits of the virtual address space."
- DEFAULT 38
- TYPE STRING
- ADVANCED)
-
-if(VIRT_ADDR_SPACE_WIDTH EQUAL 0x0)
- message(FATAL_ERROR "VIRT_ADDR_SPACE_WIDTH is not initialized")
-endif()
-
-target_compile_definitions(rmm-lib-slot_buf
- PUBLIC "VIRT_ADDR_SPACE_SIZE=(1ULL << ULL(${VIRT_ADDR_SPACE_WIDTH}))")
-
target_link_libraries(rmm-lib-slot_buf
PRIVATE rmm-lib-arch
rmm-lib-common
diff --git a/plat/common/CMakeLists.txt b/plat/common/CMakeLists.txt
index e630467..31ec794 100644
--- a/plat/common/CMakeLists.txt
+++ b/plat/common/CMakeLists.txt
@@ -33,12 +33,29 @@
DEFAULT 0
TYPE STRING)
+#
+# Default Stage 1 virtual address space width for a given platform.
+#
+arm_config_option(
+ NAME PLAT_CMN_VIRT_ADDR_SPACE_WIDTH
+ HELP "Size in bits of the virtual address space."
+ DEFAULT 38
+ TYPE STRING
+ ADVANCED)
+
+if(PLAT_CMN_VIRT_ADDR_SPACE_WIDTH EQUAL 0x0)
+ message(FATAL_ERROR "PLAT_CMN_VIRT_ADDR_SPACE_WIDTH is not initialized")
+endif()
+
target_compile_definitions(rmm-plat-common
PRIVATE "PLAT_CMN_CTX_MAX_XLAT_TABLES=U(${PLAT_CMN_CTX_MAX_XLAT_TABLES})")
target_compile_definitions(rmm-plat-common
PRIVATE "PLAT_CMN_EXTRA_MMAP_REGIONS=U(${PLAT_CMN_EXTRA_MMAP_REGIONS})")
+target_compile_definitions(rmm-plat-common
+ PRIVATE "PLAT_CMN_VIRT_ADDR_SPACE_SIZE=(1ULL << ULL(${PLAT_CMN_VIRT_ADDR_SPACE_WIDTH}))")
+
target_include_directories(rmm-plat-common
PUBLIC "include"
PRIVATE "src/${RMM_ARCH}")
diff --git a/plat/common/src/plat_common_init.c b/plat/common/src/plat_common_init.c
index bdf50af..20634d2 100644
--- a/plat/common/src/plat_common_init.c
+++ b/plat/common/src/plat_common_init.c
@@ -160,7 +160,7 @@
ret = xlat_ctx_cfg_init(&runtime_xlat_ctx_cfg, VA_LOW_REGION,
&static_regions[0], nregions + COMMON_REGIONS,
- VIRT_ADDR_SPACE_SIZE);
+ PLAT_CMN_VIRT_ADDR_SPACE_SIZE);
if (ret != 0) {
ERROR("%s (%u): %s (%i)\n",