summaryrefslogtreecommitdiffstats
path: root/kernel/gsp_phys_gpu.c
diff options
context:
space:
mode:
authorArthur Hanson Rasmusson <arthur@vgpu.io>2026-10-02 10:58:17 -0400
committerArthur Hanson Rasmusson <arthur@vgpu.io>2026-10-02 10:58:17 -0400
commit09f241601423b1ae98e97846ee451768ff8a0a9e (patch)
tree7c8cb9c17a91ece09e6e0d525e53e98d1c1fe729 /kernel/gsp_phys_gpu.c
parent55eeaeb12fa8a7d493966f6057f4d34790b8a822 (diff)
downloadopen-iov-09f241601423b1ae98e97846ee451768ff8a0a9e.tar.gz
open-iov-09f241601423b1ae98e97846ee451768ff8a0a9e.zip
gsp-phys: GR engine context allocate/map/promote before the GR sem push (default off; live-unverified at promote)
Diffstat (limited to 'kernel/gsp_phys_gpu.c')
-rw-r--r--kernel/gsp_phys_gpu.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/kernel/gsp_phys_gpu.c b/kernel/gsp_phys_gpu.c
index 227246b..a52714c 100644
--- a/kernel/gsp_phys_gpu.c
+++ b/kernel/gsp_phys_gpu.c
@@ -342,6 +342,62 @@ int gsp_phys_rmcall_engine_value(void)
EXPORT_SYMBOL_GPL(gsp_phys_rmcall_engine_value);
/*
+ * H1 GR context-promote bisection selector (default 0). The p6h1b single
+ * entry (value 1, size raw+subctx) made GSP-RM assert on submission (NOCAT
+ * recType=5 errorCode=0x52a8b04, no fn76 reply) and WPR2 could not be
+ * cleared afterwards, so every other promote shape is opt-in here:
+ * 0 = PROMOTE_CTX is never sent (the GR ladder still runs the geometry
+ * queries, the context buffer/PT allocation, the PDB mapping and the
+ * channel/compute alloc, then stops before BIND with a clear log);
+ * 1 = single MAIN entry, bInitialize=1/bNonmapped=0, size raw+subctx;
+ * 2 = two-phase external-VAS shape (PA-only nonmapped first, then VA-only);
+ * 3 = single MAIN entry like 1 but with size = the exact raw save size.
+ * The set callback clamps out-of-range values to 0 and warns on every nonzero
+ * enable: a failed GR context promote can wedge the device and needs a reboot
+ * with human approval, so run it only when reboot readiness is confirmed.
+ * The value is snapshotted when stage 3 starts; later sysfs changes are noted
+ * once and ignored, so a session can never mix promote shapes.
+ */
+static int gsp_phys_rmcall_gr_promote_param;
+
+static int gsp_phys_rmcall_gr_promote_set(const char *val,
+ const struct kernel_param *kp)
+{
+ int ret;
+
+ ret = param_set_int(val, kp);
+ if (ret)
+ return ret;
+ if (gsp_phys_rmcall_gr_promote_param < 0 ||
+ gsp_phys_rmcall_gr_promote_param > 3) {
+ pr_warn("gsp-phys: gsp_phys_rmcall_gr_promote=%d is outside 0..3; clamping to 0 (no PROMOTE_CTX)\n",
+ gsp_phys_rmcall_gr_promote_param);
+ gsp_phys_rmcall_gr_promote_param = 0;
+ }
+ if (gsp_phys_rmcall_gr_promote_param != 0)
+ pr_warn("gsp-phys: WARNING: gsp_phys_rmcall_gr_promote=%d enabled: a failed GR context promote can assert GSP-RM (NOCAT recType=5 errorCode=0x52a8b04) and wedge the device with WPR2 left up and teardown unable to clear it; recovery requires a reboot with human approval - run only when reboot readiness is confirmed\n",
+ gsp_phys_rmcall_gr_promote_param);
+ return 0;
+}
+
+static const struct kernel_param_ops gsp_phys_rmcall_gr_promote_ops = {
+ .set = gsp_phys_rmcall_gr_promote_set,
+ .get = param_get_int,
+};
+
+module_param_cb(gsp_phys_rmcall_gr_promote,
+ &gsp_phys_rmcall_gr_promote_ops,
+ &gsp_phys_rmcall_gr_promote_param, 0644);
+MODULE_PARM_DESC(gsp_phys_rmcall_gr_promote,
+ "GR context-promote bisection (default 0: never send PROMOTE_CTX; 1: single entry init+nonmapped=0 size=raw+subctx, the p6h1b shape; 2: two-phase PA-only nonmapped then VA-only; 3: single entry size=raw); values outside 0..3 clamp to 0 with a warning");
+
+int gsp_phys_rmcall_gr_promote_value(void)
+{
+ return gsp_phys_rmcall_gr_promote_param;
+}
+EXPORT_SYMBOL_GPL(gsp_phys_rmcall_gr_promote_value);
+
+/*
* One-way power latch (default). Re-enabling runtime PM and D3cold after a
* claim lets the board power-gate and the host hard-freeze on resume
* (observed 2026-10-01); keep the pre-claim D0 policy instead and require