Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 1 | /* |
| 2 | * SPDX-License-Identifier: BSD-3-Clause |
| 3 | * |
| 4 | * SPDX-FileCopyrightText: Copyright TF-RMM Contributors. |
| 5 | */ |
| 6 | |
| 7 | #ifndef SMC_RMI_H |
| 8 | #define SMC_RMI_H |
| 9 | |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 10 | #include <smc.h> |
| 11 | |
| 12 | /* |
| 13 | * This file describes the Realm Management Interface (RMI) Application Binary |
| 14 | * Interface (ABI) for SMC calls made from Non-secure state to the RMM and |
| 15 | * serviced by the RMM. |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 16 | */ |
| 17 | |
| 18 | /* |
| 19 | * The major version number of the RMI implementation. Increase this whenever |
| 20 | * the binary format or semantics of the SMC calls change. |
| 21 | */ |
Soby Mathew | c9b6ecd | 2023-01-17 03:40:44 +0000 | [diff] [blame] | 22 | #define RMI_ABI_VERSION_MAJOR U(56) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 23 | |
| 24 | /* |
| 25 | * The minor version number of the RMI implementation. Increase this when |
| 26 | * a bug is fixed, or a feature is added without breaking binary compatibility. |
| 27 | */ |
Soby Mathew | c9b6ecd | 2023-01-17 03:40:44 +0000 | [diff] [blame] | 28 | #define RMI_ABI_VERSION_MINOR U(0) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 29 | |
Soby Mathew | c9b6ecd | 2023-01-17 03:40:44 +0000 | [diff] [blame] | 30 | #define RMI_ABI_VERSION ((RMI_ABI_VERSION_MAJOR << U(16)) | \ |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 31 | RMI_ABI_VERSION_MINOR) |
| 32 | |
Soby Mathew | c9b6ecd | 2023-01-17 03:40:44 +0000 | [diff] [blame] | 33 | #define RMI_ABI_VERSION_GET_MAJOR(_version) ((_version) >> U(16)) |
| 34 | #define RMI_ABI_VERSION_GET_MINOR(_version) ((_version) & U(0xFFFF)) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 35 | |
| 36 | #define SMC64_RMI_FID(_offset) SMC64_STD_FID(RMI, _offset) |
| 37 | |
| 38 | #define IS_SMC64_RMI_FID(_fid) IS_SMC64_STD_FAST_IN_RANGE(RMI, _fid) |
| 39 | |
Yousuf A | 0ec040d | 2022-10-31 12:30:57 +0000 | [diff] [blame] | 40 | /* Command completed successfully. index is zero. */ |
| 41 | #define RMI_SUCCESS U(0) |
| 42 | |
| 43 | /* |
| 44 | * The value of a command input value caused the command to fail. |
| 45 | * Index is zero. |
| 46 | */ |
| 47 | #define RMI_ERROR_INPUT U(1) |
| 48 | |
| 49 | /* |
| 50 | * An attribute of a Realm does not match the expected value. |
| 51 | * index varies between usages. |
| 52 | */ |
| 53 | #define RMI_ERROR_REALM U(2) |
| 54 | |
| 55 | /* |
| 56 | * An attribute of a REC does not match the expected value. |
| 57 | * Index is zero. |
| 58 | */ |
| 59 | #define RMI_ERROR_REC U(3) |
| 60 | |
| 61 | /* |
| 62 | * An RTT walk terminated before reaching the target RTT level, or reached |
| 63 | * an RTTE with an unexpected value. index: RTT level at which the walk |
| 64 | * terminated |
| 65 | */ |
| 66 | #define RMI_ERROR_RTT U(4) |
| 67 | |
| 68 | /* |
| 69 | * An operation cannot be completed because a resource is in use. |
| 70 | * Index is zero. |
| 71 | */ |
| 72 | #define RMI_ERROR_IN_USE U(5) |
| 73 | |
| 74 | /* |
| 75 | * Number of RMI Status Errors. |
| 76 | */ |
| 77 | #define RMI_ERROR_COUNT U(6) |
| 78 | |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 79 | /* |
| 80 | * The number of GPRs (starting from X0) that are |
| 81 | * configured by the host when a REC is created. |
| 82 | */ |
Soby Mathew | c9b6ecd | 2023-01-17 03:40:44 +0000 | [diff] [blame] | 83 | #define REC_CREATE_NR_GPRS U(8) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 84 | |
Soby Mathew | c9b6ecd | 2023-01-17 03:40:44 +0000 | [diff] [blame] | 85 | #define REC_PARAMS_FLAG_RUNNABLE (UL(1) << 0) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 86 | |
| 87 | /* |
| 88 | * The number of GPRs (starting from X0) per voluntary exit context. |
| 89 | * Per SMCCC. |
| 90 | */ |
Soby Mathew | c9b6ecd | 2023-01-17 03:40:44 +0000 | [diff] [blame] | 91 | #define REC_EXIT_NR_GPRS U(31) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 92 | |
| 93 | /* RmiHashAlgorithm type */ |
Soby Mathew | 3f56a4c | 2023-01-17 02:35:10 +0000 | [diff] [blame] | 94 | #define RMI_HASH_ALGO_SHA256 0 |
| 95 | #define RMI_HASH_ALGO_SHA512 1 |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 96 | |
| 97 | /* Maximum number of Interrupt Controller List Registers */ |
Soby Mathew | c9b6ecd | 2023-01-17 03:40:44 +0000 | [diff] [blame] | 98 | #define REC_GIC_NUM_LRS U(16) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 99 | |
| 100 | /* Maximum number of auxiliary granules required for a REC */ |
Soby Mathew | c9b6ecd | 2023-01-17 03:40:44 +0000 | [diff] [blame] | 101 | #define MAX_REC_AUX_GRANULES U(16) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 102 | |
Soby Mathew | c9b6ecd | 2023-01-17 03:40:44 +0000 | [diff] [blame] | 103 | #define REC_ENTRY_FLAG_EMUL_MMIO (UL(1) << 0) |
| 104 | #define REC_ENTRY_FLAG_INJECT_SEA (UL(1) << 1) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 105 | |
| 106 | /* Flags to specify if WFI/WFE should be trapped to host */ |
Soby Mathew | c9b6ecd | 2023-01-17 03:40:44 +0000 | [diff] [blame] | 107 | #define REC_ENTRY_FLAG_TRAP_WFI (UL(1) << 2) |
| 108 | #define REC_ENTRY_FLAG_TRAP_WFE (UL(1) << 3) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 109 | |
| 110 | /* |
| 111 | * RmiRecExitReason represents the reason for a REC exit. |
| 112 | * This is returned to NS hosts via RMI_REC_ENTER::run_ptr. |
| 113 | */ |
Soby Mathew | c9b6ecd | 2023-01-17 03:40:44 +0000 | [diff] [blame] | 114 | #define RMI_EXIT_SYNC U(0) |
| 115 | #define RMI_EXIT_IRQ U(1) |
| 116 | #define RMI_EXIT_FIQ U(2) |
| 117 | #define RMI_EXIT_PSCI U(3) |
| 118 | #define RMI_EXIT_RIPAS_CHANGE U(4) |
| 119 | #define RMI_EXIT_HOST_CALL U(5) |
| 120 | #define RMI_EXIT_SERROR U(6) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 121 | |
| 122 | /* RmiRttEntryState represents the state of an RTTE */ |
Soby Mathew | c9b6ecd | 2023-01-17 03:40:44 +0000 | [diff] [blame] | 123 | #define RMI_UNASSIGNED U(0) |
| 124 | #define RMI_DESTROYED U(1) |
| 125 | #define RMI_ASSIGNED U(2) |
| 126 | #define RMI_TABLE U(3) |
| 127 | #define RMI_VALID_NS U(4) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 128 | |
AlexeiFedorov | 7bb7a70 | 2023-01-17 17:04:14 +0000 | [diff] [blame] | 129 | /* RmiFeature enumerations */ |
| 130 | #define RMI_NOT_SUPPORTED UL(0) |
| 131 | #define RMI_SUPPORTED UL(1) |
| 132 | |
Yousuf A | a297b9b | 2022-10-13 13:54:21 +0100 | [diff] [blame] | 133 | /* RmiFeatureRegister0 format */ |
| 134 | #define RMM_FEATURE_REGISTER_0_INDEX UL(0) |
| 135 | |
| 136 | #define RMM_FEATURE_REGISTER_0_S2SZ_SHIFT UL(0) |
| 137 | #define RMM_FEATURE_REGISTER_0_S2SZ_WIDTH UL(8) |
| 138 | |
| 139 | #define RMM_FEATURE_REGISTER_0_LPA2_SHIFT UL(8) |
| 140 | #define RMM_FEATURE_REGISTER_0_LPA2_WIDTH UL(1) |
| 141 | #define RMI_NO_LPA2 UL(0) |
| 142 | #define RMI_LPA2 UL(1) |
| 143 | |
| 144 | #define RMM_FEATURE_REGISTER_0_HASH_SHA_256_SHIFT UL(28) |
| 145 | #define RMM_FEATURE_REGISTER_0_HASH_SHA_256_WIDTH UL(1) |
| 146 | |
| 147 | #define RMM_FEATURE_REGISTER_0_HASH_SHA_512_SHIFT UL(29) |
| 148 | #define RMM_FEATURE_REGISTER_0_HASH_SHA_512_WIDTH UL(1) |
| 149 | |
AlexeiFedorov | 7bb7a70 | 2023-01-17 17:04:14 +0000 | [diff] [blame] | 150 | #define RMM_FEATURE_REGISTER_0_PMU_EN_SHIFT UL(22) |
| 151 | #define RMM_FEATURE_REGISTER_0_PMU_EN_WIDTH UL(1) |
| 152 | |
| 153 | #define RMM_FEATURE_REGISTER_0_PMU_NUM_CTRS_SHIFT UL(23) |
| 154 | #define RMM_FEATURE_REGISTER_0_PMU_NUM_CTRS_WIDTH UL(5) |
| 155 | |
Yousuf A | 6280815 | 2022-10-31 10:35:42 +0000 | [diff] [blame] | 156 | /* The RmmRipas enumeration representing realm IPA state */ |
| 157 | #define RMI_EMPTY (0) |
| 158 | #define RMI_RAM (1) |
| 159 | |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 160 | /* no parameters */ |
| 161 | #define SMC_RMM_VERSION SMC64_RMI_FID(U(0x0)) |
| 162 | |
| 163 | /* |
| 164 | * arg0 == target granule address |
| 165 | */ |
| 166 | #define SMC_RMM_GRANULE_DELEGATE SMC64_RMI_FID(U(0x1)) |
| 167 | |
| 168 | /* |
| 169 | * arg0 == target granule address |
| 170 | */ |
| 171 | #define SMC_RMM_GRANULE_UNDELEGATE SMC64_RMI_FID(U(0x2)) |
| 172 | |
| 173 | /* RmiDataMeasureContent type */ |
| 174 | #define RMI_NO_MEASURE_CONTENT 0 |
| 175 | #define RMI_MEASURE_CONTENT 1 |
| 176 | |
| 177 | /* |
| 178 | * arg0 == data address |
| 179 | * arg1 == RD address |
| 180 | * arg2 == map address |
| 181 | * arg3 == SRC address |
| 182 | * arg4 == flags |
| 183 | */ |
| 184 | #define SMC_RMM_DATA_CREATE SMC64_RMI_FID(U(0x3)) |
| 185 | |
| 186 | /* |
| 187 | * arg0 == data address |
| 188 | * arg1 == RD address |
| 189 | * arg2 == map address |
| 190 | */ |
| 191 | #define SMC_RMM_DATA_CREATE_UNKNOWN SMC64_RMI_FID(U(0x4)) |
| 192 | |
| 193 | /* |
| 194 | * arg0 == RD address |
| 195 | * arg1 == map address |
| 196 | */ |
| 197 | #define SMC_RMM_DATA_DESTROY SMC64_RMI_FID(U(0x5)) |
| 198 | |
| 199 | /* |
| 200 | * arg0 == RD address |
| 201 | */ |
| 202 | #define SMC_RMM_REALM_ACTIVATE SMC64_RMI_FID(U(0x7)) |
| 203 | |
| 204 | /* |
| 205 | * arg0 == RD address |
| 206 | * arg1 == struct rmi_realm_params addr |
| 207 | */ |
| 208 | #define SMC_RMM_REALM_CREATE SMC64_RMI_FID(U(0x8)) |
| 209 | |
| 210 | /* |
| 211 | * arg0 == RD address |
| 212 | */ |
| 213 | #define SMC_RMM_REALM_DESTROY SMC64_RMI_FID(U(0x9)) |
| 214 | |
| 215 | /* |
| 216 | * arg0 == REC address |
| 217 | * arg1 == RD address |
| 218 | * arg2 == struct rmm_rec address |
| 219 | */ |
| 220 | #define SMC_RMM_REC_CREATE SMC64_RMI_FID(U(0xA)) |
| 221 | |
| 222 | /* |
| 223 | * arg0 == REC address |
| 224 | */ |
| 225 | #define SMC_RMM_REC_DESTROY SMC64_RMI_FID(U(0xB)) |
| 226 | |
| 227 | /* |
| 228 | * arg0 == rec address |
| 229 | * arg1 == rec_run address |
| 230 | */ |
| 231 | #define SMC_RMM_REC_ENTER SMC64_RMI_FID(U(0xC)) |
| 232 | |
| 233 | /* |
| 234 | * arg0 == RTT address |
| 235 | * arg1 == RD address |
| 236 | * arg2 == map address |
| 237 | * arg3 == level |
| 238 | */ |
| 239 | #define SMC_RMM_RTT_CREATE SMC64_RMI_FID(U(0xD)) |
| 240 | |
| 241 | /* |
| 242 | * arg0 == RTT address |
| 243 | * arg1 == RD address |
| 244 | * arg2 == map address |
| 245 | * arg3 == level |
| 246 | */ |
| 247 | #define SMC_RMM_RTT_DESTROY SMC64_RMI_FID(U(0xE)) |
| 248 | |
| 249 | /* |
| 250 | * arg0 == RD address |
| 251 | * arg1 == map address |
| 252 | * arg2 == level |
| 253 | * arg3 == s2tte |
| 254 | */ |
| 255 | #define SMC_RMM_RTT_MAP_UNPROTECTED SMC64_RMI_FID(U(0xF)) |
| 256 | |
| 257 | /* |
| 258 | * arg0 == RD address |
| 259 | * arg1 == map address |
| 260 | * arg2 == level |
| 261 | * ret1 == level |
| 262 | * ret2 == s2tte type |
| 263 | * ret3 == s2tte |
| 264 | * ret4 == ripas |
| 265 | */ |
| 266 | #define SMC_RMM_RTT_READ_ENTRY SMC64_RMI_FID(U(0x11)) |
| 267 | |
| 268 | /* |
| 269 | * arg0 == RD address |
| 270 | * arg1 == map address |
| 271 | * arg2 == level |
| 272 | */ |
| 273 | #define SMC_RMM_RTT_UNMAP_UNPROTECTED SMC64_RMI_FID(U(0x12)) |
| 274 | |
| 275 | /* |
| 276 | * arg0 == calling rec address |
| 277 | * arg1 == target rec address |
| 278 | */ |
| 279 | #define SMC_RMM_PSCI_COMPLETE SMC64_RMI_FID(U(0x14)) |
| 280 | |
| 281 | /* |
| 282 | * arg0 == Feature register index |
| 283 | */ |
| 284 | #define SMC_RMM_FEATURES SMC64_RMI_FID(U(0x15)) |
| 285 | |
| 286 | /* |
| 287 | * arg0 == RTT address |
| 288 | * arg1 == RD address |
| 289 | * arg2 == map address |
| 290 | * arg3 == level |
| 291 | */ |
| 292 | #define SMC_RMM_RTT_FOLD SMC64_RMI_FID(U(0x16)) |
| 293 | |
| 294 | /* |
| 295 | * arg0 == RD address |
| 296 | */ |
| 297 | #define SMC_RMM_REC_AUX_COUNT SMC64_RMI_FID(U(0x17)) |
| 298 | |
| 299 | /* |
| 300 | * arg1 == RD address |
| 301 | * arg2 == map address |
| 302 | * arg3 == level |
| 303 | */ |
| 304 | #define SMC_RMM_RTT_INIT_RIPAS SMC64_RMI_FID(U(0x18)) |
| 305 | |
| 306 | /* |
| 307 | * arg0 == RD address |
| 308 | * arg1 == REC address |
| 309 | * arg2 == map address |
| 310 | * arg3 == level |
| 311 | * arg4 == ripas |
| 312 | */ |
| 313 | #define SMC_RMM_RTT_SET_RIPAS SMC64_RMI_FID(U(0x19)) |
| 314 | |
| 315 | /* Size of Realm Personalization Value */ |
| 316 | #define RPV_SIZE 64 |
| 317 | |
Soby Mathew | c9b6ecd | 2023-01-17 03:40:44 +0000 | [diff] [blame] | 318 | #ifndef __ASSEMBLER__ |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 319 | /* |
Soby Mathew | c414f2a | 2023-01-17 02:50:17 +0000 | [diff] [blame] | 320 | * Defines member of structure and reserves space |
| 321 | * for the next member with specified offset. |
| 322 | */ |
| 323 | #define SET_MEMBER_RMI SET_MEMBER |
| 324 | |
| 325 | /* |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 326 | * The Realm attribute parameters are shared by the Host via |
| 327 | * RMI_REALM_CREATE::params_ptr. The values can be observed or modified |
| 328 | * either by the Host or by the Realm. |
| 329 | */ |
| 330 | struct rmi_realm_params { |
| 331 | /* Realm feature register 0 */ |
Soby Mathew | c414f2a | 2023-01-17 02:50:17 +0000 | [diff] [blame] | 332 | SET_MEMBER_RMI(unsigned long features_0, 0, 0x100); /* Offset 0 */ |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 333 | /* Measurement algorithm */ |
Soby Mathew | c414f2a | 2023-01-17 02:50:17 +0000 | [diff] [blame] | 334 | SET_MEMBER_RMI(unsigned char hash_algo, 0x100, 0x400); /* 0x100 */ |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 335 | /* Realm Personalization Value */ |
Soby Mathew | c414f2a | 2023-01-17 02:50:17 +0000 | [diff] [blame] | 336 | SET_MEMBER_RMI(unsigned char rpv[RPV_SIZE], 0x400, 0x800); /* 0x400 */ |
| 337 | SET_MEMBER_RMI(struct { |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 338 | /* Virtual Machine Identifier */ |
| 339 | unsigned short vmid; /* 0x800 */ |
| 340 | /* Realm Translation Table base */ |
| 341 | unsigned long rtt_base; /* 0x808 */ |
| 342 | /* RTT starting level */ |
| 343 | long rtt_level_start; /* 0x810 */ |
| 344 | /* Number of starting level RTTs */ |
| 345 | unsigned int rtt_num_start; /* 0x818 */ |
| 346 | }, 0x800, 0x1000); |
| 347 | }; |
| 348 | |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 349 | /* |
| 350 | * The REC attribute parameters are shared by the Host via |
| 351 | * MI_REC_CREATE::params_ptr. The values can be observed or modified |
| 352 | * either by the Host or by the Realm which owns the REC. |
| 353 | */ |
| 354 | struct rmi_rec_params { |
| 355 | /* Flags */ |
Soby Mathew | c414f2a | 2023-01-17 02:50:17 +0000 | [diff] [blame] | 356 | SET_MEMBER_RMI(unsigned long flags, 0, 0x100); /* Offset 0 */ |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 357 | /* MPIDR of the REC */ |
Soby Mathew | c414f2a | 2023-01-17 02:50:17 +0000 | [diff] [blame] | 358 | SET_MEMBER_RMI(unsigned long mpidr, 0x100, 0x200); /* 0x100 */ |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 359 | /* Program counter */ |
Soby Mathew | c414f2a | 2023-01-17 02:50:17 +0000 | [diff] [blame] | 360 | SET_MEMBER_RMI(unsigned long pc, 0x200, 0x300); /* 0x200 */ |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 361 | /* General-purpose registers */ |
Soby Mathew | c414f2a | 2023-01-17 02:50:17 +0000 | [diff] [blame] | 362 | SET_MEMBER_RMI(unsigned long gprs[REC_CREATE_NR_GPRS], 0x300, 0x800); /* 0x300 */ |
| 363 | SET_MEMBER_RMI(struct { |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 364 | /* Number of auxiliary Granules */ |
| 365 | unsigned long num_aux; /* 0x800 */ |
| 366 | /* Addresses of auxiliary Granules */ |
| 367 | unsigned long aux[MAX_REC_AUX_GRANULES];/* 0x808 */ |
| 368 | }, 0x800, 0x1000); |
| 369 | }; |
| 370 | |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 371 | /* |
| 372 | * Structure contains data passed from the Host to the RMM on REC entry |
| 373 | */ |
| 374 | struct rmi_rec_entry { |
| 375 | /* Flags */ |
Soby Mathew | c414f2a | 2023-01-17 02:50:17 +0000 | [diff] [blame] | 376 | SET_MEMBER_RMI(unsigned long flags, 0, 0x200); /* Offset 0 */ |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 377 | /* General-purpose registers */ |
Soby Mathew | c414f2a | 2023-01-17 02:50:17 +0000 | [diff] [blame] | 378 | SET_MEMBER_RMI(unsigned long gprs[REC_EXIT_NR_GPRS], 0x200, 0x300); /* 0x200 */ |
| 379 | SET_MEMBER_RMI(struct { |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 380 | /* GICv3 Hypervisor Control Register */ |
| 381 | unsigned long gicv3_hcr; /* 0x300 */ |
| 382 | /* GICv3 List Registers */ |
| 383 | unsigned long gicv3_lrs[REC_GIC_NUM_LRS]; /* 0x308 */ |
| 384 | }, 0x300, 0x800); |
| 385 | }; |
| 386 | |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 387 | /* |
| 388 | * Structure contains data passed from the RMM to the Host on REC exit |
| 389 | */ |
| 390 | struct rmi_rec_exit { |
| 391 | /* Exit reason */ |
Soby Mathew | c414f2a | 2023-01-17 02:50:17 +0000 | [diff] [blame] | 392 | SET_MEMBER_RMI(unsigned long exit_reason, 0, 0x100);/* Offset 0 */ |
| 393 | SET_MEMBER_RMI(struct { |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 394 | /* Exception Syndrome Register */ |
| 395 | unsigned long esr; /* 0x100 */ |
| 396 | /* Fault Address Register */ |
| 397 | unsigned long far; /* 0x108 */ |
| 398 | /* Hypervisor IPA Fault Address register */ |
| 399 | unsigned long hpfar; /* 0x110 */ |
| 400 | }, 0x100, 0x200); |
| 401 | /* General-purpose registers */ |
Soby Mathew | c414f2a | 2023-01-17 02:50:17 +0000 | [diff] [blame] | 402 | SET_MEMBER_RMI(unsigned long gprs[REC_EXIT_NR_GPRS], 0x200, 0x300); /* 0x200 */ |
| 403 | SET_MEMBER_RMI(struct { |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 404 | /* GICv3 Hypervisor Control Register */ |
| 405 | unsigned long gicv3_hcr; /* 0x300 */ |
| 406 | /* GICv3 List Registers */ |
| 407 | unsigned long gicv3_lrs[REC_GIC_NUM_LRS]; /* 0x308 */ |
| 408 | /* GICv3 Maintenance Interrupt State Register */ |
| 409 | unsigned long gicv3_misr; /* 0x388 */ |
| 410 | /* GICv3 Virtual Machine Control Register */ |
| 411 | unsigned long gicv3_vmcr; /* 0x390 */ |
| 412 | }, 0x300, 0x400); |
Soby Mathew | c414f2a | 2023-01-17 02:50:17 +0000 | [diff] [blame] | 413 | SET_MEMBER_RMI(struct { |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 414 | /* Counter-timer Physical Timer Control Register */ |
| 415 | unsigned long cntp_ctl; /* 0x400 */ |
| 416 | /* Counter-timer Physical Timer CompareValue Register */ |
| 417 | unsigned long cntp_cval; /* 0x408 */ |
| 418 | /* Counter-timer Virtual Timer Control Register */ |
| 419 | unsigned long cntv_ctl; /* 0x410 */ |
| 420 | /* Counter-timer Virtual Timer CompareValue Register */ |
| 421 | unsigned long cntv_cval; /* 0x418 */ |
| 422 | }, 0x400, 0x500); |
Soby Mathew | c414f2a | 2023-01-17 02:50:17 +0000 | [diff] [blame] | 423 | SET_MEMBER_RMI(struct { |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 424 | /* Base address of pending RIPAS change */ |
| 425 | unsigned long ripas_base; /* 0x500 */ |
| 426 | /* Size of pending RIPAS change */ |
| 427 | unsigned long ripas_size; /* 0x508 */ |
| 428 | /* RIPAS value of pending RIPAS change */ |
| 429 | unsigned char ripas_value; /* 0x510 */ |
| 430 | }, 0x500, 0x600); |
| 431 | /* Host call immediate value */ |
Soby Mathew | c414f2a | 2023-01-17 02:50:17 +0000 | [diff] [blame] | 432 | SET_MEMBER_RMI(unsigned int imm, 0x600, 0x800); /* 0x600 */ |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 433 | }; |
| 434 | |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 435 | /* |
| 436 | * Structure contains shared information between RMM and Host |
| 437 | * during REC entry and REC exit. |
| 438 | */ |
| 439 | struct rmi_rec_run { |
| 440 | /* Entry information */ |
Soby Mathew | c414f2a | 2023-01-17 02:50:17 +0000 | [diff] [blame] | 441 | SET_MEMBER_RMI(struct rmi_rec_entry entry, 0, 0x800); /* Offset 0 */ |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 442 | /* Exit information */ |
Soby Mathew | c414f2a | 2023-01-17 02:50:17 +0000 | [diff] [blame] | 443 | SET_MEMBER_RMI(struct rmi_rec_exit exit, 0x800, 0x1000); /* 0x800 */ |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 444 | }; |
| 445 | |
Soby Mathew | c9b6ecd | 2023-01-17 03:40:44 +0000 | [diff] [blame] | 446 | #endif /* __ASSEMBLER__ */ |
| 447 | |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 448 | #endif /* SMC_RMI_H */ |