blob: 569f8d38f800cc2e9696bf101218503c5157ac10 [file] [log] [blame]
Soby Mathewb4c6df42022-11-09 11:13:29 +00001#
2# SPDX-License-Identifier: BSD-3-Clause
3# SPDX-FileCopyrightText: Copyright TF-RMM Contributors.
4#
5
6#
7# Common config options
8#
9arm_config_option(
10 NAME MAX_CPUS
11 HELP "Maximum number of CPUs supported by RMM"
12 TYPE STRING
13 DEFAULT 16)
14
15#
16# The RMM is mapped with 4K pages, and all RMM APIs use the same granularity.
17#
18arm_config_option(
Mate Toth-Palac0cfbb2023-06-19 16:29:52 +020019 NAME GRANULE_SHIFT
20 HELP "The shift value of granule size. i.e: GRANULE_SIZE == 1 << GRANULE_SHIFT"
Soby Mathewb4c6df42022-11-09 11:13:29 +000021 TYPE STRING
Mate Toth-Palac0cfbb2023-06-19 16:29:52 +020022 DEFAULT 12)
Soby Mathewb4c6df42022-11-09 11:13:29 +000023
AlexeiFedorov7c5001a2022-12-14 13:22:33 +000024#
25# RMM_MAX_GRANULES. Maximum number of granules supported.
26#
27arm_config_option(
28 NAME RMM_MAX_GRANULES
29 HELP "Maximum number of granules supported"
30 TYPE STRING
31 DEFAULT 0x0)
32
Soby Mathewb4c6df42022-11-09 11:13:29 +000033arm_config_option(
Mate Toth-Pal7f5b27d2023-08-08 13:49:19 +020034 NAME RMM_NUM_PAGES_PER_STACK
35 HELP "Number of pages to use per CPU stack"
36 TYPE STRING
37 DEFAULT 5
38 ADVANCED)
39
40arm_config_option(
Soby Mathewb4c6df42022-11-09 11:13:29 +000041 NAME RMM_DOCS
42 HELP "RMM Documentation build"
43 TYPE BOOL
44 DEFAULT OFF)
45
46# TODO: Move to lib/arch once MbedTLS compilation is moved to build phase.
47arm_config_option(
48 NAME RMM_FPU_USE_AT_REL2
49 HELP "Enable Advanced SIMD support in RMM"
50 TYPE BOOL
Soby Mathew9b2de242024-02-27 16:08:42 +000051 DEFAULT OFF)
Soby Mathewb4c6df42022-11-09 11:13:29 +000052
53#
AlexeiFedorovea68b552023-10-03 11:11:47 +010054# The number of 4K pages allocated for attestation buffer.
55#
56arm_config_option(
57 NAME RMM_CCA_TOKEN_BUFFER
58 HELP "Number of pages to allocate in Aux granules for Realm CCA token"
59 TYPE STRING
60 DEFAULT 1)
61
Arunachalam Ganapathy33e3bdc2024-04-10 20:55:40 +010062arm_config_option(
63 NAME RMM_CCA_DA
64 HELP "Enable Device Assignment support in RMM (experimental)"
65 TYPE BOOL
66 DEFAULT OFF)
67
Soby Mathewe307b0a2024-10-03 12:12:52 +010068arm_config_option(
69 NAME ATTEST_EL3_TOKEN_SIGN
70 HELP "Use EL3 service to sign realm attestation token."
71 TYPE BOOL
72 DEFAULT OFF
73 ADVANCED)
74
AlexeiFedorovea68b552023-10-03 11:11:47 +010075#
Soby Mathewb4c6df42022-11-09 11:13:29 +000076# Introduce a pseudo-library purely for applying flags to RMM's libraries.
77# This is applied to any targets created after this point.
78#
79
80add_library(rmm-common INTERFACE)
81
82target_compile_definitions(rmm-common
83 INTERFACE "$<$<CONFIG:Debug>:DEBUG>")
84
85if(MAX_CPUS EQUAL 0x0)
86 message(FATAL_ERROR "MAX_CPUS is not initialized")
87endif()
88
89target_compile_definitions(rmm-common
Javier Almansa Sobrinoc4ad5b02022-07-05 19:05:14 +010090 INTERFACE "MAX_CPUS=${MAX_CPUS}U")
Soby Mathewb4c6df42022-11-09 11:13:29 +000091
Mate Toth-Palac0cfbb2023-06-19 16:29:52 +020092if(NOT(GRANULE_SHIFT EQUAL 12))
93 message(FATAL_ERROR "GRANULE_SHIFT is not initialized correctly")
Soby Mathewb4c6df42022-11-09 11:13:29 +000094endif()
95
96target_compile_definitions(rmm-common
Mate Toth-Palac0cfbb2023-06-19 16:29:52 +020097 INTERFACE "GRANULE_SHIFT=U(${GRANULE_SHIFT})")
Soby Mathewb4c6df42022-11-09 11:13:29 +000098
AlexeiFedorov7c5001a2022-12-14 13:22:33 +000099if (RMM_MAX_GRANULES EQUAL 0x0)
100 message (FATAL_ERROR "RMM_MAX_GRANULES not configured")
101endif()
102
103target_compile_definitions(rmm-common
104 INTERFACE "RMM_MAX_GRANULES=U(${RMM_MAX_GRANULES})")
105
Mate Toth-Pal7f5b27d2023-08-08 13:49:19 +0200106target_compile_definitions(rmm-common
107 INTERFACE "RMM_NUM_PAGES_PER_STACK=UL(${RMM_NUM_PAGES_PER_STACK})")
108
Arunachalam Ganapathy188d9e62024-04-18 13:42:56 +0100109if(RMM_FPU_USE_AT_REL2 AND RMM_ARCH STREQUAL aarch64)
Soby Mathewb4c6df42022-11-09 11:13:29 +0000110 target_compile_definitions(rmm-common
111 INTERFACE "RMM_FPU_USE_AT_REL2=1")
112endif()
113
AlexeiFedorovea68b552023-10-03 11:11:47 +0100114target_compile_definitions(rmm-common
115 INTERFACE "RMM_CCA_TOKEN_BUFFER=U(${RMM_CCA_TOKEN_BUFFER})")
116
Soby Mathewb4c6df42022-11-09 11:13:29 +0000117#
118# Project name and version
119#
120target_compile_definitions(rmm-common
121 INTERFACE "NAME=\"${PROJECT_NAME}\"")
122
123target_compile_definitions(rmm-common
124 INTERFACE "VERSION=\"${PROJECT_VERSION}\"")
125
126#
127# Get git commit information
128#
129find_package(Git)
130if(GIT_FOUND)
131 execute_process(
132 COMMAND ${GIT_EXECUTABLE} describe --always --dirty --tags
133 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
134 OUTPUT_VARIABLE COMMIT_INFO
135 OUTPUT_STRIP_TRAILING_WHITESPACE
136 )
137endif()
138
139target_compile_definitions(rmm-common
140 INTERFACE "COMMIT_INFO=\"${COMMIT_INFO}\"")
141
Arunachalam Ganapathy33e3bdc2024-04-10 20:55:40 +0100142if(RMM_CCA_DA)
143 message(WARNING "DA is an experimental feature")
144 target_compile_definitions(rmm-common
145 INTERFACE "RMM_CCA_DA=1")
146endif()
147
Soby Mathewb4c6df42022-11-09 11:13:29 +0000148link_libraries(rmm-common)