Skip to content

Commit 57e5cc9

Browse files
shamiali2008oupton
authored andcommitted
KVM: arm64: Specify hypercall ABI for retrieving target implementations
If the Guest requires migration to multiple targets, these hypercalls will provide a way to retrieve the target CPU implementations from the user space VMM. Subsequent patch will use this to enable the associated errata. Suggested-by: Oliver Upton <[email protected]> Suggested-by: Marc Zyngier <[email protected]> Reviewed-by: Cornelia Huck <[email protected]> Reviewed-by: Sebastian Ott <[email protected]> Signed-off-by: Shameer Kolothum <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Oliver Upton <[email protected]>
1 parent e312129 commit 57e5cc9

File tree

2 files changed

+74
-0
lines changed

2 files changed

+74
-0
lines changed

Documentation/virt/kvm/arm/hypercalls.rst

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,3 +142,62 @@ region is equal to the memory protection granule advertised by
142142
| | | +---------------------------------------------+
143143
| | | | ``INVALID_PARAMETER (-3)`` |
144144
+---------------------+----------+----+---------------------------------------------+
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+
+---------------------+----------+----+---------------------------------------------+

include/linux/arm-smccc.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,9 @@
179179
#define ARM_SMCCC_KVM_FUNC_PKVM_RESV_62 62
180180
#define ARM_SMCCC_KVM_FUNC_PKVM_RESV_63 63
181181
/* End of pKVM hypercall range */
182+
#define ARM_SMCCC_KVM_FUNC_DISCOVER_IMPL_VER 64
183+
#define ARM_SMCCC_KVM_FUNC_DISCOVER_IMPL_CPUS 65
184+
182185
#define ARM_SMCCC_KVM_FUNC_FEATURES_2 127
183186
#define ARM_SMCCC_KVM_NUM_FUNCS 128
184187

@@ -225,6 +228,18 @@
225228
ARM_SMCCC_OWNER_VENDOR_HYP, \
226229
ARM_SMCCC_KVM_FUNC_MMIO_GUARD)
227230

231+
#define ARM_SMCCC_VENDOR_HYP_KVM_DISCOVER_IMPL_VER_FUNC_ID \
232+
ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, \
233+
ARM_SMCCC_SMC_64, \
234+
ARM_SMCCC_OWNER_VENDOR_HYP, \
235+
ARM_SMCCC_KVM_FUNC_DISCOVER_IMPL_VER)
236+
237+
#define ARM_SMCCC_VENDOR_HYP_KVM_DISCOVER_IMPL_CPUS_FUNC_ID \
238+
ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, \
239+
ARM_SMCCC_SMC_64, \
240+
ARM_SMCCC_OWNER_VENDOR_HYP, \
241+
ARM_SMCCC_KVM_FUNC_DISCOVER_IMPL_CPUS)
242+
228243
/* ptp_kvm counter type ID */
229244
#define KVM_PTP_VIRT_COUNTER 0
230245
#define KVM_PTP_PHYS_COUNTER 1

0 commit comments

Comments
 (0)