| 1 |
.. SPDX-License-Identifier: GPL-2.0 |
| 2 |
|
| 3 |
=============================================== |
| 4 |
KVM/arm64-specific hypercalls exposed to guests |
| 5 |
=============================================== |
| 6 |
|
| 7 |
This file documents the KVM/arm64-specific hypercalls which may be |
| 8 |
exposed by KVM/arm64 to guest operating systems. These hypercalls are |
| 9 |
issued using the HVC instruction according to version 1.1 of the Arm SMC |
| 10 |
Calling Convention (DEN0028/C): |
| 11 |
|
| 12 |
https://developer.arm.com/docs/den0028/c |
| 13 |
|
| 14 |
All KVM/arm64-specific hypercalls are allocated within the "Vendor |
| 15 |
Specific Hypervisor Service Call" range with a UID of |
| 16 |
``28b46fb6-2ec5-11e9-a9ca-4b564d003a74``. This UID should be queried by the |
| 17 |
guest using the standard "Call UID" function for the service range in |
| 18 |
order to determine that the KVM/arm64-specific hypercalls are available. |
| 19 |
|
| 20 |
``ARM_SMCCC_VENDOR_HYP_KVM_FEATURES_FUNC_ID`` |
| 21 |
--------------------------------------------- |
| 22 |
|
| 23 |
Provides a discovery mechanism for other KVM/arm64 hypercalls. |
| 24 |
|
| 25 |
+---------------------+-------------------------------------------------------------+ |
| 26 |
| Presence: | Mandatory for the KVM/arm64 UID | |
| 27 |
+---------------------+-------------------------------------------------------------+ |
| 28 |
| Calling convention: | HVC32 | |
| 29 |
+---------------------+----------+--------------------------------------------------+ |
| 30 |
| Function ID: | (uint32) | 0x86000000 | |
| 31 |
+---------------------+----------+--------------------------------------------------+ |
| 32 |
| Arguments: | None | |
| 33 |
+---------------------+----------+----+---------------------------------------------+ |
| 34 |
| Return Values: | (uint32) | R0 | Bitmap of available function numbers 0-31 | |
| 35 |
| +----------+----+---------------------------------------------+ |
| 36 |
| | (uint32) | R1 | Bitmap of available function numbers 32-63 | |
| 37 |
| +----------+----+---------------------------------------------+ |
| 38 |
| | (uint32) | R2 | Bitmap of available function numbers 64-95 | |
| 39 |
| +----------+----+---------------------------------------------+ |
| 40 |
| | (uint32) | R3 | Bitmap of available function numbers 96-127 | |
| 41 |
+---------------------+----------+----+---------------------------------------------+ |
| 42 |
|
| 43 |
``ARM_SMCCC_VENDOR_HYP_KVM_PTP_FUNC_ID`` |
| 44 |
---------------------------------------- |
| 45 |
|
| 46 |
See ptp_kvm.rst |
| 47 |
|
| 48 |
``ARM_SMCCC_KVM_FUNC_HYP_MEMINFO`` |
| 49 |
---------------------------------- |
| 50 |
|
| 51 |
Query the memory protection parameters for a pKVM protected virtual machine. |
| 52 |
|
| 53 |
+---------------------+-------------------------------------------------------------+ |
| 54 |
| Presence: | Optional; pKVM protected guests only. | |
| 55 |
+---------------------+-------------------------------------------------------------+ |
| 56 |
| Calling convention: | HVC64 | |
| 57 |
+---------------------+----------+--------------------------------------------------+ |
| 58 |
| Function ID: | (uint32) | 0xC6000002 | |
| 59 |
+---------------------+----------+----+---------------------------------------------+ |
| 60 |
| Arguments: | (uint64) | R1 | Reserved / Must be zero | |
| 61 |
| +----------+----+---------------------------------------------+ |
| 62 |
| | (uint64) | R2 | Reserved / Must be zero | |
| 63 |
| +----------+----+---------------------------------------------+ |
| 64 |
| | (uint64) | R3 | Reserved / Must be zero | |
| 65 |
+---------------------+----------+----+---------------------------------------------+ |
| 66 |
| Return Values: | (int64) | R0 | ``INVALID_PARAMETER (-3)`` on error, else | |
| 67 |
| | | | memory protection granule in bytes | |
| 68 |
+---------------------+----------+----+---------------------------------------------+ |
| 69 |
|
| 70 |
``ARM_SMCCC_KVM_FUNC_MEM_SHARE`` |
| 71 |
-------------------------------- |
| 72 |
|
| 73 |
Share a region of memory with the KVM host, granting it read, write and execute |
| 74 |
permissions. The size of the region is equal to the memory protection granule |
| 75 |
advertised by ``ARM_SMCCC_KVM_FUNC_HYP_MEMINFO``. |
| 76 |
|
| 77 |
+---------------------+-------------------------------------------------------------+ |
| 78 |
| Presence: | Optional; pKVM protected guests only. | |
| 79 |
+---------------------+-------------------------------------------------------------+ |
| 80 |
| Calling convention: | HVC64 | |
| 81 |
+---------------------+----------+--------------------------------------------------+ |
| 82 |
| Function ID: | (uint32) | 0xC6000003 | |
| 83 |
+---------------------+----------+----+---------------------------------------------+ |
| 84 |
| Arguments: | (uint64) | R1 | Base IPA of memory region to share | |
| 85 |
| +----------+----+---------------------------------------------+ |
| 86 |
| | (uint64) | R2 | Reserved / Must be zero | |
| 87 |
| +----------+----+---------------------------------------------+ |
| 88 |
| | (uint64) | R3 | Reserved / Must be zero | |
| 89 |
+---------------------+----------+----+---------------------------------------------+ |
| 90 |
| Return Values: | (int64) | R0 | ``SUCCESS (0)`` | |
| 91 |
| | | +---------------------------------------------+ |
| 92 |
| | | | ``INVALID_PARAMETER (-3)`` | |
| 93 |
+---------------------+----------+----+---------------------------------------------+ |
| 94 |
|
| 95 |
``ARM_SMCCC_KVM_FUNC_MEM_UNSHARE`` |
| 96 |
---------------------------------- |
| 97 |
|
| 98 |
Revoke access permission from the KVM host to a memory region previously shared |
| 99 |
with ``ARM_SMCCC_KVM_FUNC_MEM_SHARE``. The size of the region is equal to the |
| 100 |
memory protection granule advertised by ``ARM_SMCCC_KVM_FUNC_HYP_MEMINFO``. |
| 101 |
|
| 102 |
+---------------------+-------------------------------------------------------------+ |
| 103 |
| Presence: | Optional; pKVM protected guests only. | |
| 104 |
+---------------------+-------------------------------------------------------------+ |
| 105 |
| Calling convention: | HVC64 | |
| 106 |
+---------------------+----------+--------------------------------------------------+ |
| 107 |
| Function ID: | (uint32) | 0xC6000004 | |
| 108 |
+---------------------+----------+----+---------------------------------------------+ |
| 109 |
| Arguments: | (uint64) | R1 | Base IPA of memory region to unshare | |
| 110 |
| +----------+----+---------------------------------------------+ |
| 111 |
| | (uint64) | R2 | Reserved / Must be zero | |
| 112 |
| +----------+----+---------------------------------------------+ |
| 113 |
| | (uint64) | R3 | Reserved / Must be zero | |
| 114 |
+---------------------+----------+----+---------------------------------------------+ |
| 115 |
| Return Values: | (int64) | R0 | ``SUCCESS (0)`` | |
| 116 |
| | | +---------------------------------------------+ |
| 117 |
| | | | ``INVALID_PARAMETER (-3)`` | |
| 118 |
+---------------------+----------+----+---------------------------------------------+ |
| 119 |
|
| 120 |
``ARM_SMCCC_KVM_FUNC_MMIO_GUARD`` |
| 121 |
---------------------------------- |
| 122 |
|
| 123 |
Request that a given memory region is handled as MMIO by the hypervisor, |
| 124 |
allowing accesses to this region to be emulated by the KVM host. The size of the |
| 125 |
region is equal to the memory protection granule advertised by |
| 126 |
``ARM_SMCCC_KVM_FUNC_HYP_MEMINFO``. |
| 127 |
|
| 128 |
+---------------------+-------------------------------------------------------------+ |
| 129 |
| Presence: | Optional; pKVM protected guests only. | |
| 130 |
+---------------------+-------------------------------------------------------------+ |
| 131 |
| Calling convention: | HVC64 | |
| 132 |
+---------------------+----------+--------------------------------------------------+ |
| 133 |
| Function ID: | (uint32) | 0xC6000007 | |
| 134 |
+---------------------+----------+----+---------------------------------------------+ |
| 135 |
| Arguments: | (uint64) | R1 | Base IPA of MMIO memory region | |
| 136 |
| +----------+----+---------------------------------------------+ |
| 137 |
| | (uint64) | R2 | Reserved / Must be zero | |
| 138 |
| +----------+----+---------------------------------------------+ |
| 139 |
| | (uint64) | R3 | Reserved / Must be zero | |
| 140 |
+---------------------+----------+----+---------------------------------------------+ |
| 141 |
| Return Values: | (int64) | R0 | ``SUCCESS (0)`` | |
| 142 |
| | | +---------------------------------------------+ |
| 143 |
| | | | ``INVALID_PARAMETER (-3)`` | |
| 144 |
+---------------------+----------+----+---------------------------------------------+ |
| 145 |
|
| 146 |
``ARM_SMCCC_VENDOR_HYP_KVM_DISCOVER_IMPL_VER_FUNC_ID`` |
| 147 |
------------------------------------------------------- |
| 148 |
Request the target CPU implementation version information and the number of target |
| 149 |
implementations for the Guest VM. |
| 150 |
|
| 151 |
+---------------------+-------------------------------------------------------------+ |
| 152 |
| Presence: | Optional; KVM/ARM64 Guests only | |
| 153 |
+---------------------+-------------------------------------------------------------+ |
| 154 |
| Calling convention: | HVC64 | |
| 155 |
+---------------------+----------+--------------------------------------------------+ |
| 156 |
| Function ID: | (uint32) | 0xC6000040 | |
| 157 |
+---------------------+----------+--------------------------------------------------+ |
| 158 |
| Arguments: | None | |
| 159 |
+---------------------+----------+----+---------------------------------------------+ |
| 160 |
| Return Values: | (int64) | R0 | ``SUCCESS (0)`` | |
| 161 |
| | | +---------------------------------------------+ |
| 162 |
| | | | ``NOT_SUPPORTED (-1)`` | |
| 163 |
| +----------+----+---------------------------------------------+ |
| 164 |
| | (uint64) | R1 | Bits [63:32] Reserved/Must be zero | |
| 165 |
| | | +---------------------------------------------+ |
| 166 |
| | | | Bits [31:16] Major version | |
| 167 |
| | | +---------------------------------------------+ |
| 168 |
| | | | Bits [15:0] Minor version | |
| 169 |
| +----------+----+---------------------------------------------+ |
| 170 |
| | (uint64) | R2 | Number of target implementations | |
| 171 |
| +----------+----+---------------------------------------------+ |
| 172 |
| | (uint64) | R3 | Reserved / Must be zero | |
| 173 |
+---------------------+----------+----+---------------------------------------------+ |
| 174 |
|
| 175 |
``ARM_SMCCC_VENDOR_HYP_KVM_DISCOVER_IMPL_CPUS_FUNC_ID`` |
| 176 |
------------------------------------------------------- |
| 177 |
|
| 178 |
Request the target CPU implementation information for the Guest VM. The Guest kernel |
| 179 |
will use this information to enable the associated errata. |
| 180 |
|
| 181 |
+---------------------+-------------------------------------------------------------+ |
| 182 |
| Presence: | Optional; KVM/ARM64 Guests only | |
| 183 |
+---------------------+-------------------------------------------------------------+ |
| 184 |
| Calling convention: | HVC64 | |
| 185 |
+---------------------+----------+--------------------------------------------------+ |
| 186 |
| Function ID: | (uint32) | 0xC6000041 | |
| 187 |
+---------------------+----------+----+---------------------------------------------+ |
| 188 |
| Arguments: | (uint64) | R1 | selected implementation index | |
| 189 |
| +----------+----+---------------------------------------------+ |
| 190 |
| | (uint64) | R2 | Reserved / Must be zero | |
| 191 |
| +----------+----+---------------------------------------------+ |
| 192 |
| | (uint64) | R3 | Reserved / Must be zero | |
| 193 |
+---------------------+----------+----+---------------------------------------------+ |
| 194 |
| Return Values: | (int64) | R0 | ``SUCCESS (0)`` | |
| 195 |
| | | +---------------------------------------------+ |
| 196 |
| | | | ``INVALID_PARAMETER (-3)`` | |
| 197 |
| +----------+----+---------------------------------------------+ |
| 198 |
| | (uint64) | R1 | MIDR_EL1 of the selected implementation | |
| 199 |
| +----------+----+---------------------------------------------+ |
| 200 |
| | (uint64) | R2 | REVIDR_EL1 of the selected implementation | |
| 201 |
| +----------+----+---------------------------------------------+ |
| 202 |
| | (uint64) | R3 | AIDR_EL1 of the selected implementation | |
| 203 |
+---------------------+----------+----+---------------------------------------------+ |