File Index
Files and directories
Sign in
FILE

rsi_smc.h

File preview with syntax highlighting.

linux-6.19.14/arch/arm64/include/asm/rsi_smc.h C
  1/* SPDX-License-Identifier: GPL-2.0-only */
  2/*
  3 * Copyright (C) 2023 ARM Ltd.
  4 */
  5
  6#ifndef __ASM_RSI_SMC_H_
  7#define __ASM_RSI_SMC_H_
  8
  9#include <linux/arm-smccc.h>
 10
 11/*
 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.
 15 */
 16
 17/*
 18 * The major version number of the RSI implementation.  This is increased when
 19 * the binary format or semantics of the SMC calls change.
 20 */
 21#define RSI_ABI_VERSION_MAJOR		UL(1)
 22
 23/*
 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.
 26 */
 27#define RSI_ABI_VERSION_MINOR		UL(0)
 28
 29#define RSI_ABI_VERSION			((RSI_ABI_VERSION_MAJOR << 16) | \
 30					 RSI_ABI_VERSION_MINOR)
 31
 32#define RSI_ABI_VERSION_GET_MAJOR(_version) ((_version) >> 16)
 33#define RSI_ABI_VERSION_GET_MINOR(_version) ((_version) & 0xFFFF)
 34
 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)
 40
 41#define SMC_RSI_FID(n)		ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL,      \
 42						   ARM_SMCCC_SMC_64,         \
 43						   ARM_SMCCC_OWNER_STANDARD, \
 44						   n)
 45
 46/*
 47 * Returns RSI version.
 48 *
 49 * arg1 == Requested interface revision
 50 * ret0 == Status / error
 51 * ret1 == Lower implemented interface revision
 52 * ret2 == Higher implemented interface revision
 53 */
 54#define SMC_RSI_ABI_VERSION	SMC_RSI_FID(0x190)
 55
 56/*
 57 * Read feature register.
 58 *
 59 * arg1 == Feature register index
 60 * ret0 == Status / error
 61 * ret1 == Feature register value
 62 */
 63#define SMC_RSI_FEATURES			SMC_RSI_FID(0x191)
 64
 65/*
 66 * Read measurement for the current Realm.
 67 *
 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
 78 */
 79#define SMC_RSI_MEASUREMENT_READ		SMC_RSI_FID(0x192)
 80
 81/*
 82 * Extend Realm Extensible Measurement (REM) value.
 83 *
 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
 95 */
 96#define SMC_RSI_MEASUREMENT_EXTEND		SMC_RSI_FID(0x193)
 97
 98/*
 99 * Initialize the operation to retrieve an attestation token.
100 *
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
111 */
112#define SMC_RSI_ATTESTATION_TOKEN_INIT		SMC_RSI_FID(0x194)
113
114/*
115 * Continue the operation to retrieve an attestation token.
116 *
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
122 */
123#define SMC_RSI_ATTESTATION_TOKEN_CONTINUE	SMC_RSI_FID(0x195)
124
125#ifndef __ASSEMBLER__
126
127struct realm_config {
128	union {
129		struct {
130			unsigned long ipa_bits; /* Width of IPA in bits */
131			unsigned long hash_algo; /* Hash algorithm */
132		};
133		u8 pad[0x200];
134	};
135	union {
136		u8 rpv[64]; /* Realm Personalization Value */
137		u8 pad2[0xe00];
138	};
139	/*
140	 * The RMM requires the configuration structure to be aligned to a 4k
141	 * boundary, ensure this happens by aligning this structure.
142	 */
143} __aligned(0x1000);
144
145#endif /* __ASSEMBLER__ */
146
147/*
148 * Read configuration for the current Realm.
149 *
150 * arg1 == struct realm_config addr
151 * ret0 == Status / error
152 */
153#define SMC_RSI_REALM_CONFIG			SMC_RSI_FID(0x196)
154
155/*
156 * Request RIPAS of a target IPA range to be changed to a specified value.
157 *
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
165 */
166#define SMC_RSI_IPA_STATE_SET			SMC_RSI_FID(0x197)
167
168#define RSI_NO_CHANGE_DESTROYED			UL(0)
169#define RSI_CHANGE_DESTROYED			UL(1)
170
171#define RSI_ACCEPT				UL(0)
172#define RSI_REJECT				UL(1)
173
174/*
175 * Get RIPAS of a target IPA range.
176 *
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
182 */
183#define SMC_RSI_IPA_STATE_GET			SMC_RSI_FID(0x198)
184
185/*
186 * Make a Host call.
187 *
188 * arg1 == IPA of host call structure
189 * ret0 == Status / error
190 */
191#define SMC_RSI_HOST_CALL			SMC_RSI_FID(0x199)
192
193#endif /* __ASM_RSI_SMC_H_ */
~/ Read-only file preview.