]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/xe/pf: Promote PF debugfs function to its own file
authorMichal Wajdeczko <michal.wajdeczko@intel.com>
Sun, 28 Sep 2025 14:00:23 +0000 (16:00 +0200)
committerMichal Wajdeczko <michal.wajdeczko@intel.com>
Mon, 29 Sep 2025 21:58:41 +0000 (23:58 +0200)
In upcoming patches, we will build on the PF separate debugfs
tree for all SR-IOV related files and this new code will need
dedicated file. To minimize large diffs later, move existing
function now as-is, so any future modifications will be done
directly in target file.

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-2-michal.wajdeczko@intel.com
drivers/gpu/drm/xe/Makefile
drivers/gpu/drm/xe/xe_debugfs.c
drivers/gpu/drm/xe/xe_sriov_pf.c
drivers/gpu/drm/xe/xe_sriov_pf.h
drivers/gpu/drm/xe/xe_sriov_pf_debugfs.c [new file with mode: 0644]
drivers/gpu/drm/xe/xe_sriov_pf_debugfs.h [new file with mode: 0644]

index d9c6cf0f189efb3018906b35c1e6943863535196..534355c23e808fe7eb54bc111d05e9ead77de593 100644 (file)
@@ -174,6 +174,7 @@ xe-$(CONFIG_PCI_IOV) += \
        xe_lmtt_ml.o \
        xe_pci_sriov.o \
        xe_sriov_pf.o \
+       xe_sriov_pf_debugfs.o \
        xe_sriov_pf_service.o
 
 # include helpers for tests even when XE is built-in
index cd977dbd1ef63e624692589c7aecb70e18206cdf..dba0a9c4a4d224d64d42f54e938a44db8bbe5305 100644 (file)
@@ -23,7 +23,7 @@
 #include "xe_psmi.h"
 #include "xe_pxp_debugfs.h"
 #include "xe_sriov.h"
-#include "xe_sriov_pf.h"
+#include "xe_sriov_pf_debugfs.h"
 #include "xe_sriov_vf.h"
 #include "xe_step.h"
 #include "xe_tile_debugfs.h"
index 27ddf3cc80e9c47738f6df4aa865c5962743c794..4698348c010a2a0d746a8b5080ea8734821afd69 100644 (file)
@@ -146,45 +146,3 @@ void xe_sriov_pf_print_vfs_summary(struct xe_device *xe, struct drm_printer *p)
        drm_printf(p, "supported: %u\n", xe->sriov.pf.driver_max_vfs);
        drm_printf(p, "enabled: %u\n", pci_num_vf(pdev));
 }
-
-static int simple_show(struct seq_file *m, void *data)
-{
-       struct drm_printer p = drm_seq_file_printer(m);
-       struct drm_info_node *node = m->private;
-       struct dentry *parent = node->dent->d_parent;
-       struct xe_device *xe = parent->d_inode->i_private;
-       void (*print)(struct xe_device *, struct drm_printer *) = node->info_ent->data;
-
-       print(xe, &p);
-       return 0;
-}
-
-static const struct drm_info_list debugfs_list[] = {
-       { .name = "vfs", .show = simple_show, .data = xe_sriov_pf_print_vfs_summary },
-       { .name = "versions", .show = simple_show, .data = xe_sriov_pf_service_print_versions },
-};
-
-/**
- * xe_sriov_pf_debugfs_register - Register PF debugfs attributes.
- * @xe: the &xe_device
- * @root: the root &dentry
- *
- * Prepare debugfs attributes exposed by the PF.
- */
-void xe_sriov_pf_debugfs_register(struct xe_device *xe, struct dentry *root)
-{
-       struct drm_minor *minor = xe->drm.primary;
-       struct dentry *parent;
-
-       /*
-        *      /sys/kernel/debug/dri/0/
-        *      ├── pf
-        *      │   ├── ...
-        */
-       parent = debugfs_create_dir("pf", root);
-       if (IS_ERR(parent))
-               return;
-       parent->d_inode->i_private = xe;
-
-       drm_debugfs_create_files(debugfs_list, ARRAY_SIZE(debugfs_list), parent, minor);
-}
index e3b34f8f5e0467d1f34a4c70ce81ce8ec3282f3a..e6cf930ecde48bdab057bba62f6fae97036a28df 100644 (file)
@@ -16,7 +16,6 @@ struct xe_device;
 bool xe_sriov_pf_readiness(struct xe_device *xe);
 int xe_sriov_pf_init_early(struct xe_device *xe);
 int xe_sriov_pf_wait_ready(struct xe_device *xe);
-void xe_sriov_pf_debugfs_register(struct xe_device *xe, struct dentry *root);
 void xe_sriov_pf_print_vfs_summary(struct xe_device *xe, struct drm_printer *p);
 #else
 static inline bool xe_sriov_pf_readiness(struct xe_device *xe)
@@ -28,10 +27,6 @@ static inline int xe_sriov_pf_init_early(struct xe_device *xe)
 {
        return 0;
 }
-
-static inline void xe_sriov_pf_debugfs_register(struct xe_device *xe, struct dentry *root)
-{
-}
 #endif
 
 #endif
diff --git a/drivers/gpu/drm/xe/xe_sriov_pf_debugfs.c b/drivers/gpu/drm/xe/xe_sriov_pf_debugfs.c
new file mode 100644 (file)
index 0000000..2a13160
--- /dev/null
@@ -0,0 +1,54 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright © 2025 Intel Corporation
+ */
+
+#include <linux/debugfs.h>
+#include <drm/drm_debugfs.h>
+
+#include "xe_device_types.h"
+#include "xe_sriov_pf.h"
+#include "xe_sriov_pf_debugfs.h"
+#include "xe_sriov_pf_service.h"
+
+static int simple_show(struct seq_file *m, void *data)
+{
+       struct drm_printer p = drm_seq_file_printer(m);
+       struct drm_info_node *node = m->private;
+       struct dentry *parent = node->dent->d_parent;
+       struct xe_device *xe = parent->d_inode->i_private;
+       void (*print)(struct xe_device *, struct drm_printer *) = node->info_ent->data;
+
+       print(xe, &p);
+       return 0;
+}
+
+static const struct drm_info_list debugfs_list[] = {
+       { .name = "vfs", .show = simple_show, .data = xe_sriov_pf_print_vfs_summary },
+       { .name = "versions", .show = simple_show, .data = xe_sriov_pf_service_print_versions },
+};
+
+/**
+ * xe_sriov_pf_debugfs_register - Register PF debugfs attributes.
+ * @xe: the &xe_device
+ * @root: the root &dentry
+ *
+ * Prepare debugfs attributes exposed by the PF.
+ */
+void xe_sriov_pf_debugfs_register(struct xe_device *xe, struct dentry *root)
+{
+       struct drm_minor *minor = xe->drm.primary;
+       struct dentry *parent;
+
+       /*
+        *      /sys/kernel/debug/dri/0/
+        *      ├── pf
+        *      │   ├── ...
+        */
+       parent = debugfs_create_dir("pf", root);
+       if (IS_ERR(parent))
+               return;
+       parent->d_inode->i_private = xe;
+
+       drm_debugfs_create_files(debugfs_list, ARRAY_SIZE(debugfs_list), parent, minor);
+}
diff --git a/drivers/gpu/drm/xe/xe_sriov_pf_debugfs.h b/drivers/gpu/drm/xe/xe_sriov_pf_debugfs.h
new file mode 100644 (file)
index 0000000..93db135
--- /dev/null
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2025 Intel Corporation
+ */
+
+#ifndef _XE_SRIOV_PF_DEBUGFS_H_
+#define _XE_SRIOV_PF_DEBUGFS_H_
+
+struct dentry;
+struct xe_device;
+
+#ifdef CONFIG_PCI_IOV
+void xe_sriov_pf_debugfs_register(struct xe_device *xe, struct dentry *root);
+#else
+static inline void xe_sriov_pf_debugfs_register(struct xe_device *xe, struct dentry *root) { }
+#endif
+
+#endif