summaryrefslogtreecommitdiffstats
path: root/kernel/main.c
diff options
context:
space:
mode:
authorArthur Hanson Rasmusson <arthur@vgpu.io>2026-09-30 05:17:23 -0400
committerArthur Hanson Rasmusson <arthur@vgpu.io>2026-09-30 05:17:23 -0400
commit85113f53848b1d1ae577967fff540d6406346ff2 (patch)
treef776b878bb1f3b4ec6a15f59ccbf7e32c47eb449 /kernel/main.c
parenta422055208b800313d44c9fa6a3df81e650999e2 (diff)
downloadopen-iov-85113f53848b1d1ae577967fff540d6406346ff2.tar.gz
open-iov-85113f53848b1d1ae577967fff540d6406346ff2.zip
sema-svc: sema_vidmem_dump param to inspect emulated vidmem (CE data-path audit)
Diffstat (limited to 'kernel/main.c')
-rw-r--r--kernel/main.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/kernel/main.c b/kernel/main.c
index 454f3b9..52156dc 100644
--- a/kernel/main.c
+++ b/kernel/main.c
@@ -2540,6 +2540,36 @@ module_param_cb(sema_counter, &nv_vgpu_sema_counter_ops, NULL, 0200);
MODULE_PARM_DESC(sema_counter, "Register channel GPU completion counter (h_object,pa)");
/*
+ * Debug: dump a range of the emulated vidmem (BAR1 shadow) into the kernel
+ * log, to verify where a decoded CE copy actually landed:
+ * echo 0x227000,256 > .../parameters/sema_vidmem_dump
+ */
+static int nv_vgpu_sema_vidmem_dump_set(const char *val,
+ const struct kernel_param *kp)
+{
+ char buf[64];
+ char *comma;
+ u64 addr = 0, len = 0;
+
+ strscpy(buf, val, sizeof(buf));
+ comma = strchr(buf, ',');
+ if (!comma)
+ return -EINVAL;
+ *comma = '\0';
+ if (kstrtoull(buf, 0, &addr) || kstrtoull(comma + 1, 0, &len))
+ return -EINVAL;
+
+ return gsp_sema_service_dump_vidmem(addr, len);
+}
+
+static const struct kernel_param_ops nv_vgpu_sema_vidmem_dump_ops = {
+ .set = nv_vgpu_sema_vidmem_dump_set,
+};
+
+module_param_cb(sema_vidmem_dump, &nv_vgpu_sema_vidmem_dump_ops, NULL, 0200);
+MODULE_PARM_DESC(sema_vidmem_dump, "Dump emulated vidmem (addr,len) to the kernel log");
+
+/*
* Debug: find page-table entries pointing at a physical address, in guest RAM
* and emulated vidmem:
* echo 0x12442b000 > .../parameters/scan_pt