summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArthur Hanson Rasmusson <arthur@vgpu.io>2026-10-05 14:02:31 -0400
committerArthur Hanson Rasmusson <arthur@vgpu.io>2026-10-05 14:02:31 -0400
commit6e2e0965c3e268acddd12bcc4c983c36c573f67e (patch)
tree7ad4fdfcbacbe9939399c46a24caa4472d7eaed4
parente2fbb2756cca242f8ee14e1106d43b7d18195dd1 (diff)
downloadopen-iov-6e2e0965c3e268acddd12bcc4c983c36c573f67e.tar.gz
open-iov-6e2e0965c3e268acddd12bcc4c983c36c573f67e.zip
vgsp: V6 client-owned ctx-buffer VA commit path (srvctx)
Source-confirmed: with the SKIP_CTXBUFFER_ALLOC channel flag the server does not allocate MAIN, does not map/book it, and its internal init/promote helpers return early for KMD virtual contexts. The client therefore owns the buffer. When no server MAIN is reported on a V6 channel, map the prepared client MAIN at the ladder ctx VA (sysmem PTEs), send GPU_INITIALIZE_CTX to install the memdesc, then the UVM-shape VA-only promote; with no server pre-booking the vaListSetManaged gate should pass and the per-buffer commit program the engine context pointer. V5 keeps the historical PA-only fallback. Build clean; not hardware-tested (GPU wedged).
-rw-r--r--kernel/gsp_phys_booter.c35
1 files changed, 33 insertions, 2 deletions
diff --git a/kernel/gsp_phys_booter.c b/kernel/gsp_phys_booter.c
index ebe873b..8a27edf 100644
--- a/kernel/gsp_phys_booter.c
+++ b/kernel/gsp_phys_booter.c
@@ -1356,6 +1356,10 @@ static struct gsp_phys_boot_stage {
* The engine context pointer needs a VA; a PA-only entry books none.
*/
bool rmcall_srv_ctxva;
+ /* true when the VA path commits the CLIENT buffer (V6 KMD virtual
+ * context: the server neither allocates nor books the ctx buffer), so
+ * INITIALIZE_CTX must run first to install the memdesc. */
+ bool rmcall_srv_ctxva_client;
/* Server-reported PATCH buffer (bufferType 2), mapped at VA_GR_PATCH
* on the server-VA path and promoted VA-only with MAIN. */
bool rmcall_srv_patch_valid;
@@ -2032,6 +2036,7 @@ static void gsp_phys_rmcall_reset(void)
boot_stage.rmcall_srv_main_size = 0;
boot_stage.rmcall_srv_main_aperture = 0;
boot_stage.rmcall_srv_ctxva = false;
+ boot_stage.rmcall_srv_ctxva_client = false;
boot_stage.rmcall_srv_patch_valid = false;
boot_stage.rmcall_srv_patch_pa = 0;
boot_stage.rmcall_srv_patch_size = 0;
@@ -9140,6 +9145,28 @@ static int gsp_phys_rmcall_srv_ctx_commit(void __iomem *bar0)
pa_attr = GSP_PHYS_RMCALL_GR_CTX_PHYS_ATTR;
pr_warn("vgsp-boot: rm-call: server MAIN ctx buffer was not reported; committing the CLIENT MAIN buffer pa=0x%llx size=0x%llx mapped (VA 0x%llx, PDE installed) instead\n",
main_pa, main_size, GSP_PHYS_RMCALL_VA_GR_CTX);
+ /*
+ * V6 (SKIP_CTXBUFFER_ALLOC, KMD virtual context): the server
+ * neither allocates MAIN nor books the engine-ctx vaList
+ * (kgrctxAllocCtxBuffers / kgrctxMapCtxBuffers skip on this
+ * flag), so the client owns the buffer. Map the prepared client
+ * buffer at the ctx VA and commit it with the UVM-shape VA-only
+ * promote; because no engine-ctx memdesc exists yet,
+ * INITIALIZE_CTX runs first to install one from the client
+ * PA/size. The V5 fallback keeps the historical PA-only promote.
+ */
+ if (boot_stage.rmcall_channel_variant ==
+ gsp_phys_rmcall_channel_variant_skipctx.id &&
+ boot_stage.rmcall_ctx_prepared &&
+ boot_stage.rmcall_ctx_pt_pages > 0) {
+ boot_stage.rmcall_ctx_va = GSP_PHYS_RMCALL_VA_GR_CTX;
+ boot_stage.rmcall_srv_ctxva = true;
+ boot_stage.rmcall_srv_ctxva_client = true;
+ gsp_phys_rmcall_pdb_build();
+ pr_info("vgsp-boot: rm-call: client MAIN mapped at VA 0x%llx (sysmem PTEs, %u pages); the KMD VA-only promote will commit it\n",
+ boot_stage.rmcall_ctx_va,
+ boot_stage.rmcall_ctx_pages);
+ }
}
/*
@@ -9150,9 +9177,13 @@ static int gsp_phys_rmcall_srv_ctx_commit(void __iomem *bar0)
* already-initialized gate). Send only the UVM-shape VA-only promote
* entries (bInitialize=0, bNonmapped=0, gpuVirtAddr only), which take
* the per-buffer VA commit branch and program the engine context
- * pointer. Otherwise: INITIALIZE_CTX + PATCH/MAIN PA-only.
+ * pointer. Exception: the V6 client-buffer VA path has no engine
+ * memdesc yet, so INITIALIZE_CTX installs one from the client PA/size
+ * before the VA promote. Otherwise: INITIALIZE_CTX + PATCH/MAIN
+ * PA-only.
*/
- if (!boot_stage.rmcall_srv_ctxva) {
+ if (!boot_stage.rmcall_srv_ctxva ||
+ boot_stage.rmcall_srv_ctxva_client) {
ic = kvzalloc(sizeof(*ic), GFP_KERNEL);
if (!ic)
return -ENOMEM;