blob: 89d4c27bf526908f9ceb7eea7af49a8c1211169a [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#
AlexeiFedorovffef39a2024-10-28 16:35:21 +000025# RMM_MAX_GRANULES. Maximum number of memory granules supported.
AlexeiFedorov7c5001a2022-12-14 13:22:33 +000026#
27arm_config_option(
28 NAME RMM_MAX_GRANULES
AlexeiFedorovffef39a2024-10-28 16:35:21 +000029 HELP "Maximum number of memory granules supported"
30 TYPE STRING
31 DEFAULT 0x0)
32
33#
34# RMM_MAX_COH_GRANULES. Maximum number of coherent device granules supported.
35#
36arm_config_option(
37 NAME RMM_MAX_COH_GRANULES
38 HELP "Maximum number of coherent device granules supported"
39 TYPE STRING
AlexeiFedorov037add62024-10-30 15:53:05 +000040 DEFAULT 1)
AlexeiFedorovffef39a2024-10-28 16:35:21 +000041
42#
43# RMM_MAX_NCOH_GRANULES. Maximum number of non-coherent device granules supported.
44#
45arm_config_option(
46 NAME RMM_MAX_NCOH_GRANULES
47 HELP "Maximum number of non-coherent device granules supported"
AlexeiFedorov7c5001a2022-12-14 13:22:33 +000048 TYPE STRING
AlexeiFedorov037add62024-10-30 15:53:05 +000049 DEFAULT 1)
AlexeiFedorov7c5001a2022-12-14 13:22:33 +000050
Soby Mathewb4c6df42022-11-09 11:13:29 +000051arm_config_option(
Mate Toth-Pal7f5b27d2023-08-08 13:49:19 +020052 NAME RMM_NUM_PAGES_PER_STACK
53 HELP "Number of pages to use per CPU stack"
54 TYPE STRING
55 DEFAULT 5
56 ADVANCED)
57
58arm_config_option(
Soby Mathewb4c6df42022-11-09 11:13:29 +000059 NAME RMM_DOCS
60 HELP "RMM Documentation build"
61 TYPE BOOL
62 DEFAULT OFF)
63
64# TODO: Move to lib/arch once MbedTLS compilation is moved to build phase.
65arm_config_option(
66 NAME RMM_FPU_USE_AT_REL2
67 HELP "Enable Advanced SIMD support in RMM"
68 TYPE BOOL
Soby Mathew9b2de242024-02-27 16:08:42 +000069 DEFAULT OFF)
Soby Mathewb4c6df42022-11-09 11:13:29 +000070
71#
AlexeiFedorovea68b552023-10-03 11:11:47 +010072# The number of 4K pages allocated for attestation buffer.
73#
74arm_config_option(
75 NAME RMM_CCA_TOKEN_BUFFER
76 HELP "Number of pages to allocate in Aux granules for Realm CCA token"
77 TYPE STRING
78 DEFAULT 1)
79
Arunachalam Ganapathy33e3bdc2024-04-10 20:55:40 +010080arm_config_option(
Arunachalam Ganapathy56aeccc2024-10-24 15:03:55 +010081 NAME RMM_V1_1
82 HELP "Enable v1.1 features in RMM (experimental)"
Arunachalam Ganapathy33e3bdc2024-04-10 20:55:40 +010083 TYPE BOOL
84 DEFAULT OFF)
85
Soby Mathewe307b0a2024-10-03 12:12:52 +010086arm_config_option(
87 NAME ATTEST_EL3_TOKEN_SIGN
88 HELP "Use EL3 service to sign realm attestation token."
89 TYPE BOOL
90 DEFAULT OFF
91 ADVANCED)
92
AlexeiFedorovea68b552023-10-03 11:11:47 +010093#
Soby Mathewb4c6df42022-11-09 11:13:29 +000094# Introduce a pseudo-library purely for applying flags to RMM's libraries.
95# This is applied to any targets created after this point.
96#
97
98add_library(rmm-common INTERFACE)
99
100target_compile_definitions(rmm-common
101 INTERFACE "$<$<CONFIG:Debug>:DEBUG>")
102
103if(MAX_CPUS EQUAL 0x0)
104 message(FATAL_ERROR "MAX_CPUS is not initialized")
105endif()
106
107target_compile_definitions(rmm-common
Javier Almansa Sobrinoc4ad5b02022-07-05 19:05:14 +0100108 INTERFACE "MAX_CPUS=${MAX_CPUS}U")
Soby Mathewb4c6df42022-11-09 11:13:29 +0000109
Mate Toth-Palac0cfbb2023-06-19 16:29:52 +0200110if(NOT(GRANULE_SHIFT EQUAL 12))
111 message(FATAL_ERROR "GRANULE_SHIFT is not initialized correctly")
Soby Mathewb4c6df42022-11-09 11:13:29 +0000112endif()
113
114target_compile_definitions(rmm-common
Mate Toth-Palac0cfbb2023-06-19 16:29:52 +0200115 INTERFACE "GRANULE_SHIFT=U(${GRANULE_SHIFT})")
Soby Mathewb4c6df42022-11-09 11:13:29 +0000116
AlexeiFedorov7c5001a2022-12-14 13:22:33 +0000117if (RMM_MAX_GRANULES EQUAL 0x0)
118 message (FATAL_ERROR "RMM_MAX_GRANULES not configured")
119endif()
120
121target_compile_definitions(rmm-common
122 INTERFACE "RMM_MAX_GRANULES=U(${RMM_MAX_GRANULES})")
123
AlexeiFedorov037add62024-10-30 15:53:05 +0000124if (RMM_MAX_COH_GRANULES EQUAL 0x0)
125 message (FATAL_ERROR "RMM_MAX_COH_GRANULES cannot be set to 0")
126endif()
127
Mate Toth-Pal7f5b27d2023-08-08 13:49:19 +0200128target_compile_definitions(rmm-common
AlexeiFedorovffef39a2024-10-28 16:35:21 +0000129 INTERFACE "RMM_MAX_COH_GRANULES=U(${RMM_MAX_COH_GRANULES})")
130
131if (RMM_MAX_NCOH_GRANULES EQUAL 0x0)
AlexeiFedorov037add62024-10-30 15:53:05 +0000132 message (FATAL_ERROR "RMM_MAX_NCOH_GRANULES cannot be set to 0")
AlexeiFedorovffef39a2024-10-28 16:35:21 +0000133endif()
134
135target_compile_definitions(rmm-common
136 INTERFACE "RMM_MAX_NCOH_GRANULES=U(${RMM_MAX_NCOH_GRANULES})")
137
138target_compile_definitions(rmm-common
Mate Toth-Pal7f5b27d2023-08-08 13:49:19 +0200139 INTERFACE "RMM_NUM_PAGES_PER_STACK=UL(${RMM_NUM_PAGES_PER_STACK})")
140
Arunachalam Ganapathy188d9e62024-04-18 13:42:56 +0100141if(RMM_FPU_USE_AT_REL2 AND RMM_ARCH STREQUAL aarch64)
Soby Mathewb4c6df42022-11-09 11:13:29 +0000142 target_compile_definitions(rmm-common
143 INTERFACE "RMM_FPU_USE_AT_REL2=1")
144endif()
145
AlexeiFedorovea68b552023-10-03 11:11:47 +0100146target_compile_definitions(rmm-common
147 INTERFACE "RMM_CCA_TOKEN_BUFFER=U(${RMM_CCA_TOKEN_BUFFER})")
148
Soby Mathewb4c6df42022-11-09 11:13:29 +0000149#
150# Project name and version
151#
152target_compile_definitions(rmm-common
153 INTERFACE "NAME=\"${PROJECT_NAME}\"")
154
155target_compile_definitions(rmm-common
156 INTERFACE "VERSION=\"${PROJECT_VERSION}\"")
157
158#
159# Get git commit information
160#
Soby Mathewb5a29752024-11-14 14:26:11 +0000161Git_Get_Commit_Info(COMMIT_INFO)
Soby Mathewb4c6df42022-11-09 11:13:29 +0000162
163target_compile_definitions(rmm-common
164 INTERFACE "COMMIT_INFO=\"${COMMIT_INFO}\"")
165
Arunachalam Ganapathy56aeccc2024-10-24 15:03:55 +0100166if(RMM_V1_1)
167 message(WARNING "RMM v1.1 features are experimental")
Arunachalam Ganapathy33e3bdc2024-04-10 20:55:40 +0100168 target_compile_definitions(rmm-common
Arunachalam Ganapathy56aeccc2024-10-24 15:03:55 +0100169 INTERFACE "RMM_V1_1=1")
Arunachalam Ganapathy33e3bdc2024-04-10 20:55:40 +0100170endif()
171
Soby Mathewb4c6df42022-11-09 11:13:29 +0000172link_libraries(rmm-common)