blob: 70565af3cf5df4bf1caabe7226d57020b01182e9 [file] [log] [blame]
Soby Mathewb4c6df42022-11-09 11:13:29 +00001/*
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 Mathewb4c6df42022-11-09 11:13:29 +000010#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 Mathewb4c6df42022-11-09 11:13:29 +000016 */
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 Mathewc9b6ecd2023-01-17 03:40:44 +000022#define RMI_ABI_VERSION_MAJOR U(56)
Soby Mathewb4c6df42022-11-09 11:13:29 +000023
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 Mathewc9b6ecd2023-01-17 03:40:44 +000028#define RMI_ABI_VERSION_MINOR U(0)
Soby Mathewb4c6df42022-11-09 11:13:29 +000029
Soby Mathewc9b6ecd2023-01-17 03:40:44 +000030#define RMI_ABI_VERSION ((RMI_ABI_VERSION_MAJOR << U(16)) | \
Soby Mathewb4c6df42022-11-09 11:13:29 +000031 RMI_ABI_VERSION_MINOR)
32
Soby Mathewc9b6ecd2023-01-17 03:40:44 +000033#define RMI_ABI_VERSION_GET_MAJOR(_version) ((_version) >> U(16))
34#define RMI_ABI_VERSION_GET_MINOR(_version) ((_version) & U(0xFFFF))
Soby Mathewb4c6df42022-11-09 11:13:29 +000035
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 A0ec040d2022-10-31 12:30:57 +000040/* 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/*
Yousuf A0ec040d2022-10-31 12:30:57 +000069 * Number of RMI Status Errors.
70 */
AlexeiFedorov892abce2023-04-06 16:32:12 +010071#define RMI_ERROR_COUNT U(5)
Yousuf A0ec040d2022-10-31 12:30:57 +000072
Soby Mathewb4c6df42022-11-09 11:13:29 +000073/*
74 * The number of GPRs (starting from X0) that are
75 * configured by the host when a REC is created.
76 */
Soby Mathewc9b6ecd2023-01-17 03:40:44 +000077#define REC_CREATE_NR_GPRS U(8)
Soby Mathewb4c6df42022-11-09 11:13:29 +000078
Soby Mathewc9b6ecd2023-01-17 03:40:44 +000079#define REC_PARAMS_FLAG_RUNNABLE (UL(1) << 0)
Soby Mathewb4c6df42022-11-09 11:13:29 +000080
81/*
82 * The number of GPRs (starting from X0) per voluntary exit context.
83 * Per SMCCC.
84 */
Soby Mathewc9b6ecd2023-01-17 03:40:44 +000085#define REC_EXIT_NR_GPRS U(31)
Soby Mathewb4c6df42022-11-09 11:13:29 +000086
87/* RmiHashAlgorithm type */
AlexeiFedorov4fc3b152023-06-13 12:08:01 +010088#define RMI_HASH_SHA_256 0
89#define RMI_HASH_SHA_512 1
Soby Mathewb4c6df42022-11-09 11:13:29 +000090
91/* Maximum number of Interrupt Controller List Registers */
Soby Mathewc9b6ecd2023-01-17 03:40:44 +000092#define REC_GIC_NUM_LRS U(16)
Soby Mathewb4c6df42022-11-09 11:13:29 +000093
94/* Maximum number of auxiliary granules required for a REC */
Soby Mathewc9b6ecd2023-01-17 03:40:44 +000095#define MAX_REC_AUX_GRANULES U(16)
Soby Mathewb4c6df42022-11-09 11:13:29 +000096
Soby Mathewc9b6ecd2023-01-17 03:40:44 +000097#define REC_ENTRY_FLAG_EMUL_MMIO (UL(1) << 0)
98#define REC_ENTRY_FLAG_INJECT_SEA (UL(1) << 1)
Soby Mathewb4c6df42022-11-09 11:13:29 +000099
100/* Flags to specify if WFI/WFE should be trapped to host */
Soby Mathewc9b6ecd2023-01-17 03:40:44 +0000101#define REC_ENTRY_FLAG_TRAP_WFI (UL(1) << 2)
102#define REC_ENTRY_FLAG_TRAP_WFE (UL(1) << 3)
Soby Mathewb4c6df42022-11-09 11:13:29 +0000103
104/*
105 * RmiRecExitReason represents the reason for a REC exit.
106 * This is returned to NS hosts via RMI_REC_ENTER::run_ptr.
107 */
Soby Mathewc9b6ecd2023-01-17 03:40:44 +0000108#define RMI_EXIT_SYNC U(0)
109#define RMI_EXIT_IRQ U(1)
110#define RMI_EXIT_FIQ U(2)
111#define RMI_EXIT_PSCI U(3)
112#define RMI_EXIT_RIPAS_CHANGE U(4)
113#define RMI_EXIT_HOST_CALL U(5)
114#define RMI_EXIT_SERROR U(6)
Soby Mathewb4c6df42022-11-09 11:13:29 +0000115
116/* RmiRttEntryState represents the state of an RTTE */
Soby Mathewc9b6ecd2023-01-17 03:40:44 +0000117#define RMI_UNASSIGNED U(0)
118#define RMI_DESTROYED U(1)
119#define RMI_ASSIGNED U(2)
120#define RMI_TABLE U(3)
Soby Mathewb4c6df42022-11-09 11:13:29 +0000121
AlexeiFedorov7bb7a702023-01-17 17:04:14 +0000122/* RmiFeature enumerations */
AlexeiFedorovc09b1652023-04-04 15:41:37 +0100123#define RMI_FEATURE_FALSE UL(0)
124#define RMI_FEATURE_TRUE UL(1)
AlexeiFedorov7bb7a702023-01-17 17:04:14 +0000125
Yousuf Aa297b9b2022-10-13 13:54:21 +0100126/* RmiFeatureRegister0 format */
127#define RMM_FEATURE_REGISTER_0_INDEX UL(0)
128
129#define RMM_FEATURE_REGISTER_0_S2SZ_SHIFT UL(0)
130#define RMM_FEATURE_REGISTER_0_S2SZ_WIDTH UL(8)
131
132#define RMM_FEATURE_REGISTER_0_LPA2_SHIFT UL(8)
133#define RMM_FEATURE_REGISTER_0_LPA2_WIDTH UL(1)
Yousuf Aa297b9b2022-10-13 13:54:21 +0100134
AlexeiFedorov18002922023-04-06 10:19:51 +0100135#define RMM_FEATURE_REGISTER_0_SVE_EN_SHIFT UL(9)
136#define RMM_FEATURE_REGISTER_0_SVE_EN_WIDTH UL(1)
Yousuf Aa297b9b2022-10-13 13:54:21 +0100137
AlexeiFedorov18002922023-04-06 10:19:51 +0100138#define RMM_FEATURE_REGISTER_0_SVE_VL_SHIFT UL(10)
139#define RMM_FEATURE_REGISTER_0_SVE_VL_WIDTH UL(4)
Yousuf Aa297b9b2022-10-13 13:54:21 +0100140
AlexeiFedorov18002922023-04-06 10:19:51 +0100141#define RMM_FEATURE_REGISTER_0_NUM_BPS_SHIFT UL(14)
142#define RMM_FEATURE_REGISTER_0_NUM_BPS_WIDTH UL(4)
143
144#define RMM_FEATURE_REGISTER_0_NUM_WPS_SHIFT UL(18)
145#define RMM_FEATURE_REGISTER_0_NUM_WPS_WIDTH UL(4)
146
147#define RMM_FEATURE_REGISTER_0_PMU_EN_SHIFT UL(22)
148#define RMM_FEATURE_REGISTER_0_PMU_EN_WIDTH UL(1)
AlexeiFedorov7bb7a702023-01-17 17:04:14 +0000149
150#define RMM_FEATURE_REGISTER_0_PMU_NUM_CTRS_SHIFT UL(23)
151#define RMM_FEATURE_REGISTER_0_PMU_NUM_CTRS_WIDTH UL(5)
152
AlexeiFedorov18002922023-04-06 10:19:51 +0100153#define RMM_FEATURE_REGISTER_0_HASH_SHA_256_SHIFT UL(28)
154#define RMM_FEATURE_REGISTER_0_HASH_SHA_256_WIDTH UL(1)
155
156#define RMM_FEATURE_REGISTER_0_HASH_SHA_512_SHIFT UL(29)
157#define RMM_FEATURE_REGISTER_0_HASH_SHA_512_WIDTH UL(1)
Arunachalam Ganapathyf6491212023-02-23 16:04:34 +0000158
AlexeiFedorov4d4e7342023-06-12 12:10:06 +0100159/* RmmRipas enumeration representing realm IPA state */
AlexeiFedorov20afb5c2023-04-18 11:44:19 +0100160#define RMI_EMPTY U(0)
161#define RMI_RAM U(1)
162#define RMI_UNDEFINED U(2)
Yousuf A62808152022-10-31 10:35:42 +0000163
AlexeiFedorov4d4e7342023-06-12 12:10:06 +0100164/* RmiPmuOverflowStatus enumeration representing PMU overflow status */
165#define RMI_PMU_OVERFLOW_NOT_ACTIVE U(0)
166#define RMI_PMU_OVERFLOW_ACTIVE U(1)
167
168/* No parameters */
Soby Mathewb4c6df42022-11-09 11:13:29 +0000169#define SMC_RMM_VERSION SMC64_RMI_FID(U(0x0))
170
171/*
172 * arg0 == target granule address
173 */
174#define SMC_RMM_GRANULE_DELEGATE SMC64_RMI_FID(U(0x1))
175
176/*
177 * arg0 == target granule address
178 */
179#define SMC_RMM_GRANULE_UNDELEGATE SMC64_RMI_FID(U(0x2))
180
181/* RmiDataMeasureContent type */
182#define RMI_NO_MEASURE_CONTENT 0
183#define RMI_MEASURE_CONTENT 1
184
185/*
AlexeiFedorovac923c82023-04-06 15:12:04 +0100186 * arg0 == RD address
187 * arg1 == data address
Soby Mathewb4c6df42022-11-09 11:13:29 +0000188 * arg2 == map address
189 * arg3 == SRC address
190 * arg4 == flags
191 */
192#define SMC_RMM_DATA_CREATE SMC64_RMI_FID(U(0x3))
193
194/*
AlexeiFedorovac923c82023-04-06 15:12:04 +0100195 * arg0 == RD address
196 * arg1 == data address
Soby Mathewb4c6df42022-11-09 11:13:29 +0000197 * arg2 == map address
198 */
199#define SMC_RMM_DATA_CREATE_UNKNOWN SMC64_RMI_FID(U(0x4))
200
201/*
202 * arg0 == RD address
203 * arg1 == map address
AlexeiFedorove2002be2023-04-19 17:20:12 +0100204 *
205 * ret1 == Address(PA) of the DATA granule, if ret0 == RMI_SUCCESS.
206 * Otherwise, undefined.
207 * ret2 == Top of the non-live address region. Only valid
AlexeiFedorov697445b2023-04-25 15:27:57 +0100208 * if ret0 == RMI_SUCCESS or ret0 == (RMI_ERROR_RTT, x)
Soby Mathewb4c6df42022-11-09 11:13:29 +0000209 */
210#define SMC_RMM_DATA_DESTROY SMC64_RMI_FID(U(0x5))
211
212/*
213 * arg0 == RD address
214 */
215#define SMC_RMM_REALM_ACTIVATE SMC64_RMI_FID(U(0x7))
216
217/*
218 * arg0 == RD address
AlexeiFedorovac923c82023-04-06 15:12:04 +0100219 * arg1 == struct rmi_realm_params address
Soby Mathewb4c6df42022-11-09 11:13:29 +0000220 */
221#define SMC_RMM_REALM_CREATE SMC64_RMI_FID(U(0x8))
222
223/*
224 * arg0 == RD address
225 */
226#define SMC_RMM_REALM_DESTROY SMC64_RMI_FID(U(0x9))
227
228/*
AlexeiFedorovac923c82023-04-06 15:12:04 +0100229 * arg0 == RD address
230 * arg1 == REC address
Soby Mathewb4c6df42022-11-09 11:13:29 +0000231 * arg2 == struct rmm_rec address
232 */
233#define SMC_RMM_REC_CREATE SMC64_RMI_FID(U(0xA))
234
235/*
236 * arg0 == REC address
237 */
238#define SMC_RMM_REC_DESTROY SMC64_RMI_FID(U(0xB))
239
240/*
241 * arg0 == rec address
AlexeiFedorovac923c82023-04-06 15:12:04 +0100242 * arg1 == struct rec_run address
Soby Mathewb4c6df42022-11-09 11:13:29 +0000243 */
244#define SMC_RMM_REC_ENTER SMC64_RMI_FID(U(0xC))
245
246/*
AlexeiFedorovac923c82023-04-06 15:12:04 +0100247 * arg0 == RD address
248 * arg1 == RTT address
Soby Mathewb4c6df42022-11-09 11:13:29 +0000249 * arg2 == map address
250 * arg3 == level
251 */
252#define SMC_RMM_RTT_CREATE SMC64_RMI_FID(U(0xD))
253
254/*
AlexeiFedorove2002be2023-04-19 17:20:12 +0100255 * arg0 == RD address
256 * arg1 == map address
257 * arg2 == level
258 *
259 * ret1 == Address (PA) of the RTT, if ret0 == RMI_SUCCESS
260 * Otherwise, undefined.
261 * ret2 == Top of the non-live address region. Only valid
AlexeiFedorov697445b2023-04-25 15:27:57 +0100262 * if ret0 == RMI_SUCCESS or ret0 == (RMI_ERROR_RTT, x)
Soby Mathewb4c6df42022-11-09 11:13:29 +0000263 */
264#define SMC_RMM_RTT_DESTROY SMC64_RMI_FID(U(0xE))
265
266/*
267 * arg0 == RD address
268 * arg1 == map address
269 * arg2 == level
270 * arg3 == s2tte
271 */
272#define SMC_RMM_RTT_MAP_UNPROTECTED SMC64_RMI_FID(U(0xF))
273
274/*
275 * arg0 == RD address
276 * arg1 == map address
277 * arg2 == level
AlexeiFedorov697445b2023-04-25 15:27:57 +0100278 *
Soby Mathewb4c6df42022-11-09 11:13:29 +0000279 * ret1 == level
280 * ret2 == s2tte type
281 * ret3 == s2tte
282 * ret4 == ripas
AlexeiFedorov697445b2023-04-25 15:27:57 +0100283 * if ret0 == RMI_SUCCESS, otherwise, undefined.
Soby Mathewb4c6df42022-11-09 11:13:29 +0000284 */
285#define SMC_RMM_RTT_READ_ENTRY SMC64_RMI_FID(U(0x11))
286
287/*
288 * arg0 == RD address
289 * arg1 == map address
290 * arg2 == level
291 */
292#define SMC_RMM_RTT_UNMAP_UNPROTECTED SMC64_RMI_FID(U(0x12))
293
294/*
295 * arg0 == calling rec address
296 * arg1 == target rec address
297 */
298#define SMC_RMM_PSCI_COMPLETE SMC64_RMI_FID(U(0x14))
299
300/*
301 * arg0 == Feature register index
302 */
303#define SMC_RMM_FEATURES SMC64_RMI_FID(U(0x15))
304
305/*
AlexeiFedorove2002be2023-04-19 17:20:12 +0100306 * arg0 == RD address
307 * arg1 == map address
308 * arg2 == level
309 *
310 * ret1 == Address(PA) of the RTT folded, if ret0 == RMI_SUCCESS
Soby Mathewb4c6df42022-11-09 11:13:29 +0000311 */
312#define SMC_RMM_RTT_FOLD SMC64_RMI_FID(U(0x16))
313
314/*
315 * arg0 == RD address
316 */
317#define SMC_RMM_REC_AUX_COUNT SMC64_RMI_FID(U(0x17))
318
319/*
AlexeiFedorovac923c82023-04-06 15:12:04 +0100320 * arg0 == RD address
AlexeiFedorov960d1612023-04-25 13:23:39 +0100321 * arg1 == start address
322 * arg2 == end address
323 *
324 * ret1 == Top of the address range where the RIPAS was updated,
325 * if ret0 == RMI_SUCCESS
Soby Mathewb4c6df42022-11-09 11:13:29 +0000326 */
327#define SMC_RMM_RTT_INIT_RIPAS SMC64_RMI_FID(U(0x18))
328
329/*
330 * arg0 == RD address
331 * arg1 == REC address
AlexeiFedorov5cf35ba2023-04-25 10:02:20 +0100332 * arg2 == start address
333 * arg3 == end address
334 *
335 * ret1 == Top of the address range where the RIPAS was updated,
336 * if ret0 == RMI_SUCCESS
Soby Mathewb4c6df42022-11-09 11:13:29 +0000337 */
338#define SMC_RMM_RTT_SET_RIPAS SMC64_RMI_FID(U(0x19))
339
340/* Size of Realm Personalization Value */
341#define RPV_SIZE 64
342
AlexeiFedorov18002922023-04-06 10:19:51 +0100343/* RmiRealmFlags format */
344#define RMI_REALM_FLAGS_LPA2_SHIFT UL(0)
345#define RMI_REALM_FLAGS_LPA2_WIDTH UL(1)
346
347#define RMI_REALM_FLAGS_SVE_SHIFT UL(1)
348#define RMI_REALM_FLAGS_SVE_WIDTH UL(1)
349
350#define RMI_REALM_FLAGS_PMU_SHIFT UL(2)
351#define RMI_REALM_FLAGS_PMU_WIDTH UL(1)
352
Soby Mathewc9b6ecd2023-01-17 03:40:44 +0000353#ifndef __ASSEMBLER__
Soby Mathewb4c6df42022-11-09 11:13:29 +0000354/*
Soby Mathewc414f2a2023-01-17 02:50:17 +0000355 * Defines member of structure and reserves space
356 * for the next member with specified offset.
357 */
358#define SET_MEMBER_RMI SET_MEMBER
359
360/*
Soby Mathewb4c6df42022-11-09 11:13:29 +0000361 * The Realm attribute parameters are shared by the Host via
362 * RMI_REALM_CREATE::params_ptr. The values can be observed or modified
363 * either by the Host or by the Realm.
364 */
365struct rmi_realm_params {
AlexeiFedorov18002922023-04-06 10:19:51 +0100366 /* Flags */
367 SET_MEMBER_RMI(unsigned long flags, 0, 0x8); /* Offset 0 */
368 /* Requested IPA width */
369 SET_MEMBER_RMI(unsigned int s2sz, 0x8, 0x10); /* 0x8 */
370 /* Requested SVE vector length */
371 SET_MEMBER_RMI(unsigned int sve_vl, 0x10, 0x18); /* 0x10 */
372 /* Requested number of breakpoints */
373 SET_MEMBER_RMI(unsigned int num_bps, 0x18, 0x20); /* 0x18 */
374 /* Requested number of watchpoints */
375 SET_MEMBER_RMI(unsigned int num_wps, 0x20, 0x28); /* 0x20 */
376 /* Requested number of PMU counters */
377 SET_MEMBER_RMI(unsigned int pmu_num_ctrs, 0x28, 0x30); /* 0x28 */
Soby Mathewb4c6df42022-11-09 11:13:29 +0000378 /* Measurement algorithm */
AlexeiFedorov18002922023-04-06 10:19:51 +0100379 SET_MEMBER_RMI(unsigned char hash_algo, 0x30, 0x400); /* 0x30 */
Soby Mathewb4c6df42022-11-09 11:13:29 +0000380 /* Realm Personalization Value */
AlexeiFedorov18002922023-04-06 10:19:51 +0100381 SET_MEMBER_RMI(unsigned char rpv[RPV_SIZE], 0x400, 0x800); /* 0x400 */
Soby Mathewc414f2a2023-01-17 02:50:17 +0000382 SET_MEMBER_RMI(struct {
Soby Mathewb4c6df42022-11-09 11:13:29 +0000383 /* Virtual Machine Identifier */
384 unsigned short vmid; /* 0x800 */
385 /* Realm Translation Table base */
386 unsigned long rtt_base; /* 0x808 */
387 /* RTT starting level */
388 long rtt_level_start; /* 0x810 */
389 /* Number of starting level RTTs */
390 unsigned int rtt_num_start; /* 0x818 */
391 }, 0x800, 0x1000);
392};
393
Soby Mathewb4c6df42022-11-09 11:13:29 +0000394/*
395 * The REC attribute parameters are shared by the Host via
396 * MI_REC_CREATE::params_ptr. The values can be observed or modified
397 * either by the Host or by the Realm which owns the REC.
398 */
399struct rmi_rec_params {
400 /* Flags */
Soby Mathewc414f2a2023-01-17 02:50:17 +0000401 SET_MEMBER_RMI(unsigned long flags, 0, 0x100); /* Offset 0 */
Soby Mathewb4c6df42022-11-09 11:13:29 +0000402 /* MPIDR of the REC */
Soby Mathewc414f2a2023-01-17 02:50:17 +0000403 SET_MEMBER_RMI(unsigned long mpidr, 0x100, 0x200); /* 0x100 */
Soby Mathewb4c6df42022-11-09 11:13:29 +0000404 /* Program counter */
Soby Mathewc414f2a2023-01-17 02:50:17 +0000405 SET_MEMBER_RMI(unsigned long pc, 0x200, 0x300); /* 0x200 */
Soby Mathewb4c6df42022-11-09 11:13:29 +0000406 /* General-purpose registers */
Soby Mathewc414f2a2023-01-17 02:50:17 +0000407 SET_MEMBER_RMI(unsigned long gprs[REC_CREATE_NR_GPRS], 0x300, 0x800); /* 0x300 */
408 SET_MEMBER_RMI(struct {
Soby Mathewb4c6df42022-11-09 11:13:29 +0000409 /* Number of auxiliary Granules */
410 unsigned long num_aux; /* 0x800 */
411 /* Addresses of auxiliary Granules */
412 unsigned long aux[MAX_REC_AUX_GRANULES];/* 0x808 */
413 }, 0x800, 0x1000);
414};
415
Soby Mathewb4c6df42022-11-09 11:13:29 +0000416/*
417 * Structure contains data passed from the Host to the RMM on REC entry
418 */
419struct rmi_rec_entry {
420 /* Flags */
Soby Mathewc414f2a2023-01-17 02:50:17 +0000421 SET_MEMBER_RMI(unsigned long flags, 0, 0x200); /* Offset 0 */
Soby Mathewb4c6df42022-11-09 11:13:29 +0000422 /* General-purpose registers */
Soby Mathewc414f2a2023-01-17 02:50:17 +0000423 SET_MEMBER_RMI(unsigned long gprs[REC_EXIT_NR_GPRS], 0x200, 0x300); /* 0x200 */
424 SET_MEMBER_RMI(struct {
Soby Mathewb4c6df42022-11-09 11:13:29 +0000425 /* GICv3 Hypervisor Control Register */
426 unsigned long gicv3_hcr; /* 0x300 */
427 /* GICv3 List Registers */
428 unsigned long gicv3_lrs[REC_GIC_NUM_LRS]; /* 0x308 */
429 }, 0x300, 0x800);
430};
431
Soby Mathewb4c6df42022-11-09 11:13:29 +0000432/*
433 * Structure contains data passed from the RMM to the Host on REC exit
434 */
435struct rmi_rec_exit {
436 /* Exit reason */
Soby Mathewc414f2a2023-01-17 02:50:17 +0000437 SET_MEMBER_RMI(unsigned long exit_reason, 0, 0x100);/* Offset 0 */
438 SET_MEMBER_RMI(struct {
Soby Mathewb4c6df42022-11-09 11:13:29 +0000439 /* Exception Syndrome Register */
440 unsigned long esr; /* 0x100 */
441 /* Fault Address Register */
442 unsigned long far; /* 0x108 */
443 /* Hypervisor IPA Fault Address register */
444 unsigned long hpfar; /* 0x110 */
445 }, 0x100, 0x200);
446 /* General-purpose registers */
Soby Mathewc414f2a2023-01-17 02:50:17 +0000447 SET_MEMBER_RMI(unsigned long gprs[REC_EXIT_NR_GPRS], 0x200, 0x300); /* 0x200 */
448 SET_MEMBER_RMI(struct {
Soby Mathewb4c6df42022-11-09 11:13:29 +0000449 /* GICv3 Hypervisor Control Register */
450 unsigned long gicv3_hcr; /* 0x300 */
451 /* GICv3 List Registers */
452 unsigned long gicv3_lrs[REC_GIC_NUM_LRS]; /* 0x308 */
453 /* GICv3 Maintenance Interrupt State Register */
454 unsigned long gicv3_misr; /* 0x388 */
455 /* GICv3 Virtual Machine Control Register */
456 unsigned long gicv3_vmcr; /* 0x390 */
457 }, 0x300, 0x400);
Soby Mathewc414f2a2023-01-17 02:50:17 +0000458 SET_MEMBER_RMI(struct {
Soby Mathewb4c6df42022-11-09 11:13:29 +0000459 /* Counter-timer Physical Timer Control Register */
460 unsigned long cntp_ctl; /* 0x400 */
461 /* Counter-timer Physical Timer CompareValue Register */
462 unsigned long cntp_cval; /* 0x408 */
463 /* Counter-timer Virtual Timer Control Register */
464 unsigned long cntv_ctl; /* 0x410 */
465 /* Counter-timer Virtual Timer CompareValue Register */
466 unsigned long cntv_cval; /* 0x418 */
467 }, 0x400, 0x500);
Soby Mathewc414f2a2023-01-17 02:50:17 +0000468 SET_MEMBER_RMI(struct {
Soby Mathewb4c6df42022-11-09 11:13:29 +0000469 /* Base address of pending RIPAS change */
470 unsigned long ripas_base; /* 0x500 */
471 /* Size of pending RIPAS change */
AlexeiFedorovccce3ad2023-04-28 18:29:47 +0100472 unsigned long ripas_top; /* 0x508 */
Soby Mathewb4c6df42022-11-09 11:13:29 +0000473 /* RIPAS value of pending RIPAS change */
474 unsigned char ripas_value; /* 0x510 */
475 }, 0x500, 0x600);
476 /* Host call immediate value */
AlexeiFedoroveaec0c42023-02-01 18:13:32 +0000477 SET_MEMBER_RMI(unsigned int imm, 0x600, 0x700); /* 0x600 */
AlexeiFedorov4d4e7342023-06-12 12:10:06 +0100478 /* PMU overflow status */
479 SET_MEMBER_RMI(unsigned long pmu_ovf_status, 0x700, 0x800); /* 0x700 */
Soby Mathewb4c6df42022-11-09 11:13:29 +0000480};
481
Soby Mathewb4c6df42022-11-09 11:13:29 +0000482/*
483 * Structure contains shared information between RMM and Host
484 * during REC entry and REC exit.
485 */
486struct rmi_rec_run {
487 /* Entry information */
Soby Mathewc414f2a2023-01-17 02:50:17 +0000488 SET_MEMBER_RMI(struct rmi_rec_entry entry, 0, 0x800); /* Offset 0 */
Soby Mathewb4c6df42022-11-09 11:13:29 +0000489 /* Exit information */
AlexeiFedoroveaec0c42023-02-01 18:13:32 +0000490 SET_MEMBER_RMI(struct rmi_rec_exit exit, 0x800, 0x1000);/* 0x800 */
Soby Mathewb4c6df42022-11-09 11:13:29 +0000491};
492
Soby Mathewc9b6ecd2023-01-17 03:40:44 +0000493#endif /* __ASSEMBLER__ */
494
Soby Mathewb4c6df42022-11-09 11:13:29 +0000495#endif /* SMC_RMI_H */