summaryrefslogtreecommitdiffstats
path: root/kernel/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/main.c')
-rw-r--r--kernel/main.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/kernel/main.c b/kernel/main.c
index c96abf8..458ba36 100644
--- a/kernel/main.c
+++ b/kernel/main.c
@@ -3660,6 +3660,38 @@ module_param_cb(dump_vidmem, &nv_vgpu_dump_vidmem_ops, NULL, 0200);
MODULE_PARM_DESC(dump_vidmem, "Dump emulated vidmem range (hex offset,hex len)");
/*
+ * Whole-vidmem page-hash bracket: snapshot every 4 KB page hash of the
+ * emulated vidmem, then re-hash and report the pages whose content changed.
+ * echo 1 > .../parameters/vidmem_hash_snap
+ * echo 1 > .../parameters/vidmem_hash_diff
+ */
+static int nv_vgpu_vidmem_hash_snap_set(const char *val,
+ const struct kernel_param *kp)
+{
+ return gsp_sema_service_vidmem_hash_snapshot();
+}
+
+static int nv_vgpu_vidmem_hash_diff_set(const char *val,
+ const struct kernel_param *kp)
+{
+ return gsp_sema_service_vidmem_hash_diff("manual", 64);
+}
+
+static const struct kernel_param_ops nv_vgpu_vidmem_hash_snap_ops = {
+ .set = nv_vgpu_vidmem_hash_snap_set,
+};
+
+static const struct kernel_param_ops nv_vgpu_vidmem_hash_diff_ops = {
+ .set = nv_vgpu_vidmem_hash_diff_set,
+};
+
+module_param_cb(vidmem_hash_snap, &nv_vgpu_vidmem_hash_snap_ops, NULL, 0200);
+MODULE_PARM_DESC(vidmem_hash_snap, "Snapshot whole-vidmem page hashes");
+module_param_cb(vidmem_hash_diff, &nv_vgpu_vidmem_hash_diff_ops, NULL, 0200);
+MODULE_PARM_DESC(vidmem_hash_diff,
+ "Diff whole-vidmem page hashes (tag manual, first 64 pages)");
+
+/*
* Debug: hex-dump or scan the BAR0 register shadow. Guest MMIO writes that go
* through the mapped shadow never reach the write callback, so this is the
* only way to observe registers the guest writes directly (e.g. the