vm.rst (ea68a3e9d14e9e0bf017d178fb4bd53b6deb1482) vm.rst (6dcf7316e05eccded11fc640813c8a8879f271a6)
1.. SPDX-License-Identifier: GPL-2.0
2
3====================
4Generic vm interface
5====================
6
7The virtual machine "device" also accepts the ioctls KVM_SET_DEVICE_ATTR,
8KVM_GET_DEVICE_ATTR, and KVM_HAS_DEVICE_ATTR. The interface uses the same

--- 307 unchanged lines hidden (view full) ---

316
317Allows userspace to query the status of migration mode.
318
319:Parameters: address of a buffer in user space to store the data (u64) to;
320 the data itself is either 0 if migration mode is disabled or 1
321 if it is enabled
322:Returns: -EFAULT if the given address is not accessible from kernel space;
323 0 in case of success.
1.. SPDX-License-Identifier: GPL-2.0
2
3====================
4Generic vm interface
5====================
6
7The virtual machine "device" also accepts the ioctls KVM_SET_DEVICE_ATTR,
8KVM_GET_DEVICE_ATTR, and KVM_HAS_DEVICE_ATTR. The interface uses the same

--- 307 unchanged lines hidden (view full) ---

316
317Allows userspace to query the status of migration mode.
318
319:Parameters: address of a buffer in user space to store the data (u64) to;
320 the data itself is either 0 if migration mode is disabled or 1
321 if it is enabled
322:Returns: -EFAULT if the given address is not accessible from kernel space;
323 0 in case of success.
324
3256. GROUP: KVM_ARM_VM_SMCCC_CTRL
326===============================
327
328:Architectures: arm64
329
3306.1. ATTRIBUTE: KVM_ARM_VM_SMCCC_FILTER (w/o)
331---------------------------------------------
332
333:Parameters: Pointer to a ``struct kvm_smccc_filter``
334
335:Returns:
336
337 ====== ===========================================
338 EEXIST Range intersects with a previously inserted
339 or reserved range
340 EBUSY A vCPU in the VM has already run
341 EINVAL Invalid filter configuration
342 ENOMEM Failed to allocate memory for the in-kernel
343 representation of the SMCCC filter
344 ====== ===========================================
345
346Requests the installation of an SMCCC call filter described as follows::
347
348 enum kvm_smccc_filter_action {
349 KVM_SMCCC_FILTER_HANDLE = 0,
350 KVM_SMCCC_FILTER_DENY,
351 KVM_SMCCC_FILTER_FWD_TO_USER,
352 };
353
354 struct kvm_smccc_filter {
355 __u32 base;
356 __u32 nr_functions;
357 __u8 action;
358 __u8 pad[15];
359 };
360
361The filter is defined as a set of non-overlapping ranges. Each
362range defines an action to be applied to SMCCC calls within the range.
363Userspace can insert multiple ranges into the filter by using
364successive calls to this attribute.
365
366The default configuration of KVM is such that all implemented SMCCC
367calls are allowed. Thus, the SMCCC filter can be defined sparsely
368by userspace, only describing ranges that modify the default behavior.
369
370The range expressed by ``struct kvm_smccc_filter`` is
371[``base``, ``base + nr_functions``). The range is not allowed to wrap,
372i.e. userspace cannot rely on ``base + nr_functions`` overflowing.
373
374The SMCCC filter applies to both SMC and HVC calls initiated by the
375guest. The SMCCC filter gates the in-kernel emulation of SMCCC calls
376and as such takes effect before other interfaces that interact with
377SMCCC calls (e.g. hypercall bitmap registers).
378
379Actions:
380
381 - ``KVM_SMCCC_FILTER_HANDLE``: Allows the guest SMCCC call to be
382 handled in-kernel. It is strongly recommended that userspace *not*
383 explicitly describe the allowed SMCCC call ranges.
384
385 - ``KVM_SMCCC_FILTER_DENY``: Rejects the guest SMCCC call in-kernel
386 and returns to the guest.
387
388 - ``KVM_SMCCC_FILTER_FWD_TO_USER``: The guest SMCCC call is forwarded
389 to userspace with an exit reason of ``KVM_EXIT_HYPERCALL``.
390
391The ``pad`` field is reserved for future use and must be zero. KVM may
392return ``-EINVAL`` if the field is nonzero.
393
394KVM reserves the 'Arm Architecture Calls' range of function IDs and
395will reject attempts to define a filter for any portion of these ranges:
396
397 =========== ===============
398 Start End (inclusive)
399 =========== ===============
400 0x8000_0000 0x8000_FFFF
401 0xC000_0000 0xC000_FFFF
402 =========== ===============