summaryrefslogtreecommitdiffstats
path: root/kernel/gsp_phys_gpu.h
diff options
context:
space:
mode:
authorArthur Hanson Rasmusson <arthur@vgpu.io>2026-10-01 21:59:42 -0400
committerArthur Hanson Rasmusson <arthur@vgpu.io>2026-10-01 21:59:42 -0400
commit954277863e8206d2ddf6058b8958a34eee22576b (patch)
tree9cbb8f9787cc44df1a9bbad1a4cc5b4fc9f48271 /kernel/gsp_phys_gpu.h
parent684dbe2e5c01b7f27e6fe15242b318057454ac5a (diff)
downloadopen-iov-954277863e8206d2ddf6058b8958a34eee22576b.tar.gz
open-iov-954277863e8206d2ddf6058b8958a34eee22576b.zip
gsp-phys: backend session API skeleton (P0, inert)
Diffstat (limited to 'kernel/gsp_phys_gpu.h')
-rw-r--r--kernel/gsp_phys_gpu.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/kernel/gsp_phys_gpu.h b/kernel/gsp_phys_gpu.h
index b8a1955..36532a5 100644
--- a/kernel/gsp_phys_gpu.h
+++ b/kernel/gsp_phys_gpu.h
@@ -12,4 +12,31 @@ int gsp_phys_gpu_claim(void);
void gsp_phys_gpu_release(void);
void __iomem *gsp_phys_gpu_bar0(void);
+/*
+ * Backend session state (P0 skeleton; one physical GPU, one live claim).
+ * OFF until a start claims the device; READY is the only state in which live
+ * RPC forwarding is legal. The refcount and owner flag decide who releases:
+ * the load-time module-owned claim is joined, never released, by a stop().
+ */
+enum gsp_phys_backend_state {
+ GSP_PHYS_BACKEND_OFF = 0,
+ GSP_PHYS_BACKEND_CLAIMING,
+ GSP_PHYS_BACKEND_BOOTING,
+ GSP_PHYS_BACKEND_READY,
+ GSP_PHYS_BACKEND_STOPPING,
+};
+
+/*
+ * Refcounted session start/stop around gsp_phys_gpu_claim()/_release(); safe
+ * (and idempotent) in any state. The generation counter is bumped when the
+ * session leaves READY; a forward that captured the previous value re-checks
+ * it under gsp_phys_rm_lock and refuses, so a stop cannot race an in-flight
+ * forward. The lock itself stays private to gsp_phys_gpu.c; the state and
+ * generation accessors are lock-free reads for use from the RPC path.
+ */
+int gsp_phys_backend_start(void);
+void gsp_phys_backend_stop(void);
+int gsp_phys_backend_state(void);
+u32 gsp_phys_backend_generation(void);
+
#endif /* GSP_PHYS_GPU_H */