18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ci===================
48c2ecf20Sopenharmony_ciVFIO virtual device
58c2ecf20Sopenharmony_ci===================
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ciDevice types supported:
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci  - KVM_DEV_TYPE_VFIO
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ciOnly one VFIO instance may be created per VM.  The created device
128c2ecf20Sopenharmony_citracks VFIO groups in use by the VM and features of those groups
138c2ecf20Sopenharmony_ciimportant to the correctness and acceleration of the VM.  As groups
148c2ecf20Sopenharmony_ciare enabled and disabled for use by the VM, KVM should be updated
158c2ecf20Sopenharmony_ciabout their presence.  When registered with KVM, a reference to the
168c2ecf20Sopenharmony_ciVFIO-group is held by KVM.
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ciGroups:
198c2ecf20Sopenharmony_ci  KVM_DEV_VFIO_GROUP
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ciKVM_DEV_VFIO_GROUP attributes:
228c2ecf20Sopenharmony_ci  KVM_DEV_VFIO_GROUP_ADD: Add a VFIO group to VFIO-KVM device tracking
238c2ecf20Sopenharmony_ci	kvm_device_attr.addr points to an int32_t file descriptor
248c2ecf20Sopenharmony_ci	for the VFIO group.
258c2ecf20Sopenharmony_ci  KVM_DEV_VFIO_GROUP_DEL: Remove a VFIO group from VFIO-KVM device tracking
268c2ecf20Sopenharmony_ci	kvm_device_attr.addr points to an int32_t file descriptor
278c2ecf20Sopenharmony_ci	for the VFIO group.
288c2ecf20Sopenharmony_ci  KVM_DEV_VFIO_GROUP_SET_SPAPR_TCE: attaches a guest visible TCE table
298c2ecf20Sopenharmony_ci	allocated by sPAPR KVM.
308c2ecf20Sopenharmony_ci	kvm_device_attr.addr points to a struct::
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci		struct kvm_vfio_spapr_tce {
338c2ecf20Sopenharmony_ci			__s32	groupfd;
348c2ecf20Sopenharmony_ci			__s32	tablefd;
358c2ecf20Sopenharmony_ci		};
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci	where:
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci	- @groupfd is a file descriptor for a VFIO group;
408c2ecf20Sopenharmony_ci	- @tablefd is a file descriptor for a TCE table allocated via
418c2ecf20Sopenharmony_ci	  KVM_CREATE_SPAPR_TCE.
42