summaryrefslogtreecommitdiffstats
path: root/kernel/include/nvidia-vgpu-vfio.h
diff options
context:
space:
mode:
authorArthur Hanson Rasmusson <arthur@vgpu.io>2026-10-01 22:22:21 -0400
committerArthur Hanson Rasmusson <arthur@vgpu.io>2026-10-01 22:22:21 -0400
commit2cecb0c172375e45ab554a42c0693135238c03ed (patch)
tree393179d97eeb617e49b2da02aa284a774d09383f /kernel/include/nvidia-vgpu-vfio.h
parentaa4cf303dd028b24ca29edbc0a5f3c237ab98e3f (diff)
downloadopen-iov-2cecb0c172375e45ab554a42c0693135238c03ed.tar.gz
open-iov-2cecb0c172375e45ab554a42c0693135238c03ed.zip
gsp-phys: mdev-owned backend lifecycle (P1)
Add the gsp_phys_mdev_owned ownership selector (default 0: unchanged load-time module-owned claim/boot). With 1, module load claims nothing; the first mdev create starts a refcounted backend session whose claim+boot runs asynchronously from a work item, so mdev create and init_work never block. The last mdev remove releases after the emulation thread is stopped. Failures are fail-open: the backend stays OFF and the mdev keeps serving the emulation path. nv_vgpu_exit now gates the session STOPPING under the session lock, drains the emulation threads via mdev_unregister_driver(), and only then releases the claim; the module-owned path keeps its previous release position. A start while STOPPING is refused and a concurrent second stopper cannot release twice. No forwarding is added.
Diffstat (limited to 'kernel/include/nvidia-vgpu-vfio.h')
-rw-r--r--kernel/include/nvidia-vgpu-vfio.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/kernel/include/nvidia-vgpu-vfio.h b/kernel/include/nvidia-vgpu-vfio.h
index 961bba2..aed3dc5 100644
--- a/kernel/include/nvidia-vgpu-vfio.h
+++ b/kernel/include/nvidia-vgpu-vfio.h
@@ -135,6 +135,12 @@ struct nv_vgpu_device {
/* VFIO device registration state */
bool vfio_dev_registered;
+
+ /* True when this mdev holds a reference on the physical backend
+ * session (gsp_phys_backend_start() succeeded in init_work); the
+ * matching gsp_phys_backend_stop() runs in cleanup_work after the
+ * emulation thread is stopped. */
+ bool phys_backend_ref;
};
typedef struct nv_vgpu_device nv_vgpu_device;