Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / arch / arm64 / include / asm / rsi_smc.h
blob6cb070eca9e9b2b7650832c96aab3795a558058e
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * Copyright (C) 2023 ARM Ltd.
4 */
6 #ifndef __ASM_RSI_SMC_H_
7 #define __ASM_RSI_SMC_H_
9 #include <linux/arm-smccc.h>
12 * This file describes the Realm Services Interface (RSI) Application Binary
13 * Interface (ABI) for SMC calls made from within the Realm to the RMM and
14 * serviced by the RMM.
18 * The major version number of the RSI implementation. This is increased when
19 * the binary format or semantics of the SMC calls change.
21 #define RSI_ABI_VERSION_MAJOR UL(1)
24 * The minor version number of the RSI implementation. This is increased when
25 * a bug is fixed, or a feature is added without breaking binary compatibility.
27 #define RSI_ABI_VERSION_MINOR UL(0)
29 #define RSI_ABI_VERSION ((RSI_ABI_VERSION_MAJOR << 16) | \
30 RSI_ABI_VERSION_MINOR)
32 #define RSI_ABI_VERSION_GET_MAJOR(_version) ((_version) >> 16)
33 #define RSI_ABI_VERSION_GET_MINOR(_version) ((_version) & 0xFFFF)
35 #define RSI_SUCCESS UL(0)
36 #define RSI_ERROR_INPUT UL(1)
37 #define RSI_ERROR_STATE UL(2)
38 #define RSI_INCOMPLETE UL(3)
39 #define RSI_ERROR_UNKNOWN UL(4)
41 #define SMC_RSI_FID(n) ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, \
42 ARM_SMCCC_SMC_64, \
43 ARM_SMCCC_OWNER_STANDARD, \
47 * Returns RSI version.
49 * arg1 == Requested interface revision
50 * ret0 == Status / error
51 * ret1 == Lower implemented interface revision
52 * ret2 == Higher implemented interface revision
54 #define SMC_RSI_ABI_VERSION SMC_RSI_FID(0x190)
57 * Read feature register.
59 * arg1 == Feature register index
60 * ret0 == Status / error
61 * ret1 == Feature register value
63 #define SMC_RSI_FEATURES SMC_RSI_FID(0x191)
66 * Read measurement for the current Realm.
68 * arg1 == Index, which measurements slot to read
69 * ret0 == Status / error
70 * ret1 == Measurement value, bytes: 0 - 7
71 * ret2 == Measurement value, bytes: 8 - 15
72 * ret3 == Measurement value, bytes: 16 - 23
73 * ret4 == Measurement value, bytes: 24 - 31
74 * ret5 == Measurement value, bytes: 32 - 39
75 * ret6 == Measurement value, bytes: 40 - 47
76 * ret7 == Measurement value, bytes: 48 - 55
77 * ret8 == Measurement value, bytes: 56 - 63
79 #define SMC_RSI_MEASUREMENT_READ SMC_RSI_FID(0x192)
82 * Extend Realm Extensible Measurement (REM) value.
84 * arg1 == Index, which measurements slot to extend
85 * arg2 == Size of realm measurement in bytes, max 64 bytes
86 * arg3 == Measurement value, bytes: 0 - 7
87 * arg4 == Measurement value, bytes: 8 - 15
88 * arg5 == Measurement value, bytes: 16 - 23
89 * arg6 == Measurement value, bytes: 24 - 31
90 * arg7 == Measurement value, bytes: 32 - 39
91 * arg8 == Measurement value, bytes: 40 - 47
92 * arg9 == Measurement value, bytes: 48 - 55
93 * arg10 == Measurement value, bytes: 56 - 63
94 * ret0 == Status / error
96 #define SMC_RSI_MEASUREMENT_EXTEND SMC_RSI_FID(0x193)
99 * Initialize the operation to retrieve an attestation token.
101 * arg1 == Challenge value, bytes: 0 - 7
102 * arg2 == Challenge value, bytes: 8 - 15
103 * arg3 == Challenge value, bytes: 16 - 23
104 * arg4 == Challenge value, bytes: 24 - 31
105 * arg5 == Challenge value, bytes: 32 - 39
106 * arg6 == Challenge value, bytes: 40 - 47
107 * arg7 == Challenge value, bytes: 48 - 55
108 * arg8 == Challenge value, bytes: 56 - 63
109 * ret0 == Status / error
110 * ret1 == Upper bound of token size in bytes
112 #define SMC_RSI_ATTESTATION_TOKEN_INIT SMC_RSI_FID(0x194)
115 * Continue the operation to retrieve an attestation token.
117 * arg1 == The IPA of token buffer
118 * arg2 == Offset within the granule of the token buffer
119 * arg3 == Size of the granule buffer
120 * ret0 == Status / error
121 * ret1 == Length of token bytes copied to the granule buffer
123 #define SMC_RSI_ATTESTATION_TOKEN_CONTINUE SMC_RSI_FID(0x195)
125 #ifndef __ASSEMBLY__
127 struct realm_config {
128 union {
129 struct {
130 unsigned long ipa_bits; /* Width of IPA in bits */
131 unsigned long hash_algo; /* Hash algorithm */
133 u8 pad[0x200];
135 union {
136 u8 rpv[64]; /* Realm Personalization Value */
137 u8 pad2[0xe00];
140 * The RMM requires the configuration structure to be aligned to a 4k
141 * boundary, ensure this happens by aligning this structure.
143 } __aligned(0x1000);
145 #endif /* __ASSEMBLY__ */
148 * Read configuration for the current Realm.
150 * arg1 == struct realm_config addr
151 * ret0 == Status / error
153 #define SMC_RSI_REALM_CONFIG SMC_RSI_FID(0x196)
156 * Request RIPAS of a target IPA range to be changed to a specified value.
158 * arg1 == Base IPA address of target region
159 * arg2 == Top of the region
160 * arg3 == RIPAS value
161 * arg4 == flags
162 * ret0 == Status / error
163 * ret1 == Top of modified IPA range
164 * ret2 == Whether the Host accepted or rejected the request
166 #define SMC_RSI_IPA_STATE_SET SMC_RSI_FID(0x197)
168 #define RSI_NO_CHANGE_DESTROYED UL(0)
169 #define RSI_CHANGE_DESTROYED UL(1)
171 #define RSI_ACCEPT UL(0)
172 #define RSI_REJECT UL(1)
175 * Get RIPAS of a target IPA range.
177 * arg1 == Base IPA of target region
178 * arg2 == End of target IPA region
179 * ret0 == Status / error
180 * ret1 == Top of IPA region which has the reported RIPAS value
181 * ret2 == RIPAS value
183 #define SMC_RSI_IPA_STATE_GET SMC_RSI_FID(0x198)
186 * Make a Host call.
188 * arg1 == IPA of host call structure
189 * ret0 == Status / error
191 #define SMC_RSI_HOST_CALL SMC_RSI_FID(0x199)
193 #endif /* __ASM_RSI_SMC_H_ */