diff options
| author | Arthur Hanson Rasmusson <arthur@vgpu.io> | 2026-09-30 05:17:23 -0400 |
|---|---|---|
| committer | Arthur Hanson Rasmusson <arthur@vgpu.io> | 2026-09-30 05:17:23 -0400 |
| commit | c9a7d464617f41c447d9e85082839b5b06e2abbd (patch) | |
| tree | 7ac484f12310a540a66f8b4e0e970303a396799d /kernel/gsp_sema_service.c | |
| parent | 50440e5784722b2677eccfbfed391cd880819699 (diff) | |
| download | open-iov-c9a7d464617f41c447d9e85082839b5b06e2abbd.tar.gz open-iov-c9a7d464617f41c447d9e85082839b5b06e2abbd.zip | |
sema-svc: sema_vidmem_dump param to inspect emulated vidmem (CE data-path audit)
Diffstat (limited to 'kernel/gsp_sema_service.c')
| -rw-r--r-- | kernel/gsp_sema_service.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/kernel/gsp_sema_service.c b/kernel/gsp_sema_service.c index 6703403..56285bf 100644 --- a/kernel/gsp_sema_service.c +++ b/kernel/gsp_sema_service.c @@ -5052,6 +5052,42 @@ int gsp_sema_service_add_map(u64 gpu_va, u64 pa, u64 len, u32 ap) } /* + * Dump a range of the emulated vidmem (BAR1 shadow) into the kernel log. + * Debug aid for the CE data path: verifies whether a decoded fill/copy + * actually landed where the CE operand said it should. + */ +int gsp_sema_service_dump_vidmem(u64 addr, u64 len) +{ + struct nv_vgpu_device *vgpu = NULL; + struct nv_vgpu_device *d; + u8 *base; + + if (!len || len > 4096) + return -EINVAL; + + mutex_lock(&nv_vgpu_driver.lock); + list_for_each_entry(d, &nv_vgpu_driver.devices, list) { + if (atomic_read(&d->vfio_dev_open_count) > 0) { + vgpu = d; + break; + } + } + mutex_unlock(&nv_vgpu_driver.lock); + if (!vgpu) + return -ENODEV; + + base = vgpu->bars[1].vaddr; + if (!base || addr + len > vgpu->bars[1].size) + return -EINVAL; + + pr_info("sema-vidmem: dump addr=0x%llx len=%llu\n", + (unsigned long long)addr, (unsigned long long)len); + print_hex_dump(KERN_INFO, "sema-vidmem: ", DUMP_PREFIX_OFFSET, + 16, 1, base + addr, (size_t)len, false); + return 0; +} + +/* * Register a channel's GPU completion counter (guest PA of the u32 the GPU * would advance as pushes complete). Called from the sema_counter debug * parameter; plain state update, so it runs in the caller's context. |
