Skip to content

Commit 6c972ba

Browse files
mchehabbonzini
authored andcommitted
docs: kvm: convert devices/vm.txt to ReST
- Use title markups; - adjust indentation and add blank lines as needed; - use :field: markups; - Use cross-references; - mark code blocks as such. Signed-off-by: Mauro Carvalho Chehab <[email protected]> Reviewed-by: Cornelia Huck <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent aff7aee commit 6c972ba

File tree

2 files changed

+127
-80
lines changed

2 files changed

+127
-80
lines changed

Documentation/virt/kvm/devices/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ Devices
1414
s390_flic
1515
vcpu
1616
vfio
17+
vm
Lines changed: 126 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
.. SPDX-License-Identifier: GPL-2.0
2+
3+
====================
14
Generic vm interface
2-
====================================
5+
====================
36

47
The virtual machine "device" also accepts the ioctls KVM_SET_DEVICE_ATTR,
58
KVM_GET_DEVICE_ATTR, and KVM_HAS_DEVICE_ATTR. The interface uses the same
@@ -10,30 +13,38 @@ The groups and attributes per virtual machine, if any, are architecture
1013
specific.
1114

1215
1. GROUP: KVM_S390_VM_MEM_CTRL
13-
Architectures: s390
16+
==============================
17+
18+
:Architectures: s390
1419

1520
1.1. ATTRIBUTE: KVM_S390_VM_MEM_ENABLE_CMMA
16-
Parameters: none
17-
Returns: -EBUSY if a vcpu is already defined, otherwise 0
21+
-------------------------------------------
22+
23+
:Parameters: none
24+
:Returns: -EBUSY if a vcpu is already defined, otherwise 0
1825

1926
Enables Collaborative Memory Management Assist (CMMA) for the virtual machine.
2027

2128
1.2. ATTRIBUTE: KVM_S390_VM_MEM_CLR_CMMA
22-
Parameters: none
23-
Returns: -EINVAL if CMMA was not enabled
24-
0 otherwise
29+
----------------------------------------
30+
31+
:Parameters: none
32+
:Returns: -EINVAL if CMMA was not enabled;
33+
0 otherwise
2534

2635
Clear the CMMA status for all guest pages, so any pages the guest marked
2736
as unused are again used any may not be reclaimed by the host.
2837

2938
1.3. ATTRIBUTE KVM_S390_VM_MEM_LIMIT_SIZE
30-
Parameters: in attr->addr the address for the new limit of guest memory
31-
Returns: -EFAULT if the given address is not accessible
32-
-EINVAL if the virtual machine is of type UCONTROL
33-
-E2BIG if the given guest memory is to big for that machine
34-
-EBUSY if a vcpu is already defined
35-
-ENOMEM if not enough memory is available for a new shadow guest mapping
36-
0 otherwise
39+
-----------------------------------------
40+
41+
:Parameters: in attr->addr the address for the new limit of guest memory
42+
:Returns: -EFAULT if the given address is not accessible;
43+
-EINVAL if the virtual machine is of type UCONTROL;
44+
-E2BIG if the given guest memory is to big for that machine;
45+
-EBUSY if a vcpu is already defined;
46+
-ENOMEM if not enough memory is available for a new shadow guest mapping;
47+
0 otherwise.
3748

3849
Allows userspace to query the actual limit and set a new limit for
3950
the maximum guest memory size. The limit will be rounded up to
@@ -42,78 +53,92 @@ the number of page table levels. In the case that there is no limit we will set
4253
the limit to KVM_S390_NO_MEM_LIMIT (U64_MAX).
4354

4455
2. GROUP: KVM_S390_VM_CPU_MODEL
45-
Architectures: s390
56+
===============================
57+
58+
:Architectures: s390
4659

4760
2.1. ATTRIBUTE: KVM_S390_VM_CPU_MACHINE (r/o)
61+
---------------------------------------------
4862

49-
Allows user space to retrieve machine and kvm specific cpu related information:
63+
Allows user space to retrieve machine and kvm specific cpu related information::
5064

51-
struct kvm_s390_vm_cpu_machine {
65+
struct kvm_s390_vm_cpu_machine {
5266
__u64 cpuid; # CPUID of host
5367
__u32 ibc; # IBC level range offered by host
5468
__u8 pad[4];
5569
__u64 fac_mask[256]; # set of cpu facilities enabled by KVM
5670
__u64 fac_list[256]; # set of cpu facilities offered by host
57-
}
71+
}
5872

59-
Parameters: address of buffer to store the machine related cpu data
60-
of type struct kvm_s390_vm_cpu_machine*
61-
Returns: -EFAULT if the given address is not accessible from kernel space
62-
-ENOMEM if not enough memory is available to process the ioctl
63-
0 in case of success
73+
:Parameters: address of buffer to store the machine related cpu data
74+
of type struct kvm_s390_vm_cpu_machine*
75+
:Returns: -EFAULT if the given address is not accessible from kernel space;
76+
-ENOMEM if not enough memory is available to process the ioctl;
77+
0 in case of success.
6478

6579
2.2. ATTRIBUTE: KVM_S390_VM_CPU_PROCESSOR (r/w)
80+
===============================================
6681

67-
Allows user space to retrieve or request to change cpu related information for a vcpu:
82+
Allows user space to retrieve or request to change cpu related information for a vcpu::
6883

69-
struct kvm_s390_vm_cpu_processor {
84+
struct kvm_s390_vm_cpu_processor {
7085
__u64 cpuid; # CPUID currently (to be) used by this vcpu
7186
__u16 ibc; # IBC level currently (to be) used by this vcpu
7287
__u8 pad[6];
7388
__u64 fac_list[256]; # set of cpu facilities currently (to be) used
74-
# by this vcpu
75-
}
89+
# by this vcpu
90+
}
7691

7792
KVM does not enforce or limit the cpu model data in any form. Take the information
7893
retrieved by means of KVM_S390_VM_CPU_MACHINE as hint for reasonable configuration
7994
setups. Instruction interceptions triggered by additionally set facility bits that
8095
are not handled by KVM need to by imlemented in the VM driver code.
8196

82-
Parameters: address of buffer to store/set the processor related cpu
83-
data of type struct kvm_s390_vm_cpu_processor*.
84-
Returns: -EBUSY in case 1 or more vcpus are already activated (only in write case)
85-
-EFAULT if the given address is not accessible from kernel space
86-
-ENOMEM if not enough memory is available to process the ioctl
87-
0 in case of success
97+
:Parameters: address of buffer to store/set the processor related cpu
98+
data of type struct kvm_s390_vm_cpu_processor*.
99+
:Returns: -EBUSY in case 1 or more vcpus are already activated (only in write case);
100+
-EFAULT if the given address is not accessible from kernel space;
101+
-ENOMEM if not enough memory is available to process the ioctl;
102+
0 in case of success.
103+
104+
.. _KVM_S390_VM_CPU_MACHINE_FEAT:
88105

89106
2.3. ATTRIBUTE: KVM_S390_VM_CPU_MACHINE_FEAT (r/o)
107+
--------------------------------------------------
90108

91109
Allows user space to retrieve available cpu features. A feature is available if
92110
provided by the hardware and supported by kvm. In theory, cpu features could
93111
even be completely emulated by kvm.
94112

95-
struct kvm_s390_vm_cpu_feat {
96-
__u64 feat[16]; # Bitmap (1 = feature available), MSB 0 bit numbering
97-
};
113+
::
98114

99-
Parameters: address of a buffer to load the feature list from.
100-
Returns: -EFAULT if the given address is not accessible from kernel space.
101-
0 in case of success.
115+
struct kvm_s390_vm_cpu_feat {
116+
__u64 feat[16]; # Bitmap (1 = feature available), MSB 0 bit numbering
117+
};
118+
119+
:Parameters: address of a buffer to load the feature list from.
120+
:Returns: -EFAULT if the given address is not accessible from kernel space;
121+
0 in case of success.
102122

103123
2.4. ATTRIBUTE: KVM_S390_VM_CPU_PROCESSOR_FEAT (r/w)
124+
----------------------------------------------------
104125

105126
Allows user space to retrieve or change enabled cpu features for all VCPUs of a
106127
VM. Features that are not available cannot be enabled.
107128

108-
See 2.3. for a description of the parameter struct.
129+
See :ref:`KVM_S390_VM_CPU_MACHINE_FEAT` for
130+
a description of the parameter struct.
109131

110-
Parameters: address of a buffer to store/load the feature list from.
111-
Returns: -EFAULT if the given address is not accessible from kernel space.
112-
-EINVAL if a cpu feature that is not available is to be enabled.
113-
-EBUSY if at least one VCPU has already been defined.
132+
:Parameters: address of a buffer to store/load the feature list from.
133+
:Returns: -EFAULT if the given address is not accessible from kernel space;
134+
-EINVAL if a cpu feature that is not available is to be enabled;
135+
-EBUSY if at least one VCPU has already been defined;
114136
0 in case of success.
115137

138+
.. _KVM_S390_VM_CPU_MACHINE_SUBFUNC:
139+
116140
2.5. ATTRIBUTE: KVM_S390_VM_CPU_MACHINE_SUBFUNC (r/o)
141+
-----------------------------------------------------
117142

118143
Allows user space to retrieve available cpu subfunctions without any filtering
119144
done by a set IBC. These subfunctions are indicated to the guest VCPU via
@@ -126,7 +151,9 @@ contained in the returned struct. If the affected instruction
126151
indicates subfunctions via a "test bit" mechanism, the subfunction codes are
127152
contained in the returned struct in MSB 0 bit numbering.
128153

129-
struct kvm_s390_vm_cpu_subfunc {
154+
::
155+
156+
struct kvm_s390_vm_cpu_subfunc {
130157
u8 plo[32]; # always valid (ESA/390 feature)
131158
u8 ptff[16]; # valid with TOD-clock steering
132159
u8 kmac[16]; # valid with Message-Security-Assist
@@ -143,13 +170,14 @@ struct kvm_s390_vm_cpu_subfunc {
143170
u8 kma[16]; # valid with Message-Security-Assist-Extension 8
144171
u8 kdsa[16]; # valid with Message-Security-Assist-Extension 9
145172
u8 reserved[1792]; # reserved for future instructions
146-
};
173+
};
147174

148-
Parameters: address of a buffer to load the subfunction blocks from.
149-
Returns: -EFAULT if the given address is not accessible from kernel space.
175+
:Parameters: address of a buffer to load the subfunction blocks from.
176+
:Returns: -EFAULT if the given address is not accessible from kernel space;
150177
0 in case of success.
151178

152179
2.6. ATTRIBUTE: KVM_S390_VM_CPU_PROCESSOR_SUBFUNC (r/w)
180+
-------------------------------------------------------
153181

154182
Allows user space to retrieve or change cpu subfunctions to be indicated for
155183
all VCPUs of a VM. This attribute will only be available if kernel and
@@ -164,107 +192,125 @@ As long as no data has been written, a read will fail. The IBC will be used
164192
to determine available subfunctions in this case, this will guarantee backward
165193
compatibility.
166194

167-
See 2.5. for a description of the parameter struct.
195+
See :ref:`KVM_S390_VM_CPU_MACHINE_SUBFUNC` for a
196+
description of the parameter struct.
168197

169-
Parameters: address of a buffer to store/load the subfunction blocks from.
170-
Returns: -EFAULT if the given address is not accessible from kernel space.
171-
-EINVAL when reading, if there was no write yet.
172-
-EBUSY if at least one VCPU has already been defined.
198+
:Parameters: address of a buffer to store/load the subfunction blocks from.
199+
:Returns: -EFAULT if the given address is not accessible from kernel space;
200+
-EINVAL when reading, if there was no write yet;
201+
-EBUSY if at least one VCPU has already been defined;
173202
0 in case of success.
174203

175204
3. GROUP: KVM_S390_VM_TOD
176-
Architectures: s390
205+
=========================
206+
207+
:Architectures: s390
177208

178209
3.1. ATTRIBUTE: KVM_S390_VM_TOD_HIGH
210+
------------------------------------
179211

180212
Allows user space to set/get the TOD clock extension (u8) (superseded by
181213
KVM_S390_VM_TOD_EXT).
182214

183-
Parameters: address of a buffer in user space to store the data (u8) to
184-
Returns: -EFAULT if the given address is not accessible from kernel space
215+
:Parameters: address of a buffer in user space to store the data (u8) to
216+
:Returns: -EFAULT if the given address is not accessible from kernel space;
185217
-EINVAL if setting the TOD clock extension to != 0 is not supported
186218

187219
3.2. ATTRIBUTE: KVM_S390_VM_TOD_LOW
220+
-----------------------------------
188221

189222
Allows user space to set/get bits 0-63 of the TOD clock register as defined in
190223
the POP (u64).
191224

192-
Parameters: address of a buffer in user space to store the data (u64) to
193-
Returns: -EFAULT if the given address is not accessible from kernel space
225+
:Parameters: address of a buffer in user space to store the data (u64) to
226+
:Returns: -EFAULT if the given address is not accessible from kernel space
194227

195228
3.3. ATTRIBUTE: KVM_S390_VM_TOD_EXT
229+
-----------------------------------
230+
196231
Allows user space to set/get bits 0-63 of the TOD clock register as defined in
197232
the POP (u64). If the guest CPU model supports the TOD clock extension (u8), it
198233
also allows user space to get/set it. If the guest CPU model does not support
199234
it, it is stored as 0 and not allowed to be set to a value != 0.
200235

201-
Parameters: address of a buffer in user space to store the data
202-
(kvm_s390_vm_tod_clock) to
203-
Returns: -EFAULT if the given address is not accessible from kernel space
236+
:Parameters: address of a buffer in user space to store the data
237+
(kvm_s390_vm_tod_clock) to
238+
:Returns: -EFAULT if the given address is not accessible from kernel space;
204239
-EINVAL if setting the TOD clock extension to != 0 is not supported
205240

206241
4. GROUP: KVM_S390_VM_CRYPTO
207-
Architectures: s390
242+
============================
243+
244+
:Architectures: s390
208245

209246
4.1. ATTRIBUTE: KVM_S390_VM_CRYPTO_ENABLE_AES_KW (w/o)
247+
------------------------------------------------------
210248

211249
Allows user space to enable aes key wrapping, including generating a new
212250
wrapping key.
213251

214-
Parameters: none
215-
Returns: 0
252+
:Parameters: none
253+
:Returns: 0
216254

217255
4.2. ATTRIBUTE: KVM_S390_VM_CRYPTO_ENABLE_DEA_KW (w/o)
256+
------------------------------------------------------
218257

219258
Allows user space to enable dea key wrapping, including generating a new
220259
wrapping key.
221260

222-
Parameters: none
223-
Returns: 0
261+
:Parameters: none
262+
:Returns: 0
224263

225264
4.3. ATTRIBUTE: KVM_S390_VM_CRYPTO_DISABLE_AES_KW (w/o)
265+
-------------------------------------------------------
226266

227267
Allows user space to disable aes key wrapping, clearing the wrapping key.
228268

229-
Parameters: none
230-
Returns: 0
269+
:Parameters: none
270+
:Returns: 0
231271

232272
4.4. ATTRIBUTE: KVM_S390_VM_CRYPTO_DISABLE_DEA_KW (w/o)
273+
-------------------------------------------------------
233274

234275
Allows user space to disable dea key wrapping, clearing the wrapping key.
235276

236-
Parameters: none
237-
Returns: 0
277+
:Parameters: none
278+
:Returns: 0
238279

239280
5. GROUP: KVM_S390_VM_MIGRATION
240-
Architectures: s390
281+
===============================
282+
283+
:Architectures: s390
241284

242285
5.1. ATTRIBUTE: KVM_S390_VM_MIGRATION_STOP (w/o)
286+
------------------------------------------------
243287

244288
Allows userspace to stop migration mode, needed for PGSTE migration.
245289
Setting this attribute when migration mode is not active will have no
246290
effects.
247291

248-
Parameters: none
249-
Returns: 0
292+
:Parameters: none
293+
:Returns: 0
250294

251295
5.2. ATTRIBUTE: KVM_S390_VM_MIGRATION_START (w/o)
296+
-------------------------------------------------
252297

253298
Allows userspace to start migration mode, needed for PGSTE migration.
254299
Setting this attribute when migration mode is already active will have
255300
no effects.
256301

257-
Parameters: none
258-
Returns: -ENOMEM if there is not enough free memory to start migration mode
259-
-EINVAL if the state of the VM is invalid (e.g. no memory defined)
302+
:Parameters: none
303+
:Returns: -ENOMEM if there is not enough free memory to start migration mode;
304+
-EINVAL if the state of the VM is invalid (e.g. no memory defined);
260305
0 in case of success.
261306

262307
5.3. ATTRIBUTE: KVM_S390_VM_MIGRATION_STATUS (r/o)
308+
--------------------------------------------------
263309

264310
Allows userspace to query the status of migration mode.
265311

266-
Parameters: address of a buffer in user space to store the data (u64) to;
267-
the data itself is either 0 if migration mode is disabled or 1
268-
if it is enabled
269-
Returns: -EFAULT if the given address is not accessible from kernel space
312+
:Parameters: address of a buffer in user space to store the data (u64) to;
313+
the data itself is either 0 if migration mode is disabled or 1
314+
if it is enabled
315+
:Returns: -EFAULT if the given address is not accessible from kernel space;
270316
0 in case of success.

0 commit comments

Comments
 (0)