From c9a7d464617f41c447d9e85082839b5b06e2abbd Mon Sep 17 00:00:00 2001 From: Arthur Hanson Rasmusson Date: Wed, 30 Sep 2026 05:17:23 -0400 Subject: sema-svc: sema_vidmem_dump param to inspect emulated vidmem (CE data-path audit) --- kernel/main.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'kernel/main.c') diff --git a/kernel/main.c b/kernel/main.c index 454f3b9..52156dc 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -2539,6 +2539,36 @@ static const struct kernel_param_ops nv_vgpu_sema_counter_ops = { 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: -- cgit v1.2.3