aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorMichal Wajdeczko <michal.wajdeczko@intel.com>2025-09-28 16:00:24 +0200
committerMichal Wajdeczko <michal.wajdeczko@intel.com>2025-09-29 23:58:43 +0200
commit4d4af0d6cbbfaf90ade642b29e50c745906c1187 (patch)
tree656caf93884123a660090095d709c0c1e9e730b2 /drivers/gpu/drm
parent1238b84ea305d5bb891761f3bd5f58763e2a6778 (diff)
drm/xe/pf: Create separate debugfs tree for SR-IOV files
Currently we expose debugfs files related to SR-IOV functions together with other native files, but that approach will not scale well as we plan to add more attributes and also expose some of them on the per-tile basis. Start building separate tree for SR-IOV specific debugfs files where we can replicate similar files per every SR-IOV function: /sys/kernel/debug/dri/BDF/ ├── sriov │ ├── pf │ │ ├── tile0 │ │ │ ├── gt0 │ │ │ ├── gt1 │ │ │ : │ │ ├── tile1 │ │ : │ ├── vf1 │ │ ├── tile0 │ │ │ ├── gt0 │ │ │ ├── gt1 │ │ │ : │ │ : │ ├── vf2 │ ├── ... We will populate this new tree in upcoming patches. Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com> Cc: Lucas De Marchi <lucas.demarchi@intel.com> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com> Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com> Link: https://lore.kernel.org/r/20250928140029.198847-3-michal.wajdeczko@intel.com
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/xe/xe_sriov_pf_debugfs.c58
1 files changed, 49 insertions, 9 deletions
diff --git a/drivers/gpu/drm/xe/xe_sriov_pf_debugfs.c b/drivers/gpu/drm/xe/xe_sriov_pf_debugfs.c
index 2a1316048439..37cc3a297667 100644
--- a/drivers/gpu/drm/xe/xe_sriov_pf_debugfs.c
+++ b/drivers/gpu/drm/xe/xe_sriov_pf_debugfs.c
@@ -9,7 +9,9 @@
#include "xe_device_types.h"
#include "xe_sriov_pf.h"
#include "xe_sriov_pf_debugfs.h"
+#include "xe_sriov_pf_helpers.h"
#include "xe_sriov_pf_service.h"
+#include "xe_sriov_printk.h"
static int simple_show(struct seq_file *m, void *data)
{
@@ -28,27 +30,65 @@ static const struct drm_info_list debugfs_list[] = {
{ .name = "versions", .show = simple_show, .data = xe_sriov_pf_service_print_versions },
};
+static void pf_populate_pf(struct xe_device *xe, struct dentry *pfdent)
+{
+ struct drm_minor *minor = xe->drm.primary;
+
+ drm_debugfs_create_files(debugfs_list, ARRAY_SIZE(debugfs_list), pfdent, minor);
+}
+
/**
* xe_sriov_pf_debugfs_register - Register PF debugfs attributes.
* @xe: the &xe_device
* @root: the root &dentry
*
- * Prepare debugfs attributes exposed by the PF.
+ * Create separate directory that will contain all SR-IOV related files,
+ * organized per each SR-IOV function (PF, VF1, VF2, ..., VFn).
*/
void xe_sriov_pf_debugfs_register(struct xe_device *xe, struct dentry *root)
{
- struct drm_minor *minor = xe->drm.primary;
- struct dentry *parent;
+ int totalvfs = xe_sriov_pf_get_totalvfs(xe);
+ struct dentry *pfdent;
+ struct dentry *vfdent;
+ struct dentry *dent;
+ char vfname[16]; /* should be more than enough for "vf%u\0" and VFID(UINT_MAX) */
+ unsigned int n;
/*
- * /sys/kernel/debug/dri/0/
- * ├── pf
+ * /sys/kernel/debug/dri/BDF/
+ * ├── sriov # d_inode->i_private = (xe_device*)
* │ ├── ...
*/
- parent = debugfs_create_dir("pf", root);
- if (IS_ERR(parent))
+ dent = debugfs_create_dir("sriov", root);
+ if (IS_ERR(dent))
+ return;
+ dent->d_inode->i_private = xe;
+
+ /*
+ * /sys/kernel/debug/dri/BDF/
+ * ├── sriov # d_inode->i_private = (xe_device*)
+ * │ ├── pf # d_inode->i_private = (xe_device*)
+ * │ │ ├── ...
+ */
+ pfdent = debugfs_create_dir("pf", dent);
+ if (IS_ERR(pfdent))
return;
- parent->d_inode->i_private = xe;
+ pfdent->d_inode->i_private = xe;
+
+ pf_populate_pf(xe, pfdent);
- drm_debugfs_create_files(debugfs_list, ARRAY_SIZE(debugfs_list), parent, minor);
+ /*
+ * /sys/kernel/debug/dri/BDF/
+ * ├── sriov # d_inode->i_private = (xe_device*)
+ * │ ├── vf1 # d_inode->i_private = VFID(1)
+ * │ ├── vf2 # d_inode->i_private = VFID(2)
+ * │ ├── ...
+ */
+ for (n = 1; n <= totalvfs; n++) {
+ snprintf(vfname, sizeof(vfname), "vf%u", VFID(n));
+ vfdent = debugfs_create_dir(vfname, dent);
+ if (IS_ERR(vfdent))
+ return;
+ vfdent->d_inode->i_private = (void *)(uintptr_t)VFID(n);
+ }
}