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