summaryrefslogtreecommitdiffstats
path: root/kernel/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/main.c')
-rw-r--r--kernel/main.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/kernel/main.c b/kernel/main.c
index 3a42132..efa4bf7 100644
--- a/kernel/main.c
+++ b/kernel/main.c
@@ -2578,6 +2578,37 @@ 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: search the whole emulated vidmem for an 8-byte pattern:
+ * echo 0x0000000400000001,16 > .../parameters/sema_vidmem_find
+ */
+static int nv_vgpu_sema_vidmem_find_set(const char *val,
+ const struct kernel_param *kp)
+{
+ char buf[64];
+ char *comma;
+ u64 pattern = 0, max_hits = 16;
+
+ strscpy(buf, val, sizeof(buf));
+ comma = strchr(buf, ',');
+ if (comma) {
+ *comma = '\0';
+ if (kstrtoull(comma + 1, 0, &max_hits))
+ return -EINVAL;
+ }
+ if (kstrtoull(buf, 0, &pattern))
+ return -EINVAL;
+
+ return gsp_sema_service_find_vidmem(pattern, max_hits);
+}
+
+static const struct kernel_param_ops nv_vgpu_sema_vidmem_find_ops = {
+ .set = nv_vgpu_sema_vidmem_find_set,
+};
+
+module_param_cb(sema_vidmem_find, &nv_vgpu_sema_vidmem_find_ops, NULL, 0200);
+MODULE_PARM_DESC(sema_vidmem_find, "Search emulated vidmem for an 8-byte pattern (pattern, max_hits)");
+
+/*
* Debug: find page-table entries pointing at a physical address, in guest RAM
* and emulated vidmem:
* echo 0x12442b000 > .../parameters/scan_pt