summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorArthur Hanson Rasmusson <arthur@vgpu.io>2026-10-06 21:18:34 -0400
committerArthur Hanson Rasmusson <arthur@vgpu.io>2026-10-06 21:18:34 -0400
commit57871ebb5f0132e554b1b1f825096f8e9c112229 (patch)
tree63a65c93abde8f1d120d13a073e95df719a38549 /kernel
parent0d294e09ed4bda348a5ef643192c1a069ca90d32 (diff)
downloadopen-iov-57871ebb5f0132e554b1b1f825096f8e9c112229.tar.gz
open-iov-57871ebb5f0132e554b1b1f825096f8e9c112229.zip
vgsp: ctxshare_force probe - share on the proven mode-31 execution channel (V6+sibling A attach via params init)
Diffstat (limited to 'kernel')
-rw-r--r--kernel/gsp_phys_booter.c21
-rw-r--r--kernel/gsp_phys_gpu.c19
-rw-r--r--kernel/gsp_phys_gpu.h8
3 files changed, 48 insertions, 0 deletions
diff --git a/kernel/gsp_phys_booter.c b/kernel/gsp_phys_booter.c
index 10ef3b7..4fc8b4f 100644
--- a/kernel/gsp_phys_booter.c
+++ b/kernel/gsp_phys_booter.c
@@ -13144,6 +13144,27 @@ static int gsp_phys_rmcall_stage3(void __iomem *bar0)
gsp_phys_rmcall_user_lane_kgr_queries(bar0);
/*
+ * Mode-31 share probe (gsp_phys_rmcall_ctxshare_force=1): allocate the
+ * share before the replay so every ladder-TSG channel (V6 and the mode-31
+ * sibling A) attaches to it via the channel-params helper, while the
+ * proven mode-31 construct/commit flow stays intact.
+ */
+ if (gsp_phys_rmcall_engine_is_gr() &&
+ gsp_phys_rmcall_ctxshare_force_value() &&
+ !boot_stage.rmcall_ctxshare) {
+ if (!gsp_phys_rmcall_vas_shared_value()) {
+ pr_err("vgsp-boot: rm-call: ctxshare_force needs the ladder SHARED_MANAGEMENT VAS (gsp_phys_rmcall_vas_shared=1); aborting with no retry\n");
+ return -EINVAL;
+ }
+ ret = gsp_phys_rmcall_alloc_ctxshare(bar0);
+ if (ret) {
+ pr_err("vgsp-boot: rm-call: stage 3 aborted: ctxshare_force FERMI_CONTEXT_SHARE_A alloc failed (%d); aborting with no retry\n",
+ ret);
+ return ret;
+ }
+ }
+
+ /*
* Golden-image replay (gsp_phys_rmcall_golden=1 + gsp_phys_gpu=1):
* replay the stock client's post-load golden channel allocations after
* the ladder's VAS/TSG exist and before the ladder's own channel/GR
diff --git a/kernel/gsp_phys_gpu.c b/kernel/gsp_phys_gpu.c
index e2fffc9..974100a 100644
--- a/kernel/gsp_phys_gpu.c
+++ b/kernel/gsp_phys_gpu.c
@@ -309,6 +309,25 @@ bool gsp_phys_rmcall_golden_enabled(void)
EXPORT_SYMBOL_GPL(gsp_phys_rmcall_golden_enabled);
/*
+ * Mode-31 share probe (default 0): allocate FERMI_CONTEXT_SHARE_A on the
+ * ladder TSG before the golden replay for ANY GR promote mode, so the proven
+ * mode-31 execution channel V6 (and the sibling A) attach to the share while
+ * keeping mode 31's construct/commit flow. Tests whether the context share is
+ * the QMD-dispatch discriminator. Requires gsp_phys_rmcall_vas_shared=1.
+ */
+static bool gsp_phys_rmcall_ctxshare_force_param;
+module_param_named(gsp_phys_rmcall_ctxshare_force,
+ gsp_phys_rmcall_ctxshare_force_param, bool, 0644);
+MODULE_PARM_DESC(gsp_phys_rmcall_ctxshare_force,
+ "Force FERMI_CONTEXT_SHARE_A allocation before the golden replay for any GR promote mode (default 0; requires gsp_phys_rmcall_vas_shared=1)");
+
+bool gsp_phys_rmcall_ctxshare_force_value(void)
+{
+ return gsp_phys_rmcall_ctxshare_force_param;
+}
+EXPORT_SYMBOL_GPL(gsp_phys_rmcall_ctxshare_force_value);
+
+/*
* P5 wave-1 shadow work forwarding (default 0). When set, the sema service
* requests one real CE copy on the debugfs ladder's channel for each decoded
* guest CE push, using only the ladder's module-owned buffers; the software
diff --git a/kernel/gsp_phys_gpu.h b/kernel/gsp_phys_gpu.h
index 8cfb5e9..2087e33 100644
--- a/kernel/gsp_phys_gpu.h
+++ b/kernel/gsp_phys_gpu.h
@@ -128,6 +128,14 @@ u32 gsp_phys_rmcall_golden_exec_shape_value(void);
bool gsp_phys_rmcall_golden_enabled(void);
/*
+ * True when gsp_phys_rmcall_ctxshare_force is set (default 0): allocate
+ * FERMI_CONTEXT_SHARE_A on the ladder TSG before the golden replay for any GR
+ * promote mode, so the mode-31 execution channel V6 attaches to the share
+ * while the mode-31 construct/commit flow stays intact.
+ */
+bool gsp_phys_rmcall_ctxshare_force_value(void);
+
+/*
* True when the gsp_phys_work_forward module parameter is set (default 0: the
* guest's CE pushes stay software-emulated exactly as before). When set, the
* sema service shadows each decoded CE push as one copy on the debugfs ladder's