summaryrefslogtreecommitdiffstats
path: root/legacy-driver-guest/debugfs/gsp_debugfs.c
diff options
context:
space:
mode:
authorArthur Hanson Rasmusson <arthur@vgpu.io>2026-09-23 06:06:26 -0400
committerArthur Hanson Rasmusson <arthur@vgpu.io>2026-09-23 06:06:26 -0400
commit333d6de1e764edc176b0003af095cee4888ecd2c (patch)
tree0c6db46fe05f56e33ba13c3dd3c6e667c0ed8e42 /legacy-driver-guest/debugfs/gsp_debugfs.c
parent2302fc09080bad51c73f293294e19fd4db464eb0 (diff)
downloadopen-iov-333d6de1e764edc176b0003af095cee4888ecd2c.tar.gz
open-iov-333d6de1e764edc176b0003af095cee4888ecd2c.zip
Untrack legacy trees and purely legacy docs (kept locally)
- patches/ -> legacy-patches/ (gitignored) - legacy-driver-guest/ (old guest vGPU driver, gitignored) - docs/old/ (superseded architecture write-up, gitignored) - docs that only reference the legacy components stay tracked; their path references now point at legacy-patches/ - install.sh PATCH_DIR updated
Diffstat (limited to 'legacy-driver-guest/debugfs/gsp_debugfs.c')
-rw-r--r--legacy-driver-guest/debugfs/gsp_debugfs.c273
1 files changed, 0 insertions, 273 deletions
diff --git a/legacy-driver-guest/debugfs/gsp_debugfs.c b/legacy-driver-guest/debugfs/gsp_debugfs.c
deleted file mode 100644
index f3df124..0000000
--- a/legacy-driver-guest/debugfs/gsp_debugfs.c
+++ /dev/null
@@ -1,273 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * GSP vGPU-IO Driver - Debugfs Interface
- */
-
-#include "gsp_core.h"
-#include <linux/debugfs.h>
-#include <linux/seq_file.h>
-
-static int gsp_debugfs_vfs_show(struct seq_file *s, void *unused)
-{
- struct gsp_device *gsp = s->private;
- struct gsp_vf *vf;
-
- seq_printf(s, "%-4s %-12s %-10s %-18s %-18s\n",
- "ID", "STATE", "REFCNT", "BAR1", "PAGE_TABLE");
-
- mutex_lock(&gsp->vf_lock);
- list_for_each_entry(vf, &gsp->vf_list, list) {
- seq_printf(s, "%-4u %-12d %-10d 0x%016llx-0x%016llx 0x%016llx-0x%016llx\n",
- vf->id, vf->state, atomic_read(&vf->refcount),
- vf->bar1_offset, vf->bar1_offset + vf->bar1_size,
- vf->pt_base, vf->pt_base + vf->pt_size);
- }
- mutex_unlock(&gsp->vf_lock);
-
- return 0;
-}
-
-static int gsp_debugfs_vfs_open(struct inode *inode, struct file *file)
-{
- return single_open(file, gsp_debugfs_vfs_show, inode->i_private);
-}
-
-static const struct file_operations gsp_debugfs_vfs_fops = {
- .open = gsp_debugfs_vfs_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
-};
-
-static int gsp_debugfs_vf_show(struct seq_file *s, void *unused)
-{
- struct gsp_vf *vf = s->private;
- struct gsp_wpr_region *rgn;
-
- seq_printf(s, "VF %u\n", vf->id);
- seq_printf(s, " State: %d\n", vf->state);
- seq_printf(s, " Refcount: %d\n", atomic_read(&vf->refcount));
- seq_printf(s, " BAR1: 0x%llx - 0x%llx (size: 0x%llx)\n",
- vf->bar1_offset, vf->bar1_offset + vf->bar1_size, vf->bar1_size);
- seq_printf(s, " Page Table: 0x%llx - 0x%llx (size: 0x%llx)\n",
- vf->pt_base, vf->pt_base + vf->pt_size, vf->pt_size);
- seq_printf(s, " Cmd Buffer: 0x%llx - 0x%llx (size: 0x%llx)\n",
- vf->cmd_base, vf->cmd_base + vf->cmd_size, vf->cmd_size);
- seq_printf(s, " BAR State:\n");
- seq_printf(s, " Aperture: 0x%llx - 0x%llx\n",
- vf->bar_state.aperture_offset,
- vf->bar_state.aperture_offset + vf->bar_state.aperture_size);
- seq_printf(s, " ForceAcc: %s (VF: %u)\n",
- vf->bar_state.force_access ? "enabled" : "disabled",
- vf->bar_state.force_vf);
- seq_printf(s, " WPR Regions:\n");
-
- mutex_lock(&vf->wpr_lock);
- list_for_each_entry(rgn, &vf->wpr_list, list) {
- seq_printf(s, " [0x%llx, 0x%llx) flags=0x%x\n",
- rgn->base, rgn->base + rgn->size, rgn->flags);
- }
- mutex_unlock(&vf->wpr_lock);
-
- if (vf->migration) {
- seq_printf(s, " Migration:\n");
- seq_printf(s, " State: %d\n", vf->migration->state);
- seq_printf(s, " Dst VF: %llu\n", vf->migration->dst_vf);
- seq_printf(s, " Token: 0x%llx\n", vf->migration->token);
- seq_printf(s, " Progress: %llu pages, %llu bytes\n",
- vf->migration->progress.pages_transferred,
- vf->migration->progress.bytes_transferred);
- }
-
- return 0;
-}
-
-static int gsp_debugfs_vf_open(struct inode *inode, struct file *file)
-{
- return single_open(file, gsp_debugfs_vf_show, inode->i_private);
-}
-
-static const struct file_operations gsp_debugfs_vf_fops = {
- .open = gsp_debugfs_vf_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
-};
-
-static int gsp_debugfs_rpc_show(struct seq_file *s, void *unused)
-{
- struct gsp_device *gsp = s->private;
-
- seq_printf(s, "RPC Statistics:\n");
- seq_printf(s, " Total: %lld\n", atomic64_read(&gsp->rpc_total));
- seq_printf(s, " Errors: %lld\n", atomic64_read(&gsp->rpc_errors));
- seq_printf(s, " BAR Traps: %lld\n", atomic64_read(&gsp->bar_traps));
- seq_printf(s, " WPR Events: %lld\n", atomic64_read(&gsp->wpr_events));
- seq_printf(s, " Migrations: %lld\n", atomic64_read(&gsp->migrations));
-
- return 0;
-}
-
-static int gsp_debugfs_rpc_open(struct inode *inode, struct file *file)
-{
- return single_open(file, gsp_debugfs_rpc_show, inode->i_private);
-}
-
-static const struct file_operations gsp_debugfs_rpc_fops = {
- .open = gsp_debugfs_rpc_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
-};
-
-static int gsp_debugfs_bar_show(struct seq_file *s, void *unused)
-{
- struct gsp_vf *vf = s->private;
-
- seq_printf(s, "VF %u BAR State:\n", vf->id);
- seq_printf(s, " Aperture Offset: 0x%llx\n", vf->bar_state.aperture_offset);
- seq_printf(s, " Aperture Size: 0x%llx\n", vf->bar_state.aperture_size);
- seq_printf(s, " Force Access: %s\n", vf->bar_state.force_access ? "enabled" : "disabled");
- seq_printf(s, " Force VF: %u\n", vf->bar_state.force_vf);
- seq_printf(s, " Backing Store: %p\n", vf->bar_state.backing_store);
- seq_printf(s, " Backing Size: 0x%zx\n", vf->bar_state.backing_size);
-
- return 0;
-}
-
-static int gsp_debugfs_bar_open(struct inode *inode, struct file *file)
-{
- return single_open(file, gsp_debugfs_bar_show, inode->i_private);
-}
-
-static const struct file_operations gsp_debugfs_bar_fops = {
- .open = gsp_debugfs_bar_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
-};
-
-static int gsp_debugfs_wpr_show(struct seq_file *s, void *unused)
-{
- struct gsp_vf *vf = s->private;
- struct gsp_wpr_region *rgn;
-
- seq_printf(s, "VF %u WPR Regions:\n", vf->id);
-
- mutex_lock(&vf->wpr_lock);
- list_for_each_entry(rgn, &vf->wpr_list, list) {
- seq_printf(s, " [0x%llx, 0x%llx) size=0x%llx flags=0x%x\n",
- rgn->base, rgn->base + rgn->size, rgn->size, rgn->flags);
- }
- mutex_unlock(&vf->wpr_lock);
-
- return 0;
-}
-
-static int gsp_debugfs_wpr_open(struct inode *inode, struct file *file)
-{
- return single_open(file, gsp_debugfs_wpr_show, inode->i_private);
-}
-
-static const struct file_operations gsp_debugfs_wpr_fops = {
- .open = gsp_debugfs_wpr_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
-};
-
-static int gsp_debugfs_migration_show(struct seq_file *s, void *unused)
-{
- struct gsp_vf *vf = s->private;
-
- if (!vf->migration) {
- seq_printf(s, "No active migration\n");
- return 0;
- }
-
- seq_printf(s, "VF %u Migration:\n", vf->id);
- seq_printf(s, " State: %d\n", vf->migration->state);
- seq_printf(s, " Destination VF: %llu\n", vf->migration->dst_vf);
- seq_printf(s, " Token: 0x%llx\n", vf->migration->token);
- seq_printf(s, " Flags: 0x%x\n", vf->migration->flags);
- seq_printf(s, " Pages Xfer: %llu\n", vf->migration->progress.pages_transferred);
- seq_printf(s, " Bytes Xfer: %llu\n", vf->migration->progress.bytes_transferred);
- seq_printf(s, " Dirty Pages: %llu\n", vf->migration->progress.dirty_pages);
- seq_printf(s, " Cancelled: %s\n", vf->migration->cancelled ? "yes" : "no");
-
- return 0;
-}
-
-static int gsp_debugfs_migration_open(struct inode *inode, struct file *file)
-{
- return single_open(file, gsp_debugfs_migration_show, inode->i_private);
-}
-
-static const struct file_operations gsp_debugfs_migration_fops = {
- .open = gsp_debugfs_migration_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
-};
-
-/* VF Debugfs Directory Creation */
-static void gsp_debugfs_vf_create(struct gsp_vf *vf)
-{
- char name[16];
- struct dentry *vf_dir;
-
- snprintf(name, sizeof(name), "vf%u", vf->id);
- vf_dir = debugfs_create_dir(name, vf->gsp->debugfs_vfs_dir);
- if (!vf_dir)
- return;
-
- debugfs_create_file("status", 0444, vf_dir, vf, &gsp_debugfs_vf_fops);
- debugfs_create_file("bar", 0444, vf_dir, vf, &gsp_debugfs_bar_fops);
- debugfs_create_file("wpr", 0444, vf_dir, vf, &gsp_debugfs_wpr_fops);
- debugfs_create_file("migration", 0444, vf_dir, vf, &gsp_debugfs_migration_fops);
-}
-
-/* Main Debugfs Init */
-int gsp_debugfs_init(struct gsp_device *gsp)
-{
- gsp->debugfs_root = debugfs_create_dir("gsp-vgpu", NULL);
- if (!gsp->debugfs_root)
- return -ENOMEM;
-
- debugfs_create_file("vfs", 0444, gsp->debugfs_root, gsp, &gsp_debugfs_vfs_fops);
- debugfs_create_file("rpc", 0444, gsp->debugfs_root, gsp, &gsp_debugfs_rpc_fops);
-
- gsp->debugfs_vfs_dir = debugfs_create_dir("vfs", gsp->debugfs_root);
- if (!gsp->debugfs_vfs_dir) {
- debugfs_remove_recursive(gsp->debugfs_root);
- return -ENOMEM;
- }
-
- /* Create entries for existing VFs */
- mutex_lock(&gsp->vf_lock);
- struct gsp_vf *vf;
- list_for_each_entry(vf, &gsp->vf_list, list)
- gsp_debugfs_vf_create(vf);
- mutex_unlock(&gsp->vf_lock);
-
- return 0;
-}
-
-void gsp_debugfs_fini(struct gsp_device *gsp)
-{
- if (gsp->debugfs_root)
- debugfs_remove_recursive(gsp->debugfs_root);
-}
-
-/* Export for VF creation/destruction */
-void gsp_debugfs_vf_add(struct gsp_vf *vf)
-{
- gsp_debugfs_vf_create(vf);
-}
-
-void gsp_debugfs_vf_remove(struct gsp_vf *vf)
-{
- char name[16];
- snprintf(name, sizeof(name), "vf%u", vf->id);
- debugfs_remove_recursive(debugfs_lookup(name, vf->gsp->debugfs_vfs_dir));
-} \ No newline at end of file