Skip to contentSkip to conversation

docs: kvm: vfio: Suggest KVM_DEV_VFIO_GROUP_ADD vs VFIO_GROUP_GET_DEVICE_FD ordering

PATCH Applied Yi Liu 3 participants 3 messages Apr 21, 2023

Subsystems (2)
lore
Share & tools
lore

Yi Liu

author
#0 lore raw

PATCH v3 1/1 docs: kvm: vfio: Suggest KVM_DEV_VFIO_GROUP_ADD vs VFIO_GROUP_GET_DEVICE_FD ordering

as some vfio_device's open_device op requires kvm pointer and kvm pointer set is part of GROUP_ADD.

---
v3:
- Add r-b from Kevin
- Remove "::" to fix "WARNING: Literal block expected; none found." "make htmldocs" looks good.
- Rename the subject per Alex's suggestion

v2: https://lore.kernel.org/kvm/[email protected]/
- Adopt Alex's suggestion

v1: https://lore.kernel.org/kvm/[email protected]/

---
 Documentation/virt/kvm/devices/vfio.rst | 5 +++++
 1 file changed, 5 insertions(+)
Documentation/virt/kvm/devices/vfio.rst +5 -0
index 2d20dc561069..08b544212638 100644
@@ -39,3 +39,8 @@ KVM_DEV_VFIO_GROUP attributes:
 	- @groupfd is a file descriptor for a VFIO group;
 	- @tablefd is a file descriptor for a TCE table allocated via
 	  KVM_CREATE_SPAPR_TCE.
+
+The GROUP_ADD operation above should be invoked prior to accessing the
+device file descriptor via VFIO_GROUP_GET_DEVICE_FD in order to support
+drivers which require a kvm pointer to be set in their .open_device()
+callback.
Signature · 1 line
2.34.1
Reviewed-by on v3 1/1
#1 lore raw
Quoted 12 lines · Yi Liu

as some vfio_device's open_device op requires kvm pointer and kvm pointer set is part of GROUP_ADD.

---
v3:
- Add r-b from Kevin
- Remove "::" to fix "WARNING: Literal block expected; none found." "make htmldocs" looks good.
- Rename the subject per Alex's suggestion

Quoted 7 lines

v2: https://lore.kernel.org/kvm/[email protected]/
- Adopt Alex's suggestion

v1: https://lore.kernel.org/kvm/[email protected]/

---
 Documentation/virt/kvm/devices/vfio.rst | 5 +++++
 1 file changed, 5 insertions(+)

Jason

#2 lore raw
In reply to Yi Liu
Quoted 25 lines · On Thu, 20 Apr 2023 22:36:11 -0700 Yi Liu <[email protected]> wrote:

as some vfio_device's open_device op requires kvm pointer and kvm pointer set is part of GROUP_ADD.

---
v3:
- Add r-b from Kevin
- Remove "::" to fix "WARNING: Literal block expected; none found." "make htmldocs" looks good.
- Rename the subject per Alex's suggestion

v2: https://lore.kernel.org/kvm/[email protected]/
- Adopt Alex's suggestion

v1: https://lore.kernel.org/kvm/[email protected]/

---
 Documentation/virt/kvm/devices/vfio.rst | 5 +++++
 1 file changed, 5 insertions(+)
Documentation/virt/kvm/devices/vfio.rst +0 -0
index 2d20dc561069..08b544212638 100644

Documentation/virt/kvm/devices/vfio.rst KVM_DEV_VFIO_GROUP attributes: · line 46

Quoted 8 lines
Documentation/virt/kvm/devices/vfio.rst +5 -0
@@ -39,3 +39,8 @@ KVM_DEV_VFIO_GROUP attributes:
 	- @groupfd is a file descriptor for a VFIO group;
 	- @tablefd is a file descriptor for a TCE table allocated via
 	  KVM_CREATE_SPAPR_TCE.
+
+The GROUP_ADD operation above should be invoked prior to accessing the
+device file descriptor via VFIO_GROUP_GET_DEVICE_FD in order to support
+drivers which require a kvm pointer to be set in their .open_device()
+callback.

Applied to vfio next branch for v6.4. Thanks,

Alex