1
- Linux KVM Hypercall:
1
+ .. SPDX-License-Identifier: GPL-2.0
2
+
3
+ ===================
4
+ Linux KVM Hypercall
2
5
===================
6
+
3
7
X86:
4
8
KVM Hypercalls have a three-byte sequence of either the vmcall or the vmmcall
5
9
instruction. The hypervisor can replace it with instructions that are
20
24
For further information on the S390 diagnose call as supported by KVM,
21
25
refer to Documentation/virt/kvm/s390-diag.txt.
22
26
23
- PowerPC:
27
+ PowerPC:
24
28
It uses R3-R10 and hypercall number in R11. R4-R11 are used as output registers.
25
29
Return value is placed in R3.
26
30
34
38
the return value is placed in $2 (v0).
35
39
36
40
KVM Hypercalls Documentation
37
- ===========================
41
+ ============================
42
+
38
43
The template for each hypercall is:
39
44
1. Hypercall name.
40
45
2. Architecture(s)
@@ -43,56 +48,64 @@ The template for each hypercall is:
43
48
44
49
1. KVM_HC_VAPIC_POLL_IRQ
45
50
------------------------
46
- Architecture: x86
47
- Status: active
48
- Purpose: Trigger guest exit so that the host can check for pending
49
- interrupts on reentry.
51
+
52
+ :Architecture: x86
53
+ :Status: active
54
+ :Purpose: Trigger guest exit so that the host can check for pending
55
+ interrupts on reentry.
50
56
51
57
2. KVM_HC_MMU_OP
52
- ------------------------
53
- Architecture: x86
54
- Status: deprecated.
55
- Purpose: Support MMU operations such as writing to PTE,
56
- flushing TLB, release PT.
58
+ ----------------
59
+
60
+ :Architecture: x86
61
+ :Status: deprecated.
62
+ :Purpose: Support MMU operations such as writing to PTE,
63
+ flushing TLB, release PT.
57
64
58
65
3. KVM_HC_FEATURES
59
- ------------------------
60
- Architecture: PPC
61
- Status: active
62
- Purpose: Expose hypercall availability to the guest. On x86 platforms, cpuid
63
- used to enumerate which hypercalls are available. On PPC, either device tree
64
- based lookup ( which is also what EPAPR dictates) OR KVM specific enumeration
65
- mechanism (which is this hypercall) can be used.
66
+ ------------------
67
+
68
+ :Architecture: PPC
69
+ :Status: active
70
+ :Purpose: Expose hypercall availability to the guest. On x86 platforms, cpuid
71
+ used to enumerate which hypercalls are available. On PPC, either
72
+ device tree based lookup ( which is also what EPAPR dictates)
73
+ OR KVM specific enumeration mechanism (which is this hypercall)
74
+ can be used.
66
75
67
76
4. KVM_HC_PPC_MAP_MAGIC_PAGE
68
- ------------------------
69
- Architecture: PPC
70
- Status: active
71
- Purpose: To enable communication between the hypervisor and guest there is a
72
- shared page that contains parts of supervisor visible register state.
73
- The guest can map this shared page to access its supervisor register through
74
- memory using this hypercall.
77
+ ----------------------------
78
+
79
+ :Architecture: PPC
80
+ :Status: active
81
+ :Purpose: To enable communication between the hypervisor and guest there is a
82
+ shared page that contains parts of supervisor visible register state.
83
+ The guest can map this shared page to access its supervisor register
84
+ through memory using this hypercall.
75
85
76
86
5. KVM_HC_KICK_CPU
77
- ------------------------
78
- Architecture: x86
79
- Status: active
80
- Purpose: Hypercall used to wakeup a vcpu from HLT state
81
- Usage example : A vcpu of a paravirtualized guest that is busywaiting in guest
82
- kernel mode for an event to occur (ex: a spinlock to become available) can
83
- execute HLT instruction once it has busy-waited for more than a threshold
84
- time-interval. Execution of HLT instruction would cause the hypervisor to put
85
- the vcpu to sleep until occurrence of an appropriate event. Another vcpu of the
86
- same guest can wakeup the sleeping vcpu by issuing KVM_HC_KICK_CPU hypercall,
87
- specifying APIC ID (a1) of the vcpu to be woken up. An additional argument (a0)
88
- is used in the hypercall for future use.
87
+ ------------------
88
+
89
+ :Architecture: x86
90
+ :Status: active
91
+ :Purpose: Hypercall used to wakeup a vcpu from HLT state
92
+ :Usage example:
93
+ A vcpu of a paravirtualized guest that is busywaiting in guest
94
+ kernel mode for an event to occur (ex: a spinlock to become available) can
95
+ execute HLT instruction once it has busy-waited for more than a threshold
96
+ time-interval. Execution of HLT instruction would cause the hypervisor to put
97
+ the vcpu to sleep until occurrence of an appropriate event. Another vcpu of the
98
+ same guest can wakeup the sleeping vcpu by issuing KVM_HC_KICK_CPU hypercall,
99
+ specifying APIC ID (a1) of the vcpu to be woken up. An additional argument (a0)
100
+ is used in the hypercall for future use.
89
101
90
102
91
103
6. KVM_HC_CLOCK_PAIRING
92
- ------------------------
93
- Architecture: x86
94
- Status: active
95
- Purpose: Hypercall used to synchronize host and guest clocks.
104
+ -----------------------
105
+ :Architecture: x86
106
+ :Status: active
107
+ :Purpose: Hypercall used to synchronize host and guest clocks.
108
+
96
109
Usage:
97
110
98
111
a0: guest physical address where host copies
@@ -101,6 +114,8 @@ a0: guest physical address where host copies
101
114
a1: clock_type, ATM only KVM_CLOCK_PAIRING_WALLCLOCK (0)
102
115
is supported (corresponding to the host's CLOCK_REALTIME clock).
103
116
117
+ ::
118
+
104
119
struct kvm_clock_pairing {
105
120
__s64 sec;
106
121
__s64 nsec;
@@ -123,15 +138,16 @@ Returns KVM_EOPNOTSUPP if the host does not use TSC clocksource,
123
138
or if clock type is different than KVM_CLOCK_PAIRING_WALLCLOCK.
124
139
125
140
6. KVM_HC_SEND_IPI
126
- ------------------------
127
- Architecture: x86
128
- Status: active
129
- Purpose: Send IPIs to multiple vCPUs.
141
+ ------------------
142
+
143
+ :Architecture: x86
144
+ :Status: active
145
+ :Purpose: Send IPIs to multiple vCPUs.
130
146
131
- a0: lower part of the bitmap of destination APIC IDs
132
- a1: higher part of the bitmap of destination APIC IDs
133
- a2: the lowest APIC ID in bitmap
134
- a3: APIC ICR
147
+ - a0: lower part of the bitmap of destination APIC IDs
148
+ - a1: higher part of the bitmap of destination APIC IDs
149
+ - a2: the lowest APIC ID in bitmap
150
+ - a3: APIC ICR
135
151
136
152
The hypercall lets a guest send multicast IPIs, with at most 128
137
153
128 destinations per hypercall in 64-bit mode and 64 vCPUs per
@@ -143,12 +159,13 @@ corresponds to the APIC ID a2+1, and so on.
143
159
Returns the number of CPUs to which the IPIs were delivered successfully.
144
160
145
161
7. KVM_HC_SCHED_YIELD
146
- ------------------------
147
- Architecture: x86
148
- Status: active
149
- Purpose: Hypercall used to yield if the IPI target vCPU is preempted
162
+ ---------------------
163
+
164
+ :Architecture: x86
165
+ :Status: active
166
+ :Purpose: Hypercall used to yield if the IPI target vCPU is preempted
150
167
151
168
a0: destination APIC ID
152
169
153
- Usage example: When sending a call-function IPI-many to vCPUs, yield if
154
- any of the IPI target vCPUs was preempted.
170
+ : Usage example: When sending a call-function IPI-many to vCPUs, yield if
171
+ any of the IPI target vCPUs was preempted.
0 commit comments