• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Generic vm interface
2====================================
3
4The virtual machine "device" also accepts the ioctls KVM_SET_DEVICE_ATTR,
5KVM_GET_DEVICE_ATTR, and KVM_HAS_DEVICE_ATTR. The interface uses the same
6struct kvm_device_attr as other devices, but targets VM-wide settings
7and controls.
8
9The groups and attributes per virtual machine, if any, are architecture
10specific.
11
121. GROUP: KVM_S390_VM_MEM_CTRL
13Architectures: s390
14
151.1. ATTRIBUTE: KVM_S390_VM_MEM_ENABLE_CMMA
16Parameters: none
17Returns: -EBUSY if a vcpu is already defined, otherwise 0
18
19Enables Collaborative Memory Management Assist (CMMA) for the virtual machine.
20
211.2. ATTRIBUTE: KVM_S390_VM_MEM_CLR_CMMA
22Parameters: none
23Returns: -EINVAL if CMMA was not enabled
24         0 otherwise
25
26Clear the CMMA status for all guest pages, so any pages the guest marked
27as unused are again used any may not be reclaimed by the host.
28
291.3. ATTRIBUTE KVM_S390_VM_MEM_LIMIT_SIZE
30Parameters: in attr->addr the address for the new limit of guest memory
31Returns: -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
37
38Allows userspace to query the actual limit and set a new limit for
39the maximum guest memory size. The limit will be rounded up to
402048 MB, 4096 GB, 8192 TB respectively, as this limit is governed by
41the number of page table levels. In the case that there is no limit we will set
42the limit to KVM_S390_NO_MEM_LIMIT (U64_MAX).
43
442. GROUP: KVM_S390_VM_CPU_MODEL
45Architectures: s390
46
472.1. ATTRIBUTE: KVM_S390_VM_CPU_MACHINE (r/o)
48
49Allows user space to retrieve machine and kvm specific cpu related information:
50
51struct kvm_s390_vm_cpu_machine {
52       __u64 cpuid;           # CPUID of host
53       __u32 ibc;             # IBC level range offered by host
54       __u8  pad[4];
55       __u64 fac_mask[256];   # set of cpu facilities enabled by KVM
56       __u64 fac_list[256];   # set of cpu facilities offered by host
57}
58
59Parameters: address of buffer to store the machine related cpu data
60            of type struct kvm_s390_vm_cpu_machine*
61Returns:    -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
64
652.2. ATTRIBUTE: KVM_S390_VM_CPU_PROCESSOR (r/w)
66
67Allows user space to retrieve or request to change cpu related information for a vcpu:
68
69struct kvm_s390_vm_cpu_processor {
70       __u64 cpuid;           # CPUID currently (to be) used by this vcpu
71       __u16 ibc;             # IBC level currently (to be) used by this vcpu
72       __u8  pad[6];
73       __u64 fac_list[256];   # set of cpu facilities currently (to be) used
74                              # by this vcpu
75}
76
77KVM does not enforce or limit the cpu model data in any form. Take the information
78retrieved by means of KVM_S390_VM_CPU_MACHINE as hint for reasonable configuration
79setups. Instruction interceptions triggered by additionally set facility bits that
80are not handled by KVM need to by imlemented in the VM driver code.
81
82Parameters: address of buffer to store/set the processor related cpu
83	    data of type struct kvm_s390_vm_cpu_processor*.
84Returns:    -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
88
892.3. ATTRIBUTE: KVM_S390_VM_CPU_MACHINE_FEAT (r/o)
90
91Allows user space to retrieve available cpu features. A feature is available if
92provided by the hardware and supported by kvm. In theory, cpu features could
93even be completely emulated by kvm.
94
95struct kvm_s390_vm_cpu_feat {
96        __u64 feat[16]; # Bitmap (1 = feature available), MSB 0 bit numbering
97};
98
99Parameters: address of a buffer to load the feature list from.
100Returns:    -EFAULT if the given address is not accessible from kernel space.
101	    0 in case of success.
102
1032.4. ATTRIBUTE: KVM_S390_VM_CPU_PROCESSOR_FEAT (r/w)
104
105Allows user space to retrieve or change enabled cpu features for all VCPUs of a
106VM. Features that are not available cannot be enabled.
107
108See 2.3. for a description of the parameter struct.
109
110Parameters: address of a buffer to store/load the feature list from.
111Returns:    -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.
114	    0 in case of success.
115
1162.5. ATTRIBUTE: KVM_S390_VM_CPU_MACHINE_SUBFUNC (r/o)
117
118Allows user space to retrieve available cpu subfunctions without any filtering
119done by a set IBC. These subfunctions are indicated to the guest VCPU via
120query or "test bit" subfunctions and used e.g. by cpacf functions, plo and ptff.
121
122A subfunction block is only valid if KVM_S390_VM_CPU_MACHINE contains the
123STFL(E) bit introducing the affected instruction. If the affected instruction
124indicates subfunctions via a "query subfunction", the response block is
125contained in the returned struct. If the affected instruction
126indicates subfunctions via a "test bit" mechanism, the subfunction codes are
127contained in the returned struct in MSB 0 bit numbering.
128
129struct kvm_s390_vm_cpu_subfunc {
130       u8 plo[32];           # always valid (ESA/390 feature)
131       u8 ptff[16];          # valid with TOD-clock steering
132       u8 kmac[16];          # valid with Message-Security-Assist
133       u8 kmc[16];           # valid with Message-Security-Assist
134       u8 km[16];            # valid with Message-Security-Assist
135       u8 kimd[16];          # valid with Message-Security-Assist
136       u8 klmd[16];          # valid with Message-Security-Assist
137       u8 pckmo[16];         # valid with Message-Security-Assist-Extension 3
138       u8 kmctr[16];         # valid with Message-Security-Assist-Extension 4
139       u8 kmf[16];           # valid with Message-Security-Assist-Extension 4
140       u8 kmo[16];           # valid with Message-Security-Assist-Extension 4
141       u8 pcc[16];           # valid with Message-Security-Assist-Extension 4
142       u8 ppno[16];          # valid with Message-Security-Assist-Extension 5
143       u8 kma[16];           # valid with Message-Security-Assist-Extension 8
144       u8 kdsa[16];          # valid with Message-Security-Assist-Extension 9
145       u8 reserved[1792];    # reserved for future instructions
146};
147
148Parameters: address of a buffer to load the subfunction blocks from.
149Returns:    -EFAULT if the given address is not accessible from kernel space.
150	    0 in case of success.
151
1522.6. ATTRIBUTE: KVM_S390_VM_CPU_PROCESSOR_SUBFUNC (r/w)
153
154Allows user space to retrieve or change cpu subfunctions to be indicated for
155all VCPUs of a VM. This attribute will only be available if kernel and
156hardware support are in place.
157
158The kernel uses the configured subfunction blocks for indication to
159the guest. A subfunction block will only be used if the associated STFL(E) bit
160has not been disabled by user space (so the instruction to be queried is
161actually available for the guest).
162
163As long as no data has been written, a read will fail. The IBC will be used
164to determine available subfunctions in this case, this will guarantee backward
165compatibility.
166
167See 2.5. for a description of the parameter struct.
168
169Parameters: address of a buffer to store/load the subfunction blocks from.
170Returns:    -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.
173	    0 in case of success.
174
1753. GROUP: KVM_S390_VM_TOD
176Architectures: s390
177
1783.1. ATTRIBUTE: KVM_S390_VM_TOD_HIGH
179
180Allows user space to set/get the TOD clock extension (u8) (superseded by
181KVM_S390_VM_TOD_EXT).
182
183Parameters: address of a buffer in user space to store the data (u8) to
184Returns:    -EFAULT if the given address is not accessible from kernel space
185	    -EINVAL if setting the TOD clock extension to != 0 is not supported
186
1873.2. ATTRIBUTE: KVM_S390_VM_TOD_LOW
188
189Allows user space to set/get bits 0-63 of the TOD clock register as defined in
190the POP (u64).
191
192Parameters: address of a buffer in user space to store the data (u64) to
193Returns:    -EFAULT if the given address is not accessible from kernel space
194
1953.3. ATTRIBUTE: KVM_S390_VM_TOD_EXT
196Allows user space to set/get bits 0-63 of the TOD clock register as defined in
197the POP (u64). If the guest CPU model supports the TOD clock extension (u8), it
198also allows user space to get/set it. If the guest CPU model does not support
199it, it is stored as 0 and not allowed to be set to a value != 0.
200
201Parameters: address of a buffer in user space to store the data
202            (kvm_s390_vm_tod_clock) to
203Returns:    -EFAULT if the given address is not accessible from kernel space
204	    -EINVAL if setting the TOD clock extension to != 0 is not supported
205
2064. GROUP: KVM_S390_VM_CRYPTO
207Architectures: s390
208
2094.1. ATTRIBUTE: KVM_S390_VM_CRYPTO_ENABLE_AES_KW (w/o)
210
211Allows user space to enable aes key wrapping, including generating a new
212wrapping key.
213
214Parameters: none
215Returns:    0
216
2174.2. ATTRIBUTE: KVM_S390_VM_CRYPTO_ENABLE_DEA_KW (w/o)
218
219Allows user space to enable dea key wrapping, including generating a new
220wrapping key.
221
222Parameters: none
223Returns:    0
224
2254.3. ATTRIBUTE: KVM_S390_VM_CRYPTO_DISABLE_AES_KW (w/o)
226
227Allows user space to disable aes key wrapping, clearing the wrapping key.
228
229Parameters: none
230Returns:    0
231
2324.4. ATTRIBUTE: KVM_S390_VM_CRYPTO_DISABLE_DEA_KW (w/o)
233
234Allows user space to disable dea key wrapping, clearing the wrapping key.
235
236Parameters: none
237Returns:    0
238
2395. GROUP: KVM_S390_VM_MIGRATION
240Architectures: s390
241
2425.1. ATTRIBUTE: KVM_S390_VM_MIGRATION_STOP (w/o)
243
244Allows userspace to stop migration mode, needed for PGSTE migration.
245Setting this attribute when migration mode is not active will have no
246effects.
247
248Parameters: none
249Returns:    0
250
2515.2. ATTRIBUTE: KVM_S390_VM_MIGRATION_START (w/o)
252
253Allows userspace to start migration mode, needed for PGSTE migration.
254Setting this attribute when migration mode is already active will have
255no effects.
256
257Dirty tracking must be enabled on all memslots, else -EINVAL is returned. When
258dirty tracking is disabled on any memslot, migration mode is automatically
259stopped.
260
261Parameters: none
262Returns:    -ENOMEM if there is not enough free memory to start migration mode
263	    -EINVAL if the state of the VM is invalid (e.g. no memory defined)
264	    0 in case of success.
265
2665.3. ATTRIBUTE: KVM_S390_VM_MIGRATION_STATUS (r/o)
267
268Allows userspace to query the status of migration mode.
269
270Parameters: address of a buffer in user space to store the data (u64) to;
271	    the data itself is either 0 if migration mode is disabled or 1
272	    if it is enabled
273Returns:    -EFAULT if the given address is not accessible from kernel space
274	    0 in case of success.
275