Skip to content

Commit 5a0af48

Browse files
mchehabbonzini
authored andcommitted
docs: kvm: Convert hypercalls.txt to ReST format
- Use document title and chapter markups; - Convert tables; - Add markups for literal blocks; - use :field: for field descriptions; - Add blank lines and adjust indentation Signed-off-by: Mauro Carvalho Chehab <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent cec0e48 commit 5a0af48

File tree

2 files changed

+75
-56
lines changed

2 files changed

+75
-56
lines changed
Lines changed: 73 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1-
Linux KVM Hypercall:
1+
.. SPDX-License-Identifier: GPL-2.0
2+
3+
===================
4+
Linux KVM Hypercall
25
===================
6+
37
X86:
48
KVM Hypercalls have a three-byte sequence of either the vmcall or the vmmcall
59
instruction. The hypervisor can replace it with instructions that are
@@ -20,7 +24,7 @@ S390:
2024
For further information on the S390 diagnose call as supported by KVM,
2125
refer to Documentation/virt/kvm/s390-diag.txt.
2226

23-
PowerPC:
27+
PowerPC:
2428
It uses R3-R10 and hypercall number in R11. R4-R11 are used as output registers.
2529
Return value is placed in R3.
2630

@@ -34,7 +38,8 @@ MIPS:
3438
the return value is placed in $2 (v0).
3539

3640
KVM Hypercalls Documentation
37-
===========================
41+
============================
42+
3843
The template for each hypercall is:
3944
1. Hypercall name.
4045
2. Architecture(s)
@@ -43,56 +48,64 @@ The template for each hypercall is:
4348

4449
1. KVM_HC_VAPIC_POLL_IRQ
4550
------------------------
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.
5056

5157
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.
5764

5865
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.
6675

6776
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.
7585

7686
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.
89101

90102

91103
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+
96109
Usage:
97110

98111
a0: guest physical address where host copies
@@ -101,6 +114,8 @@ a0: guest physical address where host copies
101114
a1: clock_type, ATM only KVM_CLOCK_PAIRING_WALLCLOCK (0)
102115
is supported (corresponding to the host's CLOCK_REALTIME clock).
103116

117+
::
118+
104119
struct kvm_clock_pairing {
105120
__s64 sec;
106121
__s64 nsec;
@@ -123,15 +138,16 @@ Returns KVM_EOPNOTSUPP if the host does not use TSC clocksource,
123138
or if clock type is different than KVM_CLOCK_PAIRING_WALLCLOCK.
124139

125140
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.
130146

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
135151

136152
The hypercall lets a guest send multicast IPIs, with at most 128
137153
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.
143159
Returns the number of CPUs to which the IPIs were delivered successfully.
144160

145161
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
150167

151168
a0: destination APIC ID
152169

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.

Documentation/virt/kvm/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ KVM
1111
amd-memory-encryption
1212
cpuid
1313
halt-polling
14+
hypercalls
1415
msr
1516
vcpu-requests
1617

1718
arm/index
19+
1820
devices/index

0 commit comments

Comments
 (0)