~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/include/linux/arm-smccc.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-only */
  2 /*
  3  * Copyright (c) 2015, Linaro Limited
  4  */
  5 #ifndef __LINUX_ARM_SMCCC_H
  6 #define __LINUX_ARM_SMCCC_H
  7 
  8 #include <linux/const.h>
  9 
 10 /*
 11  * This file provides common defines for ARM SMC Calling Convention as
 12  * specified in
 13  * https://developer.arm.com/docs/den0028/latest
 14  *
 15  * This code is up-to-date with version DEN 0028 C
 16  */
 17 
 18 #define ARM_SMCCC_STD_CALL              _AC(0,U)
 19 #define ARM_SMCCC_FAST_CALL             _AC(1,U)
 20 #define ARM_SMCCC_TYPE_SHIFT            31
 21 
 22 #define ARM_SMCCC_SMC_32                0
 23 #define ARM_SMCCC_SMC_64                1
 24 #define ARM_SMCCC_CALL_CONV_SHIFT       30
 25 
 26 #define ARM_SMCCC_OWNER_MASK            0x3F
 27 #define ARM_SMCCC_OWNER_SHIFT           24
 28 
 29 #define ARM_SMCCC_FUNC_MASK             0xFFFF
 30 
 31 #define ARM_SMCCC_IS_FAST_CALL(smc_val) \
 32         ((smc_val) & (ARM_SMCCC_FAST_CALL << ARM_SMCCC_TYPE_SHIFT))
 33 #define ARM_SMCCC_IS_64(smc_val) \
 34         ((smc_val) & (ARM_SMCCC_SMC_64 << ARM_SMCCC_CALL_CONV_SHIFT))
 35 #define ARM_SMCCC_FUNC_NUM(smc_val)     ((smc_val) & ARM_SMCCC_FUNC_MASK)
 36 #define ARM_SMCCC_OWNER_NUM(smc_val) \
 37         (((smc_val) >> ARM_SMCCC_OWNER_SHIFT) & ARM_SMCCC_OWNER_MASK)
 38 
 39 #define ARM_SMCCC_CALL_VAL(type, calling_convention, owner, func_num) \
 40         (((type) << ARM_SMCCC_TYPE_SHIFT) | \
 41         ((calling_convention) << ARM_SMCCC_CALL_CONV_SHIFT) | \
 42         (((owner) & ARM_SMCCC_OWNER_MASK) << ARM_SMCCC_OWNER_SHIFT) | \
 43         ((func_num) & ARM_SMCCC_FUNC_MASK))
 44 
 45 #define ARM_SMCCC_OWNER_ARCH            0
 46 #define ARM_SMCCC_OWNER_CPU             1
 47 #define ARM_SMCCC_OWNER_SIP             2
 48 #define ARM_SMCCC_OWNER_OEM             3
 49 #define ARM_SMCCC_OWNER_STANDARD        4
 50 #define ARM_SMCCC_OWNER_STANDARD_HYP    5
 51 #define ARM_SMCCC_OWNER_VENDOR_HYP      6
 52 #define ARM_SMCCC_OWNER_TRUSTED_APP     48
 53 #define ARM_SMCCC_OWNER_TRUSTED_APP_END 49
 54 #define ARM_SMCCC_OWNER_TRUSTED_OS      50
 55 #define ARM_SMCCC_OWNER_TRUSTED_OS_END  63
 56 
 57 #define ARM_SMCCC_FUNC_QUERY_CALL_UID  0xff01
 58 
 59 #define ARM_SMCCC_QUIRK_NONE            0
 60 #define ARM_SMCCC_QUIRK_QCOM_A6         1 /* Save/restore register a6 */
 61 
 62 #define ARM_SMCCC_VERSION_1_0           0x10000
 63 #define ARM_SMCCC_VERSION_1_1           0x10001
 64 #define ARM_SMCCC_VERSION_1_2           0x10002
 65 #define ARM_SMCCC_VERSION_1_3           0x10003
 66 
 67 #define ARM_SMCCC_1_3_SVE_HINT          0x10000
 68 
 69 #define ARM_SMCCC_VERSION_FUNC_ID                                       \
 70         ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL,                         \
 71                            ARM_SMCCC_SMC_32,                            \
 72                            0, 0)
 73 
 74 #define ARM_SMCCC_ARCH_FEATURES_FUNC_ID                                 \
 75         ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL,                         \
 76                            ARM_SMCCC_SMC_32,                            \
 77                            0, 1)
 78 
 79 #define ARM_SMCCC_ARCH_SOC_ID                                           \
 80         ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL,                         \
 81                            ARM_SMCCC_SMC_32,                            \
 82                            0, 2)
 83 
 84 #define ARM_SMCCC_ARCH_WORKAROUND_1                                     \
 85         ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL,                         \
 86                            ARM_SMCCC_SMC_32,                            \
 87                            0, 0x8000)
 88 
 89 #define ARM_SMCCC_ARCH_WORKAROUND_2                                     \
 90         ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL,                         \
 91                            ARM_SMCCC_SMC_32,                            \
 92                            0, 0x7fff)
 93 
 94 #define ARM_SMCCC_ARCH_WORKAROUND_3                                     \
 95         ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL,                         \
 96                            ARM_SMCCC_SMC_32,                            \
 97                            0, 0x3fff)
 98 
 99 #define ARM_SMCCC_VENDOR_HYP_CALL_UID_FUNC_ID                           \
100         ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL,                         \
101                            ARM_SMCCC_SMC_32,                            \
102                            ARM_SMCCC_OWNER_VENDOR_HYP,                  \
103                            ARM_SMCCC_FUNC_QUERY_CALL_UID)
104 
105 /* KVM UID value: 28b46fb6-2ec5-11e9-a9ca-4b564d003a74 */
106 #define ARM_SMCCC_VENDOR_HYP_UID_KVM_REG_0      0xb66fb428U
107 #define ARM_SMCCC_VENDOR_HYP_UID_KVM_REG_1      0xe911c52eU
108 #define ARM_SMCCC_VENDOR_HYP_UID_KVM_REG_2      0x564bcaa9U
109 #define ARM_SMCCC_VENDOR_HYP_UID_KVM_REG_3      0x743a004dU
110 
111 /* KVM "vendor specific" services */
112 #define ARM_SMCCC_KVM_FUNC_FEATURES             0
113 #define ARM_SMCCC_KVM_FUNC_PTP                  1
114 #define ARM_SMCCC_KVM_FUNC_FEATURES_2           127
115 #define ARM_SMCCC_KVM_NUM_FUNCS                 128
116 
117 #define ARM_SMCCC_VENDOR_HYP_KVM_FEATURES_FUNC_ID                       \
118         ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL,                         \
119                            ARM_SMCCC_SMC_32,                            \
120                            ARM_SMCCC_OWNER_VENDOR_HYP,                  \
121                            ARM_SMCCC_KVM_FUNC_FEATURES)
122 
123 #define SMCCC_ARCH_WORKAROUND_RET_UNAFFECTED    1
124 
125 /*
126  * ptp_kvm is a feature used for time sync between vm and host.
127  * ptp_kvm module in guest kernel will get service from host using
128  * this hypercall ID.
129  */
130 #define ARM_SMCCC_VENDOR_HYP_KVM_PTP_FUNC_ID                            \
131         ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL,                         \
132                            ARM_SMCCC_SMC_32,                            \
133                            ARM_SMCCC_OWNER_VENDOR_HYP,                  \
134                            ARM_SMCCC_KVM_FUNC_PTP)
135 
136 /* ptp_kvm counter type ID */
137 #define KVM_PTP_VIRT_COUNTER                    0
138 #define KVM_PTP_PHYS_COUNTER                    1
139 
140 /* Paravirtualised time calls (defined by ARM DEN0057A) */
141 #define ARM_SMCCC_HV_PV_TIME_FEATURES                           \
142         ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL,                 \
143                            ARM_SMCCC_SMC_64,                    \
144                            ARM_SMCCC_OWNER_STANDARD_HYP,        \
145                            0x20)
146 
147 #define ARM_SMCCC_HV_PV_TIME_ST                                 \
148         ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL,                 \
149                            ARM_SMCCC_SMC_64,                    \
150                            ARM_SMCCC_OWNER_STANDARD_HYP,        \
151                            0x21)
152 
153 /* TRNG entropy source calls (defined by ARM DEN0098) */
154 #define ARM_SMCCC_TRNG_VERSION                                  \
155         ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL,                 \
156                            ARM_SMCCC_SMC_32,                    \
157                            ARM_SMCCC_OWNER_STANDARD,            \
158                            0x50)
159 
160 #define ARM_SMCCC_TRNG_FEATURES                                 \
161         ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL,                 \
162                            ARM_SMCCC_SMC_32,                    \
163                            ARM_SMCCC_OWNER_STANDARD,            \
164                            0x51)
165 
166 #define ARM_SMCCC_TRNG_GET_UUID                                 \
167         ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL,                 \
168                            ARM_SMCCC_SMC_32,                    \
169                            ARM_SMCCC_OWNER_STANDARD,            \
170                            0x52)
171 
172 #define ARM_SMCCC_TRNG_RND32                                    \
173         ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL,                 \
174                            ARM_SMCCC_SMC_32,                    \
175                            ARM_SMCCC_OWNER_STANDARD,            \
176                            0x53)
177 
178 #define ARM_SMCCC_TRNG_RND64                                    \
179         ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL,                 \
180                            ARM_SMCCC_SMC_64,                    \
181                            ARM_SMCCC_OWNER_STANDARD,            \
182                            0x53)
183 
184 /*
185  * Return codes defined in ARM DEN 0070A
186  * ARM DEN 0070A is now merged/consolidated into ARM DEN 0028 C
187  */
188 #define SMCCC_RET_SUCCESS                       0
189 #define SMCCC_RET_NOT_SUPPORTED                 -1
190 #define SMCCC_RET_NOT_REQUIRED                  -2
191 #define SMCCC_RET_INVALID_PARAMETER             -3
192 
193 #endif /*__LINUX_ARM_SMCCC_H*/
194 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php