From d07555097d5f46d0f51c98572a220235ea5fcc0d Mon Sep 17 00:00:00 2001 From: Arthur Hanson Rasmusson Date: Mon, 5 Oct 2026 13:40:15 -0400 Subject: vgsp: add gsp_phys_rmcall_channel to force one GR channel variant Lets a bisection pair any promote shape with any channel shape, in particular V6 (SKIP_CTXBUFFER_ALLOC, KMD-managed) with the server-managed VA-only promote: with skip-ctxbuffer the server's kgrctxMapCtxBuffers does not pre-book the engine context vaList, so the VA branch's vaListSetManaged(NV_FALSE) gate should pass and the per-buffer commit can program the engine context VA. Default 0 keeps the mode-selected walk byte-identical. Not hardware-tested (GPU wedged; see Handoff ADDENDUM 51). --- kernel/gsp_phys_booter.c | 34 ++++++++++++++++++++++++++++++++++ kernel/gsp_phys_gpu.c | 19 +++++++++++++++++++ kernel/gsp_phys_gpu.h | 7 +++++++ 3 files changed, 60 insertions(+) (limited to 'kernel') diff --git a/kernel/gsp_phys_booter.c b/kernel/gsp_phys_booter.c index fae657c..3a65361 100644 --- a/kernel/gsp_phys_booter.c +++ b/kernel/gsp_phys_booter.c @@ -7249,6 +7249,40 @@ static int gsp_phys_rmcall_alloc_channel(void __iomem *bar0) vars = &gsp_phys_rmcall_channel_variants[0]; attempts = 1; } + /* + * Optional explicit force (gsp_phys_rmcall_channel=N): pin the walk to + * one variant after the mode-based selection so a bisection can pair + * any promote shape with any channel shape (e.g. V6 skip-ctxbuffer + + * the srvctx VA-only promote). + */ + if (gsp_phys_rmcall_engine_is_gr() && + gsp_phys_rmcall_channel_value() != 0) { + u32 force = (u32)gsp_phys_rmcall_channel_value(); + u32 j; + bool found = false; + + for (j = 0; j < ARRAY_SIZE(gsp_phys_rmcall_channel_variants); + j++) { + if (gsp_phys_rmcall_channel_variants[j].id != force) + continue; + vars = &gsp_phys_rmcall_channel_variants[j]; + found = true; + break; + } + if (!found && + gsp_phys_rmcall_channel_variant_skipctx.id == force) { + vars = &gsp_phys_rmcall_channel_variant_skipctx; + found = true; + } + if (!found) { + pr_err("vgsp-boot: rm-call: gsp_phys_rmcall_channel=%u is not a known variant id (1/3/4/5/6); aborting the ladder\n", + force); + return -EINVAL; + } + attempts = 1; + pr_info("vgsp-boot: rm-call: gsp_phys_rmcall_channel=%u forces channel variant V%u (%s) alone\n", + force, vars[0].id, vars[0].name); + } ret = -EIO; for (i = 0; i < attempts; i++) { diff --git a/kernel/gsp_phys_gpu.c b/kernel/gsp_phys_gpu.c index 94d6652..54fa84a 100644 --- a/kernel/gsp_phys_gpu.c +++ b/kernel/gsp_phys_gpu.c @@ -200,6 +200,25 @@ bool gsp_phys_srv_ctxcommit_value(void) } EXPORT_SYMBOL_GPL(gsp_phys_srv_ctxcommit_value); +/* + * Force one channel-alloc variant id on the GR ladder (default 0 = the + * promote-mode-selected default). 5 = V5 (client memdescs, no skip-ctxbuffer; + * the server books its managed engine context), 6 = V6 (SKIP_CTXBUFFER_ALLOC, + * KMD-managed: the server skips the ctx-buffer map/book, so a client VA-only + * promote can add and commit the engine context VA). + */ +static int gsp_phys_rmcall_channel_param; +module_param_named(gsp_phys_rmcall_channel, gsp_phys_rmcall_channel_param, + int, 0644); +MODULE_PARM_DESC(gsp_phys_rmcall_channel, + "Force one GR channel-alloc variant id (1/3/4/5/6); 0 = mode-selected default walk"); + +int gsp_phys_rmcall_channel_value(void) +{ + return gsp_phys_rmcall_channel_param; +} +EXPORT_SYMBOL_GPL(gsp_phys_rmcall_channel_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 diff --git a/kernel/gsp_phys_gpu.h b/kernel/gsp_phys_gpu.h index a270df8..925bfb2 100644 --- a/kernel/gsp_phys_gpu.h +++ b/kernel/gsp_phys_gpu.h @@ -89,6 +89,13 @@ bool gsp_phys_srv_ctxbuf_value(void); */ bool gsp_phys_srv_ctxcommit_value(void); +/* + * gsp_phys_rmcall_channel: force one channel-alloc variant id on the GR + * ladder (0 = the promote-mode-selected default). 5 = V5 (client memdescs, + * no skip-ctxbuffer), 6 = V6 (SKIP_CTXBUFFER_ALLOC, KMD-managed ctx). + */ +int gsp_phys_rmcall_channel_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 -- cgit v1.2.3