1.. SPDX-License-Identifier: GPL-2.0
2
3===================
4VFIO virtual device
5===================
6
7Device types supported:
8
9  - KVM_DEV_TYPE_VFIO
10
11Only one VFIO instance may be created per VM.  The created device
12tracks VFIO groups in use by the VM and features of those groups
13important to the correctness and acceleration of the VM.  As groups
14are enabled and disabled for use by the VM, KVM should be updated
15about their presence.  When registered with KVM, a reference to the
16VFIO-group is held by KVM.
17
18Groups:
19  KVM_DEV_VFIO_GROUP
20
21KVM_DEV_VFIO_GROUP attributes:
22  KVM_DEV_VFIO_GROUP_ADD: Add a VFIO group to VFIO-KVM device tracking
23	kvm_device_attr.addr points to an int32_t file descriptor
24	for the VFIO group.
25  KVM_DEV_VFIO_GROUP_DEL: Remove a VFIO group from VFIO-KVM device tracking
26	kvm_device_attr.addr points to an int32_t file descriptor
27	for the VFIO group.
28  KVM_DEV_VFIO_GROUP_SET_SPAPR_TCE: attaches a guest visible TCE table
29	allocated by sPAPR KVM.
30	kvm_device_attr.addr points to a struct::
31
32		struct kvm_vfio_spapr_tce {
33			__s32	groupfd;
34			__s32	tablefd;
35		};
36
37	where:
38
39	- @groupfd is a file descriptor for a VFIO group;
40	- @tablefd is a file descriptor for a TCE table allocated via
41	  KVM_CREATE_SPAPR_TCE.
42
43The GROUP_ADD operation above should be invoked prior to accessing the
44device file descriptor via VFIO_GROUP_GET_DEVICE_FD in order to support
45drivers which require a kvm pointer to be set in their .open_device()
46callback.
47